mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
ZooKeeper: Fixed potential issue [#CLICKHOUSE-2]
This commit is contained in:
parent
805325015f
commit
a2ce515a84
@ -1272,21 +1272,29 @@ void ZooKeeper::pushRequest(RequestInfo && info)
|
||||
if (expired && info.request->xid != close_xid)
|
||||
throw Exception("Session expired", ZSESSIONEXPIRED);
|
||||
|
||||
info.request->addRootPath(root_path);
|
||||
|
||||
info.time = clock::now();
|
||||
|
||||
if (!info.request->xid)
|
||||
try
|
||||
{
|
||||
info.request->xid = xid.fetch_add(1);
|
||||
if (info.request->xid < 0)
|
||||
throw Exception("XID overflow", ZSESSIONEXPIRED);
|
||||
info.request->addRootPath(root_path);
|
||||
|
||||
info.time = clock::now();
|
||||
|
||||
if (!info.request->xid)
|
||||
{
|
||||
info.request->xid = xid.fetch_add(1);
|
||||
if (info.request->xid < 0)
|
||||
throw Exception("XID overflow", ZSESSIONEXPIRED);
|
||||
}
|
||||
|
||||
ProfileEvents::increment(ProfileEvents::ZooKeeperTransactions);
|
||||
|
||||
if (!requests_queue.tryPush(std::move(info), operation_timeout.totalMilliseconds()))
|
||||
throw Exception("Cannot push request to queue within operation timeout", ZOPERATIONTIMEOUT);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
finalize(false, false);
|
||||
throw;
|
||||
}
|
||||
|
||||
ProfileEvents::increment(ProfileEvents::ZooKeeperTransactions);
|
||||
|
||||
if (!requests_queue.tryPush(std::move(info), operation_timeout.totalMilliseconds()))
|
||||
throw Exception("Cannot push request to queue within operation timeout", ZOPERATIONTIMEOUT);
|
||||
}
|
||||
|
||||
|
||||
|
@ -440,7 +440,9 @@ public:
|
||||
using MultiCallback = std::function<void(const MultiResponse &)>;
|
||||
|
||||
/// If the method will throw exception, callbacks won't be called.
|
||||
/// After the method is executed successfully, you must wait for callbacks.
|
||||
/// After the method is executed successfully, you must wait for callbacks
|
||||
/// (don't destroy callback data before it will be called).
|
||||
/// All callbacks are executed sequentially.
|
||||
|
||||
void create(
|
||||
const String & path,
|
||||
|
Loading…
Reference in New Issue
Block a user