adjust code style for keeper 4lw cmd

This commit is contained in:
JackyWoo 2021-10-27 22:26:53 +08:00
parent a60663e33d
commit e5b0eedd31
7 changed files with 18 additions and 23 deletions

View File

@ -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');

View File

@ -7,7 +7,6 @@
#include <Coordination/KeeperDispatcher.h>
#include <Coordination/KeeperInfos.h>
#include <IO/WriteBufferFromString.h>
#include <common/types.h>
#if !defined(ARCADIA_BUILD)
# include <Common/config_version.h>
@ -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;
};
}

View File

@ -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<RequestsQueue>(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<KeeperServer>(settings, config_, responses_queue, snapshots_queue);
server = std::make_unique<KeeperServer>(settings, config, responses_queue, snapshots_queue);
try
{