mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-01 03:52:15 +00:00
More correct initialization
This commit is contained in:
parent
fdf3b569f4
commit
73ed05492b
@ -40,6 +40,7 @@ static void processWatchesImpl(const String & path, TestKeeperStorage::Watches &
|
|||||||
Coordination::ZooKeeperWatchResponse watch_response;
|
Coordination::ZooKeeperWatchResponse watch_response;
|
||||||
watch_response.path = path;
|
watch_response.path = path;
|
||||||
watch_response.xid = -1;
|
watch_response.xid = -1;
|
||||||
|
watch_response.zxid = -1;
|
||||||
|
|
||||||
auto it = watches.find(watch_response.path);
|
auto it = watches.find(watch_response.path);
|
||||||
if (it != watches.end())
|
if (it != watches.end())
|
||||||
@ -54,6 +55,7 @@ static void processWatchesImpl(const String & path, TestKeeperStorage::Watches &
|
|||||||
Coordination::ZooKeeperWatchResponse watch_list_response;
|
Coordination::ZooKeeperWatchResponse watch_list_response;
|
||||||
watch_list_response.path = parentPath(path);
|
watch_list_response.path = parentPath(path);
|
||||||
watch_list_response.xid = -1;
|
watch_list_response.xid = -1;
|
||||||
|
watch_list_response.zxid = -1;
|
||||||
|
|
||||||
it = list_watches.find(watch_list_response.path);
|
it = list_watches.find(watch_list_response.path);
|
||||||
if (it != list_watches.end())
|
if (it != list_watches.end())
|
||||||
@ -238,7 +240,7 @@ struct TestKeeperStorageRemoveRequest final : public TestKeeperStorageRequest
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto prev_node = it->second;
|
auto prev_node = it->second;
|
||||||
if (it->second.is_ephemeral)
|
if (prev_node.is_ephemeral)
|
||||||
ephemerals[session_id].erase(request.path);
|
ephemerals[session_id].erase(request.path);
|
||||||
|
|
||||||
container.erase(it);
|
container.erase(it);
|
||||||
@ -247,8 +249,11 @@ struct TestKeeperStorageRemoveRequest final : public TestKeeperStorageRequest
|
|||||||
++parent.stat.cversion;
|
++parent.stat.cversion;
|
||||||
response.error = Coordination::Error::ZOK;
|
response.error = Coordination::Error::ZOK;
|
||||||
|
|
||||||
undo = [prev_node, &container, path = request.path]
|
undo = [prev_node, &container, &ephemerals, session_id, path = request.path]
|
||||||
{
|
{
|
||||||
|
if (prev_node.is_ephemeral)
|
||||||
|
ephemerals[session_id].emplace(path);
|
||||||
|
|
||||||
container.emplace(path, prev_node);
|
container.emplace(path, prev_node);
|
||||||
auto & undo_parent = container.at(parentPath(path));
|
auto & undo_parent = container.at(parentPath(path));
|
||||||
++undo_parent.stat.numChildren;
|
++undo_parent.stat.numChildren;
|
||||||
|
@ -17,12 +17,10 @@ namespace DB
|
|||||||
namespace ErrorCodes
|
namespace ErrorCodes
|
||||||
{
|
{
|
||||||
extern const int LOGICAL_ERROR;
|
extern const int LOGICAL_ERROR;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestKeeperTCPHandler::sendHandshake()
|
void TestKeeperTCPHandler::sendHandshake()
|
||||||
{
|
{
|
||||||
session_id = test_keeper_storage->getSessionID();
|
|
||||||
Coordination::write(Coordination::SERVER_HANDSHAKE_LENGTH, *out);
|
Coordination::write(Coordination::SERVER_HANDSHAKE_LENGTH, *out);
|
||||||
Coordination::write(Coordination::ZOOKEEPER_PROTOCOL_VERSION, *out);
|
Coordination::write(Coordination::ZOOKEEPER_PROTOCOL_VERSION, *out);
|
||||||
Coordination::write(Coordination::DEFAULT_SESSION_TIMEOUT_MS, *out);
|
Coordination::write(Coordination::DEFAULT_SESSION_TIMEOUT_MS, *out);
|
||||||
|
@ -25,6 +25,7 @@ public:
|
|||||||
, test_keeper_storage(global_context.getTestKeeperStorage())
|
, test_keeper_storage(global_context.getTestKeeperStorage())
|
||||||
, operation_timeout(0, Coordination::DEFAULT_OPERATION_TIMEOUT_MS * 1000)
|
, operation_timeout(0, Coordination::DEFAULT_OPERATION_TIMEOUT_MS * 1000)
|
||||||
, session_timeout(0, Coordination::DEFAULT_SESSION_TIMEOUT_MS * 1000)
|
, session_timeout(0, Coordination::DEFAULT_SESSION_TIMEOUT_MS * 1000)
|
||||||
|
, session_id(test_keeper_storage->getSessionID())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user