Merge pull request #83 from Am1GO/master

Fix for #70
master
Am1GO 2015-08-04 16:08:09 +03:00
commit e76c0db562
3 changed files with 11 additions and 10 deletions

View File

@ -27,9 +27,15 @@ void BundleCollector::finishIndex( string const & indexFn )
{
if ( indexModified )
{
verbosePrintf( "Chunks: %d used / %d total, bundles: %d kept / %d modified / %d removed\n",
indexUsedChunks, indexTotalChunks, indexKeptBundles, indexModifiedBundles, indexRemovedBundles);
verbosePrintf( "Chunks used: %d/%d, bundles: %d kept, %d modified, %d removed\n",
indexUsedChunks, indexTotalChunks, indexKeptBundles,
indexModifiedBundles, indexRemovedBundles);
filesToUnlink.push_back( indexFn );
commit();
}
else
{
chunkStorageWriter->reset();
}
}
@ -56,16 +62,14 @@ void BundleCollector::finishBundle( Bundle::Id const & bundleId, BundleInfo cons
indexUsedChunks += usedChunks;
if ( usedChunks == 0 )
{
if ( verbose )
printf( "delete %s\n", i.c_str() );
verbosePrintf( "Deleting %s bundle\n", i.c_str() );
filesToUnlink.push_back( Dir::addPath( bundlesPath, i ) );
indexModified = true;
indexRemovedBundles++;
}
else if ( usedChunks < totalChunks )
{
if ( verbose )
printf( "%s: used %d/%d\n", i.c_str(), usedChunks, totalChunks );
verbosePrintf( "%s: used %d/%d chunks\n", i.c_str(), usedChunks, totalChunks );
filesToUnlink.push_back( Dir::addPath( bundlesPath, i ) );
indexModified = true;
// Copy used chunks to the new index
@ -86,8 +90,7 @@ void BundleCollector::finishBundle( Bundle::Id const & bundleId, BundleInfo cons
else
{
chunkStorageWriter->addBundle( info, savedId );
if ( verbose )
printf( "keep %s\n", i.c_str() );
verbosePrintf( "Keeping %s bundle\n", i.c_str() );
indexKeptBundles++;
}
}

View File

@ -32,7 +32,6 @@ private:
public:
string bundlesPath;
bool verbose;
ChunkStorage::Reader *chunkStorageReader;
ChunkStorage::Writer *chunkStorageWriter;
BackupRestorer::ChunkSet usedChunkSet;

View File

@ -322,7 +322,6 @@ void ZCollector::gc()
collector.bundlesPath = getBundlesPath();
collector.chunkStorageReader = &this->chunkStorageReader;
collector.chunkStorageWriter = &chunkStorageWriter;
collector.verbose = false;
verbosePrintf( "Checking used chunks...\n" );