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

feat(): zerocopy TNS case and JOIN results RGData with CountingAllocator

This commit is contained in:
drrtuy
2025-02-17 21:38:10 +00:00
parent 3dfc8cd454
commit a4c4d33ee7
9 changed files with 96 additions and 62 deletions

View File

@ -35,8 +35,8 @@ namespace allocators
// When a sync op hits MemoryLimitLowerBound trying to allocate more memory, it throws.
// SQL operators or TBPS runtime must catch the exception and act acordingly.
const constexpr std::int64_t MemoryLimitLowerBound = 500 * 1024 * 1024; // WIP
const constexpr std::int64_t CheckPointStepSize = 100 * 1024 * 1024; // WIP
const constexpr int64_t MemoryLimitLowerBound = 500 * 1024 * 1024; // WIP
const constexpr int64_t CheckPointStepSize = 100 * 1024 * 1024; // WIP
// Custom Allocator that tracks allocated memory using an atomic counter
template <typename T>
@ -88,8 +88,8 @@ class CountingAllocator
// Constructor accepting a reference to an atomic counter
explicit CountingAllocator(std::atomic<int64_t>* memoryLimit,
const uint64_t lowerBound = MemoryLimitLowerBound,
const uint64_t checkPointStepSize = CheckPointStepSize) noexcept
const int64_t checkPointStepSize = CheckPointStepSize,
const int64_t lowerBound = MemoryLimitLowerBound) noexcept
: memoryLimit_(memoryLimit), memoryLimitLowerBound_(lowerBound), checkPointStepSize_(checkPointStepSize)
{
}

View File

@ -305,6 +305,12 @@ void UserDataStore::deserialize(ByteStream& bs)
return;
}
RGData::RGData(allocators::CountingAllocator<RGDataBufType>& _alloc) : RGData()
{
alloc = _alloc;
}
RGData::RGData(const RowGroup& rg, uint32_t rowCount)
{
RGDataSizeType s = rg.getDataSize(rowCount);

View File

@ -262,6 +262,7 @@ class RGData
{
public:
RGData() = default; // useless unless followed by an = or a deserialize operation
RGData(allocators::CountingAllocator<RGDataBufType>&);
RGData(const RowGroup& rg, uint32_t rowCount); // allocates memory for rowData
explicit RGData(const RowGroup& rg);
explicit RGData(const RowGroup& rg, allocators::CountingAllocator<RGDataBufType>& alloc);