You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
feat(): related unit tests fixes
This commit is contained in:
@ -200,7 +200,7 @@ TEST(PoolAllocatorTest, MultithreadedAllocationWithLock)
|
|||||||
EXPECT_GE(pa.getMemUsage(), expected);
|
EXPECT_GE(pa.getMemUsage(), expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const constexpr int64_t MemoryAllowance = 10 * 1024 * 1024;
|
static const constexpr int64_t MemoryAllowance = 1 * 1024 * 1024;
|
||||||
|
|
||||||
// Test Fixture for AtomicCounterAllocator
|
// Test Fixture for AtomicCounterAllocator
|
||||||
class PoolallocatorTest : public ::testing::Test
|
class PoolallocatorTest : public ::testing::Test
|
||||||
@ -213,7 +213,7 @@ class PoolallocatorTest : public ::testing::Test
|
|||||||
CountingAllocator<PoolAllocatorBufType> allocator;
|
CountingAllocator<PoolAllocatorBufType> allocator;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
PoolallocatorTest() : allocatedMemory(MemoryAllowance), allocator(&allocatedMemory, MemoryAllowance / 100)
|
PoolallocatorTest() : allocatedMemory(MemoryAllowance), allocator(&allocatedMemory, MemoryAllowance / 100, MemoryAllowance / 1000)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,5 +283,5 @@ TEST_F(PoolallocatorTest, MultithreadedAccountedAllocationWithLock)
|
|||||||
EXPECT_GE(pa.getMemUsage(), expected);
|
EXPECT_GE(pa.getMemUsage(), expected);
|
||||||
// 2 * CUSTOM_SIZE semantics is structs allocation overhead.
|
// 2 * CUSTOM_SIZE semantics is structs allocation overhead.
|
||||||
EXPECT_GE(allocatedMemory.load(),
|
EXPECT_GE(allocatedMemory.load(),
|
||||||
MemoryAllowance - (THREAD_COUNT * ALLOC_PER_THREAD * NUM_ALLOCS_PER_THREAD) - 2 * CUSTOM_SIZE);
|
MemoryAllowance - (THREAD_COUNT * ALLOC_PER_THREAD * NUM_ALLOCS_PER_THREAD) - 3 * CUSTOM_SIZE);
|
||||||
}
|
}
|
@ -360,7 +360,7 @@ class RGDataTest : public ::testing::Test
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
RGDataTest()
|
RGDataTest()
|
||||||
: allocatedMemory(MemoryAllowance), alloc(&allocatedMemory, MemoryAllowance / 100) {}
|
: allocatedMemory(MemoryAllowance) {}
|
||||||
void SetUp() override
|
void SetUp() override
|
||||||
{
|
{
|
||||||
rg = setupRG({execplan::CalpontSystemCatalog::VARCHAR, execplan::CalpontSystemCatalog::UDECIMAL,
|
rg = setupRG({execplan::CalpontSystemCatalog::VARCHAR, execplan::CalpontSystemCatalog::UDECIMAL,
|
||||||
@ -375,38 +375,38 @@ class RGDataTest : public ::testing::Test
|
|||||||
rowgroup::RowGroup rg;
|
rowgroup::RowGroup rg;
|
||||||
rowgroup::RGData rgD;
|
rowgroup::RGData rgD;
|
||||||
std::atomic<int64_t> allocatedMemory{MemoryAllowance};
|
std::atomic<int64_t> allocatedMemory{MemoryAllowance};
|
||||||
allocators::CountingAllocator<rowgroup::RGDataBufType> alloc;
|
|
||||||
};
|
};
|
||||||
// bool useStringTable = true;
|
// bool useStringTable = true;
|
||||||
TEST_F(RGDataTest, AllocData)
|
TEST_F(RGDataTest, AllocData)
|
||||||
{
|
{
|
||||||
rgD = rowgroup::RGData(rg, alloc);
|
allocators::CountingAllocator<rowgroup::RGDataBufType> alloc(&allocatedMemory, MemoryAllowance / 100, MemoryAllowance / 10000);
|
||||||
rg.setData(&rgD);
|
rgD = rowgroup::RGData(rg, alloc);
|
||||||
rg.initRow(&r);
|
rg.setData(&rgD);
|
||||||
rg.getRow(0, &r);
|
rg.initRow(&r);
|
||||||
|
rg.getRow(0, &r);
|
||||||
|
|
||||||
auto currentAllocation = allocatedMemory.load();
|
auto currentAllocation = allocatedMemory.load();
|
||||||
EXPECT_LE(currentAllocation, MemoryAllowance - rg.getMaxDataSize());
|
EXPECT_LE(currentAllocation, MemoryAllowance - rg.getMaxDataSize());
|
||||||
|
|
||||||
r.setStringField(utils::ConstString{"testaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, 0);
|
r.setStringField(utils::ConstString{"testaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, 0);
|
||||||
EXPECT_LE(allocatedMemory.load(), currentAllocation);
|
EXPECT_LE(allocatedMemory.load(), currentAllocation);
|
||||||
|
|
||||||
currentAllocation = allocatedMemory.load();
|
currentAllocation = allocatedMemory.load();
|
||||||
r.nextRow();
|
r.nextRow();
|
||||||
r.setStringField(utils::ConstString{"testaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, 0);
|
r.setStringField(utils::ConstString{"testaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, 0);
|
||||||
EXPECT_EQ(allocatedMemory.load(), currentAllocation);
|
EXPECT_EQ(allocatedMemory.load(), currentAllocation);
|
||||||
|
|
||||||
currentAllocation = allocatedMemory.load();
|
currentAllocation = allocatedMemory.load();
|
||||||
r.nextRow();
|
r.nextRow();
|
||||||
std::string longString(64 * 1024 + 1000, 'a');
|
std::string longString(64 * 1024 + 1000, 'a');
|
||||||
auto cs = utils::ConstString(longString);
|
auto cs = utils::ConstString(longString);
|
||||||
|
|
||||||
r.setStringField(cs, 0);
|
r.setStringField(cs, 0);
|
||||||
EXPECT_LE(allocatedMemory.load(), currentAllocation);
|
EXPECT_LE(allocatedMemory.load(), currentAllocation);
|
||||||
|
|
||||||
rgD = rowgroup::RGData(rg);
|
rgD = rowgroup::RGData(rg);
|
||||||
|
|
||||||
EXPECT_EQ(allocatedMemory.load(), MemoryAllowance);
|
EXPECT_EQ(allocatedMemory.load(), MemoryAllowance);
|
||||||
|
|
||||||
// reinit
|
// reinit
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user