Merge pull request #54251 from ClickHouse/fix_zk_fault_injection_logging

Properly re-initialize ZooKeeper fault injection
This commit is contained in:
Alexander Gololobov 2023-09-04 22:00:48 +02:00 committed by GitHub
commit 941f0f1aef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -1516,7 +1516,7 @@ bool ZooKeeper::hasReachedDeadline() const
void ZooKeeper::maybeInjectSendFault()
{
if (unlikely(inject_setup.test() && send_inject_fault && send_inject_fault.value()(thread_local_rng)))
throw Exception::fromMessage(Error::ZSESSIONEXPIRED, "Session expired (fault injected on recv)");
throw Exception::fromMessage(Error::ZSESSIONEXPIRED, "Session expired (fault injected on send)");
}
void ZooKeeper::maybeInjectRecvFault()

View File

@ -2743,6 +2743,8 @@ zkutil::ZooKeeperPtr Context::getZooKeeper() const
Stopwatch watch;
LOG_DEBUG(shared->log, "Trying to establish a new connection with ZooKeeper");
shared->zookeeper = shared->zookeeper->startNewSession();
if (isServerCompletelyStarted())
shared->zookeeper->setServerCompletelyStarted();
LOG_DEBUG(shared->log, "Establishing a new connection with ZooKeeper took {} ms", watch.elapsedMilliseconds());
}