mirror of https://github.com/vitalif/zbackup
commit
e76c0db562
|
@ -27,9 +27,15 @@ void BundleCollector::finishIndex( string const & indexFn )
|
||||||
{
|
{
|
||||||
if ( indexModified )
|
if ( indexModified )
|
||||||
{
|
{
|
||||||
verbosePrintf( "Chunks: %d used / %d total, bundles: %d kept / %d modified / %d removed\n",
|
verbosePrintf( "Chunks used: %d/%d, bundles: %d kept, %d modified, %d removed\n",
|
||||||
indexUsedChunks, indexTotalChunks, indexKeptBundles, indexModifiedBundles, indexRemovedBundles);
|
indexUsedChunks, indexTotalChunks, indexKeptBundles,
|
||||||
|
indexModifiedBundles, indexRemovedBundles);
|
||||||
filesToUnlink.push_back( indexFn );
|
filesToUnlink.push_back( indexFn );
|
||||||
|
commit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
chunkStorageWriter->reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,16 +62,14 @@ void BundleCollector::finishBundle( Bundle::Id const & bundleId, BundleInfo cons
|
||||||
indexUsedChunks += usedChunks;
|
indexUsedChunks += usedChunks;
|
||||||
if ( usedChunks == 0 )
|
if ( usedChunks == 0 )
|
||||||
{
|
{
|
||||||
if ( verbose )
|
verbosePrintf( "Deleting %s bundle\n", i.c_str() );
|
||||||
printf( "delete %s\n", i.c_str() );
|
|
||||||
filesToUnlink.push_back( Dir::addPath( bundlesPath, i ) );
|
filesToUnlink.push_back( Dir::addPath( bundlesPath, i ) );
|
||||||
indexModified = true;
|
indexModified = true;
|
||||||
indexRemovedBundles++;
|
indexRemovedBundles++;
|
||||||
}
|
}
|
||||||
else if ( usedChunks < totalChunks )
|
else if ( usedChunks < totalChunks )
|
||||||
{
|
{
|
||||||
if ( verbose )
|
verbosePrintf( "%s: used %d/%d chunks\n", i.c_str(), usedChunks, totalChunks );
|
||||||
printf( "%s: used %d/%d\n", i.c_str(), usedChunks, totalChunks );
|
|
||||||
filesToUnlink.push_back( Dir::addPath( bundlesPath, i ) );
|
filesToUnlink.push_back( Dir::addPath( bundlesPath, i ) );
|
||||||
indexModified = true;
|
indexModified = true;
|
||||||
// Copy used chunks to the new index
|
// Copy used chunks to the new index
|
||||||
|
@ -86,8 +90,7 @@ void BundleCollector::finishBundle( Bundle::Id const & bundleId, BundleInfo cons
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
chunkStorageWriter->addBundle( info, savedId );
|
chunkStorageWriter->addBundle( info, savedId );
|
||||||
if ( verbose )
|
verbosePrintf( "Keeping %s bundle\n", i.c_str() );
|
||||||
printf( "keep %s\n", i.c_str() );
|
|
||||||
indexKeptBundles++;
|
indexKeptBundles++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
string bundlesPath;
|
string bundlesPath;
|
||||||
bool verbose;
|
|
||||||
ChunkStorage::Reader *chunkStorageReader;
|
ChunkStorage::Reader *chunkStorageReader;
|
||||||
ChunkStorage::Writer *chunkStorageWriter;
|
ChunkStorage::Writer *chunkStorageWriter;
|
||||||
BackupRestorer::ChunkSet usedChunkSet;
|
BackupRestorer::ChunkSet usedChunkSet;
|
||||||
|
|
|
@ -322,7 +322,6 @@ void ZCollector::gc()
|
||||||
collector.bundlesPath = getBundlesPath();
|
collector.bundlesPath = getBundlesPath();
|
||||||
collector.chunkStorageReader = &this->chunkStorageReader;
|
collector.chunkStorageReader = &this->chunkStorageReader;
|
||||||
collector.chunkStorageWriter = &chunkStorageWriter;
|
collector.chunkStorageWriter = &chunkStorageWriter;
|
||||||
collector.verbose = false;
|
|
||||||
|
|
||||||
verbosePrintf( "Checking used chunks...\n" );
|
verbosePrintf( "Checking used chunks...\n" );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue