mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Merge branch 'add_4_letter_words_commands' of github.com:JackyWoo/ClickHouse into JackyWoo_add_4_letter_words_commands
This commit is contained in:
commit
f33e93e305
@ -317,7 +317,7 @@ uint64_t KeeperServer::getSyncedFollowerCount() const
|
|||||||
uint64_t stale_followers = 0;
|
uint64_t stale_followers = 0;
|
||||||
|
|
||||||
const uint64_t stale_follower_gap = raft_instance->get_current_params().stale_log_gap_;
|
const uint64_t stale_follower_gap = raft_instance->get_current_params().stale_log_gap_;
|
||||||
for (auto & fl : followers)
|
for (const auto & fl : followers)
|
||||||
{
|
{
|
||||||
if (last_log_idx > fl.last_log_idx_ + stale_follower_gap)
|
if (last_log_idx > fl.last_log_idx_ + stale_follower_gap)
|
||||||
stale_followers++;
|
stale_followers++;
|
||||||
|
@ -186,7 +186,7 @@ public:
|
|||||||
|
|
||||||
uint64_t getApproximateDataSize() const
|
uint64_t getApproximateDataSize() const
|
||||||
{
|
{
|
||||||
return container.getApproximateSataSize();
|
return container.getApproximateDataSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t getTotalWatchesCount() const;
|
uint64_t getTotalWatchesCount() const;
|
||||||
|
@ -274,7 +274,7 @@ public:
|
|||||||
return list.size();
|
return list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t getApproximateSataSize() const
|
uint64_t getApproximateDataSize() const
|
||||||
{
|
{
|
||||||
return approximate_data_size;
|
return approximate_data_size;
|
||||||
}
|
}
|
||||||
|
@ -940,33 +940,33 @@ TEST_P(CoordinationTest, SnapshotableHashMapDataSize)
|
|||||||
/// int
|
/// int
|
||||||
DB::SnapshotableHashTable<IntNode> hello;
|
DB::SnapshotableHashTable<IntNode> hello;
|
||||||
hello.disableSnapshotMode();
|
hello.disableSnapshotMode();
|
||||||
EXPECT_EQ(hello.getApproximateSataSize(), 0);
|
EXPECT_EQ(hello.getApproximateDataSize(), 0);
|
||||||
|
|
||||||
hello.insert("hello", 1);
|
hello.insert("hello", 1);
|
||||||
EXPECT_EQ(hello.getApproximateSataSize(), 9);
|
EXPECT_EQ(hello.getApproximateDataSize(), 9);
|
||||||
hello.updateValue("hello", [](IntNode & value) { value = 2; });
|
hello.updateValue("hello", [](IntNode & value) { value = 2; });
|
||||||
EXPECT_EQ(hello.getApproximateSataSize(), 9);
|
EXPECT_EQ(hello.getApproximateDataSize(), 9);
|
||||||
|
|
||||||
hello.erase("hello");
|
hello.erase("hello");
|
||||||
EXPECT_EQ(hello.getApproximateSataSize(), 0);
|
EXPECT_EQ(hello.getApproximateDataSize(), 0);
|
||||||
|
|
||||||
hello.clear();
|
hello.clear();
|
||||||
EXPECT_EQ(hello.getApproximateSataSize(), 0);
|
EXPECT_EQ(hello.getApproximateDataSize(), 0);
|
||||||
|
|
||||||
hello.enableSnapshotMode();
|
hello.enableSnapshotMode();
|
||||||
hello.insert("hello", 1);
|
hello.insert("hello", 1);
|
||||||
EXPECT_EQ(hello.getApproximateSataSize(), 9);
|
EXPECT_EQ(hello.getApproximateDataSize(), 9);
|
||||||
hello.updateValue("hello", [](IntNode & value) { value = 2; });
|
hello.updateValue("hello", [](IntNode & value) { value = 2; });
|
||||||
EXPECT_EQ(hello.getApproximateSataSize(), 18);
|
EXPECT_EQ(hello.getApproximateDataSize(), 18);
|
||||||
|
|
||||||
hello.clearOutdatedNodes();
|
hello.clearOutdatedNodes();
|
||||||
EXPECT_EQ(hello.getApproximateSataSize(), 9);
|
EXPECT_EQ(hello.getApproximateDataSize(), 9);
|
||||||
|
|
||||||
hello.erase("hello");
|
hello.erase("hello");
|
||||||
EXPECT_EQ(hello.getApproximateSataSize(), 9);
|
EXPECT_EQ(hello.getApproximateDataSize(), 9);
|
||||||
|
|
||||||
hello.clearOutdatedNodes();
|
hello.clearOutdatedNodes();
|
||||||
EXPECT_EQ(hello.getApproximateSataSize(), 0);
|
EXPECT_EQ(hello.getApproximateDataSize(), 0);
|
||||||
|
|
||||||
/// Node
|
/// Node
|
||||||
using Node = DB::KeeperStorage::Node;
|
using Node = DB::KeeperStorage::Node;
|
||||||
@ -983,27 +983,27 @@ TEST_P(CoordinationTest, SnapshotableHashMapDataSize)
|
|||||||
/// 160 = sizeof Node
|
/// 160 = sizeof Node
|
||||||
/// 5 = sizeof key
|
/// 5 = sizeof key
|
||||||
/// 4 = sizeof value
|
/// 4 = sizeof value
|
||||||
EXPECT_EQ(world.getApproximateSataSize(), 169);
|
EXPECT_EQ(world.getApproximateDataSize(), 169);
|
||||||
world.updateValue("world", [&](Node & value) { value = n2; });
|
world.updateValue("world", [&](Node & value) { value = n2; });
|
||||||
EXPECT_EQ(world.getApproximateSataSize(), 171);
|
EXPECT_EQ(world.getApproximateDataSize(), 171);
|
||||||
|
|
||||||
world.erase("world");
|
world.erase("world");
|
||||||
EXPECT_EQ(world.getApproximateSataSize(), 0);
|
EXPECT_EQ(world.getApproximateDataSize(), 0);
|
||||||
|
|
||||||
world.enableSnapshotMode();
|
world.enableSnapshotMode();
|
||||||
world.insert("world", n1);
|
world.insert("world", n1);
|
||||||
EXPECT_EQ(world.getApproximateSataSize(), 169);
|
EXPECT_EQ(world.getApproximateDataSize(), 169);
|
||||||
world.updateValue("world", [&](Node & value) { value = n2; });
|
world.updateValue("world", [&](Node & value) { value = n2; });
|
||||||
EXPECT_EQ(world.getApproximateSataSize(), 340);
|
EXPECT_EQ(world.getApproximateDataSize(), 340);
|
||||||
|
|
||||||
world.clearOutdatedNodes();
|
world.clearOutdatedNodes();
|
||||||
EXPECT_EQ(world.getApproximateSataSize(), 171);
|
EXPECT_EQ(world.getApproximateDataSize(), 171);
|
||||||
|
|
||||||
world.erase("world");
|
world.erase("world");
|
||||||
EXPECT_EQ(world.getApproximateSataSize(), 171);
|
EXPECT_EQ(world.getApproximateDataSize(), 171);
|
||||||
|
|
||||||
world.clear();
|
world.clear();
|
||||||
EXPECT_EQ(world.getApproximateSataSize(), 0);
|
EXPECT_EQ(world.getApproximateDataSize(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addNode(DB::KeeperStorage & storage, const std::string & path, const std::string & data, int64_t ephemeral_owner=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