1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-02 17:22:27 +03:00

Fixed a number of bugs in storage manager, and added code to detect

and recover from being killed while writing new objects.

Conflicts:
	storage-manager/src/Synchronizer.cpp
This commit is contained in:
Patrick LeBlanc
2020-05-20 18:37:17 -04:00
parent 5b6f1290d7
commit aeec468814
7 changed files with 107 additions and 23 deletions

View File

@ -683,7 +683,7 @@ void Synchronizer::synchronizeWithJournal(const string &sourceFile, list<string>
while (count < size)
{
err = ::write(newFD, data.get(), size - count);
err = ::write(newFD, &data[count], size - count);
if (err < 0)
{
::unlink(newCachePath.string().c_str());
@ -693,8 +693,19 @@ void Synchronizer::synchronizeWithJournal(const string &sourceFile, list<string>
count += err;
}
numBytesWritten += size;
assert(bf::file_size(oldCachePath) == MetadataFile::getLengthFromKey(cloudKey));
//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))
{
ostringstream oss;
oss << "Synchronizer::synchronizeWithJournal(): detected a mismatch between file size and " <<
"length stored in the object name. object name = " << cloudKey << " length-in-name = " <<
MetadataFile::getLengthFromKey(cloudKey) << " real-length = " << bf::file_size(oldCachePath)
<< ". Reloading cache metadata, this will pause IO activity briefly.";
logger->log(LOG_WARNING, oss.str().c_str());
cache->repopulate(prefix);
}
replicator->remove(oldCachePath);
}