MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / createDatabaseNodesInZooKeeper

Method createDatabaseNodesInZooKeeper

src/Databases/DatabaseReplicated.cpp:744–760  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

742}
743
744bool DatabaseReplicated::createDatabaseNodesInZooKeeper(const zkutil::ZooKeeperPtr & current_zookeeper)
745{
746 current_zookeeper->createAncestors(zookeeper_path);
747
748 Coordination::Requests ops = buildDatabaseNodesInZooKeeper();
749
750 Coordination::Responses responses;
751 auto res = current_zookeeper->tryMulti(ops, responses);
752 if (res == Coordination::Error::ZOK)
753 return true; /// Created new database (it's the first replica)
754 if (res == Coordination::Error::ZNODEEXISTS)
755 return false; /// Database exists, we will add new replica
756
757 /// Other codes are unexpected, will throw
758 zkutil::KeeperMultiException::check(res, ops, responses);
759 UNREACHABLE();
760}
761
762bool DatabaseReplicated::looksLikeReplicatedDatabasePath(const ZooKeeperPtr & current_zookeeper, const String & path)
763{

Callers

nothing calls this directly

Calls 3

checkFunction · 0.50
createAncestorsMethod · 0.45
tryMultiMethod · 0.45

Tested by

no test coverage detected