mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Merge pull request #9961 from ClickHouse/fix_zookeeper_implementation
Fix bug with wrong implementation in ZooKeeper API
This commit is contained in:
commit
576936f4e8
@ -45,7 +45,7 @@ static void check(int32_t code, const std::string & path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ZooKeeper::init(const std::string & implementation, const std::string & hosts_, const std::string & identity_,
|
void ZooKeeper::init(const std::string & implementation_, const std::string & hosts_, const std::string & identity_,
|
||||||
int32_t session_timeout_ms_, int32_t operation_timeout_ms_, const std::string & chroot_)
|
int32_t session_timeout_ms_, int32_t operation_timeout_ms_, const std::string & chroot_)
|
||||||
{
|
{
|
||||||
log = &Logger::get("ZooKeeper");
|
log = &Logger::get("ZooKeeper");
|
||||||
@ -54,6 +54,7 @@ void ZooKeeper::init(const std::string & implementation, const std::string & hos
|
|||||||
session_timeout_ms = session_timeout_ms_;
|
session_timeout_ms = session_timeout_ms_;
|
||||||
operation_timeout_ms = operation_timeout_ms_;
|
operation_timeout_ms = operation_timeout_ms_;
|
||||||
chroot = chroot_;
|
chroot = chroot_;
|
||||||
|
implementation = implementation_;
|
||||||
|
|
||||||
if (implementation == "zookeeper")
|
if (implementation == "zookeeper")
|
||||||
{
|
{
|
||||||
@ -65,13 +66,13 @@ void ZooKeeper::init(const std::string & implementation, const std::string & hos
|
|||||||
Coordination::ZooKeeper::Addresses addresses;
|
Coordination::ZooKeeper::Addresses addresses;
|
||||||
addresses.reserve(addresses_strings.size());
|
addresses.reserve(addresses_strings.size());
|
||||||
|
|
||||||
for (const auto &address_string : addresses_strings)
|
for (const auto & address_string : addresses_strings)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
addresses.emplace_back(address_string);
|
addresses.emplace_back(address_string);
|
||||||
}
|
}
|
||||||
catch (const Poco::Net::DNSException &e)
|
catch (const Poco::Net::DNSException & e)
|
||||||
{
|
{
|
||||||
LOG_ERROR(log, "Cannot use ZooKeeper address " << address_string << ", reason: " << e.displayText());
|
LOG_ERROR(log, "Cannot use ZooKeeper address " << address_string << ", reason: " << e.displayText());
|
||||||
}
|
}
|
||||||
@ -107,9 +108,9 @@ void ZooKeeper::init(const std::string & implementation, const std::string & hos
|
|||||||
}
|
}
|
||||||
|
|
||||||
ZooKeeper::ZooKeeper(const std::string & hosts_, const std::string & identity_, int32_t session_timeout_ms_,
|
ZooKeeper::ZooKeeper(const std::string & hosts_, const std::string & identity_, int32_t session_timeout_ms_,
|
||||||
int32_t operation_timeout_ms_, const std::string & chroot_, const std::string & implementation)
|
int32_t operation_timeout_ms_, const std::string & chroot_, const std::string & implementation_)
|
||||||
{
|
{
|
||||||
init(implementation, hosts_, identity_, session_timeout_ms_, operation_timeout_ms_, chroot_);
|
init(implementation_, hosts_, identity_, session_timeout_ms_, operation_timeout_ms_, chroot_);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ZooKeeperArgs
|
struct ZooKeeperArgs
|
||||||
@ -671,7 +672,7 @@ void ZooKeeper::waitForDisappear(const std::string & path)
|
|||||||
|
|
||||||
ZooKeeperPtr ZooKeeper::startNewSession() const
|
ZooKeeperPtr ZooKeeper::startNewSession() const
|
||||||
{
|
{
|
||||||
return std::make_shared<ZooKeeper>(hosts, identity, session_timeout_ms, operation_timeout_ms, chroot);
|
return std::make_shared<ZooKeeper>(hosts, identity, session_timeout_ms, operation_timeout_ms, chroot, implementation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -258,6 +258,7 @@ private:
|
|||||||
int32_t session_timeout_ms;
|
int32_t session_timeout_ms;
|
||||||
int32_t operation_timeout_ms;
|
int32_t operation_timeout_ms;
|
||||||
std::string chroot;
|
std::string chroot;
|
||||||
|
std::string implementation;
|
||||||
|
|
||||||
std::mutex mutex;
|
std::mutex mutex;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user