Followup fix

This commit is contained in:
alesapin 2021-03-03 15:31:21 +03:00
parent 0136d7d51a
commit 186b39f0d5
2 changed files with 41 additions and 1 deletions

View File

@ -898,7 +898,7 @@ TEST(CoordinationTest, SnapshotableHashMapTrySnapshot)
void addNode(DB::NuKeeperStorage & storage, const std::string & path, const std::string & data, int64_t ephemeral_owner=0)
{
using Node = DB::NuKeeperStorage::Node;
storage.container.insertOrReplace(path, Node{.data=data, .ephemeral_owner = ephemeral_owner});
storage.container.insertOrReplace(path, Node{.data=data, .stat.ephemeralOwner = ephemeral_owner});
}
TEST(CoordinationTest, TestStorageSnapshotSimple)

View File

@ -89,3 +89,43 @@ def test_state_after_restart(started_cluster):
node_zk2.close()
except:
pass
def test_ephemeral_after_restart(started_cluster):
try:
node_zk = None
node_zk2 = None
node_zk = get_connection_zk("node")
node_zk.create("/test_ephemeral_after_restart", b"somevalue")
strs = []
for i in range(100):
strs.append(random_string(123).encode())
node_zk.create("/test_ephemeral_after_restart/node" + str(i), strs[i], ephemeral=True)
for i in range(100):
if i % 7 == 0:
node_zk.delete("/test_ephemeral_after_restart/node" + str(i))
node.restart_clickhouse(kill=True)
node_zk2 = get_connection_zk("node")
assert node_zk2.get("/test_ephemeral_after_restart")[0] == b"somevalue"
for i in range(100):
if i % 7 == 0:
assert node_zk2.exists("/test_ephemeral_after_restart/node" + str(i)) is None
else:
assert len(node_zk2.get("/test_ephemeral_after_restart/node" + str(i))[0]) == 123
assert node_zk2.get("/test_ephemeral_after_restart/node" + str(i))[0] == strs[i]
finally:
try:
if node_zk is not None:
node_zk.stop()
node_zk.close()
if node_zk2 is not None:
node_zk2.stop()
node_zk2.close()
except:
pass