Rewriting ZooKeeper library [#CLICKHOUSE-2]

This commit is contained in:
Alexey Milovidov 2018-03-19 22:25:21 +03:00
parent c8f8dc429c
commit 644c5e67b6
2 changed files with 5 additions and 1 deletions

View File

@ -1088,7 +1088,11 @@ void ZooKeeper::pushRequest(RequestInfo && info)
info.request->addRootPath(root_path); info.request->addRootPath(root_path);
if (!info.request->xid) if (!info.request->xid)
{
info.request->xid = xid.fetch_add(1); info.request->xid = xid.fetch_add(1);
if (info.request->xid < 0)
throw Exception("XID overflow");
}
{ {
std::lock_guard lock(operations_mutex); std::lock_guard lock(operations_mutex);

View File

@ -476,7 +476,7 @@ private:
std::optional<ReadBufferFromPocoSocket> in; std::optional<ReadBufferFromPocoSocket> in;
std::optional<WriteBufferFromPocoSocket> out; std::optional<WriteBufferFromPocoSocket> out;
std::atomic<XID> xid {1}; /// TODO deal with xid overflow std::atomic<XID> xid {1};
struct RequestInfo struct RequestInfo
{ {