1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

feat(): propagate long strings SP type change

This commit is contained in:
drrtuy
2024-12-04 23:45:05 +00:00
parent 4e86123a5a
commit 71ed9cabe0
7 changed files with 71 additions and 30 deletions

View File

@ -96,19 +96,19 @@ uint64_t StringStore::storeString(const uint8_t* data, uint32_t len)
if (mem.size() > 0)
lastMC = (MemChunk*)mem.back().get();
std::cout << "StringStore::storeString len " << len << std::endl;
// std::cout << "StringStore::storeString len " << len << std::endl;
if ((len + 4) >= CHUNK_SIZE)
{
auto allocSize = len + sizeof(MemChunk) + 4;
// if (alloc)
// {
// cout << "StringStore::storeString longStrings with alloc " << std::endl;
// longStrings.emplace_back(std::allocate_shared<StringStoreBufType>(*alloc, allocSize));
// }
// else
if (alloc)
{
cout << "StringStore::storeString longStrings no alloc " << std::endl;
longStrings.emplace_back(std::make_shared<uint8_t[]>(allocSize));
// cout << "StringStore::storeString longStrings with alloc " << std::endl;
longStrings.emplace_back(boost::allocate_shared<StringStoreBufType>(*alloc, allocSize));
}
else
{
// cout << "StringStore::storeString longStrings no alloc " << std::endl;
longStrings.emplace_back(boost::make_shared<uint8_t[]>(allocSize));
}
// std::shared_ptr<uint8_t[]> newOne(new uint8_t[len + sizeof(MemChunk) + 4]);
lastMC = reinterpret_cast<MemChunk*>(longStrings.back().get());
@ -127,13 +127,13 @@ uint64_t StringStore::storeString(const uint8_t* data, uint32_t len)
// if (lastMC)
if (alloc)
{
cout << "StringStore::storeString with alloc " << std::endl;
// cout << "StringStore::storeString with alloc " << std::endl;
mem.emplace_back(boost::allocate_shared<StringStoreBufType>(*alloc, CHUNK_SIZE + sizeof(MemChunk)));
// boost::allocate_shared) newOne(new uint8_t[CHUNK_SIZE + sizeof(MemChunk)]);
}
else
{
cout << "StringStore::storeString no alloc " << std::endl;
// cout << "StringStore::storeString no alloc " << std::endl;
mem.emplace_back(boost::make_shared<uint8_t[]>(CHUNK_SIZE + sizeof(MemChunk)));
// mem.emplace_back(boost::allocate_shared<StringStoreBufType>(*alloc, CHUNK_SIZE + sizeof(MemChunk)));
// std::shared_ptr<uint8_t[]> newOne(new uint8_t[CHUNK_SIZE + sizeof(MemChunk)]);
@ -196,7 +196,7 @@ void StringStore::deserialize(ByteStream& bs)
// mem.clear();
bs >> count;
// mem.resize(count);
mem.reserve(count);
bs >> tmp8;
empty = (bool)tmp8;
@ -208,12 +208,12 @@ void StringStore::deserialize(ByteStream& bs)
if (alloc)
{
cout << "StringStore::deserialize with alloc " << std::endl;
// cout << "StringStore::deserialize with alloc " << std::endl;
mem.emplace_back(boost::allocate_shared<StringStoreBufType>(*alloc, size + sizeof(MemChunk)));
}
else
{
cout << "StringStore::deserialize no alloc " << std::endl;
// cout << "StringStore::deserialize no alloc " << std::endl;
mem.emplace_back(boost::make_shared<uint8_t[]>(size + sizeof(MemChunk)));
}
// mem[i].reset(new uint8_t[size + sizeof(MemChunk)]);
@ -231,7 +231,7 @@ void StringStore::deserialize(ByteStream& bs)
void StringStore::clear()
{
vector<boost::shared_ptr<uint8_t[]> > emptyv;
vector<std::shared_ptr<uint8_t[]> > emptyv2;
vector<StringStoreBufSPType> emptyv2;
mem.swap(emptyv);
longStrings.swap(emptyv2);
empty = true;
@ -380,12 +380,12 @@ void RGData::reinit(const RowGroup& rg, uint32_t rowCount)
{
if (alloc)
{
cout << "RGData::reinit with alloc " << std::endl;
// cout << "RGData::reinit with alloc " << std::endl;
rowData = boost::allocate_shared<RGDataBufType>(*alloc, rg.getDataSize(rowCount));
}
else
{
cout << "RGData::reinit no alloc " << std::endl;
// cout << "RGData::reinit no alloc " << std::endl;
rowData.reset(new uint8_t[rg.getDataSize(rowCount)]);
}