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

Fixed the fix.

Actually need to rename the file after you pick a new name for it LOL!
This commit is contained in:
Patrick LeBlanc
2020-05-21 17:34:36 -04:00
parent 4b9c1d9169
commit 31e06e77a2
2 changed files with 8 additions and 2 deletions

View File

@ -506,8 +506,13 @@ ssize_t IOCoordinator::_write(const boost::filesystem::path &filename, const uin
count += err;
iocBytesWritten += err;
// get a new name for the object
bf::path oldPath = firstDir/newObject.key;
newObject.key = metadata.getNewKeyFromOldKey(newObject.key, err + objectOffset);
metadata.updateEntryLength(newObject.offset, (err + objectOffset));
::rename(oldPath.string().c_str(), (firstDir/newObject.key).string().c_str());
// rename and resize the object in metadata
metadata.updateEntry(newObject.offset, newObject.key, (err + objectOffset));
cache->newObject(firstDir, newObject.key,err + objectOffset);
newObjectKeys.push_back(newObject.key);
goto out;
@ -638,7 +643,9 @@ ssize_t IOCoordinator::append(const char *_filename, const uint8_t *data, size_t
iocBytesWritten += err;
if (err < (int64_t) writeLength)
{
bf::path oldPath = firstDir/newObject.key;
newObject.key = metadata.getNewKeyFromOldKey(newObject.key, err + newObject.offset);
::rename(oldPath.string().c_str(), (firstDir/newObject.key).string().c_str());
metadata.updateEntry(newObject.offset, newObject.key, err + newObject.offset);
}
cache->newObject(firstDir, newObject.key,err);

View File

@ -77,7 +77,6 @@ class MetadataFile
// removes p from the json cache. p should be a fully qualified metadata file
static void deletedMeta(const boost::filesystem::path &p);
// TBD: this may have to go; there may be no use case where only the uuid needs to change.
static std::string getNewKeyFromOldKey(const std::string &oldKey, size_t length=0);
static std::string getNewKey(std::string sourceName, size_t offset, size_t length);
static off_t getOffsetFromKey(const std::string &key);