mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 13:13:36 +00:00
fix seg fault and add test
This commit is contained in:
parent
89f7c7eef6
commit
ec1ad60e9d
@ -192,6 +192,7 @@ public:
|
||||
return false;
|
||||
|
||||
auto list_itr = it->second;
|
||||
UInt64 old_data_size = sizeOf<V>(&list_itr->value);
|
||||
if (snapshot_mode)
|
||||
{
|
||||
list_itr->active_in_map = false;
|
||||
@ -203,7 +204,7 @@ public:
|
||||
list.erase(list_itr);
|
||||
}
|
||||
|
||||
updateDataSize(ERASE, sizeOf<std::string>(&key), 0, sizeOf<V>(&list_itr->value));
|
||||
updateDataSize(ERASE, sizeOf<std::string>(&key), 0, old_data_size);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -963,6 +963,7 @@ TEST_P(CoordinationTest, SnapshotableHashMapDataSize)
|
||||
n1.data = "1234";
|
||||
Node n2;
|
||||
n2.data = "123456";
|
||||
n2.children.insert("");
|
||||
|
||||
world.disableSnapshotMode();
|
||||
world.insert("world", n1);
|
||||
@ -974,7 +975,7 @@ TEST_P(CoordinationTest, SnapshotableHashMapDataSize)
|
||||
world.updateValue("world", [&](Node & value) { value = n2; });
|
||||
EXPECT_EQ(world.getApproximateSataSize(), 171);
|
||||
|
||||
world.clear();
|
||||
world.erase("world");
|
||||
EXPECT_EQ(world.getApproximateSataSize(), 0);
|
||||
|
||||
world.enableSnapshotMode();
|
||||
@ -985,6 +986,12 @@ TEST_P(CoordinationTest, SnapshotableHashMapDataSize)
|
||||
|
||||
world.clearOutdatedNodes();
|
||||
EXPECT_EQ(world.getApproximateSataSize(), 171);
|
||||
|
||||
world.erase("world");
|
||||
EXPECT_EQ(world.getApproximateSataSize(), 171);
|
||||
|
||||
world.clear();
|
||||
EXPECT_EQ(world.getApproximateSataSize(), 0);
|
||||
}
|
||||
|
||||
void addNode(DB::KeeperStorage & storage, const std::string & path, const std::string & data, int64_t ephemeral_owner=0)
|
||||
|
Loading…
Reference in New Issue
Block a user