| 742 | } |
| 743 | |
| 744 | bool 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 | |
| 762 | bool DatabaseReplicated::looksLikeReplicatedDatabasePath(const ZooKeeperPtr & current_zookeeper, const String & path) |
| 763 | { |
nothing calls this directly
no test coverage detected