1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-27 21:01:50 +03:00

feat(BRM) MCOL-5555 Reduce a number of direct writes to BRM journal/tablelocks files

This commit is contained in:
Denis Khalikov
2023-09-25 23:39:49 +03:00
committed by GitHub
parent 46fa03378c
commit 02114b5b7c
5 changed files with 98 additions and 11 deletions

View File

@ -70,14 +70,21 @@ void TableLockServer::save()
if (!out)
throw runtime_error("TableLockServer::save(): could not open save file");
out->write((char*)&count, 4);
uint32_t bufferSize = 4;
for (const auto& lock : locks)
bufferSize += lock.second.getInternalSize();
std::unique_ptr<char[]> buffer(new char[bufferSize]);
uint32_t offset = 0;
std::memcpy(&buffer[offset], (char*)&count, 4);
offset += 4;
for (it = locks.begin(); it != locks.end(); ++it)
{
if (!out)
throw runtime_error("TableLockServer::save(): could not write save file");
it->second.serialize(out.get());
it->second.serialize(buffer.get(), offset);
}
}