diff --git a/src/Common/getCurrentProcessFDCount.cpp b/src/Common/getCurrentProcessFDCount.cpp index 9653b4eccd8..6bcfabcdf20 100644 --- a/src/Common/getCurrentProcessFDCount.cpp +++ b/src/Common/getCurrentProcessFDCount.cpp @@ -20,7 +20,7 @@ int getCurrentProcessFDCount() WriteBufferFromOwnString out; copyData(command->out, out); - if(!out.str().empty()) + if (!out.str().empty()) { return std::stoi(out.str()); } diff --git a/src/Common/getMaxFileDescriptorCount.cpp b/src/Common/getMaxFileDescriptorCount.cpp index 751145e4967..70de1dd0c08 100644 --- a/src/Common/getMaxFileDescriptorCount.cpp +++ b/src/Common/getMaxFileDescriptorCount.cpp @@ -14,7 +14,7 @@ int getMaxFileDescriptorCount() WriteBufferFromOwnString out; copyData(command->out, out); - if(!out.str().empty()) + if (!out.str().empty()) { return std::stoi(out.str()); } diff --git a/src/Coordination/CoordinationSettings.cpp b/src/Coordination/CoordinationSettings.cpp index 46e60689103..e4f2cd1e031 100644 --- a/src/Coordination/CoordinationSettings.cpp +++ b/src/Coordination/CoordinationSettings.cpp @@ -37,13 +37,15 @@ void KeeperSettings::dump(WriteBufferFromOwnString & buf) const { auto write = [&buf](const String & content) { buf.write(content.data(), content.size()); }; - auto write_int = [&buf](Int64 value) { + auto write_int = [&buf](Int64 value) + { String str_val = std::to_string(value); buf.write(str_val.data(), str_val.size()); buf.write('\n'); }; - auto write_bool = [&buf](bool value) { + auto write_bool = [&buf](bool value) + { String str_val = value ? "true" : "false"; buf.write(str_val.data(), str_val.size()); buf.write('\n'); @@ -52,17 +54,17 @@ void KeeperSettings::dump(WriteBufferFromOwnString & buf) const write("server_id="); write_int(server_id); - if(tcp_port != NO_PORT) + if (tcp_port != NO_PORT) { write("tcp_port="); write_int(tcp_port); } - if(tcp_port_secure != NO_PORT) + if (tcp_port_secure != NO_PORT) { write("tcp_port_secure="); write_int(tcp_port_secure); } - if(!super_digest.empty()) + if (!super_digest.empty()) { write("superdigest="); write(super_digest); @@ -136,15 +138,15 @@ KeeperSettings::loadFromConfig(const Poco::Util::AbstractConfiguration & config, ret->server_id = config.getInt("keeper_server.server_id"); ret->standalone_keeper = standalone_keeper_; - if(config.has("keeper_server.tcp_port")) + if (config.has("keeper_server.tcp_port")) { ret->tcp_port = config.getInt("keeper_server.tcp_port"); } - if(config.has("keeper_server.tcp_port_secure")) + if (config.has("keeper_server.tcp_port_secure")) { ret->tcp_port_secure = config.getInt("keeper_server.tcp_port_secure"); } - if(config.has("keeper_server.superdigest")) + if (config.has("keeper_server.superdigest")) { ret->super_digest = config.getString("keeper_server.tcp_port_secure"); } diff --git a/src/Coordination/FourLetterCommand.h b/src/Coordination/FourLetterCommand.h index 3867a5ede86..1cbd880978f 100644 --- a/src/Coordination/FourLetterCommand.h +++ b/src/Coordination/FourLetterCommand.h @@ -7,7 +7,6 @@ #include #include #include -#include #if !defined(ARCADIA_BUILD) # include @@ -98,9 +97,6 @@ struct RuokCommand : public IFourLetterCommand * zk_followers 2 - only exposed by the Leader * zk_synced_followers 2 - only exposed by the Leader * zk_pending_syncs 0 - only exposed by the Leader - * zk_last_proposal_size -1 - * zk_max_proposal_size -1 - * zk_min_proposal_size -1 */ struct MonitorCommand : public IFourLetterCommand { @@ -144,6 +140,4 @@ struct ConfCommand : public IFourLetterCommand ~ConfCommand() override; }; - - } diff --git a/src/Coordination/KeeperDispatcher.cpp b/src/Coordination/KeeperDispatcher.cpp index 3977c36a943..e34693e2821 100644 --- a/src/Coordination/KeeperDispatcher.cpp +++ b/src/Coordination/KeeperDispatcher.cpp @@ -12,7 +12,6 @@ namespace ErrorCodes extern const int LOGICAL_ERROR; extern const int TIMEOUT_EXCEEDED; extern const int SYSTEM_ERROR; - extern const int UNKNOWN_SETTING; } UInt64 KeeperDispatcher::KeeperStats::getMinLatency() const @@ -330,7 +329,7 @@ bool KeeperDispatcher::putRequest(const Coordination::ZooKeeperRequestPtr & requ if (!requests_queue->push(std::move(request_info))) throw Exception("Cannot push request to queue", ErrorCodes::SYSTEM_ERROR); } - else if (!requests_queue->tryPush(std::move(request_info), coordination_settings->operation_timeout_ms.totalMilliseconds())) + else if (!requests_queue->tryPush(std::move(request_info), settings->coordination_settings->operation_timeout_ms.totalMilliseconds())) { throw Exception("Cannot push request to queue within operation timeout", ErrorCodes::TIMEOUT_EXCEEDED); } @@ -342,14 +341,14 @@ void KeeperDispatcher::initialize(const Poco::Util::AbstractConfiguration & conf { LOG_DEBUG(log, "Initializing storage dispatcher"); - settings = KeeperSettings::loadFromConfig(config_, standalone_keeper); + settings = KeeperSettings::loadFromConfig(config, standalone_keeper); requests_queue = std::make_unique(settings->coordination_settings->max_requests_batch_size); request_thread = ThreadFromGlobalPool([this] { requestThread(); }); responses_thread = ThreadFromGlobalPool([this] { responseThread(); }); snapshot_thread = ThreadFromGlobalPool([this] { snapshotThread(); }); - server = std::make_unique(settings, config_, responses_queue, snapshots_queue); + server = std::make_unique(settings, config, responses_queue, snapshots_queue); try { diff --git a/src/Coordination/KeeperStorage.h b/src/Coordination/KeeperStorage.h index 1ea57a9b77c..ed12c448f24 100644 --- a/src/Coordination/KeeperStorage.h +++ b/src/Coordination/KeeperStorage.h @@ -44,7 +44,7 @@ public: UInt64 size() const { UInt64 child_size{0}; - for(auto & child : children) + for (auto & child : children) { child_size += child.size(); } @@ -201,7 +201,7 @@ public: UInt64 getEphemeralCount() const { UInt64 ret{0}; - for(const auto & ephs : ephemerals) + for (const auto & ephs : ephemerals) { ret += ephs.second.size(); } diff --git a/src/Server/KeeperTCPHandler.cpp b/src/Server/KeeperTCPHandler.cpp index ce7073441b8..ae11fa31a3a 100644 --- a/src/Server/KeeperTCPHandler.cpp +++ b/src/Server/KeeperTCPHandler.cpp @@ -382,7 +382,7 @@ void KeeperTCPHandler::runImpl() /// Do request statistics, /// not accurate when there is watch response in the channel - if(result.responses_count != 0) + if (result.responses_count != 0) { process_time_stopwatch.stop(); keeper_dispatcher->updateKeeperStat(process_time_stopwatch.elapsedMilliseconds());