1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-12-17 01:02:23 +03:00

Merge branch 'develop' of github.com:pleblanc1976/storage-manager into develop

This commit is contained in:
Patrick LeBlanc
2019-05-30 10:58:27 -05:00
3 changed files with 18 additions and 5 deletions

View File

@@ -324,15 +324,15 @@ int IOCoordinator::_write(const char *filename, const uint8_t *data, off_t offse
// there is no overlapping data, or data goes beyond end of last object
while (dataRemaining > 0)
{
metadataObject newObject = metadata.addMetadataObject(filename,0);
off_t newObjectOffset = metadata.getMetadataNewObjectOffset();
// count is 0 so first write is beyond current end of file.
// offset is > than newObject.offset so we need to adjust offset for object
// unless offset is beyond newObject.offset + objectSize then we need to write null data to this object
if (count == 0 && (uint64_t) offset > newObject.offset)
if (count == 0 && offset > newObjectOffset)
{
//this is starting beyond last object in metadata
//figure out if the offset is in this object
objectOffset = offset - newObject.offset;
objectOffset = offset - newObjectOffset;
writeLength = min((objectSize - objectOffset),dataRemaining);
}
else
@@ -346,8 +346,8 @@ int IOCoordinator::_write(const char *filename, const uint8_t *data, off_t offse
// objectOffset is 0 unless the write starts beyond the end of data
// in that case need to add the null data to cachespace
cache->makeSpace(writeLength + objectOffset);
if ((writeLength + objectOffset) > newObject.length)
metadata.updateEntryLength(newObject.offset, (writeLength + objectOffset));
metadataObject newObject = metadata.addMetadataObject(filename,(writeLength + objectOffset));
// send to replicator
err = replicator->newObject(newObject.key.c_str(),&data[count],objectOffset,writeLength);

View File

@@ -459,6 +459,18 @@ void MetadataFile::updateEntryLength(off_t offset, size_t newLength)
updateObj->length = newLength;
}
off_t MetadataFile::getMetadataNewObjectOffset()
{
off_t newObjectOffset = 0;
if (!mObjects.empty())
{
std::set<metadataObject>::reverse_iterator iLastObject = mObjects.rbegin();
newObjectOffset = iLastObject->offset + iLastObject->length;
}
return newObjectOffset;
}
metadataObject::metadataObject()
{}

View File

@@ -69,6 +69,7 @@ class MetadataFile
// breaks a key into its consitituent fields
static void breakout(const std::string &key, std::vector<std::string> &out);
off_t getMetadataNewObjectOffset();
// this will be a singleton, which stores the config used
// by all MetadataFile instances so we don't have to keep bothering Config.
// members are public b/c i don't want to write accessors right now. Also who cares.