diff --git a/src/Common/ZooKeeper/ZooKeeper.h b/src/Common/ZooKeeper/ZooKeeper.h index b31dbc8da49..636c9049af0 100644 --- a/src/Common/ZooKeeper/ZooKeeper.h +++ b/src/Common/ZooKeeper/ZooKeeper.h @@ -675,7 +675,7 @@ bool hasZooKeeperConfig(const Poco::Util::AbstractConfiguration & config); String getZooKeeperConfigName(const Poco::Util::AbstractConfiguration & config); template -void addCheckNotExistsRequest(Coordination::Requests requests, const Client & client, const std::string & path) +void addCheckNotExistsRequest(Coordination::Requests & requests, const Client & client, const std::string & path) { if (client.getApiVersion() >= DB::KeeperApiVersion::WITH_CHECK_NOT_EXISTS) { diff --git a/src/Coordination/KeeperStorage.cpp b/src/Coordination/KeeperStorage.cpp index 28cb4fba9c9..a838de07ecb 100644 --- a/src/Coordination/KeeperStorage.cpp +++ b/src/Coordination/KeeperStorage.cpp @@ -1457,13 +1457,8 @@ struct KeeperStorageCheckRequestProcessor final : public KeeperStorageRequestPro bool checkAuth(KeeperStorage & storage, int64_t session_id, bool is_local) const override { - StringRef path; - if (check_not_exists) - path = parentPath(zk_request->getPath()); - else - path = zk_request->getPath(); - - return storage.checkACL(path, Coordination::ACL::Read, session_id, is_local); + auto path = zk_request->getPath(); + return storage.checkACL(check_not_exists ? parentPath(path) : path, Coordination::ACL::Read, session_id, is_local); } std::vector @@ -1744,6 +1739,7 @@ struct KeeperStorageMultiRequestProcessor final : public KeeperStorageRequestPro concrete_requests.push_back(std::make_shared(sub_zk_request)); break; case Coordination::OpNum::Check: + case Coordination::OpNum::CheckNotExists: check_operation_type(OperationType::Write); concrete_requests.push_back(std::make_shared(sub_zk_request)); break;