Add support for simple list

This commit is contained in:
Antonio Andelic 2022-09-26 08:05:02 +00:00
parent f833366555
commit 937d534cd4
5 changed files with 17 additions and 3 deletions

View File

@ -36,4 +36,5 @@ Coordination::RequestPtr makeCheckRequest(const std::string & path, int version)
Coordination::RequestPtr makeGetRequest(const std::string & path);
Coordination::RequestPtr makeListRequest(const std::string & path);
Coordination::RequestPtr makeSimpleListRequest(const std::string & path);
}

View File

@ -1222,6 +1222,13 @@ Coordination::RequestPtr makeListRequest(const std::string & path)
return request;
}
Coordination::RequestPtr makeSimpleListRequest(const std::string & path)
{
auto request = std::make_shared<Coordination::ZooKeeperSimpleListRequest>();
request->path = path;
return request;
}
std::string normalizeZooKeeperPath(std::string zookeeper_path, bool check_starts_with_slash, Poco::Logger * log)
{
if (!zookeeper_path.empty() && zookeeper_path.back() == '/')

View File

@ -485,6 +485,11 @@ ZooKeeperMultiRequest::ZooKeeperMultiRequest(const Requests & generic_requests,
checkOperationType(Read);
requests.push_back(std::make_shared<ZooKeeperGetRequest>(*concrete_request_get));
}
else if (const auto * concrete_request_simple_list = dynamic_cast<const ZooKeeperSimpleListRequest *>(generic_request.get()))
{
checkOperationType(Read);
requests.push_back(std::make_shared<ZooKeeperSimpleListRequest>(*concrete_request_simple_list));
}
else if (const auto * concrete_request_list = dynamic_cast<const ListRequest *>(generic_request.get()))
{
checkOperationType(Read);

View File

@ -351,9 +351,6 @@ struct ZooKeeperListRequest : ListRequest, ZooKeeperRequest
struct ZooKeeperSimpleListRequest final : ZooKeeperListRequest
{
ZooKeeperSimpleListRequest() = default;
explicit ZooKeeperSimpleListRequest(const ListRequest & base) : ZooKeeperListRequest(base) {}
OpNum getOpNum() const override { return OpNum::SimpleList; }
ZooKeeperResponsePtr makeResponse() const override;
};

View File

@ -1655,6 +1655,10 @@ struct KeeperStorageMultiRequestProcessor final : public KeeperStorageRequestPro
check_operation_type(OperationType::Read);
concrete_requests.push_back(std::make_shared<KeeperStorageListRequestProcessor>(sub_zk_request));
break;
case Coordination::OpNum::SimpleList:
check_operation_type(OperationType::Read);
concrete_requests.push_back(std::make_shared<KeeperStorageListRequestProcessor>(sub_zk_request));
break;
default:
throw DB::Exception(
ErrorCodes::BAD_ARGUMENTS, "Illegal command as part of multi ZooKeeper request {}", sub_zk_request->getOpNum());