1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-04 04:42:30 +03:00

Cleaned up a little code of previous commit, added retry loops and

a little better error handling to the code that writes journal entries.
This commit is contained in:
Patrick LeBlanc
2020-05-21 16:28:32 -04:00
parent aeec468814
commit 4b9c1d9169
3 changed files with 100 additions and 17 deletions

View File

@ -694,9 +694,14 @@ void Synchronizer::synchronizeWithJournal(const string &sourceFile, list<string>
}
numBytesWritten += size;
//assert(bf::file_size(oldCachePath) == MetadataFile::getLengthFromKey(cloudKey));
cache->rename(prefix, cloudKey, newCloudKey, size - MetadataFile::getLengthFromKey(cloudKey));
if (bf::file_size(oldCachePath) != MetadataFile::getLengthFromKey(cloudKey))
size_t oldSize = bf::file_size(oldCachePath);
cache->rename(prefix, cloudKey, newCloudKey, size - oldSize);
replicator->remove(oldCachePath);
// This condition is probably irrelevant for correct functioning now,
// but it should be very rare so what the hell.
if (oldSize != MetadataFile::getLengthFromKey(cloudKey))
{
ostringstream oss;
oss << "Synchronizer::synchronizeWithJournal(): detected a mismatch between file size and " <<
@ -706,7 +711,6 @@ void Synchronizer::synchronizeWithJournal(const string &sourceFile, list<string>
logger->log(LOG_WARNING, oss.str().c_str());
cache->repopulate(prefix);
}
replicator->remove(oldCachePath);
}
mergeDiff += size - originalSize;