Merge pull request #58092 from Algunenano/cosmetic_changes

Minor cosmetic changes
This commit is contained in:
Alexey Milovidov 2023-12-21 06:06:48 +01:00 committed by GitHub
commit b57bc0e4ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 2 deletions

View File

@ -78,13 +78,16 @@ BackupInfo BackupInfo::fromAST(const IAST & ast)
}
}
res.args.reserve(list->children.size() - index);
for (; index < list->children.size(); ++index)
size_t args_size = list->children.size();
res.args.reserve(args_size - index);
for (; index < args_size; ++index)
{
const auto & elem = list->children[index];
const auto * lit = elem->as<const ASTLiteral>();
if (!lit)
{
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Expected literal, got {}", serializeAST(*elem));
}
res.args.push_back(lit->value);
}
}

View File

@ -290,6 +290,11 @@ bool ZooKeeperWithFaultInjection::exists(const std::string & path, Coordination:
return executeWithFaultSync(__func__, path, [&]() { return keeper->exists(path, stat, watch); });
}
bool ZooKeeperWithFaultInjection::anyExists(const std::vector<std::string> & paths)
{
return executeWithFaultSync(__func__, !paths.empty() ? paths.front() : "", [&]() { return keeper->anyExists(paths); });
}
zkutil::ZooKeeper::MultiExistsResponse ZooKeeperWithFaultInjection::exists(const std::vector<std::string> & paths)
{
return executeWithFaultSync(__func__, !paths.empty() ? paths.front() : "", [&]() { return keeper->exists(paths); });

View File

@ -59,6 +59,7 @@ private:
class ZooKeeperWithFaultInjection
{
zkutil::ZooKeeper::Ptr keeper;
std::unique_ptr<RandomFaultInjection> fault_policy;
std::string name;
Poco::Logger * logger = nullptr;
@ -203,6 +204,8 @@ public:
zkutil::ZooKeeper::MultiExistsResponse exists(const std::vector<std::string> & paths);
bool anyExists(const std::vector<std::string> & paths);
std::string create(const std::string & path, const std::string & data, int32_t mode);
Coordination::Error tryCreate(const std::string & path, const std::string & data, int32_t mode, std::string & path_created);