You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pegasus.apache.org by la...@apache.org on 2023/01/28 06:22:29 UTC
[incubator-pegasus] branch master updated: refactor(log): use LOG_* instead of LOG_*_F (#1322)
This is an automated email from the ASF dual-hosted git repository.
laiyingchun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git
The following commit(s) were added to refs/heads/master by this push:
new 79e58f2fe refactor(log): use LOG_* instead of LOG_*_F (#1322)
79e58f2fe is described below
commit 79e58f2fe19a9e0014147f90ccc14a33fae4bb42
Author: Yingchun Lai <la...@apache.org>
AuthorDate: Sat Jan 28 14:22:22 2023 +0800
refactor(log): use LOG_* instead of LOG_*_F (#1322)
---
src/aio/disk_engine.cpp | 8 +-
src/aio/native_linux_aio_provider.cpp | 17 +-
src/aio/test/aio.cpp | 2 +-
src/base/pegasus_value_schema.h | 4 +-
src/block_service/block_service_manager.cpp | 32 +-
src/block_service/directio_writable_file.cpp | 36 +-
src/block_service/fds/fds_service.cpp | 133 ++-
src/block_service/hdfs/hdfs_service.cpp | 91 ++-
src/block_service/local/local_service.cpp | 72 +-
src/client/partition_resolver.cpp | 8 +-
src/client/partition_resolver_manager.cpp | 2 +-
src/client/partition_resolver_simple.cpp | 26 +-
src/client/replication_ddl_client.cpp | 4 +-
src/client_lib/pegasus_client_factory_impl.cpp | 6 +-
src/client_lib/pegasus_client_impl.cpp | 92 +--
src/common/fs_manager.cpp | 61 +-
src/common/replication_common.cpp | 12 +-
src/common/storage_serverlet.h | 8 +-
src/failure_detector/failure_detector.cpp | 86 +-
.../failure_detector_multimaster.cpp | 18 +-
src/failure_detector/test/failure_detector.cpp | 22 +-
src/geo/lib/geo_client.cpp | 114 +--
src/geo/lib/latlng_codec.cpp | 2 +-
src/http/http_message_parser.cpp | 8 +-
src/http/http_server.cpp | 2 +-
src/http/pprof_http_service.cpp | 26 +-
src/meta/app_balance_policy.cpp | 30 +-
src/meta/app_env_validator.cpp | 2 +-
src/meta/backup_engine.cpp | 76 +-
src/meta/cluster_balance_policy.cpp | 48 +-
src/meta/dump_file.h | 12 +-
src/meta/duplication/duplication_info.cpp | 6 +-
src/meta/duplication/duplication_info.h | 10 +-
src/meta/duplication/meta_duplication_service.cpp | 66 +-
src/meta/greedy_load_balancer.cpp | 6 +-
src/meta/load_balance_policy.cpp | 53 +-
src/meta/meta_backup_service.cpp | 378 +++++----
src/meta/meta_bulk_load_ingestion_context.cpp | 18 +-
src/meta/meta_bulk_load_service.cpp | 625 +++++++-------
src/meta/meta_data.cpp | 74 +-
src/meta/meta_server_failure_detector.cpp | 82 +-
src/meta/meta_service.cpp | 100 +--
src/meta/meta_service.h | 10 +-
src/meta/meta_split_service.cpp | 160 ++--
src/meta/meta_state_service_simple.cpp | 4 +-
src/meta/meta_state_service_utils_impl.h | 6 +-
src/meta/meta_state_service_zookeeper.cpp | 20 +-
src/meta/partition_guardian.cpp | 194 ++---
src/meta/server_state.cpp | 897 ++++++++++-----------
src/meta/server_state_restore.cpp | 18 +-
src/meta/test/backup_test.cpp | 8 +-
.../test/balancer_simulator/balancer_simulator.cpp | 4 +-
src/meta/test/balancer_validator.cpp | 24 +-
src/meta/test/main.cpp | 2 +-
src/meta/test/meta_bulk_load_service_test.cpp | 32 +-
src/meta/test/meta_split_service_test.cpp | 6 +-
src/meta/test/meta_state/meta_state_service.cpp | 2 +-
src/meta/test/meta_test_base.cpp | 8 +-
src/meta/test/misc/misc.cpp | 16 +-
src/meta/test/update_configuration_test.cpp | 2 +-
src/nfs/nfs_client_impl.cpp | 54 +-
src/nfs/nfs_server_impl.cpp | 20 +-
src/perf_counter/builtin_counters.cpp | 2 +-
src/perf_counter/perf_counters.cpp | 3 +-
src/perf_counter/test/perf_counter_test.cpp | 8 +-
src/redis_protocol/proxy_lib/proxy_layer.cpp | 12 +-
src/redis_protocol/proxy_lib/redis_parser.cpp | 76 +-
src/redis_protocol/proxy_ut/redis_proxy_test.cpp | 2 +-
src/replica/backup/cold_backup_context.cpp | 395 +++++----
src/replica/backup/replica_backup_manager.cpp | 2 +-
src/replica/backup/replica_backup_server.cpp | 30 +-
.../bulk_load/test/replica_bulk_loader_test.cpp | 4 +-
src/replica/disk_cleaner.cpp | 24 +-
src/replica/duplication/duplication_sync_timer.cpp | 15 +-
src/replica/duplication/load_from_private_log.cpp | 2 +-
.../test/load_from_private_log_test.cpp | 2 +-
src/replica/log_file.cpp | 40 +-
src/replica/mutation.cpp | 6 +-
src/replica/mutation_log.cpp | 357 ++++----
src/replica/mutation_log_replay.cpp | 26 +-
src/replica/replica_2pc.cpp | 18 +-
src/replica/replica_backup.cpp | 200 +++--
src/replica/replica_config.cpp | 8 +-
src/replica/replica_context.cpp | 6 +-
src/replica/replica_init.cpp | 47 +-
src/replica/replica_restore.cpp | 46 +-
src/replica/replica_stub.cpp | 384 +++++----
src/replica/replication_app_base.cpp | 10 +-
.../storage/simple_kv/simple_kv.server.impl.cpp | 8 +-
src/replica/storage/simple_kv/test/case.cpp | 22 +-
src/replica/storage/simple_kv/test/checker.cpp | 14 +-
src/replica/storage/simple_kv/test/client.cpp | 4 +-
.../storage/simple_kv/test/simple_kv.main.cpp | 2 +-
.../simple_kv/test/simple_kv.server.impl.cpp | 32 +-
src/replica/test/mock_utils.h | 6 +-
src/replica/test/mutation_log_test.cpp | 2 +-
src/replica/test/replica_disk_test.cpp | 2 +-
src/reporter/pegasus_counter_reporter.cpp | 26 +-
src/runtime/env.sim.cpp | 2 +-
src/runtime/fault_injector.cpp | 64 +-
src/runtime/rpc/asio_net_provider.cpp | 56 +-
src/runtime/rpc/asio_rpc_session.cpp | 38 +-
src/runtime/rpc/dsn_message_parser.cpp | 18 +-
src/runtime/rpc/group_address.h | 2 +-
src/runtime/rpc/network.cpp | 78 +-
src/runtime/rpc/network.sim.cpp | 2 +-
src/runtime/rpc/raw_message_parser.cpp | 4 +-
src/runtime/rpc/rpc_address.cpp | 20 +-
src/runtime/rpc/rpc_engine.cpp | 97 ++-
src/runtime/rpc/thrift_message_parser.cpp | 8 +-
src/runtime/security/client_negotiation.cpp | 39 +-
src/runtime/security/init.cpp | 16 +-
src/runtime/security/kinit_context.cpp | 22 +-
src/runtime/security/negotiation.cpp | 8 +-
src/runtime/security/negotiation_manager.cpp | 6 +-
src/runtime/security/replica_access_controller.cpp | 2 +-
src/runtime/security/server_negotiation.cpp | 30 +-
src/runtime/service_api_c.cpp | 12 +-
src/runtime/simulator.cpp | 4 +-
src/runtime/task/simple_task_queue.cpp | 2 +-
src/runtime/task/task.cpp | 10 +-
src/runtime/task/task.h | 9 +-
src/runtime/task/task_engine.cpp | 8 +-
src/runtime/task/task_spec.cpp | 24 +-
src/runtime/task/task_worker.cpp | 14 +-
src/runtime/test/async_call.cpp | 12 +-
src/runtime/test/netprovider.cpp | 12 +-
src/runtime/test/rpc.cpp | 6 +-
src/runtime/test/test_utils.h | 10 +-
src/runtime/tool_api.cpp | 2 +-
src/runtime/tracer.cpp | 148 ++--
src/runtime/zlocks.cpp | 16 +-
src/server/available_detector.cpp | 126 +--
src/server/compaction_filter_rule.cpp | 2 +-
src/server/compaction_operation.cpp | 4 +-
src/server/hotspot_partition_calculator.cpp | 40 +-
src/server/info_collector.cpp | 42 +-
src/server/main.cpp | 2 +-
src/server/pegasus_mutation_duplicator.cpp | 2 +-
src/server/pegasus_server_impl.cpp | 2 +-
src/server/pegasus_server_write.cpp | 4 +-
src/server/result_writer.cpp | 36 +-
src/shell/command_helper.h | 34 +-
src/shell/commands/duplication.cpp | 2 +-
src/test/function_test/base_api_test/test_copy.cpp | 6 +-
src/test/function_test/base_api_test/test_scan.cpp | 4 +-
src/test/kill_test/data_verifier.cpp | 239 +++---
src/test/kill_test/kill_testor.cpp | 24 +-
src/test/kill_test/killer_handler_shell.cpp | 16 +-
src/test/kill_test/partition_kill_testor.cpp | 10 +-
src/test/kill_test/process_kill_testor.cpp | 45 +-
src/test/pressure_test/main.cpp | 16 +-
src/utils/api_utilities.h | 2 +-
src/utils/command_manager.h | 4 +-
src/utils/fail_point.cpp | 20 +-
src/utils/filesystem.cpp | 78 +-
src/utils/fmt_logging.h | 22 +-
src/utils/latency_tracer.cpp | 4 +-
src/utils/shared_io_service.cpp | 2 +-
src/utils/token_bucket_throttling_controller.cpp | 5 +-
src/utils/utils.cpp | 10 +-
.../distributed_lock_service_zookeeper.cpp | 15 +-
src/zookeeper/lock_struct.cpp | 158 ++--
src/zookeeper/test/distributed_lock_zookeeper.cpp | 11 +-
src/zookeeper/zookeeper_session.cpp | 20 +-
165 files changed, 3779 insertions(+), 3837 deletions(-)
diff --git a/src/aio/disk_engine.cpp b/src/aio/disk_engine.cpp
index 521713f46..490af15d7 100644
--- a/src/aio/disk_engine.cpp
+++ b/src/aio/disk_engine.cpp
@@ -236,10 +236,10 @@ void disk_engine::process_write(aio_task *aio, uint64_t sz)
void disk_engine::complete_io(aio_task *aio, error_code err, uint64_t bytes)
{
if (err != ERR_OK) {
- LOG_DEBUG_F("disk operation failure with code {}, err = {}, aio_task_id = {:#018x}",
- aio->spec().name,
- err,
- aio->id());
+ LOG_DEBUG("disk operation failure with code {}, err = {}, aio_task_id = {:#018x}",
+ aio->spec().name,
+ err,
+ aio->id());
}
// batching
diff --git a/src/aio/native_linux_aio_provider.cpp b/src/aio/native_linux_aio_provider.cpp
index 3ca601c76..9720f0aba 100644
--- a/src/aio/native_linux_aio_provider.cpp
+++ b/src/aio/native_linux_aio_provider.cpp
@@ -47,7 +47,7 @@ linux_fd_t native_linux_aio_provider::open(const char *file_name, int flag, int
{
auto fd = ::open(file_name, flag, pmode);
if (fd == DSN_INVALID_FILE_HANDLE) {
- LOG_ERROR_F("create file failed, err = {}", utils::safe_strerror(errno));
+ LOG_ERROR("create file failed, err = {}", utils::safe_strerror(errno));
}
return linux_fd_t(fd);
}
@@ -58,7 +58,7 @@ error_code native_linux_aio_provider::close(linux_fd_t fd)
return ERR_OK;
}
- LOG_ERROR_F("close file failed, err = {}", utils::safe_strerror(errno));
+ LOG_ERROR("close file failed, err = {}", utils::safe_strerror(errno));
return ERR_FILE_OPERATION_FAILED;
}
@@ -68,7 +68,7 @@ error_code native_linux_aio_provider::flush(linux_fd_t fd)
return ERR_OK;
}
- LOG_ERROR_F("flush file failed, err = {}", utils::safe_strerror(errno));
+ LOG_ERROR("flush file failed, err = {}", utils::safe_strerror(errno));
return ERR_FILE_OPERATION_FAILED;
}
@@ -85,13 +85,12 @@ error_code native_linux_aio_provider::write(const aio_context &aio_ctx,
aio_ctx.file_offset + buffer_offset);
if (dsn_unlikely(ret < 0)) {
if (errno == EINTR) {
- LOG_WARNING_F("write failed with errno={} and will retry it.",
- utils::safe_strerror(errno));
+ LOG_WARNING("write failed with errno={} and will retry it.",
+ utils::safe_strerror(errno));
continue;
}
resp = ERR_FILE_OPERATION_FAILED;
- LOG_ERROR_F(
- "write failed with errno={}, return {}.", utils::safe_strerror(errno), resp);
+ LOG_ERROR("write failed with errno={}, return {}.", utils::safe_strerror(errno), resp);
return resp;
}
@@ -104,7 +103,7 @@ error_code native_linux_aio_provider::write(const aio_context &aio_ctx,
buffer_offset += ret;
if (dsn_unlikely(buffer_offset != aio_ctx.buffer_size)) {
- LOG_WARNING_F(
+ LOG_WARNING(
"write incomplete, request_size={}, total_write_size={}, this_write_size={}, "
"and will retry it.",
aio_ctx.buffer_size,
@@ -125,7 +124,7 @@ error_code native_linux_aio_provider::read(const aio_context &aio_ctx,
aio_ctx.buffer_size,
aio_ctx.file_offset);
if (dsn_unlikely(ret < 0)) {
- LOG_WARNING_F("write failed with errno={} and will retry it.", utils::safe_strerror(errno));
+ LOG_WARNING("write failed with errno={} and will retry it.", utils::safe_strerror(errno));
return ERR_FILE_OPERATION_FAILED;
}
if (ret == 0) {
diff --git a/src/aio/test/aio.cpp b/src/aio/test/aio.cpp
index fad929c08..5aa7e80e0 100644
--- a/src/aio/test/aio.cpp
+++ b/src/aio/test/aio.cpp
@@ -188,7 +188,7 @@ TEST(core, operation_failed)
t = ::dsn::file::read(fp2, buffer, 512, 100, LPC_AIO_TEST, nullptr, io_callback, 0);
t->wait();
- LOG_INFO_F("error code: {}", *err);
+ LOG_INFO("error code: {}", *err);
file::close(fp);
file::close(fp2);
fail::teardown();
diff --git a/src/base/pegasus_value_schema.h b/src/base/pegasus_value_schema.h
index c014509df..b54ed1911 100644
--- a/src/base/pegasus_value_schema.h
+++ b/src/base/pegasus_value_schema.h
@@ -107,7 +107,7 @@ inline void pegasus_update_expire_ts(uint32_t version, std::string &value, uint3
new_expire_ts = dsn::endian::hton(new_expire_ts);
memcpy(const_cast<char *>(value.data()), &new_expire_ts, sizeof(uint32_t));
} else {
- LOG_FATAL_F("unsupported value schema version: {}", version);
+ LOG_FATAL("unsupported value schema version: {}", version);
__builtin_unreachable();
}
}
@@ -148,7 +148,7 @@ public:
} else if (value_schema_version == 1) {
return generate_value_v1(expire_ts, timetag, user_data);
} else {
- LOG_FATAL_F("unsupported value schema version: {}", value_schema_version);
+ LOG_FATAL("unsupported value schema version: {}", value_schema_version);
__builtin_unreachable();
}
}
diff --git a/src/block_service/block_service_manager.cpp b/src/block_service/block_service_manager.cpp
index 2f41f7c87..9e9c72346 100644
--- a/src/block_service/block_service_manager.cpp
+++ b/src/block_service/block_service_manager.cpp
@@ -52,7 +52,7 @@ block_service_manager::block_service_manager()
block_service_manager::~block_service_manager()
{
- LOG_INFO_F("close block service manager.");
+ LOG_INFO("close block service manager.");
zauto_write_lock l(_fs_lock);
_fs_map.clear();
}
@@ -71,9 +71,9 @@ block_filesystem *block_service_manager::get_or_create_block_filesystem(const st
block_filesystem *fs =
utils::factory_store<block_filesystem>::create(provider_type, PROVIDER_TYPE_MAIN);
if (fs == nullptr) {
- LOG_ERROR_F("acquire block filesystem failed, provider = {}, provider_type = {}",
- provider,
- std::string(provider_type));
+ LOG_ERROR("acquire block filesystem failed, provider = {}, provider_type = {}",
+ provider,
+ std::string(provider_type));
return nullptr;
}
@@ -85,12 +85,12 @@ block_filesystem *block_service_manager::get_or_create_block_filesystem(const st
dsn::error_code err = fs->initialize(args);
if (dsn::ERR_OK == err) {
- LOG_INFO_F("create block filesystem ok for provider {}", provider);
+ LOG_INFO("create block filesystem ok for provider {}", provider);
_fs_map.emplace(provider, std::unique_ptr<block_filesystem>(fs));
} else {
- LOG_ERROR_F("create block file system err {} for provider {}",
- std::string(err.to_string()),
- provider);
+ LOG_ERROR("create block file system err {} for provider {}",
+ std::string(err.to_string()),
+ provider);
delete fs;
fs = nullptr;
}
@@ -144,7 +144,7 @@ error_code block_service_manager::download_file(const std::string &remote_dir,
// local file exists
const std::string local_file_name = utils::filesystem::path_combine(local_dir, file_name);
if (utils::filesystem::file_exists(local_file_name)) {
- LOG_INFO_F("local file({}) exists", local_file_name);
+ LOG_INFO("local file({}) exists", local_file_name);
return ERR_PATH_ALREADY_EXIST;
}
@@ -156,7 +156,7 @@ error_code block_service_manager::download_file(const std::string &remote_dir,
create_block_file_sync(remote_file_name, false /*ignore file meta*/, fs, &tracker);
error_code err = create_resp.err;
if (err != ERR_OK) {
- LOG_ERROR_F("create file({}) failed with error({})", remote_file_name, err.to_string());
+ LOG_ERROR("create file({}) failed with error({})", remote_file_name, err.to_string());
return err;
}
block_file_ptr bf = create_resp.file_handle;
@@ -167,17 +167,17 @@ error_code block_service_manager::download_file(const std::string &remote_dir,
// error, however, if file damaged on remote file provider, bulk load should stop,
// return ERR_CORRUPTION instead
if (resp.err == ERR_OBJECT_NOT_FOUND) {
- LOG_ERROR_F("download file({}) failed, file on remote file provider is damaged",
- local_file_name);
+ LOG_ERROR("download file({}) failed, file on remote file provider is damaged",
+ local_file_name);
return ERR_CORRUPTION;
}
return resp.err;
}
- LOG_INFO_F("download file({}) succeed, file_size = {}, md5 = {}",
- local_file_name.c_str(),
- resp.downloaded_size,
- resp.file_md5);
+ LOG_INFO("download file({}) succeed, file_size = {}, md5 = {}",
+ local_file_name.c_str(),
+ resp.downloaded_size,
+ resp.file_md5);
download_file_size = resp.downloaded_size;
download_file_md5 = resp.file_md5;
return ERR_OK;
diff --git a/src/block_service/directio_writable_file.cpp b/src/block_service/directio_writable_file.cpp
index d1b82b110..2e5e18238 100644
--- a/src/block_service/directio_writable_file.cpp
+++ b/src/block_service/directio_writable_file.cpp
@@ -74,7 +74,7 @@ direct_io_writable_file::~direct_io_writable_file()
bool direct_io_writable_file::initialize()
{
if (posix_memalign(&_buffer, g_page_size, _buffer_size) != 0) {
- LOG_ERROR_F("Allocate memaligned buffer failed, err = {}", utils::safe_strerror(errno));
+ LOG_ERROR("Allocate memaligned buffer failed, err = {}", utils::safe_strerror(errno));
return false;
}
@@ -86,10 +86,10 @@ bool direct_io_writable_file::initialize()
// maybe just terminate the process or mark the disk as failed would be better
_fd = ::open(_file_path.c_str(), flag, S_IRUSR | S_IWUSR | S_IRGRP);
if (_fd < 0) {
- LOG_ERROR_F("Failed to open {} with flag {}, err = {}",
- _file_path,
- flag,
- utils::safe_strerror(errno));
+ LOG_ERROR("Failed to open {} with flag {}, err = {}",
+ _file_path,
+ flag,
+ utils::safe_strerror(errno));
::free(_buffer);
_buffer = nullptr;
return false;
@@ -104,23 +104,23 @@ bool direct_io_writable_file::finalize()
if (_offset > 0) {
ssize_t written_bytes = ::write(_fd, _buffer, _buffer_size);
if (dsn_unlikely(written_bytes < 0)) {
- LOG_ERROR_F("Failed to write the last chunk, file_path = {}, err = {}",
- _file_path,
- utils::safe_strerror(errno));
+ LOG_ERROR("Failed to write the last chunk, file_path = {}, err = {}",
+ _file_path,
+ utils::safe_strerror(errno));
return false;
}
// TODO(yingchun): would better to retry
if (dsn_unlikely(written_bytes != _buffer_size)) {
- LOG_ERROR_F("Failed to write the last chunk, file_path = {}, data bytes = {}, written "
- "bytes = {}",
- _file_path,
- _buffer_size,
- written_bytes);
+ LOG_ERROR("Failed to write the last chunk, file_path = {}, data bytes = {}, written "
+ "bytes = {}",
+ _file_path,
+ _buffer_size,
+ written_bytes);
return false;
}
_offset = 0;
if (::ftruncate(_fd, _file_size) < 0) {
- LOG_ERROR_F("Failed to truncate {}, err = {}", _file_path, utils::safe_strerror(errno));
+ LOG_ERROR("Failed to truncate {}, err = {}", _file_path, utils::safe_strerror(errno));
return false;
}
}
@@ -142,14 +142,14 @@ bool direct_io_writable_file::write(const char *s, size_t n)
if (_offset == _buffer_size) {
ssize_t written_bytes = ::write(_fd, _buffer, _buffer_size);
if (dsn_unlikely(written_bytes < 0)) {
- LOG_ERROR_F("Failed to write chunk, file_path = {}, err = {}",
- _file_path,
- utils::safe_strerror(errno));
+ LOG_ERROR("Failed to write chunk, file_path = {}, err = {}",
+ _file_path,
+ utils::safe_strerror(errno));
return false;
}
// TODO(yingchun): would better to retry
if (dsn_unlikely(written_bytes != _buffer_size)) {
- LOG_ERROR_F(
+ LOG_ERROR(
"Failed to write chunk, file_path = {}, data bytes = {}, written bytes = {}",
_file_path,
_buffer_size,
diff --git a/src/block_service/fds/fds_service.cpp b/src/block_service/fds/fds_service.cpp
index 45452c135..86ade3e7e 100644
--- a/src/block_service/fds/fds_service.cpp
+++ b/src/block_service/fds/fds_service.cpp
@@ -161,26 +161,26 @@ error_code fds_service::initialize(const std::vector<std::string> &args)
#define FDS_EXCEPTION_HANDLE(ERR_REFERENCE, OPERATION, INPUT_PARAMETER) \
catch (const Poco::TimeoutException &ex) \
{ \
- LOG_ERROR_F("fds {} timeout: parameter({}), code({}), msg({})", \
- OPERATION, \
- INPUT_PARAMETER, \
- ex.code(), \
- ex.message()); \
+ LOG_ERROR("fds {} timeout: parameter({}), code({}), msg({})", \
+ OPERATION, \
+ INPUT_PARAMETER, \
+ ex.code(), \
+ ex.message()); \
ERR_REFERENCE = ERR_TIMEOUT; \
} \
catch (const Poco::Exception &ex) \
{ \
- LOG_ERROR_F("fds {} get poco exception: parameter({}), code({}), msg({}), what({})", \
- OPERATION, \
- INPUT_PARAMETER, \
- ex.code(), \
- ex.message(), \
- ex.what()); \
+ LOG_ERROR("fds {} get poco exception: parameter({}), code({}), msg({}), what({})", \
+ OPERATION, \
+ INPUT_PARAMETER, \
+ ex.code(), \
+ ex.message(), \
+ ex.what()); \
ERR_REFERENCE = ERR_FS_INTERNAL; \
} \
catch (...) \
{ \
- LOG_ERROR_F("fds {} get unknown exception: parameter({})", OPERATION, INPUT_PARAMETER); \
+ LOG_ERROR("fds {} get unknown exception: parameter({})", OPERATION, INPUT_PARAMETER); \
ERR_REFERENCE = ERR_FS_INTERNAL; \
}
@@ -233,10 +233,10 @@ dsn::task_ptr fds_service::list_dir(const ls_request &req,
}
}
} catch (const galaxy::fds::GalaxyFDSClientException &ex) {
- LOG_ERROR_F("fds listObjects failed: parameter({}), code({}), msg({})",
- req.dir_name,
- ex.code(),
- ex.what());
+ LOG_ERROR("fds listObjects failed: parameter({}), code({}), msg({})",
+ req.dir_name,
+ ex.code(),
+ ex.what());
resp.err = ERR_FS_INTERNAL;
}
FDS_EXCEPTION_HANDLE(resp.err, "listObject", req.dir_name.c_str())
@@ -245,17 +245,17 @@ dsn::task_ptr fds_service::list_dir(const ls_request &req,
try {
if (_client->doesObjectExist(_bucket_name,
utils::path_to_fds(req.dir_name, false))) {
- LOG_ERROR_F("fds list_dir failed: path not dir, parameter({})", req.dir_name);
+ LOG_ERROR("fds list_dir failed: path not dir, parameter({})", req.dir_name);
resp.err = ERR_INVALID_PARAMETERS;
} else {
- LOG_ERROR_F("fds list_dir failed: path not found, parameter({})", req.dir_name);
+ LOG_ERROR("fds list_dir failed: path not found, parameter({})", req.dir_name);
resp.err = ERR_OBJECT_NOT_FOUND;
}
} catch (const galaxy::fds::GalaxyFDSClientException &ex) {
- LOG_ERROR_F("fds doesObjectExist failed: parameter({}), code({}), msg({})",
- req.dir_name,
- ex.code(),
- ex.what());
+ LOG_ERROR("fds doesObjectExist failed: parameter({}), code({}), msg({})",
+ req.dir_name,
+ ex.code(),
+ ex.what());
resp.err = ERR_FS_INTERNAL;
}
FDS_EXCEPTION_HANDLE(resp.err, "doesObjectExist", req.dir_name.c_str())
@@ -331,22 +331,22 @@ dsn::task_ptr fds_service::remove_path(const remove_path_request &req,
if (req.recursive) {
should_remove_path = true;
} else {
- LOG_ERROR_F("fds remove_path failed: dir not empty, parameter({})", req.path);
+ LOG_ERROR("fds remove_path failed: dir not empty, parameter({})", req.path);
resp.err = ERR_DIR_NOT_EMPTY;
}
} else {
if (_client->doesObjectExist(_bucket_name, utils::path_to_fds(req.path, false))) {
should_remove_path = true;
} else {
- LOG_ERROR_F("fds remove_path failed: path not found, parameter({})", req.path);
+ LOG_ERROR("fds remove_path failed: path not found, parameter({})", req.path);
resp.err = ERR_OBJECT_NOT_FOUND;
}
}
} catch (const galaxy::fds::GalaxyFDSClientException &ex) {
- LOG_ERROR_F("fds remove_path failed: parameter({}), code({}), msg({})",
- req.path,
- ex.code(),
- ex.what());
+ LOG_ERROR("fds remove_path failed: parameter({}), code({}), msg({})",
+ req.path,
+ ex.code(),
+ ex.what());
resp.err = ERR_FS_INTERNAL;
}
FDS_EXCEPTION_HANDLE(resp.err, "remove_path", req.path.c_str());
@@ -358,16 +358,16 @@ dsn::task_ptr fds_service::remove_path(const remove_path_request &req,
if (deleting->countFailedObjects() <= 0) {
resp.err = ERR_OK;
} else {
- LOG_ERROR_F("fds remove_path failed: countFailedObjects = {}, parameter({})",
- deleting->countFailedObjects(),
- req.path);
+ LOG_ERROR("fds remove_path failed: countFailedObjects = {}, parameter({})",
+ deleting->countFailedObjects(),
+ req.path);
resp.err = ERR_FS_INTERNAL;
}
} catch (const galaxy::fds::GalaxyFDSClientException &ex) {
- LOG_ERROR_F("fds remove_path failed: parameter({}), code({}), msg({})",
- req.path,
- ex.code(),
- ex.what());
+ LOG_ERROR("fds remove_path failed: parameter({}), code({}), msg({})",
+ req.path,
+ ex.code(),
+ ex.what());
resp.err = ERR_FS_INTERNAL;
}
FDS_EXCEPTION_HANDLE(resp.err, "remove_path", req.path.c_str());
@@ -424,10 +424,10 @@ error_code fds_file_object::get_file_meta()
if (ex.code() == Poco::Net::HTTPResponse::HTTP_NOT_FOUND) {
err = ERR_OBJECT_NOT_FOUND;
} else {
- LOG_ERROR_F("fds getObjectMetadata failed: parameter({}), code({}), msg({})",
- _name.c_str(),
- ex.code(),
- ex.what());
+ LOG_ERROR("fds getObjectMetadata failed: parameter({}), code({}), msg({})",
+ _name.c_str(),
+ ex.code(),
+ ex.what());
err = ERR_FS_INTERNAL;
}
}
@@ -496,15 +496,15 @@ error_code fds_file_object::get_content(uint64_t pos,
_fds_path,
pos + transfered_bytes,
length - transfered_bytes);
- LOG_DEBUG_F("get object from fds succeed, remote_file({})", _fds_path);
+ LOG_DEBUG("get object from fds succeed, remote_file({})", _fds_path);
std::istream &is = obj->objectContent();
transfered_bytes += utils::copy_stream(is, os, PIECE_SIZE);
err = ERR_OK;
} catch (const galaxy::fds::GalaxyFDSClientException &ex) {
- LOG_ERROR_F("fds getObject error: remote_file({}), code({}), msg({})",
- file_name(),
- ex.code(),
- ex.what());
+ LOG_ERROR("fds getObject error: remote_file({}), code({}), msg({})",
+ file_name(),
+ ex.code(),
+ ex.what());
if (ex.code() == Poco::Net::HTTPResponse::HTTP_NOT_FOUND) {
_has_meta_synced = true;
_md5sum = "";
@@ -535,20 +535,20 @@ error_code fds_file_object::put_content(/*in-out*/ std::istream &is,
FLAGS_fds_write_limit_rate << 20,
FLAGS_fds_write_burst_size
<< 20)) {
- LOG_INFO_F("the transfer count({}B) is greater than burst size({}MB), so it is rejected by "
- "token bucket",
- to_transfer_bytes,
- FLAGS_fds_write_burst_size);
+ LOG_INFO("the transfer count({}B) is greater than burst size({}MB), so it is rejected by "
+ "token bucket",
+ to_transfer_bytes,
+ FLAGS_fds_write_burst_size);
return ERR_BUSY;
}
try {
c->putObject(_service->get_bucket_name(), _fds_path, is, galaxy::fds::FDSObjectMetadata());
} catch (const galaxy::fds::GalaxyFDSClientException &ex) {
- LOG_ERROR_F("fds putObject error: remote_file({}), code({}), msg({})",
- file_name(),
- ex.code(),
- ex.what());
+ LOG_ERROR("fds putObject error: remote_file({}), code({}), msg({})",
+ file_name(),
+ ex.code(),
+ ex.what());
err = ERR_FS_INTERNAL;
}
FDS_EXCEPTION_HANDLE(err, "putObject", file_name().c_str())
@@ -557,7 +557,7 @@ error_code fds_file_object::put_content(/*in-out*/ std::istream &is,
return err;
}
- LOG_INFO_F("start to synchronize meta data after successfully wrote data to fds");
+ LOG_INFO("start to synchronize meta data after successfully wrote data to fds");
err = get_file_meta();
if (err == ERR_OK) {
transfered_bytes = _size;
@@ -611,11 +611,10 @@ dsn::task_ptr fds_file_object::upload(const upload_request &req,
std::ifstream is(local_file, std::ios::binary | std::ios::in);
if (!is.is_open()) {
- LOG_ERROR_F(
- "fds upload failed: open local file({}) failed when upload to({}), error({})",
- local_file,
- file_name(),
- ::dsn::utils::safe_strerror(errno));
+ LOG_ERROR("fds upload failed: open local file({}) failed when upload to({}), error({})",
+ local_file,
+ file_name(),
+ ::dsn::utils::safe_strerror(errno));
resp.err = dsn::ERR_FILE_OPERATION_FAILED;
} else {
resp.err = put_content(is, file_sz, resp.uploaded_size);
@@ -671,10 +670,10 @@ dsn::task_ptr fds_file_object::download(const download_request &req,
std::shared_ptr<std::ofstream> handle(new std::ofstream(
req.output_local_name, std::ios::binary | std::ios::out | std::ios::trunc));
if (!handle->is_open()) {
- LOG_ERROR_F("fds download failed: fail to open localfile({}) when download({}), error({})",
- req.output_local_name,
- _fds_path,
- ::dsn::utils::safe_strerror(errno));
+ LOG_ERROR("fds download failed: fail to open localfile({}) when download({}), error({})",
+ req.output_local_name,
+ _fds_path,
+ ::dsn::utils::safe_strerror(errno));
resp.err = ERR_FILE_OPERATION_FAILED;
resp.downloaded_size = 0;
t->enqueue_with(resp);
@@ -693,14 +692,14 @@ dsn::task_ptr fds_file_object::download(const download_request &req,
}
handle->close();
if (resp.err != ERR_OK && dsn::utils::filesystem::file_exists(req.output_local_name)) {
- LOG_ERROR_F("fail to download file {} from fds, remove localfile {}",
- _fds_path,
- req.output_local_name);
+ LOG_ERROR("fail to download file {} from fds, remove localfile {}",
+ _fds_path,
+ req.output_local_name);
dsn::utils::filesystem::remove_path(req.output_local_name);
} else if ((resp.err = dsn::utils::filesystem::md5sum(req.output_local_name,
resp.file_md5)) != ERR_OK) {
- LOG_ERROR_F("download failed when calculate the md5sum of local file {}",
- req.output_local_name);
+ LOG_ERROR("download failed when calculate the md5sum of local file {}",
+ req.output_local_name);
}
t->enqueue_with(resp);
release_ref();
diff --git a/src/block_service/hdfs/hdfs_service.cpp b/src/block_service/hdfs/hdfs_service.cpp
index 3403e4970..144b6d0b6 100644
--- a/src/block_service/hdfs/hdfs_service.cpp
+++ b/src/block_service/hdfs/hdfs_service.cpp
@@ -84,7 +84,7 @@ error_code hdfs_service::initialize(const std::vector<std::string> &args)
// If no path was configured, just use "/" as default root path.
_hdfs_name_node = args[0];
_hdfs_path = args.size() >= 2 ? args[1] : "/";
- LOG_INFO_F("hdfs backup root path is initialized to {}.", _hdfs_path);
+ LOG_INFO("hdfs backup root path is initialized to {}.", _hdfs_path);
return create_fs();
}
@@ -93,18 +93,18 @@ error_code hdfs_service::create_fs()
{
hdfsBuilder *builder = hdfsNewBuilder();
if (!builder) {
- LOG_ERROR_F("Fail to create an HDFS builder, error: {}.", utils::safe_strerror(errno));
+ LOG_ERROR("Fail to create an HDFS builder, error: {}.", utils::safe_strerror(errno));
return ERR_FS_INTERNAL;
}
hdfsBuilderSetNameNode(builder, _hdfs_name_node.c_str());
_fs = hdfsBuilderConnect(builder);
if (!_fs) {
- LOG_ERROR_F("Fail to connect hdfs name node {}, error: {}.",
- _hdfs_name_node,
- utils::safe_strerror(errno));
+ LOG_ERROR("Fail to connect hdfs name node {}, error: {}.",
+ _hdfs_name_node,
+ utils::safe_strerror(errno));
return ERR_FS_INTERNAL;
}
- LOG_INFO_F("Succeed to connect hdfs name node {}.", _hdfs_name_node);
+ LOG_INFO("Succeed to connect hdfs name node {}.", _hdfs_name_node);
return ERR_OK;
}
@@ -113,11 +113,11 @@ void hdfs_service::close()
// This method should be carefully called.
// Calls to hdfsDisconnect() by individual threads would terminate
// all other connections handed out via hdfsConnect() to the same URI.
- LOG_INFO_F("Try to disconnect hdfs.");
+ LOG_INFO("Try to disconnect hdfs.");
int result = hdfsDisconnect(_fs);
if (result == -1) {
- LOG_ERROR_F("Fail to disconnect from the hdfs file system, error: {}.",
- utils::safe_strerror(errno));
+ LOG_ERROR("Fail to disconnect from the hdfs file system, error: {}.",
+ utils::safe_strerror(errno));
}
// Even if there is an error, the resources associated with the hdfsFS will be freed.
_fs = nullptr;
@@ -143,7 +143,7 @@ dsn::task_ptr hdfs_service::list_dir(const ls_request &req,
ls_response resp;
if (hdfsExists(_fs, path.c_str()) == -1) {
- LOG_ERROR_F("HDFS list directory failed: path {} not found.", path);
+ LOG_ERROR("HDFS list directory failed: path {} not found.", path);
resp.err = ERR_OBJECT_NOT_FOUND;
tsk->enqueue_with(resp);
return;
@@ -151,20 +151,20 @@ dsn::task_ptr hdfs_service::list_dir(const ls_request &req,
hdfsFileInfo *dir_info = hdfsGetPathInfo(_fs, path.c_str());
if (dir_info == nullptr) {
- LOG_ERROR_F("HDFS get path {} failed.", path);
+ LOG_ERROR("HDFS get path {} failed.", path);
resp.err = ERR_FS_INTERNAL;
tsk->enqueue_with(resp);
return;
}
if (dir_info->mKind == kObjectKindFile) {
- LOG_ERROR_F("HDFS list directory failed, {} is not a directory", path);
+ LOG_ERROR("HDFS list directory failed, {} is not a directory", path);
resp.err = ERR_INVALID_PARAMETERS;
} else {
int entries = 0;
hdfsFileInfo *info = hdfsListDirectory(_fs, path.c_str(), &entries);
if (info == nullptr) {
- LOG_ERROR_F("HDFS list directory {} failed.", path);
+ LOG_ERROR("HDFS list directory {} failed.", path);
resp.err = ERR_FS_INTERNAL;
} else {
for (int i = 0; i < entries; i++) {
@@ -211,7 +211,7 @@ dsn::task_ptr hdfs_service::create_file(const create_file_request &req,
// immediately after this call.
resp.err = ERR_OK;
resp.file_handle = f;
- LOG_INFO_F("create remote file {} succeed", hdfs_file);
+ LOG_INFO("create remote file {} succeed", hdfs_file);
}
tsk->enqueue_with(resp);
};
@@ -234,7 +234,7 @@ dsn::task_ptr hdfs_service::remove_path(const remove_path_request &req,
// Check if path exists.
if (hdfsExists(_fs, path.c_str()) == -1) {
- LOG_ERROR_F("HDFS remove_path failed: path {} not found.", path);
+ LOG_ERROR("HDFS remove_path failed: path {} not found.", path);
resp.err = ERR_OBJECT_NOT_FOUND;
tsk->enqueue_with(resp);
return;
@@ -244,7 +244,7 @@ dsn::task_ptr hdfs_service::remove_path(const remove_path_request &req,
hdfsFileInfo *info = hdfsListDirectory(_fs, path.c_str(), &entries);
hdfsFreeFileInfo(info, entries);
if (entries > 0 && !req.recursive) {
- LOG_ERROR_F("HDFS remove_path failed: directory {} is not empty.", path);
+ LOG_ERROR("HDFS remove_path failed: directory {} is not empty.", path);
resp.err = ERR_DIR_NOT_EMPTY;
tsk->enqueue_with(resp);
return;
@@ -252,7 +252,7 @@ dsn::task_ptr hdfs_service::remove_path(const remove_path_request &req,
// Remove directory now.
if (hdfsDelete(_fs, path.c_str(), req.recursive) == -1) {
- LOG_ERROR_F("HDFS remove_path {} failed.", path);
+ LOG_ERROR("HDFS remove_path {} failed.", path);
resp.err = ERR_FS_INTERNAL;
} else {
resp.err = ERR_OK;
@@ -272,12 +272,12 @@ hdfs_file_object::hdfs_file_object(hdfs_service *s, const std::string &name)
error_code hdfs_file_object::get_file_meta()
{
if (hdfsExists(_service->get_fs(), file_name().c_str()) == -1) {
- LOG_WARNING_F("HDFS file {} does not exist.", file_name());
+ LOG_WARNING("HDFS file {} does not exist.", file_name());
return ERR_OBJECT_NOT_FOUND;
}
hdfsFileInfo *info = hdfsGetPathInfo(_service->get_fs(), file_name().c_str());
if (info == nullptr) {
- LOG_ERROR_F("HDFS get file info failed, file: {}.", file_name());
+ LOG_ERROR("HDFS get file info failed, file: {}.", file_name());
return ERR_FS_INTERNAL;
}
_size = info->mSize;
@@ -296,9 +296,9 @@ error_code hdfs_file_object::write_data_in_batches(const char *data,
hdfsFile write_file =
hdfsOpenFile(_service->get_fs(), file_name().c_str(), O_WRONLY | O_CREAT, 0, 0, 0);
if (!write_file) {
- LOG_ERROR_F("Failed to open hdfs file {} for writting, error: {}.",
- file_name(),
- utils::safe_strerror(errno));
+ LOG_ERROR("Failed to open hdfs file {} for writting, error: {}.",
+ file_name(),
+ utils::safe_strerror(errno));
return ERR_FS_INTERNAL;
}
uint64_t cur_pos = 0;
@@ -314,28 +314,28 @@ error_code hdfs_file_object::write_data_in_batches(const char *data,
(void *)(data + cur_pos),
static_cast<tSize>(write_len));
if (num_written_bytes == -1) {
- LOG_ERROR_F("Failed to write hdfs file {}, error: {}.",
- file_name(),
- utils::safe_strerror(errno));
+ LOG_ERROR("Failed to write hdfs file {}, error: {}.",
+ file_name(),
+ utils::safe_strerror(errno));
hdfsCloseFile(_service->get_fs(), write_file);
return ERR_FS_INTERNAL;
}
cur_pos += num_written_bytes;
}
if (hdfsHFlush(_service->get_fs(), write_file) != 0) {
- LOG_ERROR_F(
+ LOG_ERROR(
"Failed to flush hdfs file {}, error: {}.", file_name(), utils::safe_strerror(errno));
hdfsCloseFile(_service->get_fs(), write_file);
return ERR_FS_INTERNAL;
}
written_size = cur_pos;
if (hdfsCloseFile(_service->get_fs(), write_file) != 0) {
- LOG_ERROR_F(
+ LOG_ERROR(
"Failed to close hdfs file {}, error: {}", file_name(), utils::safe_strerror(errno));
return ERR_FS_INTERNAL;
}
- LOG_INFO_F("start to synchronize meta data after successfully wrote data to hdfs");
+ LOG_INFO("start to synchronize meta data after successfully wrote data to hdfs");
return get_file_meta();
}
@@ -378,11 +378,10 @@ dsn::task_ptr hdfs_file_object::upload(const upload_request &req,
is.close();
resp.err = write_data_in_batches(buffer.get(), file_sz, resp.uploaded_size);
} else {
- LOG_ERROR_F(
- "HDFS upload failed: open local file {} failed when upload to {}, error: {}",
- req.input_local_name,
- file_name(),
- utils::safe_strerror(errno));
+ LOG_ERROR("HDFS upload failed: open local file {} failed when upload to {}, error: {}",
+ req.input_local_name,
+ file_name(),
+ utils::safe_strerror(errno));
resp.err = dsn::ERR_FILE_OPERATION_FAILED;
}
t->enqueue_with(resp);
@@ -402,16 +401,16 @@ error_code hdfs_file_object::read_data_in_batches(uint64_t start_pos,
if (!_has_meta_synced) {
error_code err = get_file_meta();
if (err != ERR_OK) {
- LOG_ERROR_F("Failed to read remote file {}", file_name());
+ LOG_ERROR("Failed to read remote file {}", file_name());
return err;
}
}
hdfsFile read_file = hdfsOpenFile(_service->get_fs(), file_name().c_str(), O_RDONLY, 0, 0, 0);
if (!read_file) {
- LOG_ERROR_F("Failed to open hdfs file {} for reading, error: {}.",
- file_name(),
- utils::safe_strerror(errno));
+ LOG_ERROR("Failed to open hdfs file {} for reading, error: {}.",
+ file_name(),
+ utils::safe_strerror(errno));
return ERR_FS_INTERNAL;
}
std::unique_ptr<char[]> raw_buf(new char[_size]);
@@ -438,15 +437,15 @@ error_code hdfs_file_object::read_data_in_batches(uint64_t start_pos,
cur_pos += num_read_bytes;
dst_buf += num_read_bytes;
} else if (num_read_bytes == -1) {
- LOG_ERROR_F("Failed to read hdfs file {}, error: {}.",
- file_name(),
- utils::safe_strerror(errno));
+ LOG_ERROR("Failed to read hdfs file {}, error: {}.",
+ file_name(),
+ utils::safe_strerror(errno));
read_success = false;
break;
}
}
if (hdfsCloseFile(_service->get_fs(), read_file) != 0) {
- LOG_ERROR_F(
+ LOG_ERROR(
"Failed to close hdfs file {}, error: {}.", file_name(), utils::safe_strerror(errno));
return ERR_FS_INTERNAL;
}
@@ -530,11 +529,11 @@ dsn::task_ptr hdfs_file_object::download(const download_request &req,
}
}
if (!write_succ) {
- LOG_ERROR_F("HDFS download failed: fail to open localfile {} when download {}, "
- "error: {}",
- req.output_local_name,
- file_name(),
- utils::safe_strerror(errno));
+ LOG_ERROR("HDFS download failed: fail to open localfile {} when download {}, "
+ "error: {}",
+ req.output_local_name,
+ file_name(),
+ utils::safe_strerror(errno));
resp.err = ERR_FILE_OPERATION_FAILED;
resp.downloaded_size = 0;
}
diff --git a/src/block_service/local/local_service.cpp b/src/block_service/local/local_service.cpp
index a3f259764..5ec4bc1f2 100644
--- a/src/block_service/local/local_service.cpp
+++ b/src/block_service/local/local_service.cpp
@@ -53,7 +53,7 @@ bool file_metadata_from_json(std::ifstream &fin, file_metadata &fmeta) noexcept
nlohmann::json::parse(data).get_to(fmeta);
return true;
} catch (nlohmann::json::exception &exp) {
- LOG_WARNING_F("decode meta data from json failed: {} [{}]", exp.what(), data);
+ LOG_WARNING("decode meta data from json failed: {} [{}]", exp.what(), data);
return false;
}
}
@@ -78,16 +78,16 @@ error_code local_service::initialize(const std::vector<std::string> &args)
_root = args[0];
if (_root.empty()) {
- LOG_INFO_F("initialize local block service succeed with empty root");
+ LOG_INFO("initialize local block service succeed with empty root");
} else {
if (::dsn::utils::filesystem::directory_exists(_root)) {
- LOG_WARNING_F("old local block service root dir has already exist, path({})", _root);
+ LOG_WARNING("old local block service root dir has already exist, path({})", _root);
} else {
CHECK(::dsn::utils::filesystem::create_directory(_root),
"local block service create directory({}) fail",
_root);
}
- LOG_INFO_F("local block service initialize succeed with root({})", _root);
+ LOG_INFO("local block service initialize succeed with root({})", _root);
}
return ERR_OK;
}
@@ -109,14 +109,14 @@ dsn::task_ptr local_service::list_dir(const ls_request &req,
resp.err = ERR_OK;
if (::dsn::utils::filesystem::file_exists(dir_path)) {
- LOG_INFO_F("list_dir: invalid parameter({})", dir_path);
+ LOG_INFO("list_dir: invalid parameter({})", dir_path);
resp.err = ERR_INVALID_PARAMETERS;
} else if (!::dsn::utils::filesystem::directory_exists(dir_path)) {
- LOG_INFO_F("directory does not exist, dir = {}", dir_path);
+ LOG_INFO("directory does not exist, dir = {}", dir_path);
resp.err = ERR_OBJECT_NOT_FOUND;
} else {
if (!::dsn::utils::filesystem::get_subfiles(dir_path, children, false)) {
- LOG_ERROR_F("get files under directory: {} fail", dir_path);
+ LOG_ERROR("get files under directory: {} fail", dir_path);
resp.err = ERR_FS_INTERNAL;
children.clear();
} else {
@@ -137,7 +137,7 @@ dsn::task_ptr local_service::list_dir(const ls_request &req,
children.clear();
if (!::dsn::utils::filesystem::get_subdirectories(dir_path, children, false)) {
- LOG_ERROR_F("get subpaths under directory: {} fail", dir_path);
+ LOG_ERROR("get subpaths under directory: {} fail", dir_path);
resp.err = ERR_FS_INTERNAL;
children.clear();
} else {
@@ -185,7 +185,7 @@ dsn::task_ptr local_service::create_file(const create_file_request &req,
if (utils::filesystem::file_exists(file_path) &&
utils::filesystem::file_exists(meta_file_path)) {
- LOG_DEBUG_F("file({}) already exist", file_path);
+ LOG_DEBUG("file({}) already exist", file_path);
resp.err = f->load_metadata();
}
@@ -264,7 +264,7 @@ error_code local_file_object::load_metadata()
std::string metadata_path = local_service::get_metafile(file_name());
std::ifstream is(metadata_path, std::ios::in);
if (!is.is_open()) {
- LOG_WARNING_F(
+ LOG_WARNING(
"load meta data from {} failed, err = {}", metadata_path, utils::safe_strerror(errno));
return ERR_FS_INTERNAL;
}
@@ -290,7 +290,7 @@ error_code local_file_object::store_metadata()
std::string metadata_path = local_service::get_metafile(file_name());
std::ofstream os(metadata_path, std::ios::out | std::ios::trunc);
if (!os.is_open()) {
- LOG_WARNING_F(
+ LOG_WARNING(
"store to metadata file {} failed, err={}", metadata_path, utils::safe_strerror(errno));
return ERR_FS_INTERNAL;
}
@@ -331,7 +331,7 @@ dsn::task_ptr local_file_object::write(const write_request &req,
}
if (resp.err == ERR_OK) {
- LOG_DEBUG_F("start write file, file = {}", file_name());
+ LOG_DEBUG("start write file, file = {}", file_name());
std::ofstream fout(file_name(), std::ifstream::out | std::ifstream::trunc);
if (!fout.is_open()) {
@@ -375,7 +375,7 @@ dsn::task_ptr local_file_object::read(const read_request &req,
resp.err = ERR_OBJECT_NOT_FOUND;
} else {
if ((resp.err = load_metadata()) != ERR_OK) {
- LOG_WARNING_F("load meta data of {} failed", file_name());
+ LOG_WARNING("load meta data of {} failed", file_name());
} else {
int64_t file_sz = _size;
int64_t total_sz = 0;
@@ -385,7 +385,7 @@ dsn::task_ptr local_file_object::read(const read_request &req,
total_sz = req.remote_length;
}
- LOG_DEBUG_F("read file({}), size = {}", file_name(), total_sz);
+ LOG_DEBUG("read file({}), size = {}", file_name(), total_sz);
std::string buf;
buf.resize(total_sz + 1);
std::ifstream fin(file_name(), std::ifstream::in);
@@ -422,25 +422,25 @@ dsn::task_ptr local_file_object::upload(const upload_request &req,
resp.err = ERR_OK;
std::ifstream fin(req.input_local_name, std::ios_base::in);
if (!fin.is_open()) {
- LOG_WARNING_F("open source file {} for read failed, err({})",
- req.input_local_name,
- utils::safe_strerror(errno));
+ LOG_WARNING("open source file {} for read failed, err({})",
+ req.input_local_name,
+ utils::safe_strerror(errno));
resp.err = ERR_FILE_OPERATION_FAILED;
}
utils::filesystem::create_file(file_name());
std::ofstream fout(file_name(), std::ios_base::out | std::ios_base::trunc);
if (!fout.is_open()) {
- LOG_WARNING_F("open target file {} for write failed, err({})",
- file_name(),
- utils::safe_strerror(errno));
+ LOG_WARNING("open target file {} for write failed, err({})",
+ file_name(),
+ utils::safe_strerror(errno));
resp.err = ERR_FS_INTERNAL;
}
if (resp.err == ERR_OK) {
- LOG_DEBUG_F("start to transfer from src_file({}) to dst_file({})",
- req.input_local_name,
- file_name());
+ LOG_DEBUG("start to transfer from src_file({}) to dst_file({})",
+ req.input_local_name,
+ file_name());
int64_t total_sz = 0;
char buf[max_length] = {'\0'};
while (!fin.eof()) {
@@ -448,7 +448,7 @@ dsn::task_ptr local_file_object::upload(const upload_request &req,
total_sz += fin.gcount();
fout.write(buf, fin.gcount());
}
- LOG_DEBUG_F("finish upload file, file = {}, total_size = {}", file_name(), total_sz);
+ LOG_DEBUG("finish upload file, file = {}, total_size = {}", file_name(), total_sz);
fout.close();
fin.close();
@@ -492,7 +492,7 @@ dsn::task_ptr local_file_object::download(const download_request &req,
resp.err = ERR_OK;
std::string target_file = req.output_local_name;
if (target_file.empty()) {
- LOG_ERROR_F(
+ LOG_ERROR(
"download {} failed, because target name({}) is invalid", file_name(), target_file);
resp.err = ERR_INVALID_PARAMETERS;
}
@@ -507,9 +507,9 @@ dsn::task_ptr local_file_object::download(const download_request &req,
if (resp.err == ERR_OK) {
std::ifstream fin(file_name(), std::ifstream::in);
if (!fin.is_open()) {
- LOG_ERROR_F("open block file({}) failed, err({})",
- file_name(),
- utils::safe_strerror(errno));
+ LOG_ERROR("open block file({}) failed, err({})",
+ file_name(),
+ utils::safe_strerror(errno));
resp.err = ERR_FS_INTERNAL;
}
@@ -517,14 +517,14 @@ dsn::task_ptr local_file_object::download(const download_request &req,
if (!fout.is_open()) {
if (fin.is_open())
fin.close();
- LOG_ERROR_F("open target file({}) failed, err({})",
- target_file,
- utils::safe_strerror(errno));
+ LOG_ERROR("open target file({}) failed, err({})",
+ target_file,
+ utils::safe_strerror(errno));
resp.err = ERR_FILE_OPERATION_FAILED;
}
if (resp.err == ERR_OK) {
- LOG_DEBUG_F(
+ LOG_DEBUG(
"start to transfer, src_file({}), dst_file({})", file_name(), target_file);
int64_t total_sz = 0;
char buf[max_length] = {'\0'};
@@ -533,16 +533,16 @@ dsn::task_ptr local_file_object::download(const download_request &req,
total_sz += fin.gcount();
fout.write(buf, fin.gcount());
}
- LOG_DEBUG_F("finish download file({}), total_size = {}", target_file, total_sz);
+ LOG_DEBUG("finish download file({}), total_size = {}", target_file, total_sz);
fout.close();
fin.close();
resp.downloaded_size = static_cast<uint64_t>(total_sz);
_size = total_sz;
if ((resp.err = utils::filesystem::md5sum(target_file, _md5_value)) != ERR_OK) {
- LOG_WARNING_F("download {} failed when calculate the md5sum of {}",
- file_name(),
- target_file);
+ LOG_WARNING("download {} failed when calculate the md5sum of {}",
+ file_name(),
+ target_file);
} else {
_has_meta_synced = true;
resp.file_md5 = _md5_value;
diff --git a/src/client/partition_resolver.cpp b/src/client/partition_resolver.cpp
index d3c67bcf6..58a4a46bb 100644
--- a/src/client/partition_resolver.cpp
+++ b/src/client/partition_resolver.cpp
@@ -88,10 +88,10 @@ void partition_resolver::call_task(const rpc_response_task_ptr &t)
std::chrono::milliseconds(gap));
return;
} else {
- LOG_ERROR_F("service access failed ({}), no more time for further tries, set error "
- "= ERR_TIMEOUT, trace_id = {:#018x}",
- err,
- req->header->trace_id);
+ LOG_ERROR("service access failed ({}), no more time for further tries, set error "
+ "= ERR_TIMEOUT, trace_id = {:#018x}",
+ err,
+ req->header->trace_id);
err = ERR_TIMEOUT;
}
}
diff --git a/src/client/partition_resolver_manager.cpp b/src/client/partition_resolver_manager.cpp
index 946a0f5a9..dd71ad720 100644
--- a/src/client/partition_resolver_manager.cpp
+++ b/src/client/partition_resolver_manager.cpp
@@ -66,7 +66,7 @@ partition_resolver_ptr partition_resolver_manager::find_or_create(
dsn::rpc_address meta_group = ptr->get_meta_server();
const std::vector<dsn::rpc_address> &existing_list = meta_group.group_address()->members();
if (!vector_equal(meta_list, existing_list)) {
- LOG_ERROR_F("meta list not match for cluster({})", cluster_name);
+ LOG_ERROR("meta list not match for cluster({})", cluster_name);
return nullptr;
}
return ptr;
diff --git a/src/client/partition_resolver_simple.cpp b/src/client/partition_resolver_simple.cpp
index f589b7285..a95634b3a 100644
--- a/src/client/partition_resolver_simple.cpp
+++ b/src/client/partition_resolver_simple.cpp
@@ -83,16 +83,16 @@ void partition_resolver_simple::on_access_failure(int partition_index, error_cod
zauto_write_lock l(_config_lock);
if (err == ERR_PARENT_PARTITION_MISUSED) {
- LOG_INFO_F("clear all partition configuration cache due to access failure {} at {}.{}",
- err,
- _app_id,
- partition_index);
+ LOG_INFO("clear all partition configuration cache due to access failure {} at {}.{}",
+ err,
+ _app_id,
+ partition_index);
_app_partition_count = -1;
} else {
- LOG_INFO_F("clear partition configuration cache {}.{} due to access failure {}",
- _app_id,
- partition_index,
- err);
+ LOG_INFO("clear partition configuration cache {}.{} due to access failure {}",
+ _app_id,
+ partition_index,
+ err);
_config_cache.erase(partition_index);
}
}
@@ -267,7 +267,7 @@ void partition_resolver_simple::query_config_reply(error_code err,
zauto_write_lock l(_config_lock);
if (_app_id != -1 && _app_id != resp.app_id) {
- LOG_WARNING_F(
+ LOG_WARNING(
"app id is changed (mostly the app was removed and created with the same "
"name), local vs remote: {} vs {} ",
_app_id,
@@ -276,10 +276,10 @@ void partition_resolver_simple::query_config_reply(error_code err,
if (_app_partition_count != -1 && _app_partition_count != resp.partition_count &&
_app_partition_count * 2 != resp.partition_count &&
_app_partition_count != resp.partition_count * 2) {
- LOG_WARNING_F("partition count is changed (mostly the app was removed and created "
- "with the same name), local vs remote: {} vs {} ",
- _app_partition_count,
- resp.partition_count);
+ LOG_WARNING("partition count is changed (mostly the app was removed and created "
+ "with the same name), local vs remote: {} vs {} ",
+ _app_partition_count,
+ resp.partition_count);
}
_app_id = resp.app_id;
_app_partition_count = resp.partition_count;
diff --git a/src/client/replication_ddl_client.cpp b/src/client/replication_ddl_client.cpp
index ec67f37f2..884e02bbf 100644
--- a/src/client/replication_ddl_client.cpp
+++ b/src/client/replication_ddl_client.cpp
@@ -69,7 +69,7 @@ replication_ddl_client::replication_ddl_client(const std::vector<dsn::rpc_addres
_meta_server.assign_group("meta-servers");
for (const auto &m : meta_servers) {
if (!_meta_server.group_address()->add(m)) {
- LOG_WARNING_F("duplicate adress {}", m);
+ LOG_WARNING("duplicate adress {}", m);
}
}
}
@@ -393,7 +393,7 @@ dsn::error_code replication_ddl_client::list_apps(const dsn::app_status::type st
std::vector<partition_configuration> partitions;
r = list_app(info.app_name, app_id, partition_count, partitions);
if (r != dsn::ERR_OK) {
- LOG_ERROR_F("list app({}) failed, err = {}", info.app_name, r);
+ LOG_ERROR("list app({}) failed, err = {}", info.app_name, r);
return r;
}
CHECK_EQ(info.app_id, app_id);
diff --git a/src/client_lib/pegasus_client_factory_impl.cpp b/src/client_lib/pegasus_client_factory_impl.cpp
index 8e7c35120..907b90e34 100644
--- a/src/client_lib/pegasus_client_factory_impl.cpp
+++ b/src/client_lib/pegasus_client_factory_impl.cpp
@@ -33,7 +33,7 @@ bool pegasus_client_factory_impl::initialize(const char *config_file)
CHECK(is_initialized, "rdsn engine not started, please specify a valid config file");
} else {
if (is_initialized) {
- LOG_WARNING_F("rdsn engine already started, ignore the config file '{}'", config_file);
+ LOG_WARNING("rdsn engine already started, ignore the config file '{}'", config_file);
} else {
// use config file to run
char exe[] = "client";
@@ -52,11 +52,11 @@ pegasus_client *pegasus_client_factory_impl::get_client(const char *cluster_name
const char *app_name)
{
if (cluster_name == nullptr || cluster_name[0] == '\0') {
- LOG_ERROR_F("invalid parameter 'cluster_name'");
+ LOG_ERROR("invalid parameter 'cluster_name'");
return nullptr;
}
if (app_name == nullptr || app_name[0] == '\0') {
- LOG_ERROR_F("invalid parameter 'app_name'");
+ LOG_ERROR("invalid parameter 'app_name'");
return nullptr;
}
diff --git a/src/client_lib/pegasus_client_impl.cpp b/src/client_lib/pegasus_client_impl.cpp
index 623f67a4f..1730d6030 100644
--- a/src/client_lib/pegasus_client_impl.cpp
+++ b/src/client_lib/pegasus_client_impl.cpp
@@ -92,8 +92,8 @@ void pegasus_client_impl::async_set(const std::string &hash_key,
{
// check params
if (hash_key.size() >= UINT16_MAX) {
- LOG_ERROR_F("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
- hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
+ hash_key.size());
if (callback != nullptr)
callback(PERR_INVALID_HASH_KEY, internal_info());
return;
@@ -161,20 +161,20 @@ void pegasus_client_impl::async_multi_set(const std::string &hash_key,
{
// check params
if (hash_key.size() == 0) {
- LOG_ERROR_F("invalid hash key: hash key should not be empty for multi_set");
+ LOG_ERROR("invalid hash key: hash key should not be empty for multi_set");
if (callback != nullptr)
callback(PERR_INVALID_HASH_KEY, internal_info());
return;
}
if (hash_key.size() >= UINT16_MAX) {
- LOG_ERROR_F("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
- hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
+ hash_key.size());
if (callback != nullptr)
callback(PERR_INVALID_HASH_KEY, internal_info());
return;
}
if (kvs.empty()) {
- LOG_ERROR_F("invalid kvs: kvs should not be empty");
+ LOG_ERROR("invalid kvs: kvs should not be empty");
if (callback != nullptr)
callback(PERR_INVALID_VALUE, internal_info());
return;
@@ -249,8 +249,8 @@ void pegasus_client_impl::async_get(const std::string &hash_key,
{
// check params
if (hash_key.size() >= UINT16_MAX) {
- LOG_ERROR_F("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
- hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
+ hash_key.size());
if (callback != nullptr)
callback(PERR_INVALID_HASH_KEY, std::string(), internal_info());
return;
@@ -323,14 +323,14 @@ void pegasus_client_impl::async_multi_get(const std::string &hash_key,
{
// check params
if (hash_key.size() == 0) {
- LOG_ERROR_F("invalid hash key: hash key should not be empty");
+ LOG_ERROR("invalid hash key: hash key should not be empty");
if (callback != nullptr)
callback(PERR_INVALID_HASH_KEY, std::map<std::string, std::string>(), internal_info());
return;
}
if (hash_key.size() >= UINT16_MAX) {
- LOG_ERROR_F("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
- hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
+ hash_key.size());
if (callback != nullptr)
callback(PERR_INVALID_HASH_KEY, std::map<std::string, std::string>(), internal_info());
return;
@@ -419,14 +419,14 @@ void pegasus_client_impl::async_multi_get(const std::string &hash_key,
{
// check params
if (hash_key.size() == 0) {
- LOG_ERROR_F("invalid hash key: hash key should not be empty");
+ LOG_ERROR("invalid hash key: hash key should not be empty");
if (callback != nullptr)
callback(PERR_INVALID_HASH_KEY, std::map<std::string, std::string>(), internal_info());
return;
}
if (hash_key.size() >= UINT16_MAX) {
- LOG_ERROR_F("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
- hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
+ hash_key.size());
if (callback != nullptr)
callback(PERR_INVALID_HASH_KEY, std::map<std::string, std::string>(), internal_info());
return;
@@ -506,14 +506,14 @@ void pegasus_client_impl::async_multi_get_sortkeys(const std::string &hash_key,
{
// check params
if (hash_key.size() == 0) {
- LOG_ERROR_F("invalid hash key: hash key should not be empty for multi_get_sortkeys");
+ LOG_ERROR("invalid hash key: hash key should not be empty for multi_get_sortkeys");
if (callback != nullptr)
callback(PERR_INVALID_HASH_KEY, std::set<std::string>(), internal_info());
return;
}
if (hash_key.size() >= UINT16_MAX) {
- LOG_ERROR_F("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
- hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
+ hash_key.size());
if (callback != nullptr)
callback(PERR_INVALID_HASH_KEY, std::set<std::string>(), internal_info());
return;
@@ -570,12 +570,12 @@ int pegasus_client_impl::sortkey_count(const std::string &hash_key,
{
// check params
if (hash_key.size() == 0) {
- LOG_ERROR_F("invalid hash key: hash key should not be empty for sortkey_count");
+ LOG_ERROR("invalid hash key: hash key should not be empty for sortkey_count");
return PERR_INVALID_HASH_KEY;
}
if (hash_key.size() >= UINT16_MAX) {
- LOG_ERROR_F("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
- hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
+ hash_key.size());
return PERR_INVALID_HASH_KEY;
}
@@ -629,8 +629,8 @@ void pegasus_client_impl::async_del(const std::string &hash_key,
{
// check params
if (hash_key.size() >= UINT16_MAX) {
- LOG_ERROR_F("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
- hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
+ hash_key.size());
if (callback != nullptr)
callback(PERR_INVALID_HASH_KEY, internal_info());
return;
@@ -692,20 +692,20 @@ void pegasus_client_impl::async_multi_del(const std::string &hash_key,
{
// check params
if (hash_key.size() == 0) {
- LOG_ERROR_F("invalid hash key: hash key should not be empty for multi_del");
+ LOG_ERROR("invalid hash key: hash key should not be empty for multi_del");
if (callback != nullptr)
callback(PERR_INVALID_HASH_KEY, 0, internal_info());
return;
}
if (hash_key.size() >= UINT16_MAX) {
- LOG_ERROR_F("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
- hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
+ hash_key.size());
if (callback != nullptr)
callback(PERR_INVALID_HASH_KEY, 0, internal_info());
return;
}
if (sort_keys.empty()) {
- LOG_ERROR_F("invalid sort keys: should not be empty");
+ LOG_ERROR("invalid sort keys: should not be empty");
if (callback != nullptr)
callback(PERR_INVALID_VALUE, 0, internal_info());
return;
@@ -780,14 +780,14 @@ void pegasus_client_impl::async_incr(const std::string &hash_key,
{
// check params
if (hash_key.size() >= UINT16_MAX) {
- LOG_ERROR_F("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
- hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
+ hash_key.size());
if (callback != nullptr)
callback(PERR_INVALID_HASH_KEY, 0, internal_info());
return;
}
if (ttl_seconds < -1) {
- LOG_ERROR_F("invalid ttl seconds: should be no less than -1, but {}", ttl_seconds);
+ LOG_ERROR("invalid ttl seconds: should be no less than -1, but {}", ttl_seconds);
if (callback != nullptr)
callback(PERR_INVALID_ARGUMENT, 0, internal_info());
return;
@@ -872,8 +872,8 @@ void pegasus_client_impl::async_check_and_set(const std::string &hash_key,
{
// check params
if (hash_key.size() >= UINT16_MAX) {
- LOG_ERROR_F("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
- hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
+ hash_key.size());
if (callback != nullptr)
callback(PERR_INVALID_HASH_KEY, check_and_set_results(), internal_info());
return;
@@ -881,7 +881,7 @@ void pegasus_client_impl::async_check_and_set(const std::string &hash_key,
if (dsn::apps::_cas_check_type_VALUES_TO_NAMES.find(check_type) ==
dsn::apps::_cas_check_type_VALUES_TO_NAMES.end()) {
- LOG_ERROR_F("invalid check type: {}", check_type);
+ LOG_ERROR("invalid check type: {}", check_type);
if (callback != nullptr)
callback(PERR_INVALID_ARGUMENT, check_and_set_results(), internal_info());
return;
@@ -990,8 +990,8 @@ void pegasus_client_impl::async_check_and_mutate(const std::string &hash_key,
{
// check params
if (hash_key.size() >= UINT16_MAX) {
- LOG_ERROR_F("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
- hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
+ hash_key.size());
if (callback != nullptr)
callback(PERR_INVALID_HASH_KEY, check_and_mutate_results(), internal_info());
return;
@@ -999,13 +999,13 @@ void pegasus_client_impl::async_check_and_mutate(const std::string &hash_key,
if (dsn::apps::_cas_check_type_VALUES_TO_NAMES.find(check_type) ==
dsn::apps::_cas_check_type_VALUES_TO_NAMES.end()) {
- LOG_ERROR_F("invalid check type: {}", check_type);
+ LOG_ERROR("invalid check type: {}", check_type);
if (callback != nullptr)
callback(PERR_INVALID_ARGUMENT, check_and_mutate_results(), internal_info());
return;
}
if (mutations.is_empty()) {
- LOG_ERROR_F("invalid mutations: mutations should not be empty.");
+ LOG_ERROR("invalid mutations: mutations should not be empty.");
if (callback != nullptr)
callback(PERR_INVALID_ARGUMENT, check_and_mutate_results(), internal_info());
return;
@@ -1086,8 +1086,8 @@ int pegasus_client_impl::ttl(const std::string &hash_key,
{
// check params
if (hash_key.size() >= UINT16_MAX) {
- LOG_ERROR_F("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
- hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
+ hash_key.size());
return PERR_INVALID_HASH_KEY;
}
@@ -1136,12 +1136,12 @@ int pegasus_client_impl::get_scanner(const std::string &hash_key,
{
// check params
if (hash_key.size() >= UINT16_MAX) {
- LOG_ERROR_F("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
- hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but {}",
+ hash_key.size());
return PERR_INVALID_HASH_KEY;
}
if (hash_key.empty()) {
- LOG_ERROR_F("invalid hash key: hash key cannot be empty when scan");
+ LOG_ERROR("invalid hash key: hash key cannot be empty when scan");
return PERR_INVALID_HASH_KEY;
}
@@ -1201,8 +1201,8 @@ void pegasus_client_impl::async_get_unordered_scanners(
// check params
if (max_split_count <= 0) {
- LOG_ERROR_F("invalid max_split_count: which should be greater than 0, but {}",
- max_split_count);
+ LOG_ERROR("invalid max_split_count: which should be greater than 0, but {}",
+ max_split_count);
callback(PERR_INVALID_SPLIT_COUNT, std::vector<pegasus_scanner *>());
return;
}
@@ -1313,9 +1313,9 @@ const char *pegasus_client_impl::get_error_string(int error_code) const
auto it = _server_error_to_client.find(server_error);
if (it != _server_error_to_client.end())
return it->second;
- LOG_ERROR_F("can't find corresponding client error definition, server error:[{}:{}]",
- server_error,
- ::dsn::error_code(server_error));
+ LOG_ERROR("can't find corresponding client error definition, server error:[{}:{}]",
+ server_error,
+ ::dsn::error_code(server_error));
return PERR_UNKNOWN;
}
diff --git a/src/common/fs_manager.cpp b/src/common/fs_manager.cpp
index 9f611b69b..39c2e9841 100644
--- a/src/common/fs_manager.cpp
+++ b/src/common/fs_manager.cpp
@@ -89,7 +89,7 @@ bool dir_node::update_disk_stat(const bool update_disk_status)
FAIL_POINT_INJECT_F("update_disk_stat", [](string_view) { return false; });
dsn::utils::filesystem::disk_space_info info;
if (!dsn::utils::filesystem::get_disk_space_info(full_dir, info)) {
- LOG_ERROR_F("update disk space failed: dir = {}", full_dir);
+ LOG_ERROR("update disk space failed: dir = {}", full_dir);
return false;
}
// update disk space info
@@ -99,12 +99,12 @@ bool dir_node::update_disk_stat(const bool update_disk_status)
disk_capacity_mb == 0 ? 0 : std::round(disk_available_mb * 100.0 / disk_capacity_mb));
if (!update_disk_status) {
- LOG_INFO_F("update disk space succeed: dir = {}, capacity_mb = {}, available_mb = {}, "
- "available_ratio = {}%",
- full_dir,
- disk_capacity_mb,
- disk_available_mb,
- disk_available_ratio);
+ LOG_INFO("update disk space succeed: dir = {}, capacity_mb = {}, available_mb = {}, "
+ "available_ratio = {}%",
+ full_dir,
+ disk_capacity_mb,
+ disk_available_mb,
+ disk_available_ratio);
return false;
}
auto old_status = status;
@@ -114,13 +114,13 @@ bool dir_node::update_disk_stat(const bool update_disk_status)
if (old_status != new_status) {
status = new_status;
}
- LOG_INFO_F("update disk space succeed: dir = {}, capacity_mb = {}, available_mb = {}, "
- "available_ratio = {}%, disk_status = {}",
- full_dir,
- disk_capacity_mb,
- disk_available_mb,
- disk_available_ratio,
- enum_to_string(status));
+ LOG_INFO("update disk space succeed: dir = {}, capacity_mb = {}, available_mb = {}, "
+ "available_ratio = {}%, disk_status = {}",
+ full_dir,
+ disk_capacity_mb,
+ disk_available_mb,
+ disk_available_ratio,
+ enum_to_string(status));
return (old_status != new_status);
}
@@ -177,7 +177,7 @@ dsn::error_code fs_manager::initialize(const std::vector<std::string> &data_dirs
utils::filesystem::get_normalized_path(data_dirs[i], norm_path);
dir_node *n = new dir_node(tags[i], norm_path);
_dir_nodes.emplace_back(n);
- LOG_INFO_F("{}: mark data dir({}) as tag({})", dsn_primary_address(), norm_path, tags[i]);
+ LOG_INFO("{}: mark data dir({}) as tag({})", dsn_primary_address(), norm_path, tags[i]);
}
_available_data_dirs = data_dirs;
@@ -202,17 +202,17 @@ void fs_manager::add_replica(const gpid &pid, const std::string &pid_dir)
{
dir_node *n = get_dir_node(pid_dir);
if (nullptr == n) {
- LOG_ERROR_F(
+ LOG_ERROR(
"{}: dir({}) of gpid({}) haven't registered", dsn_primary_address(), pid_dir, pid);
} else {
zauto_write_lock l(_lock);
std::set<dsn::gpid> &replicas_for_app = n->holding_replicas[pid.get_app_id()];
auto result = replicas_for_app.emplace(pid);
if (!result.second) {
- LOG_WARNING_F(
+ LOG_WARNING(
"{}: gpid({}) already in the dir_node({})", dsn_primary_address(), pid, n->tag);
} else {
- LOG_INFO_F("{}: add gpid({}) to dir_node({})", dsn_primary_address(), pid, n->tag);
+ LOG_INFO("{}: add gpid({}) to dir_node({})", dsn_primary_address(), pid, n->tag);
}
}
}
@@ -245,7 +245,7 @@ void fs_manager::allocate_dir(const gpid &pid, const std::string &type, /*out*/
}
}
- LOG_INFO_F(
+ LOG_INFO(
"{}: put pid({}) to dir({}), which has {} replicas of current app, {} replicas totally",
dsn_primary_address(),
pid,
@@ -269,7 +269,7 @@ void fs_manager::remove_replica(const gpid &pid)
pid,
n->tag);
if (r != 0) {
- LOG_INFO_F("{}: remove gpid({}) from dir({})", dsn_primary_address(), pid, n->tag);
+ LOG_INFO("{}: remove gpid({}) from dir({})", dsn_primary_address(), pid, n->tag);
}
remove_count += r;
}
@@ -300,15 +300,15 @@ void fs_manager::update_disk_stat(bool check_status_changed)
_total_available_ratio = static_cast<int>(
_total_capacity_mb == 0 ? 0 : std::round(_total_available_mb * 100.0 / _total_capacity_mb));
- LOG_INFO_F("update disk space succeed: disk_count = {}, total_capacity_mb = {}, "
- "total_available_mb = {}, total_available_ratio = {}%, min_available_ratio = {}%, "
- "max_available_ratio = {}%",
- _dir_nodes.size(),
- _total_capacity_mb,
- _total_available_mb,
- _total_available_ratio,
- _min_available_ratio,
- _max_available_ratio);
+ LOG_INFO("update disk space succeed: disk_count = {}, total_capacity_mb = {}, "
+ "total_available_mb = {}, total_available_ratio = {}%, min_available_ratio = {}%, "
+ "max_available_ratio = {}%",
+ _dir_nodes.size(),
+ _total_capacity_mb,
+ _total_available_mb,
+ _total_available_ratio,
+ _min_available_ratio,
+ _max_available_ratio);
_counter_total_capacity_mb->set(_total_capacity_mb);
_counter_total_available_mb->set(_total_available_mb);
_counter_total_available_ratio->set(_total_available_ratio);
@@ -324,8 +324,7 @@ void fs_manager::add_new_dir_node(const std::string &data_dir, const std::string
dir_node *n = new dir_node(tag, norm_path);
_dir_nodes.emplace_back(n);
_available_data_dirs.emplace_back(data_dir);
- LOG_INFO_F(
- "{}: mark data dir({}) as tag({})", dsn_primary_address().to_string(), norm_path, tag);
+ LOG_INFO("{}: mark data dir({}) as tag({})", dsn_primary_address().to_string(), norm_path, tag);
}
bool fs_manager::is_dir_node_available(const std::string &data_dir, const std::string &tag) const
diff --git a/src/common/replication_common.cpp b/src/common/replication_common.cpp
index 473b8666c..be67dfb99 100644
--- a/src/common/replication_common.cpp
+++ b/src/common/replication_common.cpp
@@ -485,14 +485,14 @@ bool replica_helper::load_meta_servers(/*out*/ std::vector<dsn::rpc_address> &se
if (0 != (ip = ::dsn::rpc_address::ipv4_from_host(hostname_port[0].c_str()))) {
addr.assign_ipv4(ip, static_cast<uint16_t>(port_num));
} else if (!addr.from_string_ipv4(s.c_str())) {
- LOG_ERROR_F("invalid address '{}' specified in config [{}].{}", s, section, key);
+ LOG_ERROR("invalid address '{}' specified in config [{}].{}", s, section, key);
return false;
}
// TODO(yingchun): check there is no duplicates
servers.push_back(addr);
}
if (servers.empty()) {
- LOG_ERROR_F("no meta server specified in config [{}].{}", section, key);
+ LOG_ERROR("no meta server specified in config [{}].{}", section, key);
return false;
}
return true;
@@ -554,7 +554,7 @@ replication_options::get_data_dir_and_tag(const std::string &config_dirs_str,
for (unsigned i = 0; i < dirs.size(); ++i) {
const std::string &dir = dirs[i];
- LOG_INFO_F("data_dirs[{}] = {}, tag = {}", i + 1, dir, dir_tags[i]);
+ LOG_INFO("data_dirs[{}] = {}, tag = {}", i + 1, dir, dir_tags[i]);
data_dirs.push_back(utils::filesystem::path_combine(dir, "reps"));
data_dir_tags.push_back(dir_tags[i]);
}
@@ -566,11 +566,11 @@ replication_options::get_data_dirs_in_black_list(const std::string &fname,
/*out*/ std::vector<std::string> &dirs)
{
if (fname.empty() || !utils::filesystem::file_exists(fname)) {
- LOG_INFO_F("data_dirs_black_list_file[{}] not found, ignore it", fname);
+ LOG_INFO("data_dirs_black_list_file[{}] not found, ignore it", fname);
return;
}
- LOG_INFO_F("data_dirs_black_list_file[{}] found, apply it", fname);
+ LOG_INFO("data_dirs_black_list_file[{}] found, apply it", fname);
std::ifstream file(fname);
CHECK(file, "open data_dirs_black_list_file failed: {}", fname);
@@ -586,7 +586,7 @@ replication_options::get_data_dirs_in_black_list(const std::string &fname,
}
dirs.push_back(str2);
count++;
- LOG_INFO_F("black_list[{}] = [{}]", count, str2);
+ LOG_INFO("black_list[{}] = [{}]", count, str2);
}
}
diff --git a/src/common/storage_serverlet.h b/src/common/storage_serverlet.h
index bef086946..8eb7c67e0 100644
--- a/src/common/storage_serverlet.h
+++ b/src/common/storage_serverlet.h
@@ -129,10 +129,10 @@ protected:
if (ptr != nullptr) {
(*ptr)(static_cast<T *>(this), request);
} else {
- LOG_WARNING_F("recv message with unhandled rpc name {} from {}, trace_id = {:#018x} ",
- t,
- request->header->from_address,
- request->header->trace_id);
+ LOG_WARNING("recv message with unhandled rpc name {} from {}, trace_id = {:#018x} ",
+ t,
+ request->header->from_address,
+ request->header->trace_id);
dsn_rpc_reply(request->create_response(), ::dsn::ERR_HANDLER_NOT_FOUND);
}
return 0;
diff --git a/src/failure_detector/failure_detector.cpp b/src/failure_detector/failure_detector.cpp
index cb78e0e2f..e2176e4cc 100644
--- a/src/failure_detector/failure_detector.cpp
+++ b/src/failure_detector/failure_detector.cpp
@@ -117,7 +117,7 @@ void failure_detector::register_master(::dsn::rpc_address target)
auto ret = _masters.insert(std::make_pair(target, record));
if (ret.second) {
- LOG_DEBUG_F("register master[{}] successfully", target);
+ LOG_DEBUG("register master[{}] successfully", target);
setup_timer = true;
} else {
// active the beacon again in case previously local node is not in target's allow list
@@ -125,7 +125,7 @@ void failure_detector::register_master(::dsn::rpc_address target)
ret.first->second.rejected = false;
setup_timer = true;
}
- LOG_DEBUG_F("master[{}] already registered", target);
+ LOG_DEBUG("master[{}] already registered", target);
}
if (setup_timer) {
@@ -150,7 +150,7 @@ bool failure_detector::switch_master(::dsn::rpc_address from,
auto it2 = _masters.find(to);
if (it != _masters.end()) {
if (it2 != _masters.end()) {
- LOG_WARNING_F(
+ LOG_WARNING(
"switch master failed as both are already registered, from[{}], to[{}]", from, to);
return false;
}
@@ -169,9 +169,9 @@ bool failure_detector::switch_master(::dsn::rpc_address from,
_masters.insert(std::make_pair(to, it->second));
_masters.erase(from);
- LOG_INFO_F("switch master successfully, from[{}], to[{}]", from, to);
+ LOG_INFO("switch master successfully, from[{}], to[{}]", from, to);
} else {
- LOG_WARNING_F(
+ LOG_WARNING(
"switch master failed as from node is not registered yet, from[{}], to[{}]", from, to);
return false;
}
@@ -182,7 +182,7 @@ bool failure_detector::is_time_greater_than(uint64_t ts, uint64_t base) { return
void failure_detector::report(::dsn::rpc_address node, bool is_master, bool is_connected)
{
- LOG_INFO_F(
+ LOG_INFO(
"{} {}connected: {}", is_master ? "master" : "worker", is_connected ? "" : "dis", node);
}
@@ -225,13 +225,13 @@ void failure_detector::check_all_records()
is_time_greater_than(now, record.last_send_time_for_beacon_with_ack) &&
now + _check_interval_milliseconds - record.last_send_time_for_beacon_with_ack >
_lease_milliseconds) {
- LOG_ERROR_F("master {} disconnected, now={}, last_send_time={}, "
- "now+check_interval-last_send_time={}",
- record.node,
- now,
- record.last_send_time_for_beacon_with_ack,
- now + _check_interval_milliseconds -
- record.last_send_time_for_beacon_with_ack);
+ LOG_ERROR("master {} disconnected, now={}, last_send_time={}, "
+ "now+check_interval-last_send_time={}",
+ record.node,
+ now,
+ record.last_send_time_for_beacon_with_ack,
+ now + _check_interval_milliseconds -
+ record.last_send_time_for_beacon_with_ack);
expire.push_back(record.node);
record.is_alive = false;
@@ -268,7 +268,7 @@ void failure_detector::check_all_records()
// overflow
if (record.is_alive && is_time_greater_than(now, record.last_beacon_recv_time) &&
now - record.last_beacon_recv_time > _grace_milliseconds) {
- LOG_ERROR_F(
+ LOG_ERROR(
"worker {} disconnected, now={}, last_beacon_recv_time={}, now-last_recv={}",
record.node,
now,
@@ -310,8 +310,8 @@ void failure_detector::set_allow_list(const std::vector<std::string> &replica_ad
for (auto &addr : replica_addrs) {
rpc_address node;
if (!node.from_string_ipv4(addr.c_str())) {
- LOG_WARNING_F("replica_white_list has invalid ip {}, the allow list won't be modified",
- addr);
+ LOG_WARNING("replica_white_list has invalid ip {}, the allow list won't be modified",
+ addr);
return;
}
nodes.push_back(node);
@@ -354,7 +354,7 @@ void failure_detector::on_ping_internal(const beacon_msg &beacon, /*out*/ beacon
if (itr == _workers.end()) {
// if is a new worker, check allow list first if need
if (_use_allow_list && _allow_list.find(node) == _allow_list.end()) {
- LOG_WARNING_F("new worker[{}] is rejected", node);
+ LOG_WARNING("new worker[{}] is rejected", node);
ack.allowed = false;
return;
}
@@ -370,9 +370,9 @@ void failure_detector::on_ping_internal(const beacon_msg &beacon, /*out*/ beacon
// update last_beacon_recv_time
itr->second.last_beacon_recv_time = now;
- LOG_INFO_F("master {} update last_beacon_recv_time={}",
- itr->second.node,
- itr->second.last_beacon_recv_time);
+ LOG_INFO("master {} update last_beacon_recv_time={}",
+ itr->second.node,
+ itr->second.last_beacon_recv_time);
if (itr->second.is_alive == false) {
itr->second.is_alive = true;
@@ -381,7 +381,7 @@ void failure_detector::on_ping_internal(const beacon_msg &beacon, /*out*/ beacon
on_worker_connected(node);
}
} else {
- LOG_INFO_F("now[{}] <= last_recv_time[{}]", now, itr->second.last_beacon_recv_time);
+ LOG_INFO("now[{}] <= last_recv_time[{}]", now, itr->second.last_beacon_recv_time);
}
}
@@ -406,26 +406,26 @@ bool failure_detector::end_ping_internal(::dsn::error_code err, const beacon_ack
auto node = ack.this_node;
if (err != ERR_OK) {
- LOG_WARNING_F("ping master({}) failed, timeout_ms = {}, err = {}",
- node,
- _beacon_timeout_milliseconds,
- err);
+ LOG_WARNING("ping master({}) failed, timeout_ms = {}, err = {}",
+ node,
+ _beacon_timeout_milliseconds,
+ err);
_recent_beacon_fail_count->increment();
}
master_map::iterator itr = _masters.find(node);
if (itr == _masters.end()) {
- LOG_WARNING_F("received beacon ack without corresponding master, ignore it, "
- "remote_master[{}], local_worker[{}]",
- node,
- dsn_primary_address());
+ LOG_WARNING("received beacon ack without corresponding master, ignore it, "
+ "remote_master[{}], local_worker[{}]",
+ node,
+ dsn_primary_address());
return false;
}
master_record &record = itr->second;
if (!ack.allowed) {
- LOG_WARNING_F(
+ LOG_WARNING(
"worker rejected, stop sending beacon message, remote_master[{}], local_worker[{}]",
node,
dsn_primary_address());
@@ -436,9 +436,9 @@ bool failure_detector::end_ping_internal(::dsn::error_code err, const beacon_ack
if (!is_time_greater_than(beacon_send_time, record.last_send_time_for_beacon_with_ack)) {
// out-dated beacon acks, do nothing
- LOG_INFO_F("ignore out dated beacon acks, send_time({}), last_beacon({})",
- beacon_send_time,
- record.last_send_time_for_beacon_with_ack);
+ LOG_INFO("ignore out dated beacon acks, send_time({}), last_beacon({})",
+ beacon_send_time,
+ record.last_send_time_for_beacon_with_ack);
return false;
}
@@ -449,7 +449,7 @@ bool failure_detector::end_ping_internal(::dsn::error_code err, const beacon_ack
// if ack is not from master meta, worker should not update its last send time
if (!ack.is_master) {
- LOG_WARNING_F(
+ LOG_WARNING(
"node[{}] is not master, ack.primary_node[{}] is real master", node, ack.primary_node);
return true;
}
@@ -458,9 +458,9 @@ bool failure_detector::end_ping_internal(::dsn::error_code err, const beacon_ack
record.last_send_time_for_beacon_with_ack = beacon_send_time;
record.rejected = false;
- LOG_INFO_F("worker {} send beacon succeed, update last_send_time={}",
- record.node,
- record.last_send_time_for_beacon_with_ack);
+ LOG_INFO("worker {} send beacon succeed, update last_send_time={}",
+ record.node,
+ record.last_send_time_for_beacon_with_ack);
uint64_t now = dsn_now_ms();
// we should ensure now is greater than record.last_beacon_recv_time to aviod integer overflow
@@ -483,10 +483,10 @@ bool failure_detector::unregister_master(::dsn::rpc_address node)
if (it != _masters.end()) {
it->second.send_beacon_timer->cancel(true);
_masters.erase(it);
- LOG_INFO_F("unregister master[{}] successfully", node);
+ LOG_INFO("unregister master[{}] successfully", node);
return true;
} else {
- LOG_INFO_F("unregister master[{}] failed, cannot find it in FD", node);
+ LOG_INFO("unregister master[{}] failed, cannot find it in FD", node);
return false;
}
}
@@ -511,9 +511,9 @@ void failure_detector::register_worker(::dsn::rpc_address target, bool is_connec
auto ret = _workers.insert(std::make_pair(target, record));
if (ret.second) {
- LOG_DEBUG_F("register worker[{}] successfully", target);
+ LOG_DEBUG("register worker[{}] successfully", target);
} else {
- LOG_DEBUG_F("worker[{}] already registered", target);
+ LOG_DEBUG("worker[{}] already registered", target);
}
}
@@ -532,7 +532,7 @@ bool failure_detector::unregister_worker(::dsn::rpc_address node)
ret = true;
}
- LOG_DEBUG_F("unregister worker[{}] successfully, removed entry count is {}", node, count);
+ LOG_DEBUG("unregister worker[{}] successfully, removed entry count is {}", node, count);
return ret;
}
@@ -561,7 +561,7 @@ void failure_detector::send_beacon(::dsn::rpc_address target, uint64_t time)
beacon.to_addr = target;
beacon.__set_start_time(static_cast<int64_t>(dsn::utils::process_start_millis()));
- LOG_INFO_F(
+ LOG_INFO(
"send ping message, from[{}], to[{}], time[{}]", beacon.from_addr, beacon.to_addr, time);
::dsn::rpc::call(target,
diff --git a/src/failure_detector/failure_detector_multimaster.cpp b/src/failure_detector/failure_detector_multimaster.cpp
index da72a0f58..9a230dff3 100644
--- a/src/failure_detector/failure_detector_multimaster.cpp
+++ b/src/failure_detector/failure_detector_multimaster.cpp
@@ -50,7 +50,7 @@ slave_failure_detector_with_multimaster::slave_failure_detector_with_multimaster
_meta_servers.assign_group("meta-servers");
for (const auto &s : meta_servers) {
if (!_meta_servers.group_address()->add(s)) {
- LOG_WARNING_F("duplicate adress {}", s);
+ LOG_WARNING("duplicate adress {}", s);
}
}
@@ -74,14 +74,14 @@ void slave_failure_detector_with_multimaster::end_ping(::dsn::error_code err,
const fd::beacon_ack &ack,
void *)
{
- LOG_INFO_F("end ping result, error[{}], time[{}], ack.this_node[{}], ack.primary_node[{}], "
- "ack.is_master[{}], ack.allowed[{}]",
- err,
- ack.time,
- ack.this_node,
- ack.primary_node,
- ack.is_master ? "true" : "false",
- ack.allowed ? "true" : "false");
+ LOG_INFO("end ping result, error[{}], time[{}], ack.this_node[{}], ack.primary_node[{}], "
+ "ack.is_master[{}], ack.allowed[{}]",
+ err,
+ ack.time,
+ ack.this_node,
+ ack.primary_node,
+ ack.is_master ? "true" : "false",
+ ack.allowed ? "true" : "false");
zauto_lock l(failure_detector::_lock);
if (!failure_detector::end_ping_internal(err, ack))
diff --git a/src/failure_detector/test/failure_detector.cpp b/src/failure_detector/test/failure_detector.cpp
index ff2de6d66..e173e8937 100644
--- a/src/failure_detector/test/failure_detector.cpp
+++ b/src/failure_detector/test/failure_detector.cpp
@@ -68,7 +68,7 @@ protected:
if (_send_ping_switch)
failure_detector::send_beacon(node, time);
else {
- LOG_DEBUG_F("ignore send beacon, to node[{}], time[{}]", node, time);
+ LOG_DEBUG("ignore send beacon, to node[{}], time[{}]", node, time);
}
}
@@ -118,10 +118,10 @@ public:
if (_response_ping_switch)
meta_server_failure_detector::on_ping(beacon, reply);
else {
- LOG_DEBUG_F("ignore on ping, beacon msg, time[{}], from[{}], to[{}]",
- beacon.time,
- beacon.from_addr,
- beacon.to_addr);
+ LOG_DEBUG("ignore on ping, beacon msg, time[{}], from[{}], to[{}]",
+ beacon.time,
+ beacon.from_addr,
+ beacon.to_addr);
}
}
@@ -180,9 +180,9 @@ public:
void on_master_config(const config_master_message &request, bool &response)
{
- LOG_DEBUG_F("master config, request: {}, type: {}",
- request.master,
- request.is_register ? "reg" : "unreg");
+ LOG_DEBUG("master config, request: {}, type: {}",
+ request.master,
+ request.is_register ? "reg" : "unreg");
if (request.is_register)
_worker_fd->register_master(request.master);
else
@@ -220,7 +220,7 @@ public:
}
_master_fd->start(1, 1, 9, 10, use_allow_list);
- LOG_DEBUG_F("{}", _master_fd->get_allow_list({}));
+ LOG_DEBUG("{}", _master_fd->get_allow_list({}));
++started_apps;
return ERR_OK;
@@ -328,7 +328,7 @@ void clear(test_worker *worker, std::vector<test_master *> masters)
void finish(test_worker *worker, test_master *master, int master_index)
{
- LOG_WARNING_F("start to finish");
+ LOG_WARNING("start to finish");
std::atomic_int wait_count;
wait_count.store(2);
worker->fd()->when_disconnected(
@@ -507,7 +507,7 @@ TEST(fd, old_master_died)
worker->fd()->when_disconnected([](const std::vector<rpc_address> &masters_list) {
ASSERT_EQ(masters_list.size(), 1);
- LOG_DEBUG_F("disconnect from master: {}", masters_list[0]);
+ LOG_DEBUG("disconnect from master: {}", masters_list[0]);
});
/*first let's stop the old master*/
diff --git a/src/geo/lib/geo_client.cpp b/src/geo/lib/geo_client.cpp
index 4aa102778..c81af5588 100644
--- a/src/geo/lib/geo_client.cpp
+++ b/src/geo/lib/geo_client.cpp
@@ -116,10 +116,10 @@ int geo_client::set(const std::string &hash_key,
dsn::utils::notify_event set_completed;
auto async_set_callback = [&](int ec_, pegasus_client::internal_info &&info_) {
if (ec_ != PERR_OK) {
- LOG_ERROR_F("set data failed. hash_key={}, sort_key={}, error={}",
- hash_key,
- sort_key,
- get_error_string(ec_));
+ LOG_ERROR("set data failed. hash_key={}, sort_key={}, error={}",
+ hash_key,
+ sort_key,
+ get_error_string(ec_));
ret = ec_;
}
if (info != nullptr) {
@@ -163,11 +163,11 @@ void geo_client::async_set(const std::string &hash_key,
}
if (ec_ != PERR_OK) {
- LOG_ERROR_F("set {} data failed. hash_key={}, sort_key={}, error={}",
- data_type_ == DataType::common ? "common" : "geo",
- hash_key,
- sort_key,
- get_error_string(ec_));
+ LOG_ERROR("set {} data failed. hash_key={}, sort_key={}, error={}",
+ data_type_ == DataType::common ? "common" : "geo",
+ hash_key,
+ sort_key,
+ get_error_string(ec_));
*ret = ec_;
}
@@ -216,10 +216,10 @@ int geo_client::get(const std::string &hash_key,
lat_degrees = lat_degrees_;
lng_degrees = lng_degrees_;
} else {
- LOG_WARNING_F("get data failed. hash_key={}, sort_key={}, error={}",
- hash_key,
- sort_key,
- get_error_string(ec_));
+ LOG_WARNING("get data failed. hash_key={}, sort_key={}, error={}",
+ hash_key,
+ sort_key,
+ get_error_string(ec_));
}
ret = ec_;
get_completed.notify();
@@ -247,10 +247,10 @@ void geo_client::async_get(const std::string &hash_key,
}
S2LatLng latlng;
if (!_codec.decode_from_value(value_, latlng)) {
- LOG_ERROR_F("decode_from_value failed. hash_key={}, sort_key={}, value={}",
- hash_key,
- sort_key,
- value_);
+ LOG_ERROR("decode_from_value failed. hash_key={}, sort_key={}, value={}",
+ hash_key,
+ sort_key,
+ value_);
cb(PERR_GEO_DECODE_VALUE_ERROR, id, 0, 0);
return;
}
@@ -268,10 +268,10 @@ int geo_client::del(const std::string &hash_key,
dsn::utils::notify_event del_completed;
auto async_del_callback = [&](int ec_, pegasus_client::internal_info &&info_) {
if (ec_ != PERR_OK) {
- LOG_ERROR_F("del data failed. hash_key={}, sort_key={}, error={}",
- hash_key,
- sort_key,
- get_error_string(ec_));
+ LOG_ERROR("del data failed. hash_key={}, sort_key={}, error={}",
+ hash_key,
+ sort_key,
+ get_error_string(ec_));
ret = ec_;
}
if (info != nullptr) {
@@ -315,7 +315,7 @@ void geo_client::async_del(const std::string &hash_key,
std::string geo_sort_key;
if (!generate_geo_keys(hash_key, sort_key, value_, geo_hash_key, geo_sort_key)) {
keep_geo_data = true;
- LOG_WARNING_F("generate_geo_keys failed");
+ LOG_WARNING("generate_geo_keys failed");
}
std::shared_ptr<int> ret = std::make_shared<int>(PERR_OK);
@@ -335,11 +335,11 @@ void geo_client::async_del(const std::string &hash_key,
auto async_del_callback =
[=](int ec__, pegasus_client::internal_info &&, DataType data_type_) mutable {
if (ec__ != PERR_OK) {
- LOG_ERROR_F("del {} data failed. hash_key={}, sort_key={}, error={}",
- data_type_ == DataType::common ? "common" : "geo",
- hash_key,
- sort_key,
- get_error_string(ec_));
+ LOG_ERROR("del {} data failed. hash_key={}, sort_key={}, error={}",
+ data_type_ == DataType::common ? "common" : "geo",
+ hash_key,
+ sort_key,
+ get_error_string(ec_));
*ret = ec__;
}
@@ -369,10 +369,10 @@ int geo_client::set_geo_data(const std::string &hash_key,
auto async_set_callback = [&](int ec_, pegasus_client::internal_info &&info_) {
if (ec_ != PERR_OK) {
ret = ec_;
- LOG_ERROR_F("set geo data failed. hash_key={}, sort_key={}, error={}",
- hash_key,
- sort_key,
- get_error_string(ec_));
+ LOG_ERROR("set geo data failed. hash_key={}, sort_key={}, error={}",
+ hash_key,
+ sort_key,
+ get_error_string(ec_));
}
set_completed.notify();
};
@@ -412,7 +412,7 @@ int geo_client::search_radial(double lat_degrees,
int ret = PERR_OK;
S2LatLng latlng = S2LatLng::FromDegrees(lat_degrees, lng_degrees);
if (!latlng.is_valid()) {
- LOG_ERROR_F("latlng is invalid. lat_degrees={}, lng_degrees={}", lat_degrees, lng_degrees);
+ LOG_ERROR("latlng is invalid. lat_degrees={}, lng_degrees={}", lat_degrees, lng_degrees);
return PERR_GEO_INVALID_LATLNG_ERROR;
}
dsn::utils::notify_event search_completed;
@@ -442,7 +442,7 @@ void geo_client::async_search_radial(double lat_degrees,
{
S2LatLng latlng = S2LatLng::FromDegrees(lat_degrees, lng_degrees);
if (!latlng.is_valid()) {
- LOG_ERROR_F("latlng is invalid. lat_degrees={}, lng_degrees={}", lat_degrees, lng_degrees);
+ LOG_ERROR("latlng is invalid. lat_degrees={}, lng_degrees={}", lat_degrees, lng_degrees);
callback(PERR_GEO_INVALID_LATLNG_ERROR, {});
}
@@ -499,20 +499,20 @@ void geo_client::async_search_radial(const std::string &hash_key,
cb = std::move(callback)
](int ec_, std::string &&value_, pegasus_client::internal_info &&) mutable {
if (ec_ != PERR_OK) {
- LOG_ERROR_F("get failed. hash_key={}, sort_key={}, error={}",
- hash_key,
- sort_key,
- get_error_string(ec_));
+ LOG_ERROR("get failed. hash_key={}, sort_key={}, error={}",
+ hash_key,
+ sort_key,
+ get_error_string(ec_));
cb(ec_, {});
return;
}
S2LatLng latlng;
if (!_codec.decode_from_value(value_, latlng)) {
- LOG_ERROR_F("decode_from_value failed. hash_key={}, sort_key={}, value={}",
- hash_key,
- sort_key,
- value_);
+ LOG_ERROR("decode_from_value failed. hash_key={}, sort_key={}, value={}",
+ hash_key,
+ sort_key,
+ value_);
cb(ec_, {});
return;
}
@@ -701,10 +701,10 @@ bool geo_client::generate_geo_keys(const std::string &hash_key,
// extract latitude and longitude from value
S2LatLng latlng;
if (!_codec.decode_from_value(value, latlng)) {
- LOG_ERROR_F("decode_from_value failed. hash_key={}, sort_key={}, value={}",
- hash_key,
- sort_key,
- value);
+ LOG_ERROR("decode_from_value failed. hash_key={}, sort_key={}, value={}",
+ hash_key,
+ sort_key,
+ value);
return false;
}
@@ -879,14 +879,14 @@ void geo_client::do_scan(pegasus_client::pegasus_scanner_wrapper scanner_wrapper
}
if (ret != PERR_OK) {
- LOG_ERROR_F("async_next failed. error={}", get_error_string(ret));
+ LOG_ERROR("async_next failed. error={}", get_error_string(ret));
cb();
return;
}
S2LatLng latlng;
if (!_codec.decode_from_value(value, latlng)) {
- LOG_ERROR_F("decode_from_value failed. value={}", value);
+ LOG_ERROR("decode_from_value failed. value={}", value);
cb();
return;
}
@@ -895,7 +895,7 @@ void geo_client::do_scan(pegasus_client::pegasus_scanner_wrapper scanner_wrapper
if (distance <= S2Earth::ToMeters(cap_ptr->radius())) {
std::string origin_hash_key, origin_sort_key;
if (!restore_origin_keys(geo_sort_key, origin_hash_key, origin_sort_key)) {
- LOG_ERROR_F("restore_origin_keys failed. geo_sort_key={}", geo_sort_key);
+ LOG_ERROR("restore_origin_keys failed. geo_sort_key={}", geo_sort_key);
cb();
return;
}
@@ -928,7 +928,7 @@ int geo_client::distance(const std::string &hash_key1,
dsn::utils::notify_event get_completed;
auto async_calculate_callback = [&](int ec_, double &&distance_) {
if (ec_ != PERR_OK) {
- LOG_ERROR_F(
+ LOG_ERROR(
"get distance failed. hash_key1={}, sort_key1={}, hash_key2={}, sort_key2={}, "
"error={}",
hash_key1,
@@ -962,19 +962,19 @@ void geo_client::async_distance(const std::string &hash_key1,
int ec_, std::string &&value_, pegasus_client::internal_info &&)
{
if (ec_ != PERR_OK) {
- LOG_ERROR_F("get data failed. hash_key1={}, sort_key1={}, hash_key2={}, sort_key2={}, "
- "error={}",
- hash_key1,
- sort_key1,
- hash_key2,
- sort_key2,
- get_error_string(ec_));
+ LOG_ERROR("get data failed. hash_key1={}, sort_key1={}, hash_key2={}, sort_key2={}, "
+ "error={}",
+ hash_key1,
+ sort_key1,
+ hash_key2,
+ sort_key2,
+ get_error_string(ec_));
*ret = ec_;
}
S2LatLng latlng;
if (!_codec.decode_from_value(value_, latlng)) {
- LOG_ERROR_F("decode_from_value failed. value={}", value_);
+ LOG_ERROR("decode_from_value failed. value={}", value_);
*ret = PERR_GEO_DECODE_VALUE_ERROR;
}
diff --git a/src/geo/lib/latlng_codec.cpp b/src/geo/lib/latlng_codec.cpp
index f3f827ca4..3a2e0c361 100644
--- a/src/geo/lib/latlng_codec.cpp
+++ b/src/geo/lib/latlng_codec.cpp
@@ -94,7 +94,7 @@ bool latlng_codec::encode_to_value(double lat_degrees, double lng_degrees, std::
CHECK_EQ(_sorted_indices.size(), 2);
S2LatLng latlng = S2LatLng::FromDegrees(lat_degrees, lng_degrees);
if (!latlng.is_valid()) {
- LOG_ERROR_F("latlng is invalid. lat_degrees={}, lng_degrees={}", lat_degrees, lng_degrees);
+ LOG_ERROR("latlng is invalid. lat_degrees={}, lng_degrees={}", lat_degrees, lng_degrees);
return false;
}
diff --git a/src/http/http_message_parser.cpp b/src/http/http_message_parser.cpp
index 6771fed7d..a47792802 100644
--- a/src/http/http_message_parser.cpp
+++ b/src/http/http_message_parser.cpp
@@ -136,7 +136,7 @@ http_message_parser::http_message_parser()
header->hdr_type = http_method::HTTP_METHOD_POST;
header->context.u.is_request = 1;
} else {
- LOG_ERROR_F("invalid http type {} and method {}", parser->type, parser->method);
+ LOG_ERROR("invalid http type {} and method {}", parser->type, parser->method);
return 1;
}
return 0;
@@ -179,9 +179,9 @@ message_ex *http_message_parser::get_message_on_receive(message_reader *reader,
// error handling
if (_parser.http_errno != HPE_OK) {
auto err = HTTP_PARSER_ERRNO(&_parser);
- LOG_ERROR_F("failed on stage {} [{}]",
- http_parser_stage_to_string(_stage),
- http_errno_description(err));
+ LOG_ERROR("failed on stage {} [{}]",
+ http_parser_stage_to_string(_stage),
+ http_errno_description(err));
read_next = -1;
return nullptr;
diff --git a/src/http/http_server.cpp b/src/http/http_server.cpp
index c137d9d3e..d8212bb7a 100644
--- a/src/http/http_server.cpp
+++ b/src/http/http_server.cpp
@@ -62,7 +62,7 @@ error_s update_config(const http_request &req)
case http_status_code::internal_server_error:
return "500 Internal Server Error";
default:
- LOG_FATAL_F("invalid code: {}", static_cast<int>(code));
+ LOG_FATAL("invalid code: {}", static_cast<int>(code));
__builtin_unreachable();
}
}
diff --git a/src/http/pprof_http_service.cpp b/src/http/pprof_http_service.cpp
index a4b047af1..a9637342c 100644
--- a/src/http/pprof_http_service.cpp
+++ b/src/http/pprof_http_service.cpp
@@ -73,10 +73,10 @@ static int extract_symbols_from_binary(std::map<uintptr_t, std::string> &addr_ma
std::string cmd = "nm -C -p ";
cmd.append(lib_info.path);
std::stringstream ss;
- LOG_INFO_F("executing `{}`", cmd);
+ LOG_INFO("executing `{}`", cmd);
const int rc = utils::pipe_execute(cmd.c_str(), ss);
if (rc < 0) {
- LOG_ERROR_F("fail to popen `{}`", cmd);
+ LOG_ERROR("fail to popen `{}`", cmd);
return -1;
}
std::string line;
@@ -162,7 +162,7 @@ static int extract_symbols_from_binary(std::map<uintptr_t, std::string> &addr_ma
addr_map[lib_info.end_addr] = std::string();
}
tm.stop();
- LOG_INFO_F("Loaded {} in {}ms", lib_info.path, tm.m_elapsed().count());
+ LOG_INFO("Loaded {} in {}ms", lib_info.path, tm.m_elapsed().count());
return 0;
}
@@ -259,11 +259,11 @@ static void load_symbols()
}
tm2.stop();
if (num_removed) {
- LOG_INFO_F("Removed {} entries in {}ms", num_removed, tm2.m_elapsed().count());
+ LOG_INFO("Removed {} entries in {}ms", num_removed, tm2.m_elapsed().count());
}
tm.stop();
- LOG_INFO_F("Loaded all symbols in {}ms", tm.m_elapsed().count());
+ LOG_INFO("Loaded all symbols in {}ms", tm.m_elapsed().count());
}
static void find_symbols(std::string *out, std::vector<uintptr_t> &addr_list)
@@ -329,7 +329,7 @@ void pprof_http_service::heap_handler(const http_request &req, http_response &re
{
bool in_pprof = false;
if (!_in_pprof_action.compare_exchange_strong(in_pprof, true)) {
- LOG_WARNING_F("node is already exectuting pprof action, please wait and retry");
+ LOG_WARNING("node is already exectuting pprof action, please wait and retry");
resp.status_code = http_status_code::internal_server_error;
return;
}
@@ -372,19 +372,19 @@ ssize_t read_command_line(char *buf, size_t len, bool with_args)
{
auto fd = open("/proc/self/cmdline", O_RDONLY);
if (fd < 0) {
- LOG_ERROR_F("Fail to open /proc/self/cmdline");
+ LOG_ERROR("Fail to open /proc/self/cmdline");
return -1;
}
auto cleanup = defer([fd]() { close(fd); });
ssize_t nr = read(fd, buf, len);
if (nr <= 0) {
- LOG_ERROR_F("Fail to read /proc/self/cmdline");
+ LOG_ERROR("Fail to read /proc/self/cmdline");
return -1;
}
if (with_args) {
if ((size_t)nr == len) {
- LOG_ERROR_F("buf is not big enough");
+ LOG_ERROR("buf is not big enough");
return -1;
}
for (ssize_t i = 0; i < nr; ++i) {
@@ -401,7 +401,7 @@ ssize_t read_command_line(char *buf, size_t len, bool with_args)
}
}
if ((size_t)nr == len) {
- LOG_INFO_F("buf is not big enough");
+ LOG_INFO("buf is not big enough");
return -1;
}
return nr;
@@ -426,13 +426,13 @@ void pprof_http_service::growth_handler(const http_request &req, http_response &
{
bool in_pprof = false;
if (!_in_pprof_action.compare_exchange_strong(in_pprof, true)) {
- LOG_WARNING_F("node is already exectuting pprof action, please wait and retry");
+ LOG_WARNING("node is already exectuting pprof action, please wait and retry");
resp.status_code = http_status_code::internal_server_error;
return;
}
MallocExtension *malloc_ext = MallocExtension::instance();
- LOG_INFO_F("received requests for growth profile");
+ LOG_INFO("received requests for growth profile");
malloc_ext->GetHeapGrowthStacks(&resp.body);
_in_pprof_action.store(false);
@@ -469,7 +469,7 @@ void pprof_http_service::profile_handler(const http_request &req, http_response
{
bool in_pprof = false;
if (!_in_pprof_action.compare_exchange_strong(in_pprof, true)) {
- LOG_WARNING_F("node is already exectuting pprof action, please wait and retry");
+ LOG_WARNING("node is already exectuting pprof action, please wait and retry");
resp.status_code = http_status_code::internal_server_error;
return;
}
diff --git a/src/meta/app_balance_policy.cpp b/src/meta/app_balance_policy.cpp
index 07acbc8bc..8387b9486 100644
--- a/src/meta/app_balance_policy.cpp
+++ b/src/meta/app_balance_policy.cpp
@@ -96,11 +96,11 @@ void app_balance_policy::balance(bool checker, const meta_view *global_view, mig
bool app_balance_policy::need_balance_secondaries(bool balance_checker)
{
if (!balance_checker && !_migration_result->empty()) {
- LOG_INFO_F("stop to do secondary balance coz we already have actions to do");
+ LOG_INFO("stop to do secondary balance coz we already have actions to do");
return false;
}
if (_only_primary_balancer) {
- LOG_INFO_F("stop to do secondary balancer coz it is not allowed");
+ LOG_INFO("stop to do secondary balancer coz it is not allowed");
return false;
}
return true;
@@ -134,7 +134,7 @@ bool copy_secondary_operation::can_continue()
int id_max = *_ordered_address_ids.rbegin();
if (_partition_counts[id_max] <= _replicas_low ||
_partition_counts[id_max] - _partition_counts[id_min] <= 1) {
- LOG_INFO_F("{}: stop copy secondary coz it will be balanced later", _app->get_logname());
+ LOG_INFO("{}: stop copy secondary coz it will be balanced later", _app->get_logname());
return false;
}
return true;
@@ -150,29 +150,29 @@ bool copy_secondary_operation::can_select(gpid pid, migration_list *result)
int id_max = *_ordered_address_ids.rbegin();
const node_state &max_ns = _nodes.at(_address_vec[id_max]);
if (max_ns.served_as(pid) == partition_status::PS_PRIMARY) {
- LOG_DEBUG_F("{}: skip gpid({}.{}) coz it is primary",
- _app->get_logname(),
- pid.get_app_id(),
- pid.get_partition_index());
+ LOG_DEBUG("{}: skip gpid({}.{}) coz it is primary",
+ _app->get_logname(),
+ pid.get_app_id(),
+ pid.get_partition_index());
return false;
}
// if the pid have been used
if (result->find(pid) != result->end()) {
- LOG_DEBUG_F("{}: skip gpid({}.{}) coz it is already copyed",
- _app->get_logname(),
- pid.get_app_id(),
- pid.get_partition_index());
+ LOG_DEBUG("{}: skip gpid({}.{}) coz it is already copyed",
+ _app->get_logname(),
+ pid.get_app_id(),
+ pid.get_partition_index());
return false;
}
int id_min = *_ordered_address_ids.begin();
const node_state &min_ns = _nodes.at(_address_vec[id_min]);
if (min_ns.served_as(pid) != partition_status::PS_INACTIVE) {
- LOG_DEBUG_F("{}: skip gpid({}.{}) coz it is already a member on the target node",
- _app->get_logname(),
- pid.get_app_id(),
- pid.get_partition_index());
+ LOG_DEBUG("{}: skip gpid({}.{}) coz it is already a member on the target node",
+ _app->get_logname(),
+ pid.get_app_id(),
+ pid.get_partition_index());
return false;
}
return true;
diff --git a/src/meta/app_env_validator.cpp b/src/meta/app_env_validator.cpp
index 45edf8b4c..4c2bf3dd4 100644
--- a/src/meta/app_env_validator.cpp
+++ b/src/meta/app_env_validator.cpp
@@ -154,7 +154,7 @@ bool app_env_validator::validate_app_env(const std::string &env_name,
if (func_iter != _validator_funcs.end()) {
// check function == nullptr means no check
if (nullptr != func_iter->second && !func_iter->second(env_value, hint_message)) {
- LOG_WARNING_F("{}={} is invalid.", env_name, env_value);
+ LOG_WARNING("{}={} is invalid.", env_name, env_value);
return false;
}
diff --git a/src/meta/backup_engine.cpp b/src/meta/backup_engine.cpp
index 001b64ab0..d05d3a7f4 100644
--- a/src/meta/backup_engine.cpp
+++ b/src/meta/backup_engine.cpp
@@ -41,7 +41,7 @@ error_code backup_engine::init_backup(int32_t app_id)
_backup_service->get_state()->lock_read(l);
std::shared_ptr<app_state> app = _backup_service->get_state()->get_app(app_id);
if (app == nullptr || app->status != app_status::AS_AVAILABLE) {
- LOG_ERROR_F("app {} is not available, couldn't do backup now.", app_id);
+ LOG_ERROR("app {} is not available, couldn't do backup now.", app_id);
return ERR_INVALID_STATE;
}
app_name = app->app_name;
@@ -77,7 +77,7 @@ error_code backup_engine::set_backup_path(const std::string &path)
if (_block_service && _block_service->is_root_path_set()) {
return ERR_INVALID_PARAMETERS;
}
- LOG_INFO_F("backup path is set to {}.", path);
+ LOG_INFO("backup path is set to {}.", path);
_backup_path = path;
return ERR_OK;
}
@@ -100,7 +100,7 @@ error_code backup_engine::write_backup_file(const std::string &file_name,
})
->wait();
if (err != dsn::ERR_OK) {
- LOG_INFO_F("create file {} failed", file_name);
+ LOG_INFO("create file {} failed", file_name);
return err;
}
CHECK_NOTNULL(
@@ -121,7 +121,7 @@ error_code backup_engine::backup_app_meta()
_backup_service->get_state()->lock_read(l);
std::shared_ptr<app_state> app = _backup_service->get_state()->get_app(_cur_backup.app_id);
if (app == nullptr || app->status != app_status::AS_AVAILABLE) {
- LOG_ERROR_F("app {} is not available, couldn't do backup now.", _cur_backup.app_id);
+ LOG_ERROR("app {} is not available, couldn't do backup now.", _cur_backup.app_id);
return ERR_INVALID_STATE;
}
app_state tmp = *app;
@@ -146,7 +146,7 @@ void backup_engine::backup_app_partition(const gpid &pid)
_backup_service->get_state()->lock_read(l);
std::shared_ptr<app_state> app = _backup_service->get_state()->get_app(pid.get_app_id());
if (app == nullptr || app->status != app_status::AS_AVAILABLE) {
- LOG_ERROR_F("app {} is not available, couldn't do backup now.", pid.get_app_id());
+ LOG_ERROR("app {} is not available, couldn't do backup now.", pid.get_app_id());
zauto_lock lock(_lock);
_is_backup_failed = true;
@@ -156,7 +156,7 @@ void backup_engine::backup_app_partition(const gpid &pid)
}
if (partition_primary.is_invalid()) {
- LOG_WARNING_F(
+ LOG_WARNING(
"backup_id({}): partition {} doesn't have a primary now, retry to backup it later.",
_cur_backup.backup_id,
pid.to_string());
@@ -180,10 +180,10 @@ void backup_engine::backup_app_partition(const gpid &pid)
req->__set_backup_path(_backup_path);
}
- LOG_INFO_F("backup_id({}): send backup request to partition {}, target_addr = {}",
- _cur_backup.backup_id,
- pid.to_string(),
- partition_primary.to_string());
+ LOG_INFO("backup_id({}): send backup request to partition {}, target_addr = {}",
+ _cur_backup.backup_id,
+ pid.to_string(),
+ partition_primary.to_string());
backup_rpc rpc(std::move(req), RPC_COLD_BACKUP, 10000_ms, 0, pid.thread_hash());
rpc.call(
partition_primary, &_tracker, [this, rpc, pid, partition_primary](error_code err) mutable {
@@ -200,10 +200,10 @@ inline void backup_engine::handle_replica_backup_failed(const backup_response &r
CHECK_EQ(response.pid, pid);
CHECK_EQ(response.backup_id, _cur_backup.backup_id);
- LOG_ERROR_F("backup_id({}): backup for partition {} failed, response.err: {}",
- _cur_backup.backup_id,
- pid.to_string(),
- response.err.to_string());
+ LOG_ERROR("backup_id({}): backup for partition {} failed, response.err: {}",
+ _cur_backup.backup_id,
+ pid.to_string(),
+ response.err.to_string());
zauto_lock l(_lock);
// if one partition fail, the whole backup plan fail.
_is_backup_failed = true;
@@ -246,11 +246,11 @@ void backup_engine::on_backup_reply(const error_code err,
}
if (rep_error != ERR_OK) {
- LOG_ERROR_F("backup_id({}): backup request to server {} failed, error: {}, retry to "
- "send backup request.",
- _cur_backup.backup_id,
- primary.to_string(),
- rep_error.to_string());
+ LOG_ERROR("backup_id({}): backup request to server {} failed, error: {}, retry to "
+ "send backup request.",
+ _cur_backup.backup_id,
+ primary.to_string(),
+ rep_error.to_string());
retry_backup(pid);
return;
};
@@ -258,9 +258,9 @@ void backup_engine::on_backup_reply(const error_code err,
if (response.progress == cold_backup_constant::PROGRESS_FINISHED) {
CHECK_EQ(response.pid, pid);
CHECK_EQ(response.backup_id, _cur_backup.backup_id);
- LOG_INFO_F("backup_id({}): backup for partition {} completed.",
- _cur_backup.backup_id,
- pid.to_string());
+ LOG_INFO("backup_id({}): backup for partition {} completed.",
+ _cur_backup.backup_id,
+ pid.to_string());
{
zauto_lock l(_lock);
_backup_status[pid.get_partition_index()] = backup_status::COMPLETED;
@@ -270,12 +270,12 @@ void backup_engine::on_backup_reply(const error_code err,
}
// backup is not finished, meta polling to send request
- LOG_INFO_F("backup_id({}): receive backup response for partition {} from server {}, now "
- "progress {}, retry to send backup request.",
- _cur_backup.backup_id,
- pid.to_string(),
- primary.to_string(),
- response.progress);
+ LOG_INFO("backup_id({}): receive backup response for partition {} from server {}, now "
+ "progress {}, retry to send backup request.",
+ _cur_backup.backup_id,
+ pid.to_string(),
+ primary.to_string(),
+ response.progress);
retry_backup(pid);
}
@@ -288,7 +288,7 @@ void backup_engine::write_backup_info()
blob buf = dsn::json::json_forwarder<app_backup_info>::encode(_cur_backup);
error_code err = write_backup_file(file_name, buf);
if (err == ERR_FS_INTERNAL) {
- LOG_ERROR_F(
+ LOG_ERROR(
"backup_id({}): write backup info failed, error {}, do not try again for this error.",
_cur_backup.backup_id,
err.to_string());
@@ -297,8 +297,8 @@ void backup_engine::write_backup_info()
return;
}
if (err != ERR_OK) {
- LOG_WARNING_F("backup_id({}): write backup info failed, retry it later.",
- _cur_backup.backup_id);
+ LOG_WARNING("backup_id({}): write backup info failed, retry it later.",
+ _cur_backup.backup_id);
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this]() { write_backup_info(); },
@@ -306,9 +306,9 @@ void backup_engine::write_backup_info()
std::chrono::seconds(1));
return;
}
- LOG_INFO_F("backup_id({}): successfully wrote backup info, backup for app {} completed.",
- _cur_backup.backup_id,
- _cur_backup.app_id);
+ LOG_INFO("backup_id({}): successfully wrote backup info, backup for app {} completed.",
+ _cur_backup.backup_id,
+ _cur_backup.app_id);
zauto_lock l(_lock);
_cur_backup.end_time_ms = dsn_now_ms();
}
@@ -332,10 +332,10 @@ error_code backup_engine::start()
{
error_code err = backup_app_meta();
if (err != ERR_OK) {
- LOG_ERROR_F("backup_id({}): backup meta data for app {} failed, error {}",
- _cur_backup.backup_id,
- _cur_backup.app_id,
- err.to_string());
+ LOG_ERROR("backup_id({}): backup meta data for app {} failed, error {}",
+ _cur_backup.backup_id,
+ _cur_backup.app_id,
+ err.to_string());
return err;
}
for (int i = 0; i < _backup_status.size(); ++i) {
diff --git a/src/meta/cluster_balance_policy.cpp b/src/meta/cluster_balance_policy.cpp
index 94731751d..2364d789a 100644
--- a/src/meta/cluster_balance_policy.cpp
+++ b/src/meta/cluster_balance_policy.cpp
@@ -120,7 +120,7 @@ bool cluster_balance_policy::cluster_replica_balance(const meta_view *global_vie
return false;
}
if (!list.empty()) {
- LOG_INFO_F("migration count of {} = {}", enum_to_string(type), list.size());
+ LOG_INFO("migration count of {} = {}", enum_to_string(type), list.size());
return false;
}
return true;
@@ -165,11 +165,11 @@ bool cluster_balance_policy::get_cluster_migration_info(
const std::shared_ptr<app_state> &app = kv.second;
auto ignored = is_ignored_app(app->app_id);
if (ignored || app->is_bulk_loading || app->splitting()) {
- LOG_INFO_F("skip to balance app({}), ignored={}, bulk loading={}, splitting={}",
- app->app_name,
- ignored,
- app->is_bulk_loading,
- app->splitting());
+ LOG_INFO("skip to balance app({}), ignored={}, bulk loading={}, splitting={}",
+ app->app_name,
+ ignored,
+ app->is_bulk_loading,
+ app->splitting());
continue;
}
if (app->status == app_status::AS_AVAILABLE) {
@@ -263,13 +263,13 @@ bool cluster_balance_policy::get_next_move(const cluster_migration_info &cluster
std::multimap<uint32_t, int32_t> app_skew_multimap = utils::flip_map(cluster_info.apps_skew);
auto max_app_skew = app_skew_multimap.rbegin()->first;
if (max_app_skew == 0) {
- LOG_INFO_F("every app is balanced and any move will unbalance a app");
+ LOG_INFO("every app is balanced and any move will unbalance a app");
return false;
}
auto server_skew = get_skew(cluster_info.replicas_count);
if (max_app_skew <= 1 && server_skew <= 1) {
- LOG_INFO_F("every app is balanced and the cluster as a whole is balanced");
+ LOG_INFO("every app is balanced and the cluster as a whole is balanced");
return false;
}
@@ -314,10 +314,10 @@ bool cluster_balance_policy::get_next_move(const cluster_migration_info &cluster
std::multimap<uint32_t, rpc_address> app_count_multimap = utils::flip_map(app_map);
if (app_count_multimap.rbegin()->first <= app_count_multimap.begin()->first + 1 &&
(app_cluster_min_set.empty() || app_cluster_max_set.empty())) {
- LOG_INFO_F("do not move replicas of a balanced app({}) if the least (most) loaded "
- "servers overall do not intersect the servers hosting the least (most) "
- "replicas of the app",
- app_id);
+ LOG_INFO("do not move replicas of a balanced app({}) if the least (most) loaded "
+ "servers overall do not intersect the servers hosting the least (most) "
+ "replicas of the app",
+ app_id);
continue;
}
@@ -357,10 +357,10 @@ bool cluster_balance_policy::pick_up_move(const cluster_migration_info &cluster_
}
auto index = rand() % max_load_disk_set.size();
auto max_load_disk = *select_random(max_load_disk_set, index);
- LOG_INFO_F("most load disk({}) on node({}) is picked, has {} partition",
- max_load_disk.node.to_string(),
- max_load_disk.disk_tag,
- max_load_disk.partitions.size());
+ LOG_INFO("most load disk({}) on node({}) is picked, has {} partition",
+ max_load_disk.node.to_string(),
+ max_load_disk.disk_tag,
+ max_load_disk.partitions.size());
for (const auto &node_addr : min_nodes) {
gpid picked_pid;
if (pick_up_partition(
@@ -370,17 +370,17 @@ bool cluster_balance_policy::pick_up_move(const cluster_migration_info &cluster_
move_info.source_disk_tag = max_load_disk.disk_tag;
move_info.target_node = node_addr;
move_info.type = cluster_info.type;
- LOG_INFO_F("partition[{}] will migrate from {} to {}",
- picked_pid,
- max_load_disk.node.to_string(),
- node_addr.to_string());
+ LOG_INFO("partition[{}] will migrate from {} to {}",
+ picked_pid,
+ max_load_disk.node.to_string(),
+ node_addr.to_string());
return true;
}
}
- LOG_INFO_F("can not find a partition(app_id={}) from random max load disk(node={}, disk={})",
- app_id,
- max_load_disk.node.to_string(),
- max_load_disk.disk_tag);
+ LOG_INFO("can not find a partition(app_id={}) from random max load disk(node={}, disk={})",
+ app_id,
+ max_load_disk.node.to_string(),
+ max_load_disk.disk_tag);
return false;
}
diff --git a/src/meta/dump_file.h b/src/meta/dump_file.h
index 79a758af0..4e8018ca5 100644
--- a/src/meta/dump_file.h
+++ b/src/meta/dump_file.h
@@ -53,7 +53,7 @@
#define log_error_and_return(buffer, length) \
do { \
::dsn::utils::safe_strerror_r(errno, buffer, length); \
- LOG_ERROR_F("append file failed, reason({})", buffer); \
+ LOG_ERROR("append file failed, reason({})", buffer); \
return -1; \
} while (0)
@@ -131,8 +131,8 @@ public:
size_t cnt = fread(raw_mem + len, 1, hdr.length - len, _file_handle);
if (len + cnt < hdr.length) {
if (feof(_file_handle)) {
- LOG_ERROR_F("unexpected file end, start offset of this block ({})",
- ftell(_file_handle) - len - sizeof(hdr));
+ LOG_ERROR("unexpected file end, start offset of this block ({})",
+ ftell(_file_handle) - len - sizeof(hdr));
return -1;
} else if (errno != EINTR) {
log_error_and_return(msg_buffer, 128);
@@ -142,9 +142,9 @@ public:
}
_crc = dsn::utils::crc32_calc(raw_mem, len, _crc);
if (_crc != hdr.crc32) {
- LOG_ERROR_F("file {} data error, block offset({})",
- _filename,
- ftell(_file_handle) - hdr.length - sizeof(hdr));
+ LOG_ERROR("file {} data error, block offset({})",
+ _filename,
+ ftell(_file_handle) - hdr.length - sizeof(hdr));
return -1;
}
diff --git a/src/meta/duplication/duplication_info.cpp b/src/meta/duplication/duplication_info.cpp
index 8c28cfa43..7ea5a479e 100644
--- a/src/meta/duplication/duplication_info.cpp
+++ b/src/meta/duplication/duplication_info.cpp
@@ -48,7 +48,7 @@ namespace replication {
s = it->second;
return true;
}
- LOG_ERROR_F("unexpected duplication_status name: {}", name);
+ LOG_ERROR("unexpected duplication_status name: {}", name);
// for forward compatibility issue, duplication of unexpected status
// will be marked as invisible.
@@ -77,7 +77,7 @@ namespace replication {
fmode = it->second;
return true;
}
- LOG_ERROR_F("unexpected duplication_fail_mode name: {}", name);
+ LOG_ERROR("unexpected duplication_fail_mode name: {}", name);
// marked as default value.
fmode = duplication_fail_mode::FAIL_SLOW;
return false;
@@ -196,7 +196,7 @@ void duplication_info::report_progress_if_time_up()
// progress report is not supposed to be too frequent.
if (dsn_now_ms() > _last_progress_report_ms + PROGRESS_REPORT_PERIOD_MS) {
_last_progress_report_ms = dsn_now_ms();
- LOG_INFO_F("duplication report: {}", to_string());
+ LOG_INFO("duplication report: {}", to_string());
}
}
diff --git a/src/meta/duplication/duplication_info.h b/src/meta/duplication/duplication_info.h
index 7b2fc028d..0708e63d4 100644
--- a/src/meta/duplication/duplication_info.h
+++ b/src/meta/duplication/duplication_info.h
@@ -75,10 +75,10 @@ public:
if (is_duplicating_checkpoint) {
return alter_status(duplication_status::DS_PREPARE);
}
- LOG_WARNING_F("you now create duplication[{}[{}.{}]] without duplicating checkpoint",
- id,
- follower_cluster_name,
- app_name);
+ LOG_WARNING("you now create duplication[{}[{}.{}]] without duplicating checkpoint",
+ id,
+ follower_cluster_name,
+ app_name);
return alter_status(duplication_status::DS_LOG);
}
@@ -169,7 +169,7 @@ public:
return item.second.checkpoint_prepared;
});
if (!completed) {
- LOG_WARNING_F("replica checkpoint still running: {}/{}", prepared, _progress.size());
+ LOG_WARNING("replica checkpoint still running: {}/{}", prepared, _progress.size());
}
return completed;
}
diff --git a/src/meta/duplication/meta_duplication_service.cpp b/src/meta/duplication/meta_duplication_service.cpp
index 36c2ec397..be140c038 100644
--- a/src/meta/duplication/meta_duplication_service.cpp
+++ b/src/meta/duplication/meta_duplication_service.cpp
@@ -35,7 +35,7 @@ using namespace literals::chrono_literals;
void meta_duplication_service::query_duplication_info(const duplication_query_request &request,
duplication_query_response &response)
{
- LOG_INFO_F("query duplication info for app: {}", request.app_name);
+ LOG_INFO("query duplication info for app: {}", request.app_name);
response.err = ERR_OK;
{
@@ -59,12 +59,11 @@ void meta_duplication_service::modify_duplication(duplication_modify_rpc rpc)
const auto &request = rpc.request();
auto &response = rpc.response();
- LOG_INFO_F("modify duplication({}) to [status={},fail_mode={}] for app({})",
- request.dupid,
- request.__isset.status ? duplication_status_to_string(request.status) : "nil",
- request.__isset.fail_mode ? duplication_fail_mode_to_string(request.fail_mode)
- : "nil",
- request.app_name);
+ LOG_INFO("modify duplication({}) to [status={},fail_mode={}] for app({})",
+ request.dupid,
+ request.__isset.status ? duplication_status_to_string(request.status) : "nil",
+ request.__isset.fail_mode ? duplication_fail_mode_to_string(request.fail_mode) : "nil",
+ request.app_name);
dupid_t dupid = request.dupid;
@@ -133,9 +132,9 @@ void meta_duplication_service::add_duplication(duplication_add_rpc rpc)
const auto &request = rpc.request();
auto &response = rpc.response();
- LOG_INFO_F("add duplication for app({}), remote cluster name is {}",
- request.app_name,
- request.remote_cluster_name);
+ LOG_INFO("add duplication for app({}), remote cluster name is {}",
+ request.app_name,
+ request.remote_cluster_name);
response.err = ERR_OK;
@@ -191,7 +190,7 @@ void meta_duplication_service::do_add_duplication(std::shared_ptr<app_state> &ap
{
const auto err = dup->start(rpc.request().is_duplicating_checkpoint);
if (dsn_unlikely(err != ERR_OK)) {
- LOG_ERROR_F("start dup[{}({})] failed: err = {}", app->app_name, dup->id, err.to_string());
+ LOG_ERROR("start dup[{}({})] failed: err = {}", app->app_name, dup->id, err.to_string());
return;
}
blob value = dup->to_json_blob();
@@ -199,10 +198,10 @@ void meta_duplication_service::do_add_duplication(std::shared_ptr<app_state> &ap
std::queue<std::string> nodes({get_duplication_path(*app), std::to_string(dup->id)});
_meta_svc->get_meta_storage()->create_node_recursively(
std::move(nodes), std::move(value), [app, this, dup, rpc]() mutable {
- LOG_INFO_F("[{}] add duplication successfully [app_name: {}, follower: {}]",
- dup->log_prefix(),
- app->app_name,
- dup->follower_cluster_name);
+ LOG_INFO("[{}] add duplication successfully [app_name: {}, follower: {}]",
+ dup->log_prefix(),
+ app->app_name,
+ dup->follower_cluster_name);
// The duplication starts only after it's been persisted.
dup->persist_status();
@@ -252,7 +251,7 @@ void meta_duplication_service::duplication_sync(duplication_sync_rpc rpc)
node_state *ns = get_node_state(_state->_nodes, request.node, false);
if (ns == nullptr) {
- LOG_WARNING_F("node({}) is not found in meta server", request.node.to_string());
+ LOG_WARNING("node({}) is not found in meta server", request.node.to_string());
response.err = ERR_OBJECT_NOT_FOUND;
return;
}
@@ -368,13 +367,13 @@ void meta_duplication_service::create_follower_app_for_duplication(
std::move(value),
[=]() { dup->persist_status(); });
} else {
- LOG_ERROR_F("created follower app[{}.{}] to trigger duplicate checkpoint failed: "
- "duplication_status = {}, create_err = {}, update_err = {}",
- dup->follower_cluster_name,
- dup->app_name,
- duplication_status_to_string(dup->status()),
- create_err.to_string(),
- update_err.to_string());
+ LOG_ERROR("created follower app[{}.{}] to trigger duplicate checkpoint failed: "
+ "duplication_status = {}, create_err = {}, update_err = {}",
+ dup->follower_cluster_name,
+ dup->app_name,
+ duplication_status_to_string(dup->status()),
+ create_err.to_string(),
+ update_err.to_string());
}
});
}
@@ -451,7 +450,7 @@ void meta_duplication_service::check_follower_app_if_create_completed(
std::move(value),
[dup]() { dup->persist_status(); });
} else {
- LOG_ERROR_F(
+ LOG_ERROR(
"query follower app[{}.{}] replica configuration completed, result: "
"duplication_status = {}, query_err = {}, update_err = {}",
dup->follower_cluster_name,
@@ -534,7 +533,7 @@ meta_duplication_service::new_dup_from_init(const std::string &follower_cluster_
// ThreadPool(WRITE): THREAD_POOL_META_STATE
void meta_duplication_service::recover_from_meta_state()
{
- LOG_INFO_F("recovering duplication states from meta storage");
+ LOG_INFO("recovering duplication states from meta storage");
// /<app>/duplication/<dupid>/<partition_idx>
// | |-> confirmed_decree
@@ -558,8 +557,8 @@ void meta_duplication_service::recover_from_meta_state()
dupid_t dup_id;
if (!buf2int32(raw_dup_id, dup_id)) {
// unlikely
- LOG_ERROR_F("invalid duplication path: {}",
- get_duplication_path(*app, raw_dup_id));
+ LOG_ERROR("invalid duplication path: {}",
+ get_duplication_path(*app, raw_dup_id));
return;
}
do_restore_duplication(dup_id, app);
@@ -590,16 +589,16 @@ void meta_duplication_service::do_restore_duplication_progress(
int64_t confirmed_decree = invalid_decree;
if (!buf2int64(value, confirmed_decree)) {
- LOG_ERROR_F("[{}] invalid confirmed_decree {} on partition_idx {}",
- dup->log_prefix(),
- value.to_string(),
- partition_idx);
+ LOG_ERROR("[{}] invalid confirmed_decree {} on partition_idx {}",
+ dup->log_prefix(),
+ value.to_string(),
+ partition_idx);
return; // fail fast
}
dup->init_progress(partition_idx, confirmed_decree);
- LOG_INFO_F(
+ LOG_INFO(
"[{}] initialize progress from metastore [partition_idx: {}, confirmed: {}]",
dup->log_prefix(),
partition_idx,
@@ -623,8 +622,7 @@ void meta_duplication_service::do_restore_duplication(dupid_t dup_id,
auto dup = duplication_info::decode_from_blob(
dup_id, app->app_id, app->app_name, app->partition_count, store_path, json);
if (nullptr == dup) {
- LOG_ERROR_F(
- "failed to decode json \"{}\" on path {}", json.to_string(), store_path);
+ LOG_ERROR("failed to decode json \"{}\" on path {}", json.to_string(), store_path);
return; // fail fast
}
if (!dup->is_invalid_status()) {
diff --git a/src/meta/greedy_load_balancer.cpp b/src/meta/greedy_load_balancer.cpp
index 3487feccf..6c0578247 100644
--- a/src/meta/greedy_load_balancer.cpp
+++ b/src/meta/greedy_load_balancer.cpp
@@ -154,7 +154,7 @@ bool greedy_load_balancer::all_replica_infos_collected(const node_state &ns)
return ns.for_each_partition([this, n](const dsn::gpid &pid) {
config_context &cc = *get_config_context(*(t_global_view->apps), pid);
if (cc.find_from_serving(n) == cc.serving.end()) {
- LOG_INFO_F("meta server hasn't collected gpid({})'s info of {}", pid, n);
+ LOG_INFO("meta server hasn't collected gpid({})'s info of {}", pid, n);
return false;
}
return true;
@@ -186,7 +186,7 @@ void greedy_load_balancer::greedy_balancer(const bool balance_checker)
bool greedy_load_balancer::balance(meta_view view, migration_list &list)
{
- LOG_INFO_F("balancer round");
+ LOG_INFO("balancer round");
list.clear();
t_alive_nodes = view.nodes->size();
@@ -200,7 +200,7 @@ bool greedy_load_balancer::balance(meta_view view, migration_list &list)
bool greedy_load_balancer::check(meta_view view, migration_list &list)
{
- LOG_INFO_F("balance checker round");
+ LOG_INFO("balance checker round");
list.clear();
t_alive_nodes = view.nodes->size();
diff --git a/src/meta/load_balance_policy.cpp b/src/meta/load_balance_policy.cpp
index 75e74c314..a46ae0b15 100644
--- a/src/meta/load_balance_policy.cpp
+++ b/src/meta/load_balance_policy.cpp
@@ -42,7 +42,7 @@ void dump_disk_load(app_id id, const rpc_address &node, bool only_primary, const
load_string << kv.first << ": " << kv.second << std::endl;
}
load_string << ">>>>>>>>>>";
- LOG_DEBUG_F("{}", load_string.str());
+ LOG_DEBUG("{}", load_string.str());
}
bool calc_disk_load(node_mapper &nodes,
@@ -57,11 +57,11 @@ bool calc_disk_load(node_mapper &nodes,
CHECK_NOTNULL(ns, "can't find node({}) from node_state", node.to_string());
auto add_one_replica_to_disk_load = [&](const gpid &pid) {
- LOG_DEBUG_F("add gpid({}) to node({}) disk load", pid, node);
+ LOG_DEBUG("add gpid({}) to node({}) disk load", pid, node);
const config_context &cc = *get_config_context(apps, pid);
auto iter = cc.find_from_serving(node);
if (iter == cc.serving.end()) {
- LOG_WARNING_F(
+ LOG_WARNING(
"can't collect gpid({})'s info from {}, which should be primary", pid, node);
return false;
} else {
@@ -91,7 +91,7 @@ get_node_loads(const std::shared_ptr<app_state> &app,
for (auto iter = nodes.begin(); iter != nodes.end(); ++iter) {
if (!calc_disk_load(
nodes, apps, app->app_id, iter->first, only_primary, node_loads[iter->first])) {
- LOG_WARNING_F(
+ LOG_WARNING(
"stop the balancer as some replica infos aren't collected, node({}), app({})",
iter->first.to_string(),
app->get_logname());
@@ -153,12 +153,12 @@ generate_balancer_request(const app_mapper &apps,
default:
CHECK(false, "");
}
- LOG_INFO_F("generate balancer: {} {} from {} of disk_tag({}) to {}",
- pc.pid,
- ans,
- from,
- get_disk_tag(apps, from, pc.pid),
- to);
+ LOG_INFO("generate balancer: {} {} from {} of disk_tag({}) to {}",
+ pc.pid,
+ ans,
+ from,
+ get_disk_tag(apps, from, pc.pid),
+ to);
return std::make_shared<configuration_balancer_request>(std::move(result));
}
@@ -194,25 +194,24 @@ bool load_balance_policy::primary_balance(const std::shared_ptr<app_state> &app,
CHECK_GE_MSG(_alive_nodes,
FLAGS_min_live_node_count_for_unfreeze,
"too few alive nodes will lead to freeze");
- LOG_INFO_F("primary balancer for app({}:{})", app->app_name, app->app_id);
+ LOG_INFO("primary balancer for app({}:{})", app->app_name, app->app_id);
auto graph = ford_fulkerson::builder(app, *_global_view->nodes, address_id).build();
if (nullptr == graph) {
- LOG_DEBUG_F("the primaries are balanced for app({}:{})", app->app_name, app->app_id);
+ LOG_DEBUG("the primaries are balanced for app({}:{})", app->app_name, app->app_id);
return true;
}
auto path = graph->find_shortest_path();
if (path != nullptr) {
- LOG_DEBUG_F("{} primaries are flew", path->_flow.back());
+ LOG_DEBUG("{} primaries are flew", path->_flow.back());
return move_primary(std::move(path));
} else {
- LOG_INFO_F(
- "we can't make the server load more balanced by moving primaries to secondaries");
+ LOG_INFO("we can't make the server load more balanced by moving primaries to secondaries");
if (!only_move_primary) {
return copy_primary(app, graph->have_less_than_average());
} else {
- LOG_INFO_F("stop to copy primary for app({}) coz it is disabled", app->get_logname());
+ LOG_INFO("stop to copy primary for app({}) coz it is disabled", app->get_logname());
return true;
}
}
@@ -244,9 +243,9 @@ bool load_balance_policy::move_primary(std::unique_ptr<flow_path> path)
int current = path->_prev.back();
if (!calc_disk_load(
nodes, apps, path->_app->app_id, address_vec[current], true, *current_load)) {
- LOG_WARNING_F("stop move primary as some replica infos aren't collected, node({}), app({})",
- address_vec[current].to_string(),
- path->_app->get_logname());
+ LOG_WARNING("stop move primary as some replica infos aren't collected, node({}), app({})",
+ address_vec[current].to_string(),
+ path->_app->get_logname());
return false;
}
@@ -255,7 +254,7 @@ bool load_balance_policy::move_primary(std::unique_ptr<flow_path> path)
rpc_address from = address_vec[path->_prev[current]];
rpc_address to = address_vec[current];
if (!calc_disk_load(nodes, apps, path->_app->app_id, from, true, *prev_load)) {
- LOG_WARNING_F(
+ LOG_WARNING(
"stop move primary as some replica infos aren't collected, node({}), app({})",
from.to_string(),
path->_app->get_logname());
@@ -351,7 +350,7 @@ bool load_balance_policy::execute_balance(
for (const auto &kv : apps) {
const std::shared_ptr<app_state> &app = kv.second;
if (is_ignored_app(kv.first)) {
- LOG_INFO_F("skip to do balance for the ignored app[{}]", app->get_logname());
+ LOG_INFO("skip to do balance for the ignored app[{}]", app->get_logname());
continue;
}
if (app->status != app_status::AS_AVAILABLE || app->is_bulk_loading || app->splitting())
@@ -367,8 +366,8 @@ bool load_balance_policy::execute_balance(
if (!balance_checker) {
if (!_migration_result->empty()) {
if (balance_in_turn) {
- LOG_INFO_F("stop to handle more apps after we found some actions for {}",
- app->get_logname());
+ LOG_INFO("stop to handle more apps after we found some actions for {}",
+ app->get_logname());
return false;
}
}
@@ -751,15 +750,15 @@ bool copy_primary_operation::can_continue()
{
int id_min = *_ordered_address_ids.begin();
if (_have_lower_than_average && _partition_counts[id_min] >= _replicas_low) {
- LOG_INFO_F("{}: stop the copy due to primaries on all nodes will reach low later.",
- _app->get_logname());
+ LOG_INFO("{}: stop the copy due to primaries on all nodes will reach low later.",
+ _app->get_logname());
return false;
}
int id_max = *_ordered_address_ids.rbegin();
if (!_have_lower_than_average && _partition_counts[id_max] - _partition_counts[id_min] <= 1) {
- LOG_INFO_F("{}: stop the copy due to the primary will be balanced later.",
- _app->get_logname());
+ LOG_INFO("{}: stop the copy due to the primary will be balanced later.",
+ _app->get_logname());
return false;
}
return true;
diff --git a/src/meta/meta_backup_service.cpp b/src/meta/meta_backup_service.cpp
index 259b130b5..f51778c97 100644
--- a/src/meta/meta_backup_service.cpp
+++ b/src/meta/meta_backup_service.cpp
@@ -58,7 +58,7 @@ void policy_context::start_backup_app_meta_unlocked(int32_t app_id)
// if app is dropped when app is under backuping, we just skip backup this app this time, and
// also we will not write backup-finish-flag on fds
if (!app_available) {
- LOG_WARNING_F(
+ LOG_WARNING(
"{}: can't encode app_info for app({}), perhaps removed, treat it as backup finished",
_backup_sig,
app_id);
@@ -95,9 +95,9 @@ void policy_context::start_backup_app_meta_unlocked(int32_t app_id)
})
->wait();
if (err != dsn::ERR_OK) {
- LOG_ERROR_F("{}: create file {} failed, restart this backup later",
- _backup_sig,
- create_file_req.file_name);
+ LOG_ERROR("{}: create file {} failed, restart this backup later",
+ _backup_sig,
+ create_file_req.file_name);
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this, app_id]() {
@@ -121,22 +121,22 @@ void policy_context::start_backup_app_meta_unlocked(int32_t app_id)
CHECK_EQ(resp.written_size, buffer.length());
{
zauto_lock l(_lock);
- LOG_INFO_F("{}: successfully backup app metadata to {}",
- _policy.policy_name,
- remote_file->file_name());
+ LOG_INFO("{}: successfully backup app metadata to {}",
+ _policy.policy_name,
+ remote_file->file_name());
start_backup_app_partitions_unlocked(app_id);
}
} else if (resp.err == ERR_FS_INTERNAL) {
zauto_lock l(_lock);
_is_backup_failed = true;
- LOG_ERROR_F("write {} failed, err = {}, don't try again when got this error.",
- remote_file->file_name(),
- resp.err.to_string());
+ LOG_ERROR("write {} failed, err = {}, don't try again when got this error.",
+ remote_file->file_name(),
+ resp.err.to_string());
return;
} else {
- LOG_WARNING_F("write {} failed, reason({}), try it later",
- remote_file->file_name(),
- resp.err);
+ LOG_WARNING("write {} failed, reason({}), try it later",
+ remote_file->file_name(),
+ resp.err);
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this, app_id]() {
@@ -166,8 +166,7 @@ void policy_context::write_backup_app_finish_flag_unlocked(int32_t app_id,
dsn::task_ptr write_callback)
{
if (_progress.is_app_skipped[app_id]) {
- LOG_WARNING_F("app is unavaliable, skip write finish flag for this app(app_id = {})",
- app_id);
+ LOG_WARNING("app is unavaliable, skip write finish flag for this app(app_id = {})", app_id);
if (write_callback != nullptr) {
write_callback->enqueue();
}
@@ -202,9 +201,9 @@ void policy_context::write_backup_app_finish_flag_unlocked(int32_t app_id,
->wait();
if (err != ERR_OK) {
- LOG_ERROR_F("{}: create file {} failed, restart this backup later",
- _backup_sig,
- create_file_req.file_name);
+ LOG_ERROR("{}: create file {} failed, restart this backup later",
+ _backup_sig,
+ create_file_req.file_name);
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this, app_id, write_callback]() {
@@ -223,7 +222,7 @@ void policy_context::write_backup_app_finish_flag_unlocked(int32_t app_id,
if (remote_file->get_size() > 0) {
// we only focus whether app_backup_status file is exist, so ignore app_backup_status file's
// context
- LOG_INFO_F("app({}) already write finish-flag on block service", app_id);
+ LOG_INFO("app({}) already write finish-flag on block service", app_id);
if (write_callback != nullptr) {
write_callback->enqueue();
}
@@ -238,22 +237,22 @@ void policy_context::write_backup_app_finish_flag_unlocked(int32_t app_id,
[this, app_id, write_callback, remote_file](
const dist::block_service::write_response &resp) {
if (resp.err == ERR_OK) {
- LOG_INFO_F("app({}) finish backup and write finish-flag on block service succeed",
- app_id);
+ LOG_INFO("app({}) finish backup and write finish-flag on block service succeed",
+ app_id);
if (write_callback != nullptr) {
write_callback->enqueue();
}
} else if (resp.err == ERR_FS_INTERNAL) {
zauto_lock l(_lock);
_is_backup_failed = true;
- LOG_ERROR_F("write {} failed, err = {}, don't try again when got this error.",
- remote_file->file_name(),
- resp.err.to_string());
+ LOG_ERROR("write {} failed, err = {}, don't try again when got this error.",
+ remote_file->file_name(),
+ resp.err.to_string());
return;
} else {
- LOG_WARNING_F("write {} failed, reason({}), try it later",
- remote_file->file_name(),
- resp.err);
+ LOG_WARNING("write {} failed, reason({}), try it later",
+ remote_file->file_name(),
+ resp.err);
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this, app_id, write_callback]() {
@@ -268,12 +267,12 @@ void policy_context::write_backup_app_finish_flag_unlocked(int32_t app_id,
void policy_context::finish_backup_app_unlocked(int32_t app_id)
{
- LOG_INFO_F("{}: finish backup for app({}), progress({})",
- _backup_sig,
- app_id,
- _progress.unfinished_apps);
+ LOG_INFO("{}: finish backup for app({}), progress({})",
+ _backup_sig,
+ app_id,
+ _progress.unfinished_apps);
if (--_progress.unfinished_apps == 0) {
- LOG_INFO_F("{}: finish current backup for all apps", _backup_sig);
+ LOG_INFO("{}: finish current backup for all apps", _backup_sig);
_cur_backup.end_time_ms = dsn_now_ms();
task_ptr write_backup_info_callback =
@@ -288,7 +287,7 @@ void policy_context::finish_backup_app_unlocked(int32_t app_id)
_cur_backup.backup_id);
_cur_backup.start_time_ms = 0;
_cur_backup.end_time_ms = 0;
- LOG_INFO_F("{}: finish an old backup, try to start a new one", _backup_sig);
+ LOG_INFO("{}: finish an old backup, try to start a new one", _backup_sig);
issue_new_backup_unlocked();
});
sync_backup_to_remote_storage_unlocked(_cur_backup, start_a_new_backup, false);
@@ -318,9 +317,9 @@ void policy_context::write_backup_info_unlocked(const backup_info &b_info,
->wait();
if (err != ERR_OK) {
- LOG_ERROR_F("{}: create file {} failed, restart this backup later",
- _backup_sig,
- create_file_req.file_name);
+ LOG_ERROR("{}: create file {} failed, restart this backup later",
+ _backup_sig,
+ create_file_req.file_name);
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this, b_info, write_callback]() {
@@ -345,22 +344,22 @@ void policy_context::write_backup_info_unlocked(const backup_info &b_info,
[this, b_info, write_callback, remote_file](
const dist::block_service::write_response &resp) {
if (resp.err == ERR_OK) {
- LOG_INFO_F("policy({}) write backup_info to cold backup media succeed",
- _policy.policy_name);
+ LOG_INFO("policy({}) write backup_info to cold backup media succeed",
+ _policy.policy_name);
if (write_callback != nullptr) {
write_callback->enqueue();
}
} else if (resp.err == ERR_FS_INTERNAL) {
zauto_lock l(_lock);
_is_backup_failed = true;
- LOG_ERROR_F("write {} failed, err = {}, don't try again when got this error.",
- remote_file->file_name(),
- resp.err.to_string());
+ LOG_ERROR("write {} failed, err = {}, don't try again when got this error.",
+ remote_file->file_name(),
+ resp.err.to_string());
return;
} else {
- LOG_WARNING_F("write {} failed, reason({}), try it later",
- remote_file->file_name(),
- resp.err);
+ LOG_WARNING("write {} failed, reason({}), try it later",
+ remote_file->file_name(),
+ resp.err);
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this, b_info, write_callback]() {
@@ -379,7 +378,7 @@ bool policy_context::update_partition_progress_unlocked(gpid pid,
{
int32_t &local_progress = _progress.partition_progress[pid];
if (local_progress == cold_backup_constant::PROGRESS_FINISHED) {
- LOG_WARNING_F(
+ LOG_WARNING(
"{}: backup of partition {} has been finished, ignore the backup response from {} ",
_backup_sig,
pid.to_string(),
@@ -388,24 +387,24 @@ bool policy_context::update_partition_progress_unlocked(gpid pid,
}
if (progress < local_progress) {
- LOG_WARNING_F("{}: local backup progress {} is larger than progress {} from server {} for "
- "partition {}, perhaps it's primary has changed",
- _backup_sig,
- local_progress,
- progress,
- source.to_string(),
- pid.to_string());
+ LOG_WARNING("{}: local backup progress {} is larger than progress {} from server {} for "
+ "partition {}, perhaps it's primary has changed",
+ _backup_sig,
+ local_progress,
+ progress,
+ source.to_string(),
+ pid.to_string());
}
local_progress = progress;
- LOG_DEBUG_F(
+ LOG_DEBUG(
"{}: update partition {} backup progress to {}.", _backup_sig, pid.to_string(), progress);
if (local_progress == cold_backup_constant::PROGRESS_FINISHED) {
- LOG_INFO_F("{}: finish backup for partition {}, the app has {} unfinished backup "
- "partition now.",
- _backup_sig,
- pid.to_string(),
- _progress.unfinished_partitions_per_app[pid.get_app_id()]);
+ LOG_INFO("{}: finish backup for partition {}, the app has {} unfinished backup "
+ "partition now.",
+ _backup_sig,
+ pid.to_string(),
+ _progress.unfinished_partitions_per_app[pid.get_app_id()]);
// update the progress-chain: partition => app => current_backup_instance
if (--_progress.unfinished_partitions_per_app[pid.get_app_id()] == 0) {
@@ -435,7 +434,7 @@ void policy_context::start_backup_partition_unlocked(gpid pid)
const app_state *app = _backup_service->get_state()->get_app(pid.get_app_id()).get();
if (app == nullptr || app->status == app_status::AS_DROPPED) {
- LOG_WARNING_F(
+ LOG_WARNING(
"{}: app {} is not available, skip to backup it.", _backup_sig, pid.get_app_id());
_progress.is_app_skipped[pid.get_app_id()] = true;
update_partition_progress_unlocked(
@@ -445,9 +444,9 @@ void policy_context::start_backup_partition_unlocked(gpid pid)
partition_primary = app->partitions[pid.get_partition_index()].primary;
}
if (partition_primary.is_invalid()) {
- LOG_WARNING_F("{}: partition {} doesn't have a primary now, retry to backup it later",
- _backup_sig,
- pid.to_string());
+ LOG_WARNING("{}: partition {} doesn't have a primary now, retry to backup it later",
+ _backup_sig,
+ pid.to_string());
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this, pid]() {
@@ -473,10 +472,10 @@ void policy_context::start_backup_partition_unlocked(gpid pid)
[this, pid, partition_primary](error_code err, backup_response &&response) {
on_backup_reply(err, std::move(response), pid, partition_primary);
});
- LOG_INFO_F("{}: send backup command to partition {}, target_addr = {}",
- _backup_sig,
- pid.to_string(),
- partition_primary.to_string());
+ LOG_INFO("{}: send backup command to partition {}, target_addr = {}",
+ _backup_sig,
+ pid.to_string(),
+ partition_primary.to_string());
_backup_service->get_meta_service()->send_request(request, partition_primary, rpc_callback);
}
@@ -485,10 +484,10 @@ void policy_context::on_backup_reply(error_code err,
gpid pid,
const rpc_address &primary)
{
- LOG_INFO_F("{}: receive backup response for partition {} from server {}.",
- _backup_sig,
- pid.to_string(),
- primary.to_string());
+ LOG_INFO("{}: receive backup response for partition {} from server {}.",
+ _backup_sig,
+ pid.to_string(),
+ primary.to_string());
if (err == dsn::ERR_OK && response.err == dsn::ERR_OK) {
CHECK_EQ_MSG(response.policy_name,
_policy.policy_name,
@@ -509,14 +508,13 @@ void policy_context::on_backup_reply(error_code err,
pid);
if (response.backup_id < _cur_backup.backup_id) {
- LOG_WARNING_F(
- "{}: got a backup response of partition {} from server {}, whose backup id "
- "{} is smaller than current backup id {}, maybe it is a stale message",
- _backup_sig,
- pid.to_string(),
- primary.to_string(),
- response.backup_id,
- _cur_backup.backup_id);
+ LOG_WARNING("{}: got a backup response of partition {} from server {}, whose backup id "
+ "{} is smaller than current backup id {}, maybe it is a stale message",
+ _backup_sig,
+ pid.to_string(),
+ primary.to_string(),
+ response.backup_id,
+ _cur_backup.backup_id);
} else {
zauto_lock l(_lock);
record_partition_checkpoint_size_unlock(pid, response.checkpoint_total_size);
@@ -528,15 +526,15 @@ void policy_context::on_backup_reply(error_code err,
} else if (response.err == dsn::ERR_LOCAL_APP_FAILURE) {
zauto_lock l(_lock);
_is_backup_failed = true;
- LOG_ERROR_F("{}: backup got error {} for partition {} from {}, don't try again when got "
- "this error.",
- _backup_sig.c_str(),
- response.err.to_string(),
- pid.to_string(),
- primary.to_string());
+ LOG_ERROR("{}: backup got error {} for partition {} from {}, don't try again when got "
+ "this error.",
+ _backup_sig.c_str(),
+ response.err.to_string(),
+ pid.to_string(),
+ primary.to_string());
return;
} else {
- LOG_WARNING_F(
+ LOG_WARNING(
"{}: backup got error for partition {} from {}, rpc error {}, response error {}",
_backup_sig.c_str(),
pid.to_string(),
@@ -570,12 +568,12 @@ void policy_context::initialize_backup_progress_unlocked()
const std::shared_ptr<app_state> &app = _backup_service->get_state()->get_app(app_id);
_progress.is_app_skipped[app_id] = true;
if (app == nullptr) {
- LOG_WARNING_F("{}: app id({}) is invalid", _policy.policy_name, app_id);
+ LOG_WARNING("{}: app id({}) is invalid", _policy.policy_name, app_id);
} else if (app->status != app_status::AS_AVAILABLE) {
- LOG_WARNING_F("{}: {} is not available, status({})",
- _policy.policy_name,
- app->get_logname(),
- enum_to_string(app->status));
+ LOG_WARNING("{}: {} is not available, status({})",
+ _policy.policy_name,
+ app->get_logname(),
+ enum_to_string(app->status));
} else {
// NOTICE: only available apps have entry in
// unfinished_partitions_per_app & partition_progress & app_chkpt_size
@@ -614,20 +612,20 @@ void policy_context::sync_backup_to_remote_storage_unlocked(const backup_info &b
auto callback = [this, b_info, sync_callback, create_new_node](dsn::error_code err) {
if (dsn::ERR_OK == err || (create_new_node && ERR_NODE_ALREADY_EXIST == err)) {
- LOG_INFO_F("{}: synced backup_info({}) to remote storage successfully, "
- "start real backup work, new_node_create({})",
- _policy.policy_name,
- b_info.backup_id,
- create_new_node ? "true" : "false");
+ LOG_INFO("{}: synced backup_info({}) to remote storage successfully, "
+ "start real backup work, new_node_create({})",
+ _policy.policy_name,
+ b_info.backup_id,
+ create_new_node ? "true" : "false");
if (sync_callback != nullptr) {
sync_callback->enqueue();
} else {
- LOG_WARNING_F("{}: empty callback", _policy.policy_name);
+ LOG_WARNING("{}: empty callback", _policy.policy_name);
}
} else if (ERR_TIMEOUT == err) {
- LOG_ERROR_F("{}: sync backup info({}) to remote storage got timeout, retry it later",
- _policy.policy_name,
- b_info.backup_id);
+ LOG_ERROR("{}: sync backup info({}) to remote storage got timeout, retry it later",
+ _policy.policy_name,
+ b_info.backup_id);
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this, b_info, sync_callback, create_new_node]() {
@@ -657,8 +655,8 @@ void policy_context::sync_backup_to_remote_storage_unlocked(const backup_info &b
void policy_context::continue_current_backup_unlocked()
{
if (_policy.is_disable) {
- LOG_INFO_F("{}: policy is disabled, ignore this backup and try it later",
- _policy.policy_name);
+ LOG_INFO("{}: policy is disabled, ignore this backup and try it later",
+ _policy.policy_name);
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this]() {
@@ -743,7 +741,7 @@ void policy_context::issue_new_backup_unlocked()
{
// before issue new backup, we check whether the policy is dropped
if (_policy.is_disable) {
- LOG_INFO_F("{}: policy is disabled, just ignore backup, try it later", _policy.policy_name);
+ LOG_INFO("{}: policy is disabled, just ignore backup, try it later", _policy.policy_name);
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this]() {
@@ -764,9 +762,9 @@ void policy_context::issue_new_backup_unlocked()
},
0,
_backup_service->backup_option().issue_backup_interval_ms);
- LOG_INFO_F("{}: start issue new backup {}ms later",
- _policy.policy_name,
- _backup_service->backup_option().issue_backup_interval_ms.count());
+ LOG_INFO("{}: start issue new backup {}ms later",
+ _policy.policy_name,
+ _backup_service->backup_option().issue_backup_interval_ms.count());
return;
}
@@ -774,8 +772,8 @@ void policy_context::issue_new_backup_unlocked()
// if all apps are dropped, we don't issue a new backup
if (_progress.unfinished_partitions_per_app.empty()) {
// TODO: just ignore this backup and wait next backup
- LOG_WARNING_F("{}: all apps have been dropped, ignore this backup and retry it later",
- _backup_sig);
+ LOG_WARNING("{}: all apps have been dropped, ignore this backup and retry it later",
+ _backup_sig);
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this]() {
@@ -812,17 +810,17 @@ void policy_context::start()
"policy recent backup duration time");
issue_gc_backup_info_task_unlocked();
- LOG_INFO_F("{}: start gc backup info task succeed", _policy.policy_name);
+ LOG_INFO("{}: start gc backup info task succeed", _policy.policy_name);
}
void policy_context::add_backup_history(const backup_info &info)
{
zauto_lock l(_lock);
if (info.end_time_ms <= 0) {
- LOG_INFO_F("{}: encounter an unfished backup_info({}), start_time({}), continue it later",
- _policy.policy_name,
- info.backup_id,
- info.start_time_ms);
+ LOG_INFO("{}: encounter an unfished backup_info({}), start_time({}), continue it later",
+ _policy.policy_name,
+ info.backup_id,
+ info.start_time_ms);
CHECK_EQ_MSG(_cur_backup.start_time_ms,
0,
@@ -840,11 +838,11 @@ void policy_context::add_backup_history(const backup_info &info)
_backup_sig =
_policy.policy_name + "@" + boost::lexical_cast<std::string>(_cur_backup.backup_id);
} else {
- LOG_INFO_F("{}: add backup history, id({}), start_time({}), endtime({})",
- _policy.policy_name,
- info.backup_id,
- info.start_time_ms,
- info.end_time_ms);
+ LOG_INFO("{}: add backup history, id({}), start_time({}), endtime({})",
+ _policy.policy_name,
+ info.backup_id,
+ info.start_time_ms,
+ info.end_time_ms);
CHECK(_cur_backup.end_time_ms == 0 || info.backup_id < _cur_backup.backup_id,
"{}: backup_id({}) in history larger than current({})",
_policy.policy_name,
@@ -913,11 +911,11 @@ void policy_context::gc_backup_info_unlocked(const backup_info &info_to_gc)
::dsn::utils::time_ms_to_date_time(
static_cast<uint64_t>(info_to_gc.start_time_ms), start_time, 30);
::dsn::utils::time_ms_to_date_time(static_cast<uint64_t>(info_to_gc.end_time_ms), end_time, 30);
- LOG_INFO_F("{}: start to gc backup info, backup_id({}), start_time({}), end_time({})",
- _policy.policy_name,
- info_to_gc.backup_id,
- start_time,
- end_time);
+ LOG_INFO("{}: start to gc backup info, backup_id({}), start_time({}), end_time({})",
+ _policy.policy_name,
+ info_to_gc.backup_id,
+ start_time,
+ end_time);
dsn::task_ptr sync_callback =
::dsn::tasking::create_task(LPC_DEFAULT_CALLBACK, &_tracker, [this, info_to_gc]() {
@@ -939,7 +937,7 @@ void policy_context::gc_backup_info_unlocked(const backup_info &info_to_gc)
});
sync_remove_backup_info(info_to_gc, remove_local_backup_info_task);
} else { // ERR_FS_INTERNAL, ERR_TIMEOUT, ERR_DIR_NOT_EMPTY
- LOG_WARNING_F(
+ LOG_WARNING(
"{}: gc backup info, id({}) failed, with err = {}, just try again",
_policy.policy_name,
info_to_gc.backup_id,
@@ -956,7 +954,7 @@ void policy_context::issue_gc_backup_info_task_unlocked()
if (_backup_history.size() > _policy.backup_history_count_to_keep) {
backup_info &info = _backup_history.begin()->second;
info.info_status = backup_info_status::type::DELETING;
- LOG_INFO_F("{}: start to gc backup info with id({})", _policy.policy_name, info.backup_id);
+ LOG_INFO("{}: start to gc backup info with id({})", _policy.policy_name, info.backup_id);
tasking::create_task(LPC_DEFAULT_CALLBACK, &_tracker, [this, info]() {
gc_backup_info_unlocked(info);
@@ -964,7 +962,7 @@ void policy_context::issue_gc_backup_info_task_unlocked()
} else {
// there is no extra backup to gc, we just issue a new task to call
// issue_gc_backup_info_task_unlocked later
- LOG_DEBUG_F("{}: no need to gc backup info, start it later", _policy.policy_name);
+ LOG_DEBUG("{}: no need to gc backup info, start it later", _policy.policy_name);
tasking::create_task(LPC_DEFAULT_CALLBACK, &_tracker, [this]() {
zauto_lock l(_lock);
issue_gc_backup_info_task_unlocked();
@@ -994,15 +992,15 @@ void policy_context::sync_remove_backup_info(const backup_info &info, dsn::task_
_backup_service->get_backup_path(_policy.policy_name, info.backup_id);
auto callback = [this, info, sync_callback](dsn::error_code err) {
if (err == dsn::ERR_OK || err == dsn::ERR_OBJECT_NOT_FOUND) {
- LOG_INFO_F("{}: sync remove backup_info on remote storage successfully, backup_id({})",
- _policy.policy_name,
- info.backup_id);
+ LOG_INFO("{}: sync remove backup_info on remote storage successfully, backup_id({})",
+ _policy.policy_name,
+ info.backup_id);
if (sync_callback != nullptr) {
sync_callback->enqueue();
}
} else if (err == ERR_TIMEOUT) {
- LOG_ERROR_F("{}: sync remove backup info on remote storage got timeout, retry it later",
- _policy.policy_name);
+ LOG_ERROR("{}: sync remove backup info on remote storage got timeout, retry it later",
+ _policy.policy_name);
tasking::enqueue(
LPC_DEFAULT_CALLBACK,
&_tracker,
@@ -1044,15 +1042,15 @@ backup_service::backup_service(meta_service *meta_svc,
void backup_service::start_create_policy_meta_root(dsn::task_ptr callback)
{
- LOG_DEBUG_F("create policy meta root({}) on remote_storage", _policy_meta_root);
+ LOG_DEBUG("create policy meta root({}) on remote_storage", _policy_meta_root);
_meta_svc->get_remote_storage()->create_node(
_policy_meta_root, LPC_DEFAULT_CALLBACK, [this, callback](dsn::error_code err) {
if (err == dsn::ERR_OK || err == ERR_NODE_ALREADY_EXIST) {
- LOG_INFO_F(
+ LOG_INFO(
"create policy meta root({}) succeed, with err({})", _policy_meta_root, err);
callback->enqueue();
} else if (err == dsn::ERR_TIMEOUT) {
- LOG_ERROR_F("create policy meta root({}) timeout, try it later", _policy_meta_root);
+ LOG_ERROR("create policy meta root({}) timeout, try it later", _policy_meta_root);
dsn::tasking::enqueue(
LPC_DEFAULT_CALLBACK,
&_tracker,
@@ -1069,20 +1067,20 @@ void backup_service::start_sync_policies()
{
// TODO: make sync_policies_from_remote_storage function to async
// sync-api will leader to deadlock when the threadnum = 1 in default threadpool
- LOG_INFO_F("backup service start to sync policies from remote storage");
+ LOG_INFO("backup service start to sync policies from remote storage");
dsn::error_code err = sync_policies_from_remote_storage();
if (err == dsn::ERR_OK) {
for (auto &policy_kv : _policy_states) {
- LOG_INFO_F("policy({}) start to backup", policy_kv.first);
+ LOG_INFO("policy({}) start to backup", policy_kv.first);
policy_kv.second->start();
}
if (_policy_states.empty()) {
- LOG_WARNING_F(
+ LOG_WARNING(
"can't sync policies from remote storage, user should config some policies");
}
_in_initialize.store(false);
} else if (err == dsn::ERR_TIMEOUT) {
- LOG_ERROR_F("sync policies got timeout, retry it later");
+ LOG_ERROR("sync policies got timeout, retry it later");
dsn::tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
std::bind(&backup_service::start_sync_policies, this),
@@ -1106,7 +1104,7 @@ error_code backup_service::sync_policies_from_remote_storage()
auto init_backup_info = [this, &err, &tracker](const std::string &policy_name) {
auto after_get_backup_info = [this, &err, policy_name](error_code ec, const blob &value) {
if (ec == ERR_OK) {
- LOG_DEBUG_F("sync a backup string({}) from remote storage", value.data());
+ LOG_DEBUG("sync a backup string({}) from remote storage", value.data());
backup_info tbackup_info;
dsn::json::json_forwarder<backup_info>::decode(value, tbackup_info);
@@ -1123,7 +1121,7 @@ error_code backup_service::sync_policies_from_remote_storage()
ptr->add_backup_history(tbackup_info);
} else {
err = ec;
- LOG_INFO_F("init backup_info from remote storage fail, error_code = {}", ec);
+ LOG_INFO("init backup_info from remote storage fail, error_code = {}", ec);
}
};
std::string backup_info_root = get_policy_path(policy_name);
@@ -1138,9 +1136,9 @@ error_code backup_service::sync_policies_from_remote_storage()
for (const auto &b_id : children) {
int64_t backup_id = boost::lexical_cast<int64_t>(b_id);
std::string backup_path = get_backup_path(policy_name, backup_id);
- LOG_INFO_F("start to acquire backup_info({}) of policy({})",
- backup_id,
- policy_name);
+ LOG_INFO("start to acquire backup_info({}) of policy({})",
+ backup_id,
+ policy_name);
_meta_svc->get_remote_storage()->get_data(
backup_path,
TASK_CODE_EXEC_INLINED,
@@ -1149,15 +1147,15 @@ error_code backup_service::sync_policies_from_remote_storage()
}
} else // have not backup
{
- LOG_INFO_F("policy has not started a backup process, policy_name = {}",
- policy_name);
+ LOG_INFO("policy has not started a backup process, policy_name = {}",
+ policy_name);
}
} else {
err = ec;
- LOG_ERROR_F("get backup info dirs fail from remote storage, backup_dirs_root = "
- "{}, err = {}",
- get_policy_path(policy_name),
- ec);
+ LOG_ERROR("get backup info dirs fail from remote storage, backup_dirs_root = "
+ "{}, err = {}",
+ get_policy_path(policy_name),
+ ec);
}
},
&tracker);
@@ -1166,7 +1164,7 @@ error_code backup_service::sync_policies_from_remote_storage()
auto init_one_policy =
[this, &err, &tracker, &init_backup_info](const std::string &policy_name) {
auto policy_path = get_policy_path(policy_name);
- LOG_INFO_F("start to acquire the context of policy({})", policy_name);
+ LOG_INFO("start to acquire the context of policy({})", policy_name);
_meta_svc->get_remote_storage()->get_data(
policy_path,
LPC_DEFAULT_CALLBACK, // TASK_CODE_EXEC_INLINED,
@@ -1185,7 +1183,7 @@ error_code backup_service::sync_policies_from_remote_storage()
init_backup_info(policy_name);
} else {
err = ec;
- LOG_ERROR_F(
+ LOG_ERROR(
"init policy fail, policy_path = {}, error_code = {}", policy_path, ec);
}
},
@@ -1203,7 +1201,7 @@ error_code backup_service::sync_policies_from_remote_storage()
}
} else {
err = ec;
- LOG_ERROR_F("get policy dirs from remote storage fail, error_code = {}", ec);
+ LOG_ERROR("get policy dirs from remote storage fail, error_code = {}", ec);
}
},
&tracker);
@@ -1247,9 +1245,9 @@ void backup_service::add_backup_policy(dsn::message_ex *msg)
for (auto &app_id : request.app_ids) {
const std::shared_ptr<app_state> &app = _state->get_app(app_id);
if (app == nullptr) {
- LOG_ERROR_F("app {} doesn't exist, policy {} shouldn't be added.",
- app_id,
- request.policy_name);
+ LOG_ERROR("app {} doesn't exist, policy {} shouldn't be added.",
+ app_id,
+ request.policy_name);
response.err = ERR_INVALID_PARAMETERS;
response.hint_message = "invalid app " + std::to_string(app_id);
_meta_svc->reply_data(msg, response);
@@ -1283,7 +1281,7 @@ void backup_service::add_backup_policy(dsn::message_ex *msg)
return;
}
- LOG_INFO_F("start to add backup polciy {}.", request.policy_name);
+ LOG_INFO("start to add backup polciy {}.", request.policy_name);
std::shared_ptr<policy_context> policy_context_ptr = _factory(this);
CHECK_NOTNULL(policy_context_ptr, "invalid policy_context");
policy p;
@@ -1314,7 +1312,7 @@ void backup_service::do_add_policy(dsn::message_ex *req,
configuration_add_backup_policy_response resp;
resp.hint_message = hint_msg;
resp.err = ERR_OK;
- LOG_INFO_F("add backup policy succeed, policy_name = {}", policy_name);
+ LOG_INFO("add backup policy succeed, policy_name = {}", policy_name);
_meta_svc->reply_data(req, resp);
req->release_ref();
@@ -1324,8 +1322,8 @@ void backup_service::do_add_policy(dsn::message_ex *req,
}
p->start();
} else if (err == ERR_TIMEOUT) {
- LOG_ERROR_F("create backup policy on remote storage timeout, retry after {} ms",
- _opt.meta_retry_delay_ms.count());
+ LOG_ERROR("create backup policy on remote storage timeout, retry after {} ms",
+ _opt.meta_retry_delay_ms.count());
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
std::bind(&backup_service::do_add_policy, this, req, p, hint_msg),
@@ -1353,14 +1351,14 @@ void backup_service::do_update_policy_to_remote_storage(
if (err == ERR_OK) {
configuration_modify_backup_policy_response resp;
resp.err = ERR_OK;
- LOG_INFO_F("update backup policy to remote storage succeed, policy_name = {}",
- p.policy_name);
+ LOG_INFO("update backup policy to remote storage succeed, policy_name = {}",
+ p.policy_name);
p_context_ptr->set_policy(p);
} else if (err == ERR_TIMEOUT) {
- LOG_ERROR_F("update backup policy to remote storage failed, policy_name = {}, "
- "retry after {} ms",
- p.policy_name,
- _opt.meta_retry_delay_ms.count());
+ LOG_ERROR("update backup policy to remote storage failed, policy_name = {}, "
+ "retry after {} ms",
+ p.policy_name,
+ _opt.meta_retry_delay_ms.count());
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
std::bind(&backup_service::do_update_policy_to_remote_storage,
@@ -1488,9 +1486,9 @@ void backup_service::modify_backup_policy(configuration_modify_backup_policy_rpc
const auto &app = _state->get_app(appid);
// TODO: if app is dropped, how to process
if (app == nullptr) {
- LOG_WARNING_F("{}: add app to policy failed, because invalid app({}), ignore it",
- cur_policy.policy_name,
- appid);
+ LOG_WARNING("{}: add app to policy failed, because invalid app({}), ignore it",
+ cur_policy.policy_name,
+ appid);
} else {
valid_app_ids_to_add.emplace_back(appid);
id_to_app_names.insert(std::make_pair(appid, app->app_name));
@@ -1502,23 +1500,23 @@ void backup_service::modify_backup_policy(configuration_modify_backup_policy_rpc
if (request.__isset.is_disable) {
if (request.is_disable) {
if (is_under_backup) {
- LOG_INFO_F("{}: policy is under backuping, not allow to disable",
- cur_policy.policy_name);
+ LOG_INFO("{}: policy is under backuping, not allow to disable",
+ cur_policy.policy_name);
response.err = ERR_BUSY;
} else if (!cur_policy.is_disable) {
- LOG_INFO_F("{}: policy is marked to disable", cur_policy.policy_name);
+ LOG_INFO("{}: policy is marked to disable", cur_policy.policy_name);
cur_policy.is_disable = true;
have_modify_policy = true;
} else { // cur_policy.is_disable = true
- LOG_INFO_F("{}: policy is already disabled", cur_policy.policy_name);
+ LOG_INFO("{}: policy is already disabled", cur_policy.policy_name);
}
} else {
if (cur_policy.is_disable) {
cur_policy.is_disable = false;
- LOG_INFO_F("{}: policy is marked to enable", cur_policy.policy_name);
+ LOG_INFO("{}: policy is marked to enable", cur_policy.policy_name);
have_modify_policy = true;
} else {
- LOG_INFO_F("{}: policy is already enabled", cur_policy.policy_name);
+ LOG_INFO("{}: policy is already enabled", cur_policy.policy_name);
response.err = ERR_OK;
response.hint_message = std::string("policy is already enabled");
}
@@ -1537,35 +1535,35 @@ void backup_service::modify_backup_policy(configuration_modify_backup_policy_rpc
for (const auto &appid : request.removal_appids) {
if (appid > 0) {
cur_policy.app_ids.erase(appid);
- LOG_INFO_F("{}: remove app({}) to policy", cur_policy.policy_name, appid);
+ LOG_INFO("{}: remove app({}) to policy", cur_policy.policy_name, appid);
have_modify_policy = true;
} else {
- LOG_WARNING_F("{}: invalid app_id({})", cur_policy.policy_name, appid);
+ LOG_WARNING("{}: invalid app_id({})", cur_policy.policy_name, appid);
}
}
}
if (request.__isset.new_backup_interval_sec) {
if (request.new_backup_interval_sec > 0) {
- LOG_INFO_F("{}: policy will change backup interval from {}s to {}s",
- cur_policy.policy_name,
- cur_policy.backup_interval_seconds,
- request.new_backup_interval_sec);
+ LOG_INFO("{}: policy will change backup interval from {}s to {}s",
+ cur_policy.policy_name,
+ cur_policy.backup_interval_seconds,
+ request.new_backup_interval_sec);
cur_policy.backup_interval_seconds = request.new_backup_interval_sec;
have_modify_policy = true;
} else {
- LOG_WARNING_F("{}: invalid backup_interval_sec({})",
- cur_policy.policy_name,
- request.new_backup_interval_sec);
+ LOG_WARNING("{}: invalid backup_interval_sec({})",
+ cur_policy.policy_name,
+ request.new_backup_interval_sec);
}
}
if (request.__isset.backup_history_count_to_keep) {
if (request.backup_history_count_to_keep > 0) {
- LOG_INFO_F("{}: policy will change backup_history_count_to_keep from {} to {}",
- cur_policy.policy_name,
- cur_policy.backup_history_count_to_keep,
- request.backup_history_count_to_keep);
+ LOG_INFO("{}: policy will change backup_history_count_to_keep from {} to {}",
+ cur_policy.policy_name,
+ cur_policy.backup_history_count_to_keep,
+ request.backup_history_count_to_keep);
cur_policy.backup_history_count_to_keep = request.backup_history_count_to_keep;
have_modify_policy = true;
}
@@ -1574,10 +1572,10 @@ void backup_service::modify_backup_policy(configuration_modify_backup_policy_rpc
if (request.__isset.start_time) {
backup_start_time t_start_time;
if (t_start_time.parse_from(request.start_time)) {
- LOG_INFO_F("{}: policy change start_time from {} to {}",
- cur_policy.policy_name,
- cur_policy.start_time,
- t_start_time);
+ LOG_INFO("{}: policy change start_time from {} to {}",
+ cur_policy.policy_name,
+ cur_policy.start_time,
+ t_start_time);
cur_policy.start_time = t_start_time;
have_modify_policy = true;
}
diff --git a/src/meta/meta_bulk_load_ingestion_context.cpp b/src/meta/meta_bulk_load_ingestion_context.cpp
index 8f3897b0c..67ff9030c 100644
--- a/src/meta/meta_bulk_load_ingestion_context.cpp
+++ b/src/meta/meta_bulk_load_ingestion_context.cpp
@@ -81,20 +81,20 @@ bool ingestion_context::node_context::check_if_add(const std::string &disk_tag)
{
auto max_node_ingestion_count = FLAGS_bulk_load_node_max_ingesting_count;
if (node_ingesting_count >= max_node_ingestion_count) {
- LOG_WARNING_F("node[{}] has {} partition executing ingestion, max_count = {}",
- address.to_string(),
- node_ingesting_count,
- max_node_ingestion_count);
+ LOG_WARNING("node[{}] has {} partition executing ingestion, max_count = {}",
+ address.to_string(),
+ node_ingesting_count,
+ max_node_ingestion_count);
return false;
}
auto max_disk_ingestion_count = get_max_disk_ingestion_count(max_node_ingestion_count);
if (disk_ingesting_counts[disk_tag] >= max_disk_ingestion_count) {
- LOG_WARNING_F("node[{}] disk[{}] has {} partition executing ingestion, max_count = {}",
- address.to_string(),
- disk_tag,
- disk_ingesting_counts[disk_tag],
- max_disk_ingestion_count);
+ LOG_WARNING("node[{}] disk[{}] has {} partition executing ingestion, max_count = {}",
+ address.to_string(),
+ disk_tag,
+ disk_ingesting_counts[disk_tag],
+ max_disk_ingestion_count);
return false;
}
return true;
diff --git a/src/meta/meta_bulk_load_service.cpp b/src/meta/meta_bulk_load_service.cpp
index 5030f4573..d2807e2b9 100644
--- a/src/meta/meta_bulk_load_service.cpp
+++ b/src/meta/meta_bulk_load_service.cpp
@@ -78,7 +78,7 @@ void bulk_load_service::on_start_bulk_load(start_bulk_load_rpc rpc)
if (!FLAGS_enable_concurrent_bulk_load &&
!_meta_svc->try_lock_meta_op_status(meta_op_status::BULKLOAD)) {
response.hint_msg = "meta server is busy now, please wait";
- LOG_ERROR_F("{}", response.hint_msg);
+ LOG_ERROR("{}", response.hint_msg);
response.err = ERR_BUSY;
return;
}
@@ -88,14 +88,14 @@ void bulk_load_service::on_start_bulk_load(start_bulk_load_rpc rpc)
response.err = app == nullptr ? ERR_APP_NOT_EXIST : ERR_APP_DROPPED;
response.hint_msg = fmt::format(
"app {} is ", response.err == ERR_APP_NOT_EXIST ? "not existed" : "not available");
- LOG_ERROR_F("{}", response.hint_msg);
+ LOG_ERROR("{}", response.hint_msg);
_meta_svc->unlock_meta_op_status();
return;
}
if (app->is_bulk_loading) {
response.err = ERR_BUSY;
response.hint_msg = fmt::format("app({}) is already executing bulk load", app->app_name);
- LOG_ERROR_F("{}", response.hint_msg);
+ LOG_ERROR("{}", response.hint_msg);
_meta_svc->unlock_meta_op_status();
return;
}
@@ -110,13 +110,13 @@ void bulk_load_service::on_start_bulk_load(start_bulk_load_rpc rpc)
return;
}
- LOG_INFO_F("app({}) start bulk load, cluster_name = {}, provider = {}, remote root path = {}, "
- "ingest_behind = {}",
- request.app_name,
- request.cluster_name,
- request.file_provider_type,
- request.remote_root_path,
- request.ingest_behind);
+ LOG_INFO("app({}) start bulk load, cluster_name = {}, provider = {}, remote root path = {}, "
+ "ingest_behind = {}",
+ request.app_name,
+ request.cluster_name,
+ request.file_provider_type,
+ request.remote_root_path,
+ request.ingest_behind);
// clear old bulk load result
reset_local_bulk_load_states(app->app_id, app->app_name, true);
@@ -142,7 +142,7 @@ bulk_load_service::check_bulk_load_request_params(const start_bulk_load_request
if (!validate_ingest_behind(envs, request.ingest_behind)) {
hint_msg = fmt::format("inconsistent ingestion behind option");
- LOG_ERROR_F("{}", hint_msg);
+ LOG_ERROR("{}", hint_msg);
return ERR_INCONSISTENT_STATE;
}
@@ -151,7 +151,7 @@ bulk_load_service::check_bulk_load_request_params(const start_bulk_load_request
dsn::dist::block_service::block_filesystem *blk_fs =
_meta_svc->get_block_service_manager().get_or_create_block_filesystem(file_provider);
if (blk_fs == nullptr) {
- LOG_ERROR_F("invalid remote file provider type: {}", file_provider);
+ LOG_ERROR("invalid remote file provider type: {}", file_provider);
hint_msg = "invalid file_provider";
return ERR_INVALID_PARAMETERS;
}
@@ -174,7 +174,7 @@ bulk_load_service::check_bulk_load_request_params(const start_bulk_load_request
})
->wait();
if (err != ERR_OK || file_handler == nullptr) {
- LOG_ERROR_F(
+ LOG_ERROR(
"failed to get file({}) handler on remote provider({})", remote_path, file_provider);
hint_msg = "file_provider error";
return ERR_FILE_OPERATION_FAILED;
@@ -188,29 +188,29 @@ bulk_load_service::check_bulk_load_request_params(const start_bulk_load_request
[&r_resp](const dsn::dist::block_service::read_response &resp) { r_resp = resp; })
->wait();
if (r_resp.err != ERR_OK) {
- LOG_ERROR_F("failed to read file({}) on remote provider({}), error = {}",
- remote_path,
- file_provider,
- r_resp.err.to_string());
+ LOG_ERROR("failed to read file({}) on remote provider({}), error = {}",
+ remote_path,
+ file_provider,
+ r_resp.err.to_string());
hint_msg = "read bulk_load_info failed";
return r_resp.err;
}
bulk_load_info bl_info;
if (!::dsn::json::json_forwarder<bulk_load_info>::decode(r_resp.buffer, bl_info)) {
- LOG_ERROR_F("file({}) is damaged on remote file provider({})", remote_path, file_provider);
+ LOG_ERROR("file({}) is damaged on remote file provider({})", remote_path, file_provider);
hint_msg = "bulk_load_info damaged";
return ERR_CORRUPTION;
}
if (bl_info.app_id != app_id || bl_info.partition_count != partition_count) {
- LOG_ERROR_F("app({}) information is inconsistent, local app_id({}) VS remote app_id({}), "
- "local partition_count({}) VS remote partition_count({})",
- request.app_name,
- app_id,
- bl_info.app_id,
- partition_count,
- bl_info.partition_count);
+ LOG_ERROR("app({}) information is inconsistent, local app_id({}) VS remote app_id({}), "
+ "local partition_count({}) VS remote partition_count({})",
+ request.app_name,
+ app_id,
+ bl_info.app_id,
+ partition_count,
+ bl_info.partition_count);
hint_msg = "app_id or partition_count is inconsistent";
return ERR_INCONSISTENT_STATE;
}
@@ -265,12 +265,12 @@ void bulk_load_service::create_app_bulk_load_dir(const std::string &app_name,
_meta_svc->get_meta_storage()->delete_node_recursively(
get_app_bulk_load_path(app_id), [this, rpc, ainfo]() {
std::string bulk_load_path = get_app_bulk_load_path(ainfo.app_id);
- LOG_INFO_F("remove app({}) bulk load dir {} succeed", ainfo.app_name, bulk_load_path);
+ LOG_INFO("remove app({}) bulk load dir {} succeed", ainfo.app_name, bulk_load_path);
blob value = dsn::json::json_forwarder<app_bulk_load_info>::encode(ainfo);
_meta_svc->get_meta_storage()->create_node(
std::move(bulk_load_path), std::move(value), [this, rpc, ainfo]() {
- LOG_DEBUG_F("create app({}) bulk load dir", ainfo.app_name);
+ LOG_DEBUG("create app({}) bulk load dir", ainfo.app_name);
{
zauto_write_lock l(_lock);
_app_bulk_load_info[ainfo.app_id] = ainfo;
@@ -302,13 +302,13 @@ void bulk_load_service::create_partition_bulk_load_dir(const std::string &app_na
get_partition_bulk_load_path(pid),
std::move(value),
[app_name, pid, partition_count, rpc, pinfo, this]() {
- LOG_DEBUG_F("app({}) create partition({}) bulk_load_info", app_name, pid.to_string());
+ LOG_DEBUG("app({}) create partition({}) bulk_load_info", app_name, pid.to_string());
{
zauto_write_lock l(_lock);
_partition_bulk_load_info[pid] = pinfo;
_partitions_pending_sync_flag[pid] = false;
if (--_apps_in_progress_count[pid.get_app_id()] == 0) {
- LOG_INFO_F("app({}) start bulk load succeed", app_name);
+ LOG_INFO("app({}) start bulk load succeed", app_name);
_apps_in_progress_count[pid.get_app_id()] = partition_count;
rpc.response().err = ERR_OK;
}
@@ -328,7 +328,7 @@ bool bulk_load_service::check_partition_status(
{
std::shared_ptr<app_state> app = get_app(pid.get_app_id());
if (app == nullptr || app->status != app_status::AS_AVAILABLE) {
- LOG_WARNING_F(
+ LOG_WARNING(
"app(name={}, id={}, status={}) is not existed or not available, set bulk load failed",
app_name,
pid.get_app_id(),
@@ -339,7 +339,7 @@ bool bulk_load_service::check_partition_status(
pconfig = app->partitions[pid.get_partition_index()];
if (pconfig.primary.is_invalid()) {
- LOG_WARNING_F("app({}) partition({}) primary is invalid, try it later", app_name, pid);
+ LOG_WARNING("app({}) partition({}) primary is invalid, try it later", app_name, pid);
tasking::enqueue(LPC_META_STATE_NORMAL,
_meta_svc->tracker(),
[retry_function, app_name, pid]() { retry_function(app_name, pid); },
@@ -362,10 +362,10 @@ bool bulk_load_service::check_partition_status(
p_status == bulk_load_status::BLS_FAILED)) {
return true;
}
- LOG_WARNING_F("app({}) partition({}) is unhealthy, status({}), try it later",
- app_name,
- pid,
- dsn::enum_to_string(p_status));
+ LOG_WARNING("app({}) partition({}) is unhealthy, status({}), try it later",
+ app_name,
+ pid,
+ dsn::enum_to_string(p_status));
tasking::enqueue(LPC_META_STATE_NORMAL,
_meta_svc->tracker(),
[retry_function, app_name, pid]() { retry_function(app_name, pid); },
@@ -409,15 +409,15 @@ void bulk_load_service::partition_bulk_load(const std::string &app_name, const g
req->remote_root_path = ainfo.remote_root_path;
}
- LOG_INFO_F("send bulk load request to node({}), app({}), partition({}), partition "
- "status = {}, remote provider = {}, cluster_name = {}, remote_root_path = {}",
- primary_addr.to_string(),
- app_name,
- pid,
- dsn::enum_to_string(req->meta_bulk_load_status),
- req->remote_provider_name,
- req->cluster_name,
- req->remote_root_path);
+ LOG_INFO("send bulk load request to node({}), app({}), partition({}), partition "
+ "status = {}, remote provider = {}, cluster_name = {}, remote_root_path = {}",
+ primary_addr.to_string(),
+ app_name,
+ pid,
+ dsn::enum_to_string(req->meta_bulk_load_status),
+ req->remote_provider_name,
+ req->cluster_name,
+ req->remote_root_path);
bulk_load_rpc rpc(std::move(req), RPC_BULK_LOAD, 0_ms, 0, pid.thread_hash());
rpc.call(primary_addr, _meta_svc->tracker(), [this, rpc](error_code err) mutable {
@@ -435,7 +435,7 @@ void bulk_load_service::on_partition_bulk_load_reply(error_code err,
const rpc_address &primary_addr = request.primary_addr;
if (err != ERR_OK) {
- LOG_ERROR_F(
+ LOG_ERROR(
"app({}), partition({}) failed to receive bulk load response from node({}), error = {}",
app_name,
pid,
@@ -447,7 +447,7 @@ void bulk_load_service::on_partition_bulk_load_reply(error_code err,
}
if (response.err == ERR_OBJECT_NOT_FOUND || response.err == ERR_INVALID_STATE) {
- LOG_ERROR_F(
+ LOG_ERROR(
"app({}), partition({}) doesn't exist or has invalid state on node({}), error = {}",
app_name,
pid,
@@ -459,7 +459,7 @@ void bulk_load_service::on_partition_bulk_load_reply(error_code err,
}
if (response.err == ERR_BUSY) {
- LOG_WARNING_F(
+ LOG_WARNING(
"node({}) has enough replicas downloading, wait for next round to send bulk load "
"request for app({}), partition({})",
primary_addr.to_string(),
@@ -470,14 +470,13 @@ void bulk_load_service::on_partition_bulk_load_reply(error_code err,
}
if (response.err != ERR_OK) {
- LOG_ERROR_F(
- "app({}), partition({}) from node({}) handle bulk load response failed, error = "
- "{}, primary status = {}",
- app_name,
- pid,
- primary_addr.to_string(),
- response.err.to_string(),
- dsn::enum_to_string(response.primary_bulk_load_status));
+ LOG_ERROR("app({}), partition({}) from node({}) handle bulk load response failed, error = "
+ "{}, primary status = {}",
+ app_name,
+ pid,
+ primary_addr.to_string(),
+ response.err.to_string(),
+ dsn::enum_to_string(response.primary_bulk_load_status));
handle_bulk_load_failed(pid.get_app_id(), response.err);
try_resend_bulk_load_request(app_name, pid);
return;
@@ -486,14 +485,14 @@ void bulk_load_service::on_partition_bulk_load_reply(error_code err,
// response.err = ERR_OK
std::shared_ptr<app_state> app = get_app(pid.get_app_id());
if (app == nullptr || app->status != app_status::AS_AVAILABLE) {
- LOG_WARNING_F(
+ LOG_WARNING(
"app(name={}, id={}) is not existed, set bulk load failed", app_name, pid.get_app_id());
handle_app_unavailable(pid.get_app_id(), app_name);
return;
}
ballot current_ballot = app->partitions[pid.get_partition_index()].ballot;
if (request.ballot < current_ballot) {
- LOG_WARNING_F(
+ LOG_WARNING(
"receive out-date response from node({}), app({}), partition({}), request ballot = "
"{}, current ballot= {}",
primary_addr.to_string(),
@@ -561,7 +560,7 @@ void bulk_load_service::handle_app_downloading(const bulk_load_response &respons
const gpid &pid = response.pid;
if (!response.__isset.total_download_progress) {
- LOG_WARNING_F(
+ LOG_WARNING(
"receive bulk load response from node({}) app({}), partition({}), primary_status({}), "
"but total_download_progress is not set",
primary_addr.to_string(),
@@ -575,23 +574,23 @@ void bulk_load_service::handle_app_downloading(const bulk_load_response &respons
const auto &bulk_load_states = kv.second;
if (!bulk_load_states.__isset.download_progress ||
!bulk_load_states.__isset.download_status) {
- LOG_WARNING_F("receive bulk load response from node({}) app({}), partition({}), "
- "primary_status({}), but node({}) progress or status is not set",
- primary_addr.to_string(),
- app_name,
- pid,
- dsn::enum_to_string(response.primary_bulk_load_status),
- kv.first.to_string());
+ LOG_WARNING("receive bulk load response from node({}) app({}), partition({}), "
+ "primary_status({}), but node({}) progress or status is not set",
+ primary_addr.to_string(),
+ app_name,
+ pid,
+ dsn::enum_to_string(response.primary_bulk_load_status),
+ kv.first.to_string());
return;
}
// check partition download status
if (bulk_load_states.download_status != ERR_OK) {
- LOG_ERROR_F("app({}) partition({}) on node({}) meet unrecoverable error during "
- "downloading files, error = {}",
- app_name,
- pid,
- kv.first.to_string(),
- bulk_load_states.download_status);
+ LOG_ERROR("app({}) partition({}) on node({}) meet unrecoverable error during "
+ "downloading files, error = {}",
+ app_name,
+ pid,
+ kv.first.to_string(),
+ bulk_load_states.download_status);
error_code err = ERR_UNKNOWN;
// ERR_FILE_OPERATION_FAILED: local file system error
@@ -614,14 +613,13 @@ void bulk_load_service::handle_app_downloading(const bulk_load_response &respons
// update download progress
int32_t total_progress = response.total_download_progress;
- LOG_INFO_F(
- "receive bulk load response from node({}) app({}) partition({}), primary_status({}), "
- "total_download_progress = {}",
- primary_addr.to_string(),
- app_name,
- pid,
- dsn::enum_to_string(response.primary_bulk_load_status),
- total_progress);
+ LOG_INFO("receive bulk load response from node({}) app({}) partition({}), primary_status({}), "
+ "total_download_progress = {}",
+ primary_addr.to_string(),
+ app_name,
+ pid,
+ dsn::enum_to_string(response.primary_bulk_load_status),
+ total_progress);
{
zauto_write_lock l(_lock);
_partitions_total_download_progress[pid] = total_progress;
@@ -630,7 +628,7 @@ void bulk_load_service::handle_app_downloading(const bulk_load_response &respons
// update partition status to `downloaded` if all replica downloaded
if (total_progress >= bulk_load_constant::PROGRESS_FINISHED) {
- LOG_INFO_F(
+ LOG_INFO(
"app({}) partirion({}) download all files from remote provider succeed", app_name, pid);
update_partition_info_on_remote_storage(app_name, pid, bulk_load_status::BLS_DOWNLOADED);
}
@@ -644,54 +642,53 @@ void bulk_load_service::handle_app_ingestion(const bulk_load_response &response,
const gpid &pid = response.pid;
if (!response.__isset.is_group_ingestion_finished) {
- LOG_WARNING_F("receive bulk load response from node({}) app({}) partition({}), "
- "primary_status({}), but is_group_ingestion_finished is not set",
- primary_addr.to_string(),
- app_name,
- pid,
- dsn::enum_to_string(response.primary_bulk_load_status));
+ LOG_WARNING("receive bulk load response from node({}) app({}) partition({}), "
+ "primary_status({}), but is_group_ingestion_finished is not set",
+ primary_addr.to_string(),
+ app_name,
+ pid,
+ dsn::enum_to_string(response.primary_bulk_load_status));
return;
}
for (const auto &kv : response.group_bulk_load_state) {
const auto &bulk_load_states = kv.second;
if (!bulk_load_states.__isset.ingest_status) {
- LOG_WARNING_F("receive bulk load response from node({}) app({}) partition({}), "
- "primary_status({}), but node({}) ingestion_status is not set",
- primary_addr.to_string(),
- app_name,
- pid,
- dsn::enum_to_string(response.primary_bulk_load_status),
- kv.first.to_string());
+ LOG_WARNING("receive bulk load response from node({}) app({}) partition({}), "
+ "primary_status({}), but node({}) ingestion_status is not set",
+ primary_addr.to_string(),
+ app_name,
+ pid,
+ dsn::enum_to_string(response.primary_bulk_load_status),
+ kv.first.to_string());
return;
}
if (bulk_load_states.ingest_status == ingestion_status::IS_FAILED) {
- LOG_ERROR_F("app({}) partition({}) on node({}) ingestion failed",
- app_name,
- pid,
- kv.first.to_string());
+ LOG_ERROR("app({}) partition({}) on node({}) ingestion failed",
+ app_name,
+ pid,
+ kv.first.to_string());
finish_ingestion(pid);
handle_bulk_load_failed(pid.get_app_id(), ERR_INGESTION_FAILED);
return;
}
}
- LOG_INFO_F(
- "receive bulk load response from node({}) app({}) partition({}), primary_status({}), "
- "is_group_ingestion_finished = {}",
- primary_addr.to_string(),
- app_name,
- pid,
- dsn::enum_to_string(response.primary_bulk_load_status),
- response.is_group_ingestion_finished);
+ LOG_INFO("receive bulk load response from node({}) app({}) partition({}), primary_status({}), "
+ "is_group_ingestion_finished = {}",
+ primary_addr.to_string(),
+ app_name,
+ pid,
+ dsn::enum_to_string(response.primary_bulk_load_status),
+ response.is_group_ingestion_finished);
{
zauto_write_lock l(_lock);
_partitions_bulk_load_state[pid] = response.group_bulk_load_state;
}
if (response.is_group_ingestion_finished) {
- LOG_INFO_F("app({}) partition({}) ingestion files succeed", app_name, pid);
+ LOG_INFO("app({}) partition({}) ingestion files succeed", app_name, pid);
finish_ingestion(pid);
update_partition_info_on_remote_storage(app_name, pid, bulk_load_status::BLS_SUCCEED);
}
@@ -705,24 +702,24 @@ void bulk_load_service::handle_bulk_load_finish(const bulk_load_response &respon
const gpid &pid = response.pid;
if (!response.__isset.is_group_bulk_load_context_cleaned_up) {
- LOG_WARNING_F("receive bulk load response from node({}) app({}) partition({}), "
- "primary_status({}), but is_group_bulk_load_context_cleaned_up is not set",
- primary_addr.to_string(),
- app_name,
- pid,
- dsn::enum_to_string(response.primary_bulk_load_status));
+ LOG_WARNING("receive bulk load response from node({}) app({}) partition({}), "
+ "primary_status({}), but is_group_bulk_load_context_cleaned_up is not set",
+ primary_addr.to_string(),
+ app_name,
+ pid,
+ dsn::enum_to_string(response.primary_bulk_load_status));
return;
}
for (const auto &kv : response.group_bulk_load_state) {
if (!kv.second.__isset.is_cleaned_up) {
- LOG_WARNING_F("receive bulk load response from node({}) app({}), partition({}), "
- "primary_status({}), but node({}) is_cleaned_up is not set",
- primary_addr.to_string(),
- app_name,
- pid,
- dsn::enum_to_string(response.primary_bulk_load_status),
- kv.first.to_string());
+ LOG_WARNING("receive bulk load response from node({}) app({}), partition({}), "
+ "primary_status({}), but node({}) is_cleaned_up is not set",
+ primary_addr.to_string(),
+ app_name,
+ pid,
+ dsn::enum_to_string(response.primary_bulk_load_status),
+ kv.first.to_string());
return;
}
}
@@ -730,7 +727,7 @@ void bulk_load_service::handle_bulk_load_finish(const bulk_load_response &respon
{
zauto_read_lock l(_lock);
if (_partitions_cleaned_up[pid]) {
- LOG_WARNING_F(
+ LOG_WARNING(
"receive bulk load response from node({}) app({}) partition({}), current partition "
"has already been cleaned up",
primary_addr.to_string(),
@@ -742,14 +739,13 @@ void bulk_load_service::handle_bulk_load_finish(const bulk_load_response &respon
// The replicas have cleaned up their bulk load states and removed temporary sst files
bool group_cleaned_up = response.is_group_bulk_load_context_cleaned_up;
- LOG_INFO_F(
- "receive bulk load response from node({}) app({}) partition({}), primary status = {}, "
- "is_group_bulk_load_context_cleaned_up = {}",
- primary_addr.to_string(),
- app_name,
- pid,
- dsn::enum_to_string(response.primary_bulk_load_status),
- group_cleaned_up);
+ LOG_INFO("receive bulk load response from node({}) app({}) partition({}), primary status = {}, "
+ "is_group_bulk_load_context_cleaned_up = {}",
+ primary_addr.to_string(),
+ app_name,
+ pid,
+ dsn::enum_to_string(response.primary_bulk_load_status),
+ group_cleaned_up);
{
zauto_write_lock l(_lock);
_partitions_cleaned_up[pid] = group_cleaned_up;
@@ -765,14 +761,14 @@ void bulk_load_service::handle_bulk_load_finish(const bulk_load_response &respon
if (count == 0) {
std::shared_ptr<app_state> app = get_app(pid.get_app_id());
if (app == nullptr || app->status != app_status::AS_AVAILABLE) {
- LOG_WARNING_F("app(name={}, id={}) is not existed, remove bulk load dir on remote "
- "storage",
- app_name,
- pid.get_app_id());
+ LOG_WARNING("app(name={}, id={}) is not existed, remove bulk load dir on remote "
+ "storage",
+ app_name,
+ pid.get_app_id());
remove_bulk_load_dir_on_remote_storage(pid.get_app_id(), app_name);
return;
}
- LOG_INFO_F("app({}) update app to not bulk loading", app_name);
+ LOG_INFO("app({}) update app to not bulk loading", app_name);
update_app_not_bulk_loading_on_remote_storage(std::move(app));
reset_local_bulk_load_states(pid.get_app_id(), app_name, false);
}
@@ -787,44 +783,43 @@ void bulk_load_service::handle_app_pausing(const bulk_load_response &response,
const gpid &pid = response.pid;
if (!response.__isset.is_group_bulk_load_paused) {
- LOG_WARNING_F("receive bulk load response from node({}) app({}) partition({}), "
- "primary_status({}), but is_group_bulk_load_paused is not set",
- primary_addr.to_string(),
- app_name,
- pid,
- dsn::enum_to_string(response.primary_bulk_load_status));
+ LOG_WARNING("receive bulk load response from node({}) app({}) partition({}), "
+ "primary_status({}), but is_group_bulk_load_paused is not set",
+ primary_addr.to_string(),
+ app_name,
+ pid,
+ dsn::enum_to_string(response.primary_bulk_load_status));
return;
}
for (const auto &kv : response.group_bulk_load_state) {
if (!kv.second.__isset.is_paused) {
- LOG_WARNING_F("receive bulk load response from node({}) app({}), partition({}), "
- "primary_status({}), but node({}) is_paused is not set",
- primary_addr.to_string(),
- app_name,
- pid,
- dsn::enum_to_string(response.primary_bulk_load_status),
- kv.first.to_string());
+ LOG_WARNING("receive bulk load response from node({}) app({}), partition({}), "
+ "primary_status({}), but node({}) is_paused is not set",
+ primary_addr.to_string(),
+ app_name,
+ pid,
+ dsn::enum_to_string(response.primary_bulk_load_status),
+ kv.first.to_string());
return;
}
}
bool is_group_paused = response.is_group_bulk_load_paused;
- LOG_INFO_F(
- "receive bulk load response from node({}) app({}) partition({}), primary status = {}, "
- "is_group_bulk_load_paused = {}",
- primary_addr.to_string(),
- app_name,
- pid,
- dsn::enum_to_string(response.primary_bulk_load_status),
- is_group_paused);
+ LOG_INFO("receive bulk load response from node({}) app({}) partition({}), primary status = {}, "
+ "is_group_bulk_load_paused = {}",
+ primary_addr.to_string(),
+ app_name,
+ pid,
+ dsn::enum_to_string(response.primary_bulk_load_status),
+ is_group_paused);
{
zauto_write_lock l(_lock);
_partitions_bulk_load_state[pid] = response.group_bulk_load_state;
}
if (is_group_paused) {
- LOG_INFO_F("app({}) partirion({}) pause bulk load succeed", response.app_name, pid);
+ LOG_INFO("app({}) partirion({}) pause bulk load succeed", response.app_name, pid);
update_partition_info_on_remote_storage(
response.app_name, pid, bulk_load_status::BLS_PAUSED);
}
@@ -839,18 +834,18 @@ void bulk_load_service::try_rollback_to_downloading(const std::string &app_name,
if (app_status != bulk_load_status::BLS_DOWNLOADING &&
app_status != bulk_load_status::BLS_DOWNLOADED &&
app_status != bulk_load_status::BLS_INGESTING) {
- LOG_INFO_F("app({}) status={}, no need to rollback to downloading, wait for next round",
- app_name,
- dsn::enum_to_string(app_status));
+ LOG_INFO("app({}) status={}, no need to rollback to downloading, wait for next round",
+ app_name,
+ dsn::enum_to_string(app_status));
return;
}
if (_apps_rolling_back[pid.get_app_id()]) {
- LOG_WARNING_F("app({}) is rolling back to downloading, ignore this request", app_name);
+ LOG_WARNING("app({}) is rolling back to downloading, ignore this request", app_name);
return;
}
if (_apps_rollback_count[pid.get_app_id()] >= FLAGS_bulk_load_max_rollback_times) {
- LOG_WARNING_F(
+ LOG_WARNING(
"app({}) has been rollback to downloading for {} times, make bulk load process failed",
app_name,
_apps_rollback_count[pid.get_app_id()]);
@@ -862,11 +857,11 @@ void bulk_load_service::try_rollback_to_downloading(const std::string &app_name,
: ERR_RETRY_EXHAUSTED);
return;
}
- LOG_INFO_F("app({}) will rolling back from {} to {}, current rollback_count = {}",
- app_name,
- dsn::enum_to_string(app_status),
- dsn::enum_to_string(bulk_load_status::BLS_DOWNLOADING),
- _apps_rollback_count[pid.get_app_id()]);
+ LOG_INFO("app({}) will rolling back from {} to {}, current rollback_count = {}",
+ app_name,
+ dsn::enum_to_string(app_status),
+ dsn::enum_to_string(bulk_load_status::BLS_DOWNLOADING),
+ _apps_rollback_count[pid.get_app_id()]);
_apps_rolling_back[pid.get_app_id()] = true;
_apps_rollback_count[pid.get_app_id()]++;
update_app_status_on_remote_storage_unlocked(pid.get_app_id(),
@@ -906,7 +901,7 @@ void bulk_load_service::update_partition_metadata_on_remote_storage(
get_partition_bulk_load_path(pid), std::move(value), [this, app_name, pid, pinfo]() {
zauto_write_lock l(_lock);
_partition_bulk_load_info[pid] = pinfo;
- LOG_INFO_F(
+ LOG_INFO(
"app({}) update partition({}) bulk load metadata, file count = {}, file size = {}",
app_name,
pid,
@@ -924,18 +919,18 @@ void bulk_load_service::update_partition_info_on_remote_storage(const std::strin
zauto_write_lock l(_lock);
partition_bulk_load_info pinfo = _partition_bulk_load_info[pid];
if (pinfo.status == new_status && new_status != bulk_load_status::BLS_DOWNLOADING) {
- LOG_WARNING_F("app({}) partition({}) old status:{} VS new status:{}, ignore it",
- app_name,
- pid,
- dsn::enum_to_string(pinfo.status),
- dsn::enum_to_string(new_status));
+ LOG_WARNING("app({}) partition({}) old status:{} VS new status:{}, ignore it",
+ app_name,
+ pid,
+ dsn::enum_to_string(pinfo.status),
+ dsn::enum_to_string(new_status));
return;
}
if (_partitions_pending_sync_flag[pid]) {
if (_apps_rolling_back[pid.get_app_id()] &&
new_status == bulk_load_status::BLS_DOWNLOADING) {
- LOG_WARNING_F(
+ LOG_WARNING(
"app({}) partition({}) has already sync bulk load status, current_status = {}, "
"wait and retry to set status as {}",
app_name,
@@ -953,12 +948,12 @@ void bulk_load_service::update_partition_info_on_remote_storage(const std::strin
0,
std::chrono::seconds(1));
} else {
- LOG_INFO_F("app({}) partition({}) has already sync bulk load status, current_status = "
- "{}, new_status = {}, wait for next round",
- app_name,
- pid,
- dsn::enum_to_string(pinfo.status),
- dsn::enum_to_string(new_status));
+ LOG_INFO("app({}) partition({}) has already sync bulk load status, current_status = "
+ "{}, new_status = {}, wait for next round",
+ app_name,
+ pid,
+ dsn::enum_to_string(pinfo.status),
+ dsn::enum_to_string(new_status));
}
return;
}
@@ -1013,11 +1008,11 @@ void bulk_load_service::update_partition_info_on_remote_storage_reply(
_partition_bulk_load_info[pid] = new_info;
_partitions_pending_sync_flag[pid] = false;
- LOG_INFO_F("app({}) update partition({}) status from {} to {}",
- app_name,
- pid,
- dsn::enum_to_string(old_status),
- dsn::enum_to_string(new_status));
+ LOG_INFO("app({}) update partition({}) status from {} to {}",
+ app_name,
+ pid,
+ dsn::enum_to_string(old_status),
+ dsn::enum_to_string(new_status));
switch (new_status) {
case bulk_load_status::BLS_DOWNLOADED:
@@ -1038,7 +1033,7 @@ void bulk_load_service::update_partition_info_on_remote_storage_reply(
_apps_in_progress_count[pid.get_app_id()] =
_app_bulk_load_info[pid.get_app_id()].partition_count;
_apps_rolling_back[pid.get_app_id()] = false;
- LOG_INFO_F("app({}) restart to bulk load", app_name);
+ LOG_INFO("app({}) restart to bulk load", app_name);
}
} break;
default:
@@ -1062,20 +1057,19 @@ void bulk_load_service::update_app_status_on_remote_storage_unlocked(
auto old_status = ainfo.status;
if (old_status == new_status && new_status != bulk_load_status::BLS_DOWNLOADING) {
- LOG_WARNING_F("app({}) old status:{} VS new status:{}, ignore it",
- ainfo.app_name,
- dsn::enum_to_string(old_status),
- dsn::enum_to_string(new_status));
+ LOG_WARNING("app({}) old status:{} VS new status:{}, ignore it",
+ ainfo.app_name,
+ dsn::enum_to_string(old_status),
+ dsn::enum_to_string(new_status));
return;
}
if (_apps_pending_sync_flag[app_id]) {
- LOG_INFO_F(
- "app({}) has already sync bulk load status, wait and retry, current status = {}, "
- "new status = {}",
- ainfo.app_name,
- dsn::enum_to_string(old_status),
- dsn::enum_to_string(new_status));
+ LOG_INFO("app({}) has already sync bulk load status, wait and retry, current status = {}, "
+ "new status = {}",
+ ainfo.app_name,
+ dsn::enum_to_string(old_status),
+ dsn::enum_to_string(new_status));
tasking::enqueue(LPC_META_STATE_NORMAL,
_meta_svc->tracker(),
std::bind(&bulk_load_service::update_app_status_on_remote_storage_unlocked,
@@ -1129,10 +1123,10 @@ void bulk_load_service::update_app_status_on_remote_storage_reply(const app_bulk
}
}
- LOG_INFO_F("update app({}) status from {} to {}",
- ainfo.app_name,
- dsn::enum_to_string(old_status),
- dsn::enum_to_string(new_status));
+ LOG_INFO("update app({}) status from {} to {}",
+ ainfo.app_name,
+ dsn::enum_to_string(old_status),
+ dsn::enum_to_string(new_status));
if (new_status == bulk_load_status::BLS_INGESTING) {
for (auto i = 0; i < partition_count; ++i) {
@@ -1175,14 +1169,14 @@ bool bulk_load_service::check_ever_ingestion_succeed(const partition_configurati
std::sort(pinfo.addresses.begin(), pinfo.addresses.end());
std::sort(current_nodes.begin(), current_nodes.end());
if (current_nodes == pinfo.addresses) {
- LOG_INFO_F("app({}) partition({}) has already executed ingestion succeed", app_name, pid);
+ LOG_INFO("app({}) partition({}) has already executed ingestion succeed", app_name, pid);
update_partition_info_on_remote_storage(app_name, pid, bulk_load_status::BLS_SUCCEED);
return true;
}
- LOG_WARNING_F("app({}) partition({}) configuration changed, should executed ingestion again",
- app_name,
- pid);
+ LOG_WARNING("app({}) partition({}) configuration changed, should executed ingestion again",
+ app_name,
+ pid);
return false;
}
@@ -1193,17 +1187,17 @@ void bulk_load_service::partition_ingestion(const std::string &app_name, const g
auto app_status = get_app_bulk_load_status(pid.get_app_id());
if (app_status != bulk_load_status::BLS_INGESTING) {
- LOG_WARNING_F("app({}) current status is {}, partition({}), ignore it",
- app_name,
- dsn::enum_to_string(app_status),
- pid);
+ LOG_WARNING("app({}) current status is {}, partition({}), ignore it",
+ app_name,
+ dsn::enum_to_string(app_status),
+ pid);
return;
}
if (is_partition_metadata_not_updated(pid)) {
- LOG_ERROR_F("app({}) partition({}) doesn't have bulk load metadata, set bulk load failed",
- app_name,
- pid);
+ LOG_ERROR("app({}) partition({}) doesn't have bulk load metadata, set bulk load failed",
+ app_name,
+ pid);
handle_bulk_load_failed(pid.get_app_id(), ERR_CORRUPTION);
return;
}
@@ -1226,7 +1220,7 @@ void bulk_load_service::partition_ingestion(const std::string &app_name, const g
auto app = get_app(pid.get_app_id());
if (!try_partition_ingestion(pconfig, app->helpers->contexts[pid.get_partition_index()])) {
- LOG_WARNING_F(
+ LOG_WARNING(
"app({}) partition({}) couldn't execute ingestion, wait and try later", app_name, pid);
tasking::enqueue(LPC_META_STATE_NORMAL,
_meta_svc->tracker(),
@@ -1280,10 +1274,10 @@ void bulk_load_service::send_ingestion_request(const std::string &app_name,
on_partition_ingestion_reply(err, std::move(resp), app_name, pid, primary_addr);
});
_meta_svc->send_request(msg, primary_addr, rpc_callback);
- LOG_INFO_F("send ingest_request to node({}), app({}) partition({})",
- primary_addr.to_string(),
- app_name,
- pid);
+ LOG_INFO("send ingest_request to node({}), app({}) partition({})",
+ primary_addr.to_string(),
+ app_name,
+ pid);
}
// ThreadPool: THREAD_POOL_DEFAULT
@@ -1298,7 +1292,7 @@ void bulk_load_service::on_partition_ingestion_reply(error_code err,
}
if (err == ERR_NO_NEED_OPERATE) {
- LOG_WARNING_F(
+ LOG_WARNING(
"app({}) partition({}) on node({}) has already executing ingestion, ignore this "
"repeated request",
app_name,
@@ -1309,11 +1303,11 @@ void bulk_load_service::on_partition_ingestion_reply(error_code err,
// if meet 2pc error, ingesting will rollback to downloading, no need to retry here
if (err != ERR_OK) {
- LOG_ERROR_F("app({}) partition({}) on node({}) ingestion files failed, error = {}",
- app_name,
- pid,
- primary_addr.to_string(),
- err);
+ LOG_ERROR("app({}) partition({}) on node({}) ingestion files failed, error = {}",
+ app_name,
+ pid,
+ primary_addr.to_string(),
+ err);
tasking::enqueue(
LPC_META_STATE_NORMAL,
_meta_svc->tracker(),
@@ -1322,13 +1316,13 @@ void bulk_load_service::on_partition_ingestion_reply(error_code err,
}
if (resp.err == ERR_TRY_AGAIN && resp.rocksdb_error != 0) {
- LOG_ERROR_F("app({}) partition({}) on node({}) ingestion files failed while empty write, "
- "rocksdb error = "
- "{}, retry it later",
- app_name,
- pid,
- primary_addr.to_string(),
- resp.rocksdb_error);
+ LOG_ERROR("app({}) partition({}) on node({}) ingestion files failed while empty write, "
+ "rocksdb error = "
+ "{}, retry it later",
+ app_name,
+ pid,
+ primary_addr.to_string(),
+ resp.rocksdb_error);
tasking::enqueue(LPC_BULK_LOAD_INGESTION,
_meta_svc->tracker(),
std::bind(&bulk_load_service::partition_ingestion, this, app_name, pid),
@@ -1340,7 +1334,7 @@ void bulk_load_service::on_partition_ingestion_reply(error_code err,
// some unexpected errors happened, such as write empty write failed but rocksdb_error is ok
// stop bulk load process with failed
if (resp.err != ERR_OK || resp.rocksdb_error != 0) {
- LOG_ERROR_F(
+ LOG_ERROR(
"app({}) partition({}) on node({}) failed to ingestion files, error = {}, rocksdb "
"error = {}",
app_name,
@@ -1358,10 +1352,10 @@ void bulk_load_service::on_partition_ingestion_reply(error_code err,
return;
}
- LOG_INFO_F("app({}) partition({}) receive ingestion response from node({}) succeed",
- app_name,
- pid,
- primary_addr.to_string());
+ LOG_INFO("app({}) partition({}) receive ingestion response from node({}) succeed",
+ app_name,
+ pid,
+ primary_addr.to_string());
}
// ThreadPool: THREAD_POOL_META_STATE
@@ -1371,7 +1365,7 @@ void bulk_load_service::remove_bulk_load_dir_on_remote_storage(int32_t app_id,
std::string bulk_load_path = get_app_bulk_load_path(app_id);
_meta_svc->get_meta_storage()->delete_node_recursively(
std::move(bulk_load_path), [this, app_id, app_name, bulk_load_path]() {
- LOG_INFO_F("remove app({}) bulk load dir {} succeed", app_name, bulk_load_path);
+ LOG_INFO("remove app({}) bulk load dir {} succeed", app_name, bulk_load_path);
reset_local_bulk_load_states(app_id, app_name, true);
});
}
@@ -1383,7 +1377,7 @@ void bulk_load_service::remove_bulk_load_dir_on_remote_storage(std::shared_ptr<a
std::string bulk_load_path = get_app_bulk_load_path(app->app_id);
_meta_svc->get_meta_storage()->delete_node_recursively(
std::move(bulk_load_path), [this, app, set_app_not_bulk_loading, bulk_load_path]() {
- LOG_INFO_F("remove app({}) bulk load dir {} succeed", app->app_name, bulk_load_path);
+ LOG_INFO("remove app({}) bulk load dir {} succeed", app->app_name, bulk_load_path);
reset_local_bulk_load_states(app->app_id, app->app_name, true);
if (set_app_not_bulk_loading) {
update_app_not_bulk_loading_on_remote_storage(std::move(app));
@@ -1426,7 +1420,7 @@ void bulk_load_service::reset_local_bulk_load_states_unlocked(int32_t app_id,
_apps_cleaning_up.erase(app_id);
}
- LOG_INFO_F(
+ LOG_INFO(
"reset local app({}) bulk load context, is_reset_result({})", app_name, is_reset_result);
}
@@ -1451,7 +1445,7 @@ void bulk_load_service::update_app_not_bulk_loading_on_remote_storage(
_state->get_app_path(*app), std::move(value), [app, this]() {
zauto_write_lock l(app_lock());
app->is_bulk_loading = false;
- LOG_INFO_F("app({}) update app is_bulk_loading to false", app->app_name);
+ LOG_INFO("app({}) update app is_bulk_loading to false", app->app_name);
_meta_svc->unlock_meta_op_status();
});
}
@@ -1466,14 +1460,14 @@ void bulk_load_service::on_control_bulk_load(control_bulk_load_rpc rpc)
std::shared_ptr<app_state> app = get_app(app_name);
if (app == nullptr || app->status != app_status::AS_AVAILABLE) {
- LOG_ERROR_F("app({}) is not existed or not available", app_name);
+ LOG_ERROR("app({}) is not existed or not available", app_name);
response.err = app == nullptr ? ERR_APP_NOT_EXIST : ERR_APP_DROPPED;
response.__set_hint_msg(fmt::format("app({}) is not existed or not available", app_name));
return;
}
if (!app->is_bulk_loading) {
- LOG_ERROR_F("app({}) is not executing bulk load", app_name);
+ LOG_ERROR("app({}) is not executing bulk load", app_name);
response.err = ERR_INACTIVE_STATE;
response.__set_hint_msg(fmt::format("app({}) is not executing bulk load", app_name));
return;
@@ -1488,12 +1482,12 @@ void bulk_load_service::on_control_bulk_load(control_bulk_load_rpc rpc)
auto hint_msg = fmt::format("can not pause bulk load for app({}) with status({})",
app_name,
dsn::enum_to_string(app_status));
- LOG_ERROR_F("{}", hint_msg);
+ LOG_ERROR("{}", hint_msg);
response.err = ERR_INVALID_STATE;
response.__set_hint_msg(hint_msg);
return;
}
- LOG_INFO_F("app({}) start to pause bulk load", app_name);
+ LOG_INFO("app({}) start to pause bulk load", app_name);
update_app_status_on_remote_storage_unlocked(app_id, bulk_load_status::BLS_PAUSING);
} break;
case bulk_load_control_type::BLC_RESTART: {
@@ -1501,12 +1495,12 @@ void bulk_load_service::on_control_bulk_load(control_bulk_load_rpc rpc)
auto hint_msg = fmt::format("can not restart bulk load for app({}) with status({})",
app_name,
dsn::enum_to_string(app_status));
- LOG_ERROR_F("{}", hint_msg);
+ LOG_ERROR("{}", hint_msg);
response.err = ERR_INVALID_STATE;
response.__set_hint_msg(hint_msg);
return;
}
- LOG_INFO_F("app({}) restart bulk load", app_name);
+ LOG_INFO("app({}) restart bulk load", app_name);
update_app_status_on_remote_storage_unlocked(
app_id, bulk_load_status::BLS_DOWNLOADING, ERR_OK, true);
} break;
@@ -1516,16 +1510,16 @@ void bulk_load_service::on_control_bulk_load(control_bulk_load_rpc rpc)
auto hint_msg = fmt::format("can not cancel bulk load for app({}) with status({})",
app_name,
dsn::enum_to_string(app_status));
- LOG_ERROR_F("{}", hint_msg);
+ LOG_ERROR("{}", hint_msg);
response.err = ERR_INVALID_STATE;
response.__set_hint_msg(hint_msg);
return;
}
case bulk_load_control_type::BLC_FORCE_CANCEL: {
- LOG_INFO_F("app({}) start to {} cancel bulk load, original status = {}",
- app_name,
- control_type == bulk_load_control_type::BLC_FORCE_CANCEL ? "force" : "",
- dsn::enum_to_string(app_status));
+ LOG_INFO("app({}) start to {} cancel bulk load, original status = {}",
+ app_name,
+ control_type == bulk_load_control_type::BLC_FORCE_CANCEL ? "force" : "",
+ dsn::enum_to_string(app_status));
update_app_status_on_remote_storage_unlocked(app_id,
bulk_load_status::BLS_CANCELED,
ERR_OK,
@@ -1549,7 +1543,7 @@ void bulk_load_service::on_query_bulk_load_status(query_bulk_load_rpc rpc)
std::shared_ptr<app_state> app = get_app(app_name);
if (app == nullptr || app->status != app_status::AS_AVAILABLE) {
auto hint_msg = fmt::format("app({}) is not existed or not available", app_name);
- LOG_ERROR_F("{}", hint_msg);
+ LOG_ERROR("{}", hint_msg);
response.err = (app == nullptr) ? ERR_APP_NOT_EXIST : ERR_APP_DROPPED;
response.__set_hint_msg(hint_msg);
return;
@@ -1558,7 +1552,7 @@ void bulk_load_service::on_query_bulk_load_status(query_bulk_load_rpc rpc)
if (!app->is_bulk_loading) {
auto hint_msg =
fmt::format("app({}) is not during bulk load, return last time result", app_name);
- LOG_WARNING_F("{}", hint_msg);
+ LOG_WARNING("{}", hint_msg);
response.__set_hint_msg(hint_msg);
}
@@ -1589,9 +1583,9 @@ void bulk_load_service::on_query_bulk_load_status(query_bulk_load_rpc rpc)
response.err = get_app_bulk_load_err_unlocked(app_id);
}
- LOG_INFO_F("query app({}) bulk_load_status({}) succeed",
- app_name,
- dsn::enum_to_string(response.app_status));
+ LOG_INFO("query app({}) bulk_load_status({}) succeed",
+ app_name,
+ dsn::enum_to_string(response.app_status));
}
void bulk_load_service::on_clear_bulk_load(clear_bulk_load_rpc rpc)
@@ -1604,14 +1598,14 @@ void bulk_load_service::on_clear_bulk_load(clear_bulk_load_rpc rpc)
if (app == nullptr || app->status != app_status::AS_AVAILABLE) {
response.err = (app == nullptr) ? ERR_APP_NOT_EXIST : ERR_APP_DROPPED;
response.hint_msg = fmt::format("app({}) is not existed or not available", app_name);
- LOG_ERROR_F("{}", response.hint_msg);
+ LOG_ERROR("{}", response.hint_msg);
return;
}
if (app->is_bulk_loading) {
response.err = ERR_INVALID_STATE;
response.hint_msg = fmt::format("app({}) is executing bulk load", app_name);
- LOG_ERROR_F("{}", response.hint_msg);
+ LOG_ERROR("{}", response.hint_msg);
return;
}
@@ -1631,7 +1625,7 @@ void bulk_load_service::do_clear_app_bulk_load_result(int32_t app_id, clear_bulk
fmt::format("clear app({}) bulk load result succeed, remove bulk load dir succeed",
rpc.request().app_name);
reset_local_bulk_load_states(app_id, rpc.request().app_name, true);
- LOG_INFO_F("{}", response.hint_msg);
+ LOG_INFO("{}", response.hint_msg);
});
}
@@ -1641,7 +1635,7 @@ void bulk_load_service::create_bulk_load_root_dir()
blob value = blob();
std::string path = _bulk_load_root;
_sync_bulk_load_storage->create_node(std::move(path), std::move(value), [this]() {
- LOG_INFO_F("create bulk load root({}) succeed", _bulk_load_root);
+ LOG_INFO("create bulk load root({}) succeed", _bulk_load_root);
sync_apps_from_remote_storage();
});
}
@@ -1653,10 +1647,10 @@ void bulk_load_service::sync_apps_from_remote_storage()
_sync_bulk_load_storage->get_children(
std::move(path), [this](bool flag, const std::vector<std::string> &children) {
if (flag && children.size() > 0) {
- LOG_INFO_F("There are {} apps need to sync bulk load status", children.size());
+ LOG_INFO("There are {} apps need to sync bulk load status", children.size());
for (const auto &elem : children) {
int32_t app_id = boost::lexical_cast<int32_t>(elem);
- LOG_INFO_F("start to sync app({}) bulk load status", app_id);
+ LOG_INFO("start to sync app({}) bulk load status", app_id);
do_sync_app(app_id);
}
}
@@ -1687,10 +1681,10 @@ void bulk_load_service::sync_partitions_from_remote_storage(int32_t app_id,
_sync_bulk_load_storage->get_children(
std::move(app_path),
[this, app_path, app_id, app_name](bool flag, const std::vector<std::string> &children) {
- LOG_INFO_F("app(name={},app_id={}) has {} partition bulk load info to be synced",
- app_name,
- app_id,
- children.size());
+ LOG_INFO("app(name={},app_id={}) has {} partition bulk load info to be synced",
+ app_name,
+ app_id,
+ children.size());
for (const auto &child_pidx : children) {
int32_t pidx = boost::lexical_cast<int32_t>(child_pidx);
std::string partition_path = get_partition_bulk_load_path(app_path, pidx);
@@ -1738,7 +1732,7 @@ void bulk_load_service::try_to_continue_app_bulk_load(
std::shared_ptr<app_state> app = get_app(ainfo.app_name);
// if app is not available, remove bulk load dir
if (app == nullptr || app->status != app_status::AS_AVAILABLE) {
- LOG_ERROR_F(
+ LOG_ERROR(
"app(name={},app_id={}) is not existed or not available", ainfo.app_name, ainfo.app_id);
if (app == nullptr) {
remove_bulk_load_dir_on_remote_storage(ainfo.app_id, ainfo.app_name);
@@ -1786,7 +1780,7 @@ bulk_load_service::validate_ingest_behind(const std::map<std::string, std::strin
const auto &iter = envs.find(replica_envs::ROCKSDB_ALLOW_INGEST_BEHIND);
if (iter != envs.end()) {
if (!buf2bool(iter->second, app_allow_ingest_behind)) {
- LOG_WARNING_F("can not convert {} to bool", iter->second);
+ LOG_WARNING("can not convert {} to bool", iter->second);
app_allow_ingest_behind = false;
}
}
@@ -1805,23 +1799,23 @@ bulk_load_service::validate_ingest_behind(const std::map<std::string, std::strin
{
// app id and partition from `app_bulk_load_info` is inconsistent with current app_info
if (app_id != ainfo.app_id || partition_count != ainfo.partition_count) {
- LOG_ERROR_F("app({}) has different app_id or partition_count, bulk load app_id = {}, "
- "partition_count = {}, current app_id = {}, partition_count = {}",
- ainfo.app_name,
- ainfo.app_id,
- ainfo.partition_count,
- app_id,
- partition_count);
+ LOG_ERROR("app({}) has different app_id or partition_count, bulk load app_id = {}, "
+ "partition_count = {}, current app_id = {}, partition_count = {}",
+ ainfo.app_name,
+ ainfo.app_id,
+ ainfo.partition_count,
+ app_id,
+ partition_count);
return false;
}
// partition_bulk_load_info count should not be greater than partition_count
if (partition_count < pinfo_count) {
- LOG_ERROR_F("app({}) has invalid count, app partition_count = {}, remote "
- "partition_bulk_load_info count = {}",
- ainfo.app_name,
- partition_count,
- pinfo_count);
+ LOG_ERROR("app({}) has invalid count, app partition_count = {}, remote "
+ "partition_bulk_load_info count = {}",
+ ainfo.app_name,
+ partition_count,
+ pinfo_count);
return false;
}
@@ -1832,16 +1826,16 @@ bulk_load_service::validate_ingest_behind(const std::map<std::string, std::strin
// however, meta server crash when create app directory and part of partition directory
// when meta server recover, partition directory count is less than partition_count
if (pinfo_count != partition_count && ainfo.status != bulk_load_status::BLS_DOWNLOADING) {
- LOG_ERROR_F("app({}) bulk_load_status = {}, but there are {} partitions lack "
- "partition_bulk_load dir",
- ainfo.app_name,
- dsn::enum_to_string(ainfo.status),
- partition_count - pinfo_count);
+ LOG_ERROR("app({}) bulk_load_status = {}, but there are {} partitions lack "
+ "partition_bulk_load dir",
+ ainfo.app_name,
+ dsn::enum_to_string(ainfo.status),
+ partition_count - pinfo_count);
return false;
}
if (!validate_ingest_behind(envs, ainfo.ingest_behind)) {
- LOG_ERROR_F("app({}) has inconsistent ingest_behind option", ainfo.app_name);
+ LOG_ERROR("app({}) has inconsistent ingest_behind option", ainfo.app_name);
return false;
}
@@ -1865,13 +1859,12 @@ bulk_load_service::validate_ingest_behind(const std::map<std::string, std::strin
// some partition bulk load status is not downloading and some partition directroy is
// missing on remote storage
if (ainfo.partition_count - pinfo_map.size() > 0 && different_status_count > 0) {
- LOG_ERROR_F(
- "app({}) bulk_load_status = {}, there are {} partitions status is different "
- "from app, and {} partitions not existed, this is invalid",
- ainfo.app_name,
- dsn::enum_to_string(app_status),
- different_status_count,
- ainfo.partition_count - pinfo_map.size());
+ LOG_ERROR("app({}) bulk_load_status = {}, there are {} partitions status is different "
+ "from app, and {} partitions not existed, this is invalid",
+ ainfo.app_name,
+ dsn::enum_to_string(app_status),
+ different_status_count,
+ ainfo.partition_count - pinfo_map.size());
is_valid = false;
}
break;
@@ -1884,15 +1877,14 @@ bulk_load_service::validate_ingest_behind(const std::map<std::string, std::strin
: bulk_load_status::BLS_SUCCEED;
for (const auto &kv : pinfo_map) {
if (kv.second.status != app_status && kv.second.status != other_valid_status) {
- LOG_ERROR_F(
- "app({}) bulk_load_status = {}, but partition[{}] bulk_load_status = {}, "
- "only {} and {} is valid",
- ainfo.app_name,
- app_status,
- kv.first,
- dsn::enum_to_string(kv.second.status),
- dsn::enum_to_string(app_status),
- dsn::enum_to_string(other_valid_status));
+ LOG_ERROR("app({}) bulk_load_status = {}, but partition[{}] bulk_load_status = {}, "
+ "only {} and {} is valid",
+ ainfo.app_name,
+ app_status,
+ kv.first,
+ dsn::enum_to_string(kv.second.status),
+ dsn::enum_to_string(app_status),
+ dsn::enum_to_string(other_valid_status));
is_valid = false;
break;
}
@@ -1903,12 +1895,11 @@ bulk_load_service::validate_ingest_behind(const std::map<std::string, std::strin
// if app status is succeed or paused, all partitions' status should not be different from
// app's
if (different_status_count > 0) {
- LOG_ERROR_F(
- "app({}) bulk_load_status = {}, {} partitions status is different from app, "
- "this is invalid",
- ainfo.app_name,
- dsn::enum_to_string(app_status),
- different_status_count);
+ LOG_ERROR("app({}) bulk_load_status = {}, {} partitions status is different from app, "
+ "this is invalid",
+ ainfo.app_name,
+ dsn::enum_to_string(app_status),
+ different_status_count);
is_valid = false;
}
break;
@@ -1935,10 +1926,10 @@ void bulk_load_service::do_continue_app_bulk_load(
if (!FLAGS_enable_concurrent_bulk_load &&
!_meta_svc->try_lock_meta_op_status(meta_op_status::BULKLOAD)) {
- LOG_ERROR_F("fatal, the op status of meta server must be meta_op_status::FREE");
+ LOG_ERROR("fatal, the op status of meta server must be meta_op_status::FREE");
return;
}
- LOG_INFO_F(
+ LOG_INFO(
"app({}) continue bulk load, app_id = {}, partition_count = {}, status = {}, there are {} "
"partitions have bulk_load_info, {} partitions have same status with app, {} "
"partitions different",
@@ -2032,7 +2023,7 @@ void bulk_load_service::create_missing_partition_dir(const std::string &app_name
[app_name, pid, partition_count, pinfo, this]() {
const int32_t app_id = pid.get_app_id();
bool send_request = false;
- LOG_INFO_F("app({}) create partition({}) bulk_load_info", app_name, pid);
+ LOG_INFO("app({}) create partition({}) bulk_load_info", app_name, pid);
{
zauto_write_lock l(_lock);
_partition_bulk_load_info[pid] = pinfo;
@@ -2043,7 +2034,7 @@ void bulk_load_service::create_missing_partition_dir(const std::string &app_name
}
}
if (send_request) {
- LOG_INFO_F("app({}) start to bulk load", app_name);
+ LOG_INFO("app({}) start to bulk load", app_name);
for (auto i = 0; i < partition_count; ++i) {
partition_bulk_load(app_name, gpid(app_id, i));
}
@@ -2059,10 +2050,10 @@ void bulk_load_service::check_app_bulk_load_states(std::shared_ptr<app_state> ap
_meta_svc->get_remote_storage()->node_exist(
app_path, LPC_META_CALLBACK, [this, app_path, app, is_app_bulk_loading](error_code err) {
if (err != ERR_OK && err != ERR_OBJECT_NOT_FOUND) {
- LOG_WARNING_F("check app({}) bulk load dir({}) failed, error = {}, try later",
- app->app_name,
- app_path,
- err);
+ LOG_WARNING("check app({}) bulk load dir({}) failed, error = {}, try later",
+ app->app_name,
+ app_path,
+ err);
tasking::enqueue(LPC_META_CALLBACK,
nullptr,
std::bind(&bulk_load_service::check_app_bulk_load_states,
@@ -2075,11 +2066,11 @@ void bulk_load_service::check_app_bulk_load_states(std::shared_ptr<app_state> ap
}
if (err == ERR_OBJECT_NOT_FOUND && is_app_bulk_loading) {
- LOG_ERROR_F("app({}): bulk load dir({}) not exist, but is_bulk_loading = {}, reset "
- "app is_bulk_loading flag",
- app->app_name,
- app_path,
- is_app_bulk_loading);
+ LOG_ERROR("app({}): bulk load dir({}) not exist, but is_bulk_loading = {}, reset "
+ "app is_bulk_loading flag",
+ app->app_name,
+ app_path,
+ is_app_bulk_loading);
update_app_not_bulk_loading_on_remote_storage(std::move(app));
return;
}
diff --git a/src/meta/meta_data.cpp b/src/meta/meta_data.cpp
index 652bdd5c4..c9c9674da 100644
--- a/src/meta/meta_data.cpp
+++ b/src/meta/meta_data.cpp
@@ -138,7 +138,7 @@ bool construct_replica(meta_view view, const gpid &pid, int max_replica_count)
std::vector<dropped_replica> &drop_list = cc.dropped;
if (drop_list.empty()) {
- LOG_WARNING_F("construct for ({}) failed, coz no replicas collected", pid);
+ LOG_WARNING("construct for ({}) failed, coz no replicas collected", pid);
return false;
}
@@ -153,13 +153,13 @@ bool construct_replica(meta_view view, const gpid &pid, int max_replica_count)
pc.partition_flags = 0;
pc.max_replica_count = max_replica_count;
- LOG_INFO_F("construct for ({}), select {} as primary, ballot({}), committed_decree({}), "
- "prepare_decree({})",
- pid,
- server.node,
- server.ballot,
- server.last_committed_decree,
- server.last_prepared_decree);
+ LOG_INFO("construct for ({}), select {} as primary, ballot({}), committed_decree({}), "
+ "prepare_decree({})",
+ pid,
+ server.node,
+ server.ballot,
+ server.last_committed_decree,
+ server.last_prepared_decree);
drop_list.pop_back();
@@ -175,13 +175,13 @@ bool construct_replica(meta_view view, const gpid &pid, int max_replica_count)
break;
// similar to cc.drop_list, pc.last_drop is also a stack structure
pc.last_drops.insert(pc.last_drops.begin(), iter->node);
- LOG_INFO_F("construct for ({}), select {} into last_drops, ballot({}), "
- "committed_decree({}), prepare_decree({})",
- pid,
- iter->node,
- iter->ballot,
- iter->last_committed_decree,
- iter->last_prepared_decree);
+ LOG_INFO("construct for ({}), select {} into last_drops, ballot({}), "
+ "committed_decree({}), prepare_decree({})",
+ pid,
+ iter->node,
+ iter->ballot,
+ iter->last_committed_decree,
+ iter->last_prepared_decree);
}
cc.prefered_dropped = (int)drop_list.size() - 1;
@@ -240,12 +240,12 @@ void proposal_actions::track_current_learner(const dsn::rpc_address &node, const
// if we've collected inforamtions for the learner, then it claims it's down
// we will treat the learning process failed
if (current_learner.ballot != invalid_ballot) {
- LOG_INFO_F("{}: a learner's is down to status({}), perhaps learn failed",
- info.pid,
- dsn::enum_to_string(info.status));
+ LOG_INFO("{}: a learner's is down to status({}), perhaps learn failed",
+ info.pid,
+ dsn::enum_to_string(info.status));
learning_progress_abnormal_detected = true;
} else {
- LOG_DEBUG_F(
+ LOG_DEBUG(
"{}: ignore abnormal status of {}, perhaps learn not start", info.pid, node);
}
} else if (info.status == partition_status::PS_POTENTIAL_SECONDARY) {
@@ -254,9 +254,9 @@ void proposal_actions::track_current_learner(const dsn::rpc_address &node, const
current_learner.last_prepared_decree > info.last_prepared_decree) {
// TODO: need to add a perf counter here
- LOG_WARNING_F("{}: learner({})'s progress step back, please trace this carefully",
- info.pid,
- node);
+ LOG_WARNING("{}: learner({})'s progress step back, please trace this carefully",
+ info.pid,
+ node);
}
// NOTICE: the flag may be abormal currently. it's balancer's duty to make use of the
@@ -424,21 +424,21 @@ bool config_context::check_order()
return true;
for (unsigned int i = 0; i < dropped.size() - 1; ++i) {
if (dropped_cmp(dropped[i], dropped[i + 1]) > 0) {
- LOG_ERROR_F("check dropped order for gpid({}) failed, [{},{},{},{},{}@{}] vs "
- "[{},{},{},{},{}@{}]",
- config_owner->pid,
- dropped[i].node,
- dropped[i].time,
- dropped[i].ballot,
- dropped[i].last_committed_decree,
- dropped[i].last_prepared_decree,
- i,
- dropped[i + 1].node,
- dropped[i + 1].time,
- dropped[i + 1].ballot,
- dropped[i + 1].last_committed_decree,
- dropped[i + 1].last_prepared_decree,
- i + 1);
+ LOG_ERROR("check dropped order for gpid({}) failed, [{},{},{},{},{}@{}] vs "
+ "[{},{},{},{},{}@{}]",
+ config_owner->pid,
+ dropped[i].node,
+ dropped[i].time,
+ dropped[i].ballot,
+ dropped[i].last_committed_decree,
+ dropped[i].last_prepared_decree,
+ i,
+ dropped[i + 1].node,
+ dropped[i + 1].time,
+ dropped[i + 1].ballot,
+ dropped[i + 1].last_committed_decree,
+ dropped[i + 1].last_prepared_decree,
+ i + 1);
return false;
}
}
diff --git a/src/meta/meta_server_failure_detector.cpp b/src/meta/meta_server_failure_detector.cpp
index 82e5be2cb..57eac0556 100644
--- a/src/meta/meta_server_failure_detector.cpp
+++ b/src/meta/meta_server_failure_detector.cpp
@@ -114,7 +114,7 @@ bool meta_server_failure_detector::get_leader(rpc_address *leader)
if (err == dsn::ERR_OK && leader->from_string_ipv4(lock_owner.c_str())) {
return (*leader) == dsn_primary_address();
} else {
- LOG_WARNING_F("query leader from cache got error({})", err);
+ LOG_WARNING("query leader from cache got error({})", err);
leader->set_invalid();
return false;
}
@@ -136,10 +136,10 @@ void meta_server_failure_detector::acquire_leader_lock()
// lock granted
LPC_META_SERVER_LEADER_LOCK_CALLBACK,
[this, &err](error_code ec, const std::string &owner, uint64_t version) {
- LOG_INFO_F("leader lock granted callback: err({}), owner({}), version({})",
- ec,
- owner,
- version);
+ LOG_INFO("leader lock granted callback: err({}), owner({}), version({})",
+ ec,
+ owner,
+ version);
err = ec;
if (err == dsn::ERR_OK) {
leader_initialize(owner);
@@ -149,10 +149,10 @@ void meta_server_failure_detector::acquire_leader_lock()
// lease expire
LPC_META_SERVER_LEADER_LOCK_CALLBACK,
[](error_code ec, const std::string &owner, uint64_t version) {
- LOG_ERROR_F("leader lock expired callback: err({}), owner({}), version({})",
- ec,
- owner,
- version);
+ LOG_ERROR("leader lock expired callback: err({}), owner({}), version({})",
+ ec,
+ owner,
+ version);
// let's take the easy way right now
dsn_exit(0);
},
@@ -178,11 +178,11 @@ void meta_server_failure_detector::reset_stability_stat(const rpc_address &node)
if (iter == _stablity.end())
return;
else {
- LOG_INFO_F("old stability stat: node({}), start_time({}), unstable_count({}), will reset "
- "unstable count to 0",
- node,
- iter->second.last_start_time_ms,
- iter->second.unstable_restart_count);
+ LOG_INFO("old stability stat: node({}), start_time({}), unstable_count({}), will reset "
+ "unstable count to 0",
+ node,
+ iter->second.last_start_time_ms,
+ iter->second.unstable_restart_count);
iter->second.unstable_restart_count = 0;
}
}
@@ -208,39 +208,39 @@ bool meta_server_failure_detector::update_stability_stat(const fd::beacon_msg &b
} else {
worker_stability &w = iter->second;
if (beacon.start_time == w.last_start_time_ms) {
- LOG_DEBUG_F(
+ LOG_DEBUG(
"{} isn't restarted, last_start_time({})", beacon.from_addr, w.last_start_time_ms);
if (dsn_now_ms() - w.last_start_time_ms >=
_fd_opts->stable_rs_min_running_seconds * 1000 &&
w.unstable_restart_count > 0) {
- LOG_INFO_F("{} has stably run for a while, reset it's unstable count({}) to 0",
- beacon.from_addr,
- w.unstable_restart_count);
+ LOG_INFO("{} has stably run for a while, reset it's unstable count({}) to 0",
+ beacon.from_addr,
+ w.unstable_restart_count);
w.unstable_restart_count = 0;
}
} else if (beacon.start_time > w.last_start_time_ms) {
- LOG_INFO_F("check {} restarted, last_time({}), this_time({})",
- beacon.from_addr,
- w.last_start_time_ms,
- beacon.start_time);
+ LOG_INFO("check {} restarted, last_time({}), this_time({})",
+ beacon.from_addr,
+ w.last_start_time_ms,
+ beacon.start_time);
if (beacon.start_time - w.last_start_time_ms <
_fd_opts->stable_rs_min_running_seconds * 1000) {
w.unstable_restart_count++;
- LOG_WARNING_F("{} encounter an unstable restart, total_count({})",
- beacon.from_addr,
- w.unstable_restart_count);
+ LOG_WARNING("{} encounter an unstable restart, total_count({})",
+ beacon.from_addr,
+ w.unstable_restart_count);
} else if (w.unstable_restart_count > 0) {
- LOG_INFO_F("{} restart in {} ms after last restart, may recover ok, reset "
- "it's unstable count({}) to 0",
- beacon.from_addr,
- beacon.start_time - w.last_start_time_ms,
- w.unstable_restart_count);
+ LOG_INFO("{} restart in {} ms after last restart, may recover ok, reset "
+ "it's unstable count({}) to 0",
+ beacon.from_addr,
+ beacon.start_time - w.last_start_time_ms,
+ w.unstable_restart_count);
w.unstable_restart_count = 0;
}
w.last_start_time_ms = beacon.start_time;
} else {
- LOG_WARNING_F("{}: possible encounter a staled message, ignore it", beacon.from_addr);
+ LOG_WARNING("{}: possible encounter a staled message, ignore it", beacon.from_addr);
}
return w.unstable_restart_count < _fd_opts->max_succssive_unstable_restart;
}
@@ -255,7 +255,7 @@ void meta_server_failure_detector::on_ping(const fd::beacon_msg &beacon,
ack.allowed = true;
if (beacon.__isset.start_time && !update_stability_stat(beacon)) {
- LOG_WARNING_F("{} is unstable, don't response to it's beacon", beacon.from_addr);
+ LOG_WARNING("{} is unstable, don't response to it's beacon", beacon.from_addr);
return;
}
@@ -269,13 +269,13 @@ void meta_server_failure_detector::on_ping(const fd::beacon_msg &beacon,
failure_detector::on_ping_internal(beacon, ack);
}
- LOG_INFO_F("on_ping, beacon send time[{}], is_master({}), from_node({}), this_node({}), "
- "primary_node({})",
- ack.time,
- ack.is_master ? "true" : "false",
- beacon.from_addr,
- ack.this_node,
- ack.primary_node);
+ LOG_INFO("on_ping, beacon send time[{}], is_master({}), from_node({}), this_node({}), "
+ "primary_node({})",
+ ack.time,
+ ack.is_master ? "true" : "false",
+ beacon.from_addr,
+ ack.this_node,
+ ack.primary_node);
reply(ack);
}
@@ -284,7 +284,7 @@ void meta_server_failure_detector::on_ping(const fd::beacon_msg &beacon,
meta_server_failure_detector::meta_server_failure_detector(rpc_address leader_address,
bool is_myself_leader)
{
- LOG_INFO_F("set {} as leader", leader_address);
+ LOG_INFO("set {} as leader", leader_address);
_lock_svc = nullptr;
_is_leader.store(is_myself_leader);
}
@@ -292,7 +292,7 @@ meta_server_failure_detector::meta_server_failure_detector(rpc_address leader_ad
void meta_server_failure_detector::set_leader_for_test(rpc_address leader_address,
bool is_myself_leader)
{
- LOG_INFO_F("set {} as leader", leader_address);
+ LOG_INFO("set {} as leader", leader_address);
_is_leader.store(is_myself_leader);
}
diff --git a/src/meta/meta_service.cpp b/src/meta/meta_service.cpp
index b3712634d..3c2077d9f 100644
--- a/src/meta/meta_service.cpp
+++ b/src/meta/meta_service.cpp
@@ -68,10 +68,10 @@ meta_service::meta_service()
_state.reset(new server_state());
_function_level.store(_meta_opts.meta_function_level_on_start);
if (_meta_opts.recover_from_replica_server) {
- LOG_INFO_F("enter recovery mode for [meta_server].recover_from_replica_server = true");
+ LOG_INFO("enter recovery mode for [meta_server].recover_from_replica_server = true");
_recovering = true;
if (_meta_opts.meta_function_level_on_start > meta_function_level::fl_steady) {
- LOG_INFO_F("meta server function level changed to fl_steady under recovery mode");
+ LOG_INFO("meta server function level changed to fl_steady under recovery mode");
_function_level.store(meta_function_level::fl_steady);
}
}
@@ -124,7 +124,7 @@ error_code meta_service::remote_storage_initialize()
_meta_opts.meta_state_service_type.c_str(), PROVIDER_TYPE_MAIN);
error_code err = storage->initialize(_meta_opts.meta_state_service_args);
if (err != ERR_OK) {
- LOG_ERROR_F("init meta_state_service failed, err = {}", err);
+ LOG_ERROR("init meta_state_service failed, err = {}", err);
return err;
}
_storage.reset(storage);
@@ -139,13 +139,13 @@ error_code meta_service::remote_storage_initialize()
_storage->create_node(current, LPC_META_CALLBACK, [&err](error_code ec) { err = ec; });
tsk->wait();
if (err != ERR_OK && err != ERR_NODE_ALREADY_EXIST) {
- LOG_ERROR_F("create node failed, node_path = {}, err = {}", current, err);
+ LOG_ERROR("create node failed, node_path = {}, err = {}", current, err);
return err;
}
}
_cluster_root = current.empty() ? "/" : current;
- LOG_INFO_F("init meta_state_service succeed, cluster_root = {}", _cluster_root);
+ LOG_INFO("init meta_state_service succeed, cluster_root = {}", _cluster_root);
return ERR_OK;
}
@@ -193,19 +193,19 @@ bool meta_service::try_lock_meta_op_status(meta_op_status op_status)
{
meta_op_status expected = meta_op_status::FREE;
if (!_meta_op_status.compare_exchange_strong(expected, op_status)) {
- LOG_ERROR_F("LOCK meta op status failed, meta "
- "server is busy, current op status is {}",
- enum_to_string(expected));
+ LOG_ERROR("LOCK meta op status failed, meta "
+ "server is busy, current op status is {}",
+ enum_to_string(expected));
return false;
}
- LOG_INFO_F("LOCK meta op status to {}", enum_to_string(op_status));
+ LOG_INFO("LOCK meta op status to {}", enum_to_string(op_status));
return true;
}
void meta_service::unlock_meta_op_status()
{
- LOG_INFO_F("UNLOCK meta op status from {}", enum_to_string(_meta_op_status.load()));
+ LOG_INFO("UNLOCK meta op status from {}", enum_to_string(_meta_op_status.load()));
_meta_op_status.store(meta_op_status::FREE);
}
@@ -277,14 +277,14 @@ void meta_service::start_service()
std::chrono::milliseconds(_opts.lb_interval_ms));
if (!_meta_opts.cold_backup_disabled) {
- LOG_INFO_F("start backup service");
+ LOG_INFO("start backup service");
tasking::enqueue(LPC_DEFAULT_CALLBACK,
nullptr,
std::bind(&backup_service::start, _backup_handler.get()));
}
if (_bulk_load_svc) {
- LOG_INFO_F("start bulk load service");
+ LOG_INFO("start bulk load service");
tasking::enqueue(LPC_META_CALLBACK, tracker(), [this]() {
_bulk_load_svc->initialize_bulk_load_service();
});
@@ -301,7 +301,7 @@ error_code meta_service::start()
err = remote_storage_initialize();
dreturn_not_ok_logged(err, "init remote storage failed, err = {}", err);
- LOG_INFO_F("remote storage is successfully initialized");
+ LOG_INFO("remote storage is successfully initialized");
// start failure detector, and try to acquire the leader lock
_failure_detector.reset(new meta_server_failure_detector(this));
@@ -316,8 +316,8 @@ error_code meta_service::start()
_meta_opts.enable_white_list);
dreturn_not_ok_logged(err, "start failure_detector failed, err = {}", err);
- LOG_INFO_F("meta service failure detector is successfully started {}",
- _meta_opts.enable_white_list ? "with whitelist enabled" : "");
+ LOG_INFO("meta service failure detector is successfully started {}",
+ _meta_opts.enable_white_list ? "with whitelist enabled" : "");
// should register rpc handlers before acquiring leader lock, so that this meta service
// can tell others who is the current leader
@@ -329,8 +329,8 @@ error_code meta_service::start()
_failure_detector->acquire_leader_lock();
CHECK(_failure_detector->get_leader(nullptr), "must be primary at this point");
- LOG_INFO_F("{} got the primary lock, start to recover server state from remote storage",
- dsn_primary_address());
+ LOG_INFO("{} got the primary lock, start to recover server state from remote storage",
+ dsn_primary_address());
// initialize the load balancer
server_load_balancer *balancer = utils::factory_store<server_load_balancer>::create(
@@ -347,7 +347,7 @@ error_code meta_service::start()
// initializing the backup_handler should after remote_storage be initialized,
// because we should use _cluster_root
if (!_meta_opts.cold_backup_disabled) {
- LOG_INFO_F("initialize backup handler");
+ LOG_INFO("initialize backup handler");
_backup_handler = std::make_shared<backup_service>(
this,
meta_options::concat_path_unix_style(_cluster_root, "backup"),
@@ -362,12 +362,12 @@ error_code meta_service::start()
_state->initialize(this, meta_options::concat_path_unix_style(_cluster_root, "apps"));
while ((err = _state->initialize_data_structure()) != ERR_OK) {
if (err == ERR_OBJECT_NOT_FOUND && _meta_opts.recover_from_replica_server) {
- LOG_INFO_F("can't find apps from remote storage, and "
- "[meta_server].recover_from_replica_server = true, "
- "administrator should recover this cluster manually later");
+ LOG_INFO("can't find apps from remote storage, and "
+ "[meta_server].recover_from_replica_server = true, "
+ "administrator should recover this cluster manually later");
return dsn::ERR_OK;
}
- LOG_ERROR_F("initialize server state from remote storage failed, err = {}, retry ...", err);
+ LOG_ERROR("initialize server state from remote storage failed, err = {}, retry ...", err);
}
_state->recover_from_max_replica_count_env();
@@ -381,7 +381,7 @@ error_code meta_service::start()
start_service();
- LOG_INFO_F("start meta_service succeed");
+ LOG_INFO("start meta_service succeed");
return ERR_OK;
}
@@ -485,7 +485,7 @@ int meta_service::check_leader(dsn::message_ex *req, dsn::rpc_address *forward_a
return -1;
}
- LOG_DEBUG_F("leader address: {}", leader);
+ LOG_DEBUG("leader address: {}", leader);
if (!leader.is_invalid()) {
dsn_rpc_forward(req, leader);
return 0;
@@ -651,10 +651,10 @@ void meta_service::on_query_configuration_by_index(configuration_query_by_index_
_state->query_configuration_by_index(rpc.request(), response);
if (ERR_OK == response.err) {
- LOG_INFO_F("client {} queried an available app {} with appid {}",
- rpc.dsn_request()->header->from_address.to_string(),
- rpc.request().app_name,
- response.app_id);
+ LOG_INFO("client {} queried an available app {} with appid {}",
+ rpc.dsn_request()->header->from_address.to_string(),
+ rpc.request().app_name,
+ response.app_id);
}
}
@@ -699,9 +699,9 @@ void meta_service::on_update_configuration(dsn::message_ex *req)
_state->query_configuration_by_gpid(request->config.pid, response.config);
reply(req, response);
- LOG_INFO_F("refuse request {} coz meta function level is {}",
- boost::lexical_cast<std::string>(*request),
- _meta_function_level_VALUES_TO_NAMES.find(level)->second);
+ LOG_INFO("refuse request {} coz meta function level is {}",
+ boost::lexical_cast<std::string>(*request),
+ _meta_function_level_VALUES_TO_NAMES.find(level)->second);
return;
}
@@ -743,14 +743,14 @@ void meta_service::on_propose_balancer(configuration_balancer_rpc rpc)
}
const configuration_balancer_request &request = rpc.request();
- LOG_INFO_F("get proposal balancer request, gpid({})", request.gpid);
+ LOG_INFO("get proposal balancer request, gpid({})", request.gpid);
_state->on_propose_balancer(request, rpc.response());
}
void meta_service::on_start_recovery(configuration_recovery_rpc rpc)
{
configuration_recovery_response &response = rpc.response();
- LOG_INFO_F("got start recovery request, start to do recovery");
+ LOG_INFO("got start recovery request, start to do recovery");
int result = check_leader(rpc, nullptr);
// request has been forwarded to others
if (result == 0) {
@@ -762,8 +762,8 @@ void meta_service::on_start_recovery(configuration_recovery_rpc rpc)
} else {
zauto_write_lock l(_meta_lock);
if (_started.load()) {
- LOG_INFO_F("service({}) is already started, ignore the recovery request",
- dsn_primary_address());
+ LOG_INFO("service({}) is already started, ignore the recovery request",
+ dsn_primary_address());
response.err = ERR_SERVICE_ALREADY_RUNNING;
} else {
_state->on_start_recovery(rpc.request(), response);
@@ -795,7 +795,7 @@ void meta_service::on_add_backup_policy(dsn::message_ex *req)
}
if (_backup_handler == nullptr) {
- LOG_ERROR_F("meta doesn't enable backup service");
+ LOG_ERROR("meta doesn't enable backup service");
response.err = ERR_SERVICE_NOT_ACTIVE;
reply(req, response);
} else {
@@ -814,7 +814,7 @@ void meta_service::on_query_backup_policy(query_backup_policy_rpc policy_rpc)
auto &response = policy_rpc.response();
if (_backup_handler == nullptr) {
- LOG_ERROR_F("meta doesn't enable backup service");
+ LOG_ERROR("meta doesn't enable backup service");
response.err = ERR_SERVICE_NOT_ACTIVE;
} else {
tasking::enqueue(
@@ -831,7 +831,7 @@ void meta_service::on_modify_backup_policy(configuration_modify_backup_policy_rp
}
if (_backup_handler == nullptr) {
- LOG_ERROR_F("meta doesn't enable backup service");
+ LOG_ERROR("meta doesn't enable backup service");
rpc.response().err = ERR_SERVICE_NOT_ACTIVE;
} else {
tasking::enqueue(
@@ -978,7 +978,7 @@ void meta_service::update_app_env(app_env_rpc env_rpc)
std::bind(&server_state::clear_app_envs, _state.get(), env_rpc));
break;
default: // app_env_operation::type::APP_ENV_OP_INVALID
- LOG_WARNING_F("recv a invalid update app_env request, just ignore");
+ LOG_WARNING("recv a invalid update app_env request, just ignore");
response.err = ERR_INVALID_PARAMETERS;
response.hint_message =
"recv a invalid update_app_env request with op = APP_ENV_OP_INVALID";
@@ -1003,7 +1003,7 @@ void meta_service::on_start_partition_split(start_split_rpc rpc)
return;
}
if (_split_svc == nullptr) {
- LOG_ERROR_F("meta doesn't support partition split");
+ LOG_ERROR("meta doesn't support partition split");
rpc.response().err = ERR_SERVICE_NOT_ACTIVE;
return;
}
@@ -1020,7 +1020,7 @@ void meta_service::on_control_partition_split(control_split_rpc rpc)
}
if (_split_svc == nullptr) {
- LOG_ERROR_F("meta doesn't support partition split");
+ LOG_ERROR("meta doesn't support partition split");
rpc.response().err = ERR_SERVICE_NOT_ACTIVE;
return;
}
@@ -1037,7 +1037,7 @@ void meta_service::on_query_partition_split(query_split_rpc rpc)
}
if (_split_svc == nullptr) {
- LOG_ERROR_F("meta doesn't support partition split");
+ LOG_ERROR("meta doesn't support partition split");
rpc.response().err = ERR_SERVICE_NOT_ACTIVE;
return;
}
@@ -1062,7 +1062,7 @@ void meta_service::on_notify_stop_split(notify_stop_split_rpc rpc)
return;
}
if (_split_svc == nullptr) {
- LOG_ERROR_F("meta doesn't support partition split");
+ LOG_ERROR("meta doesn't support partition split");
rpc.response().err = ERR_SERVICE_NOT_ACTIVE;
return;
}
@@ -1078,7 +1078,7 @@ void meta_service::on_query_child_state(query_child_state_rpc rpc)
return;
}
if (_split_svc == nullptr) {
- LOG_ERROR_F("meta doesn't support partition split");
+ LOG_ERROR("meta doesn't support partition split");
rpc.response().err = ERR_SERVICE_NOT_ACTIVE;
return;
}
@@ -1092,7 +1092,7 @@ void meta_service::on_start_bulk_load(start_bulk_load_rpc rpc)
}
if (_bulk_load_svc == nullptr) {
- LOG_ERROR_F("meta doesn't support bulk load");
+ LOG_ERROR("meta doesn't support bulk load");
rpc.response().err = ERR_SERVICE_NOT_ACTIVE;
return;
}
@@ -1106,7 +1106,7 @@ void meta_service::on_control_bulk_load(control_bulk_load_rpc rpc)
}
if (_bulk_load_svc == nullptr) {
- LOG_ERROR_F("meta doesn't support bulk load");
+ LOG_ERROR("meta doesn't support bulk load");
rpc.response().err = ERR_SERVICE_NOT_ACTIVE;
return;
}
@@ -1123,7 +1123,7 @@ void meta_service::on_query_bulk_load_status(query_bulk_load_rpc rpc)
}
if (_bulk_load_svc == nullptr) {
- LOG_ERROR_F("meta doesn't support bulk load");
+ LOG_ERROR("meta doesn't support bulk load");
rpc.response().err = ERR_SERVICE_NOT_ACTIVE;
return;
}
@@ -1137,7 +1137,7 @@ void meta_service::on_clear_bulk_load(clear_bulk_load_rpc rpc)
}
if (_bulk_load_svc == nullptr) {
- LOG_ERROR_F("meta doesn't support bulk load");
+ LOG_ERROR("meta doesn't support bulk load");
rpc.response().err = ERR_SERVICE_NOT_ACTIVE;
return;
}
@@ -1153,7 +1153,7 @@ void meta_service::on_start_backup_app(start_backup_app_rpc rpc)
return;
}
if (_backup_handler == nullptr) {
- LOG_ERROR_F("meta doesn't enable backup service");
+ LOG_ERROR("meta doesn't enable backup service");
rpc.response().err = ERR_SERVICE_NOT_ACTIVE;
return;
}
@@ -1166,7 +1166,7 @@ void meta_service::on_query_backup_status(query_backup_status_rpc rpc)
return;
}
if (_backup_handler == nullptr) {
- LOG_ERROR_F("meta doesn't enable backup service");
+ LOG_ERROR("meta doesn't enable backup service");
rpc.response().err = ERR_SERVICE_NOT_ACTIVE;
return;
}
diff --git a/src/meta/meta_service.h b/src/meta/meta_service.h
index 96a74d38e..4dd23c989 100644
--- a/src/meta/meta_service.h
+++ b/src/meta/meta_service.h
@@ -352,7 +352,7 @@ int meta_service::check_leader(TRpcHolder rpc, rpc_address *forward_address)
return -1;
}
- LOG_DEBUG_F("leader address: {}", leader);
+ LOG_DEBUG("leader address: {}", leader);
if (!leader.is_invalid()) {
rpc.forward(leader);
return 0;
@@ -370,7 +370,7 @@ bool meta_service::check_status(TRpcHolder rpc, rpc_address *forward_address)
{
if (!_access_controller->allowed(rpc.dsn_request())) {
rpc.response().err = ERR_ACL_DENY;
- LOG_INFO_F("reject request with ERR_ACL_DENY");
+ LOG_INFO("reject request with ERR_ACL_DENY");
return false;
}
@@ -385,7 +385,7 @@ bool meta_service::check_status(TRpcHolder rpc, rpc_address *forward_address)
} else {
rpc.response().err = ERR_SERVICE_NOT_ACTIVE;
}
- LOG_INFO_F("reject request with {}", rpc.response().err);
+ LOG_INFO("reject request with {}", rpc.response().err);
return false;
}
@@ -396,7 +396,7 @@ template <typename TRespType>
bool meta_service::check_status_with_msg(message_ex *req, TRespType &response_struct)
{
if (!_access_controller->allowed(req)) {
- LOG_INFO_F("reject request with ERR_ACL_DENY");
+ LOG_INFO("reject request with ERR_ACL_DENY");
response_struct.err = ERR_ACL_DENY;
reply(req, response_struct);
return false;
@@ -414,7 +414,7 @@ bool meta_service::check_status_with_msg(message_ex *req, TRespType &response_st
} else {
response_struct.err = ERR_SERVICE_NOT_ACTIVE;
}
- LOG_INFO_F("reject request with {}", response_struct.err);
+ LOG_INFO("reject request with {}", response_struct.err);
reply(req, response_struct);
return false;
}
diff --git a/src/meta/meta_split_service.cpp b/src/meta/meta_split_service.cpp
index 4c2022c35..6328869d6 100644
--- a/src/meta/meta_split_service.cpp
+++ b/src/meta/meta_split_service.cpp
@@ -43,7 +43,7 @@ void meta_split_service::start_partition_split(start_split_rpc rpc)
app = _state->get_app(request.app_name);
if (app == nullptr || app->status != app_status::AS_AVAILABLE) {
- LOG_ERROR_F("app({}) is not existed or not available", request.app_name);
+ LOG_ERROR("app({}) is not existed or not available", request.app_name);
response.err = app == nullptr ? ERR_APP_NOT_EXIST : ERR_APP_DROPPED;
response.hint_msg = fmt::format(
"app {}", response.err == ERR_APP_NOT_EXIST ? "not existed" : "dropped");
@@ -53,7 +53,7 @@ void meta_split_service::start_partition_split(start_split_rpc rpc)
// new_partition_count != old_partition_count*2
if (request.new_partition_count != app->partition_count * 2) {
response.err = ERR_INVALID_PARAMETERS;
- LOG_ERROR_F(
+ LOG_ERROR(
"wrong partition count: app({}), partition count({}), new_partition_count({})",
request.app_name,
app->partition_count,
@@ -67,15 +67,15 @@ void meta_split_service::start_partition_split(start_split_rpc rpc)
response.err = ERR_BUSY;
auto err_msg =
fmt::format("app({}) is already executing partition split", request.app_name);
- LOG_ERROR_F("{}", err_msg);
+ LOG_ERROR("{}", err_msg);
response.hint_msg = err_msg;
return;
}
}
- LOG_INFO_F("app({}) start to partition split, new_partition_count={}",
- request.app_name,
- request.new_partition_count);
+ LOG_INFO("app({}) start to partition split, new_partition_count={}",
+ request.app_name,
+ request.new_partition_count);
do_start_partition_split(std::move(app), std::move(rpc));
}
@@ -84,9 +84,9 @@ void meta_split_service::do_start_partition_split(std::shared_ptr<app_state> app
start_split_rpc rpc)
{
auto on_write_storage_complete = [app, rpc, this]() {
- LOG_INFO_F("app({}) update partition count on remote storage, new partition_count = {}",
- app->app_name,
- app->partition_count * 2);
+ LOG_INFO("app({}) update partition count on remote storage, new partition_count = {}",
+ app->app_name,
+ app->partition_count * 2);
zauto_write_lock l(app_lock());
app->helpers->split_states.splitting_count = app->partition_count;
@@ -136,13 +136,13 @@ void meta_split_service::register_child_on_meta(register_child_rpc rpc)
const gpid &child_gpid = request.child_config.pid;
const auto &parent_config = app->partitions[parent_gpid.get_partition_index()];
if (request.parent_config.ballot != parent_config.ballot) {
- LOG_ERROR_F("app({}) partition({}) register child({}) failed, request is outdated, request "
- "parent ballot = {}, local parent ballot = {}",
- app_name,
- parent_gpid,
- child_gpid,
- request.parent_config.ballot,
- parent_config.ballot);
+ LOG_ERROR("app({}) partition({}) register child({}) failed, request is outdated, request "
+ "parent ballot = {}, local parent ballot = {}",
+ app_name,
+ parent_gpid,
+ child_gpid,
+ request.parent_config.ballot,
+ parent_config.ballot);
response.err = ERR_INVALID_VERSION;
response.parent_config = parent_config;
return;
@@ -150,16 +150,15 @@ void meta_split_service::register_child_on_meta(register_child_rpc rpc)
config_context &parent_context = app->helpers->contexts[parent_gpid.get_partition_index()];
if (parent_context.stage == config_status::pending_remote_sync) {
- LOG_WARNING_F(
- "app({}) partition({}): another request is syncing with remote storage, ignore "
- "this request",
- app_name,
- parent_gpid);
+ LOG_WARNING("app({}) partition({}): another request is syncing with remote storage, ignore "
+ "this request",
+ app_name,
+ parent_gpid);
return;
}
if (child_gpid.get_partition_index() >= app->partition_count) {
- LOG_ERROR_F(
+ LOG_ERROR(
"app({}) partition({}) register child({}) failed, partition split has been canceled",
app_name,
parent_gpid,
@@ -171,7 +170,7 @@ void meta_split_service::register_child_on_meta(register_child_rpc rpc)
auto iter = app->helpers->split_states.status.find(parent_gpid.get_partition_index());
if (iter == app->helpers->split_states.status.end()) {
- LOG_ERROR_F(
+ LOG_ERROR(
"duplicated register request, app({}) child partition({}) has already been registered",
app_name,
child_gpid);
@@ -187,7 +186,7 @@ void meta_split_service::register_child_on_meta(register_child_rpc rpc)
}
if (iter->second != split_status::SPLITTING) {
- LOG_ERROR_F(
+ LOG_ERROR(
"app({}) partition({}) register child({}) failed, current partition split_status = {}",
app_name,
parent_gpid,
@@ -199,7 +198,7 @@ void meta_split_service::register_child_on_meta(register_child_rpc rpc)
app->helpers->split_states.status.erase(parent_gpid.get_partition_index());
app->helpers->split_states.splitting_count--;
- LOG_INFO_F("app({}) parent({}) will register child({})", app_name, parent_gpid, child_gpid);
+ LOG_INFO("app({}) parent({}) will register child({})", app_name, parent_gpid, child_gpid);
parent_context.stage = config_status::pending_remote_sync;
parent_context.msg = rpc.dsn_request();
@@ -270,7 +269,7 @@ void meta_split_service::on_add_child_on_remote_storage_reply(error_code ec,
}
CHECK_EQ_MSG(ec, ERR_OK, "we can't handle this right now");
- LOG_INFO_F("parent({}) resgiter child({}) on remote storage succeed", parent_gpid, child_gpid);
+ LOG_INFO("parent({}) resgiter child({}) on remote storage succeed", parent_gpid, child_gpid);
// update local child partition configuration
std::shared_ptr<configuration_update_request> update_child_request =
@@ -307,23 +306,23 @@ void meta_split_service::query_partition_split(query_split_rpc rpc) const
response.err = app == nullptr ? ERR_APP_NOT_EXIST : ERR_APP_DROPPED;
response.__set_hint_msg(fmt::format(
"app({}) {}", app_name, response.err == ERR_APP_NOT_EXIST ? "not existed" : "dropped"));
- LOG_ERROR_F("query partition split failed, {}", response.hint_msg);
+ LOG_ERROR("query partition split failed, {}", response.hint_msg);
return;
}
if (!app->splitting()) {
response.err = ERR_INVALID_STATE;
response.__set_hint_msg(fmt::format("app({}) is not splitting", app_name));
- LOG_ERROR_F("query partition split failed, {}", response.hint_msg);
+ LOG_ERROR("query partition split failed, {}", response.hint_msg);
return;
}
response.new_partition_count = app->partition_count;
response.status = app->helpers->split_states.status;
- LOG_INFO_F("query partition split succeed, app({}), partition_count({}), splitting_count({})",
- app->app_name,
- response.new_partition_count,
- response.status.size());
+ LOG_INFO("query partition split succeed, app({}), partition_count({}), splitting_count({})",
+ app->app_name,
+ response.new_partition_count,
+ response.status.size());
}
void meta_split_service::control_partition_split(control_split_rpc rpc)
@@ -338,14 +337,14 @@ void meta_split_service::control_partition_split(control_split_rpc rpc)
response.err = app == nullptr ? ERR_APP_NOT_EXIST : ERR_APP_DROPPED;
response.__set_hint_msg(fmt::format(
"app {}", response.err == ERR_APP_NOT_EXIST ? "not existed" : "dropped", req.app_name));
- LOG_ERROR_F("{} split failed, {}", control_type_str(control_type), response.hint_msg);
+ LOG_ERROR("{} split failed, {}", control_type_str(control_type), response.hint_msg);
return;
}
if (!app->splitting()) {
response.err = ERR_INVALID_STATE;
response.__set_hint_msg(fmt::format("app({}) is not splitting", req.app_name));
- LOG_ERROR_F("{} split failed, {}", control_type_str(control_type), response.hint_msg);
+ LOG_ERROR("{} split failed, {}", control_type_str(control_type), response.hint_msg);
return;
}
@@ -368,10 +367,10 @@ void meta_split_service::do_control_single(std::shared_ptr<app_state> app, contr
if (parent_pidx >= app->partition_count / 2) {
response.err = ERR_INVALID_PARAMETERS;
response.__set_hint_msg(fmt::format("invalid parent partition index({})", parent_pidx));
- LOG_ERROR_F("{} split for app({}) failed, {}",
- control_type_str(control_type),
- app_name,
- response.hint_msg);
+ LOG_ERROR("{} split for app({}) failed, {}",
+ control_type_str(control_type),
+ app_name,
+ response.hint_msg);
return;
}
@@ -380,10 +379,10 @@ void meta_split_service::do_control_single(std::shared_ptr<app_state> app, contr
response.err =
control_type == split_control_type::PAUSE ? ERR_CHILD_REGISTERED : ERR_INVALID_STATE;
response.__set_hint_msg(fmt::format("partition[{}] is not splitting", parent_pidx));
- LOG_ERROR_F("{} split for app({}) failed, {}",
- control_type_str(control_type),
- app_name,
- response.hint_msg);
+ LOG_ERROR("{} split for app({}) failed, {}",
+ control_type_str(control_type),
+ app_name,
+ response.hint_msg);
return;
}
@@ -394,19 +393,19 @@ void meta_split_service::do_control_single(std::shared_ptr<app_state> app, contr
if (iter->second == old_status) {
iter->second = target_status;
response.err = ERR_OK;
- LOG_INFO_F("app({}) partition[{}] {} split succeed",
- app_name,
- parent_pidx,
- control_type_str(control_type));
+ LOG_INFO("app({}) partition[{}] {} split succeed",
+ app_name,
+ parent_pidx,
+ control_type_str(control_type));
} else {
response.err = ERR_INVALID_STATE;
response.__set_hint_msg(fmt::format("partition[{}] wrong split_status({})",
parent_pidx,
dsn::enum_to_string(iter->second)));
- LOG_ERROR_F("{} split for app({}) failed, {}",
- control_type_str(control_type),
- app_name,
- response.hint_msg);
+ LOG_ERROR("{} split for app({}) failed, {}",
+ control_type_str(control_type),
+ app_name,
+ response.hint_msg);
}
}
@@ -421,27 +420,26 @@ void meta_split_service::do_control_all(std::shared_ptr<app_state> app, control_
response.err = ERR_INVALID_PARAMETERS;
response.__set_hint_msg(
fmt::format("wrong partition_count, should be {}", app->partition_count / 2));
- LOG_ERROR_F(
- "cancel split for app({}) failed, wrong partition count: partition count({}) "
- "VS req partition_count({})",
- app->app_name,
- app->partition_count,
- req.old_partition_count);
+ LOG_ERROR("cancel split for app({}) failed, wrong partition count: partition count({}) "
+ "VS req partition_count({})",
+ app->app_name,
+ app->partition_count,
+ req.old_partition_count);
return;
}
if (app->helpers->split_states.splitting_count != req.old_partition_count) {
response.err = ERR_CHILD_REGISTERED;
response.__set_hint_msg("some partitions have already finished split");
- LOG_ERROR_F("cancel split for app({}) failed, {}", app->app_name, response.hint_msg);
+ LOG_ERROR("cancel split for app({}) failed, {}", app->app_name, response.hint_msg);
return;
}
for (auto &kv : app->helpers->split_states.status) {
- LOG_INFO_F("app({}) partition({}) cancel split, old status = {}",
- app->app_name,
- kv.first,
- dsn::enum_to_string(kv.second));
+ LOG_INFO("app({}) partition({}) cancel split, old status = {}",
+ app->app_name,
+ kv.first,
+ dsn::enum_to_string(kv.second));
kv.second = split_status::CANCELING;
}
return;
@@ -454,10 +452,10 @@ void meta_split_service::do_control_all(std::shared_ptr<app_state> app, control_
for (auto &kv : app->helpers->split_states.status) {
if (kv.second == old_status) {
kv.second = target_status;
- LOG_INFO_F("app({}) partition[{}] {} split succeed",
- app->app_name,
- kv.first,
- control_type_str(control_type));
+ LOG_INFO("app({}) partition[{}] {} split succeed",
+ app->app_name,
+ kv.first,
+ control_type_str(control_type));
}
}
response.err = ERR_OK;
@@ -481,7 +479,7 @@ void meta_split_service::notify_stop_split(notify_stop_split_rpc rpc)
const auto iter =
app->helpers->split_states.status.find(request.parent_gpid.get_partition_index());
if (iter == app->helpers->split_states.status.end()) {
- LOG_WARNING_F(
+ LOG_WARNING(
"app({}) partition({}) is not executing partition split, ignore out-dated {} split "
"request",
app->app_name,
@@ -492,19 +490,19 @@ void meta_split_service::notify_stop_split(notify_stop_split_rpc rpc)
}
if (iter->second != request.meta_split_status) {
- LOG_WARNING_F("app({}) partition({}) split_status = {}, ignore out-dated {} split request",
- app->app_name,
- request.parent_gpid,
- dsn::enum_to_string(iter->second),
- stop_type);
+ LOG_WARNING("app({}) partition({}) split_status = {}, ignore out-dated {} split request",
+ app->app_name,
+ request.parent_gpid,
+ dsn::enum_to_string(iter->second),
+ stop_type);
response.err = ERR_INVALID_VERSION;
return;
}
- LOG_INFO_F("app({}) partition({}) notify {} split succeed",
- app->app_name,
- request.parent_gpid,
- stop_type);
+ LOG_INFO("app({}) partition({}) notify {} split succeed",
+ app->app_name,
+ request.parent_gpid,
+ stop_type);
// pausing split
if (iter->second == split_status::PAUSING) {
@@ -527,9 +525,9 @@ void meta_split_service::do_cancel_partition_split(std::shared_ptr<app_state> ap
notify_stop_split_rpc rpc)
{
auto on_write_storage_complete = [app, rpc, this]() {
- LOG_INFO_F("app({}) update partition count on remote storage, new partition count is {}",
- app->app_name,
- app->partition_count / 2);
+ LOG_INFO("app({}) update partition count on remote storage, new partition count is {}",
+ app->app_name,
+ app->partition_count / 2);
zauto_write_lock l(app_lock());
app->partition_count /= 2;
app->helpers->contexts.resize(app->partition_count);
@@ -557,7 +555,7 @@ void meta_split_service::query_child_state(query_child_state_rpc rpc)
if (app->partition_count == request.partition_count) {
response.err = ERR_INVALID_STATE;
- LOG_ERROR_F("app({}) is not executing partition split", app_name);
+ LOG_ERROR("app({}) is not executing partition split", app_name);
return;
}
@@ -569,10 +567,10 @@ void meta_split_service::query_child_state(query_child_state_rpc rpc)
auto child_pidx = parent_pid.get_partition_index() + request.partition_count;
if (app->partitions[child_pidx].ballot == invalid_ballot) {
response.err = ERR_INVALID_STATE;
- LOG_ERROR_F("app({}) parent partition({}) split has been canceled", app_name, parent_pid);
+ LOG_ERROR("app({}) parent partition({}) split has been canceled", app_name, parent_pid);
return;
}
- LOG_INFO_F(
+ LOG_INFO(
"app({}) child partition({}.{}) is ready", app_name, parent_pid.get_app_id(), child_pidx);
response.err = ERR_OK;
response.__set_partition_count(app->partition_count);
diff --git a/src/meta/meta_state_service_simple.cpp b/src/meta/meta_state_service_simple.cpp
index 2b297a69c..f1a8255cd 100644
--- a/src/meta/meta_state_service_simple.cpp
+++ b/src/meta/meta_state_service_simple.cpp
@@ -198,7 +198,7 @@ error_code meta_state_service_simple::set_data_internal(const std::string &node,
error_code meta_state_service_simple::apply_transaction(
const std::shared_ptr<meta_state_service::transaction_entries> &t_entries)
{
- LOG_DEBUG_F("internal operation after logged");
+ LOG_DEBUG("internal operation after logged");
simple_transaction_entries *entries =
dynamic_cast<simple_transaction_entries *>(t_entries.get());
CHECK_NOTNULL(entries, "invalid input parameter");
@@ -284,7 +284,7 @@ error_code meta_state_service_simple::initialize(const std::vector<std::string>
_log = file::open(log_path.c_str(), O_RDWR | O_CREAT | O_BINARY, 0666);
if (!_log) {
- LOG_ERROR_F("open file failed: {}", log_path);
+ LOG_ERROR("open file failed: {}", log_path);
return ERR_FILE_OPERATION_FAILED;
}
return ERR_OK;
diff --git a/src/meta/meta_state_service_utils_impl.h b/src/meta/meta_state_service_utils_impl.h
index a5a9ec378..b83bde02c 100644
--- a/src/meta/meta_state_service_utils_impl.h
+++ b/src/meta/meta_state_service_utils_impl.h
@@ -75,9 +75,9 @@ struct operation : pipeline::environment
void on_error(T *this_instance, op_type::type type, error_code ec, const std::string &path)
{
if (ec == ERR_TIMEOUT) {
- LOG_WARNING_F("request({}) on path({}) was timeout, retry after 1 second",
- op_type::to_string(type),
- path);
+ LOG_WARNING("request({}) on path({}) was timeout, retry after 1 second",
+ op_type::to_string(type),
+ path);
pipeline::repeat(std::move(*this_instance), 1_s);
return;
}
diff --git a/src/meta/meta_state_service_zookeeper.cpp b/src/meta/meta_state_service_zookeeper.cpp
index 7a4c282b6..e2408a9fc 100644
--- a/src/meta/meta_state_service_zookeeper.cpp
+++ b/src/meta/meta_state_service_zookeeper.cpp
@@ -168,7 +168,7 @@ error_code meta_state_service_zookeeper::initialize(const std::vector<std::strin
return ERR_TIMEOUT;
}
- LOG_INFO_F("init meta_state_service_zookeeper succeed");
+ LOG_INFO("init meta_state_service_zookeeper succeed");
// Notice: this reference is released in finalize
add_ref();
@@ -206,7 +206,7 @@ task_ptr meta_state_service_zookeeper::create_node(const std::string &node,
{
error_code_future_ptr tsk(new error_code_future(cb_code, cb_create, 0));
tsk->set_tracker(tracker);
- LOG_DEBUG_F("call create, node({})", node);
+ LOG_DEBUG("call create, node({})", node);
VISIT_INIT(tsk, zookeeper_session::ZOO_OPERATION::ZOO_CREATE, node);
input->_value = value;
input->_flags = 0;
@@ -223,7 +223,7 @@ task_ptr meta_state_service_zookeeper::submit_transaction(
{
error_code_future_ptr tsk(new error_code_future(cb_code, cb_transaction, 0));
tsk->set_tracker(tracker);
- LOG_DEBUG_F("call submit batch");
+ LOG_DEBUG("call submit batch");
zookeeper_session::zoo_opcontext *op = zookeeper_session::create_context();
zookeeper_session::zoo_input *input = &op->_input;
op->_callback_function = std::bind(&meta_state_service_zookeeper::visit_zookeeper_internal,
@@ -246,7 +246,7 @@ task_ptr meta_state_service_zookeeper::delete_empty_node(const std::string &node
{
error_code_future_ptr tsk(new error_code_future(cb_code, cb_delete, 0));
tsk->set_tracker(tracker);
- LOG_DEBUG_F("call delete, node({})", node);
+ LOG_DEBUG("call delete, node({})", node);
VISIT_INIT(tsk, zookeeper_session::ZOO_OPERATION::ZOO_DELETE, node);
_session->visit(op);
return tsk;
@@ -313,7 +313,7 @@ task_ptr meta_state_service_zookeeper::get_data(const std::string &node,
{
err_value_future_ptr tsk(new err_value_future(cb_code, cb_get_data, 0));
tsk->set_tracker(tracker);
- LOG_DEBUG_F("call get, node({})", node);
+ LOG_DEBUG("call get, node({})", node);
VISIT_INIT(tsk, zookeeper_session::ZOO_OPERATION::ZOO_GET, node);
input->_is_set_watch = 0;
_session->visit(op);
@@ -328,7 +328,7 @@ task_ptr meta_state_service_zookeeper::set_data(const std::string &node,
{
error_code_future_ptr tsk(new error_code_future(cb_code, cb_set_data, 0));
tsk->set_tracker(tracker);
- LOG_DEBUG_F("call set, node({})", node);
+ LOG_DEBUG("call set, node({})", node);
VISIT_INIT(tsk, zookeeper_session::ZOO_OPERATION::ZOO_SET, node);
input->_value = value;
@@ -343,7 +343,7 @@ task_ptr meta_state_service_zookeeper::node_exist(const std::string &node,
{
error_code_future_ptr tsk(new error_code_future(cb_code, cb_exist, 0));
tsk->set_tracker(tracker);
- LOG_DEBUG_F("call node_exist, node({})", node);
+ LOG_DEBUG("call node_exist, node({})", node);
VISIT_INIT(tsk, zookeeper_session::ZOO_OPERATION::ZOO_EXISTS, node);
input->_is_set_watch = 0;
_session->visit(op);
@@ -357,7 +357,7 @@ task_ptr meta_state_service_zookeeper::get_children(const std::string &node,
{
err_stringv_future_ptr tsk(new err_stringv_future(cb_code, cb_get_children, 0));
tsk->set_tracker(tracker);
- LOG_DEBUG_F("call get children, node({})", node);
+ LOG_DEBUG("call get children, node({})", node);
VISIT_INIT(tsk, zookeeper_session::ZOO_OPERATION::ZOO_GETCHILDREN, node);
input->_is_set_watch = 0;
_session->visit(op);
@@ -372,7 +372,7 @@ void meta_state_service_zookeeper::on_zoo_session_evt(ref_this _this, int zoo_st
if (ZOO_CONNECTING_STATE == zoo_state) {
// TODO: support the switch of zookeeper session
- LOG_WARNING_F("the zk session is reconnecting");
+ LOG_WARNING("the zk session is reconnecting");
} else if (_this->_first_call && ZOO_CONNECTED_STATE == zoo_state) {
_this->_first_call = false;
_this->_notifier.notify();
@@ -388,7 +388,7 @@ void meta_state_service_zookeeper::visit_zookeeper_internal(ref_this,
{
zookeeper_session::zoo_opcontext *op =
reinterpret_cast<zookeeper_session::zoo_opcontext *>(result);
- LOG_DEBUG_F(
+ LOG_DEBUG(
"visit zookeeper internal: ans({}), call type({})", zerror(op->_output.error), op->_optype);
switch (op->_optype) {
diff --git a/src/meta/partition_guardian.cpp b/src/meta/partition_guardian.cpp
index 9852f8047..49a30948b 100644
--- a/src/meta/partition_guardian.cpp
+++ b/src/meta/partition_guardian.cpp
@@ -187,10 +187,10 @@ bool partition_guardian::from_proposals(meta_view &view,
invalid_action:
std::stringstream ss;
ss << action;
- LOG_INFO_F("proposal action({}) for gpid({}) is invalid, clear all proposal actions: {}",
- ss.str(),
- gpid,
- reason);
+ LOG_INFO("proposal action({}) for gpid({}) is invalid, clear all proposal actions: {}",
+ ss.str(),
+ gpid,
+ reason);
action.type = config_type::CT_INVALID;
while (!cc.lb_actions.empty()) {
@@ -236,7 +236,7 @@ pc_status partition_guardian::on_missing_primary(meta_view &view, const dsn::gpi
}
if (action.node.is_invalid()) {
- LOG_ERROR_F(
+ LOG_ERROR(
"all nodes for gpid({}) are dead, waiting for some secondary to come back....",
gpid_name);
result = pc_status::dead;
@@ -279,9 +279,9 @@ pc_status partition_guardian::on_missing_primary(meta_view &view, const dsn::gpi
}
// well, all replicas in this partition is dead
else {
- LOG_WARNING_F("{} enters DDD state, we are waiting for all replicas to come back, "
- "and select primary according to informations collected",
- gpid_name);
+ LOG_WARNING("{} enters DDD state, we are waiting for all replicas to come back, "
+ "and select primary according to informations collected",
+ gpid_name);
// when considering how to handle the DDD state, we must keep in mind that our
// shared/private-log data only write to OS-cache.
// so the last removed replica can't act as primary directly.
@@ -292,17 +292,17 @@ pc_status partition_guardian::on_missing_primary(meta_view &view, const dsn::gpi
const dropped_replica &dr = cc.dropped[i];
char time_buf[30];
::dsn::utils::time_ms_to_string(dr.time, time_buf);
- LOG_INFO_F("{}: config_context.dropped[{}]: "
- "node({}), time({})[{}], ballot({}), "
- "commit_decree({}), prepare_decree({})",
- gpid_name,
- i,
- dr.node,
- dr.time,
- time_buf,
- dr.ballot,
- dr.last_committed_decree,
- dr.last_prepared_decree);
+ LOG_INFO("{}: config_context.dropped[{}]: "
+ "node({}), time({})[{}], ballot({}), "
+ "commit_decree({}), prepare_decree({})",
+ gpid_name,
+ i,
+ dr.node,
+ dr.time,
+ time_buf,
+ dr.ballot,
+ dr.last_committed_decree,
+ dr.last_prepared_decree);
}
for (int i = 0; i < pc.last_drops.size(); ++i) {
@@ -313,27 +313,27 @@ pc_status partition_guardian::on_missing_primary(meta_view &view, const dsn::gpi
break;
}
}
- LOG_INFO_F("{}: config_context.last_drops[{}]: node({}), dropped_index({})",
- gpid_name,
- i,
- pc.last_drops[i],
- dropped_index);
+ LOG_INFO("{}: config_context.last_drops[{}]: node({}), dropped_index({})",
+ gpid_name,
+ i,
+ pc.last_drops[i],
+ dropped_index);
}
if (pc.last_drops.size() == 1) {
- LOG_WARNING_F("{}: the only node({}) is dead, waiting it to come back",
- gpid_name,
- pc.last_drops.back());
+ LOG_WARNING("{}: the only node({}) is dead, waiting it to come back",
+ gpid_name,
+ pc.last_drops.back());
action.node = pc.last_drops.back();
} else {
std::vector<dsn::rpc_address> nodes(pc.last_drops.end() - 2, pc.last_drops.end());
std::vector<dropped_replica> collected_info(2);
bool ready = true;
- LOG_INFO_F("{}: last two drops are {} and {} (the latest dropped)",
- gpid_name,
- nodes[0],
- nodes[1]);
+ LOG_INFO("{}: last two drops are {} and {} (the latest dropped)",
+ gpid_name,
+ nodes[0],
+ nodes[1]);
for (unsigned int i = 0; i < nodes.size(); ++i) {
node_state *ns = get_node_state(*view.nodes, nodes[i], false);
@@ -341,15 +341,15 @@ pc_status partition_guardian::on_missing_primary(meta_view &view, const dsn::gpi
ready = false;
reason = "the last dropped node(" + nodes[i].to_std_string() +
") haven't come back yet";
- LOG_WARNING_F("{}: don't select primary: {}", gpid_name, reason);
+ LOG_WARNING("{}: don't select primary: {}", gpid_name, reason);
} else {
std::vector<dropped_replica>::iterator it = cc.find_from_dropped(nodes[i]);
if (it == cc.dropped.end() || it->ballot == invalid_ballot) {
if (ns->has_collected()) {
- LOG_INFO_F("{}: ignore {}'s replica info as it doesn't exist on "
- "replica server",
- gpid_name,
- nodes[i]);
+ LOG_INFO("{}: ignore {}'s replica info as it doesn't exist on "
+ "replica server",
+ gpid_name,
+ nodes[i]);
collected_info[i] = {nodes[i], 0, -1, -1, -1};
} else {
ready = false;
@@ -360,7 +360,7 @@ pc_status partition_guardian::on_missing_primary(meta_view &view, const dsn::gpi
} else {
reason += "replica info has not been collected from the node";
}
- LOG_WARNING_F("{}: don't select primary: {}", gpid_name, reason);
+ LOG_WARNING("{}: don't select primary: {}", gpid_name, reason);
}
} else {
collected_info[i] = *it;
@@ -371,7 +371,7 @@ pc_status partition_guardian::on_missing_primary(meta_view &view, const dsn::gpi
if (ready && collected_info[0].ballot == -1 && collected_info[1].ballot == -1) {
ready = false;
reason = "no replica info collected from the last two drops";
- LOG_WARNING_F("{}: don't select primary: {}", gpid_name, reason);
+ LOG_WARNING("{}: don't select primary: {}", gpid_name, reason);
}
if (ready) {
@@ -402,7 +402,7 @@ pc_status partition_guardian::on_missing_primary(meta_view &view, const dsn::gpi
? previous_dead.node
: recent_dead.node;
}
- LOG_INFO_F("{}: select {} as a new primary", gpid_name, action.node);
+ LOG_INFO("{}: select {} as a new primary", gpid_name, action.node);
} else {
char buf[1000];
sprintf(buf,
@@ -412,12 +412,12 @@ pc_status partition_guardian::on_missing_primary(meta_view &view, const dsn::gpi
larger_pd,
pc.last_committed_decree,
larger_cd);
- LOG_WARNING_F("{}: don't select primary: {}", gpid_name, reason);
+ LOG_WARNING("{}: don't select primary: {}", gpid_name, reason);
}
} else {
reason = "for the last two drops, the node with larger ballot has smaller last "
"committed decree";
- LOG_WARNING_F("{}: don't select primary: {}", gpid_name, reason);
+ LOG_WARNING("{}: don't select primary: {}", gpid_name, reason);
}
}
}
@@ -429,9 +429,9 @@ pc_status partition_guardian::on_missing_primary(meta_view &view, const dsn::gpi
get_newly_partitions(*view.nodes, action.node)
->newly_add_primary(gpid.get_app_id(), false);
} else {
- LOG_WARNING_F("{}: don't select any node for security reason, administrator can select "
- "a proper one by shell",
- gpid_name);
+ LOG_WARNING("{}: don't select any node for security reason, administrator can select "
+ "a proper one by shell",
+ gpid_name);
_recent_choose_primary_fail_count->increment();
ddd_partition_info pinfo;
pinfo.config = pc;
@@ -483,25 +483,25 @@ pc_status partition_guardian::on_missing_secondary(meta_view &view, const dsn::g
// when max_replica_count == 2, even if there is only 1 replica alive now, we will still
// wait for replica_assign_delay_ms_for_dropouts before recover the second replica.
is_emergency = true;
- LOG_INFO_F("gpid({}): is emergency due to too few replicas", gpid);
+ LOG_INFO("gpid({}): is emergency due to too few replicas", gpid);
} else if (cc.dropped.empty()) {
is_emergency = true;
- LOG_INFO_F("gpid({}): is emergency due to no dropped candidate", gpid);
+ LOG_INFO("gpid({}): is emergency due to no dropped candidate", gpid);
} else if (has_milliseconds_expired(cc.dropped.back().time +
_replica_assign_delay_ms_for_dropouts)) {
is_emergency = true;
char time_buf[30];
::dsn::utils::time_ms_to_string(cc.dropped.back().time, time_buf);
- LOG_INFO_F("gpid({}): is emergency due to lose secondary for a long time, "
- "last_dropped_node({}), drop_time({}), delay_ms({})",
- gpid,
- cc.dropped.back().node,
- time_buf,
- _replica_assign_delay_ms_for_dropouts);
+ LOG_INFO("gpid({}): is emergency due to lose secondary for a long time, "
+ "last_dropped_node({}), drop_time({}), delay_ms({})",
+ gpid,
+ cc.dropped.back().node,
+ time_buf,
+ _replica_assign_delay_ms_for_dropouts);
} else if (in_black_list(cc.dropped.back().node)) {
- LOG_INFO_F("gpid({}) is emergency due to recent dropped({}) is in black list",
- gpid,
- cc.dropped.back().node);
+ LOG_INFO("gpid({}) is emergency due to recent dropped({}) is in black list",
+ gpid,
+ cc.dropped.back().node);
is_emergency = true;
}
action.node.set_invalid();
@@ -513,51 +513,51 @@ pc_status partition_guardian::on_missing_secondary(meta_view &view, const dsn::g
oss << ",";
oss << cc.dropped[i].node.to_string();
}
- LOG_INFO_F(
+ LOG_INFO(
"gpid({}): try to choose node in dropped list, dropped_list({}), prefered_dropped({})",
gpid,
oss.str(),
cc.prefered_dropped);
if (cc.prefered_dropped < 0 || cc.prefered_dropped >= (int)cc.dropped.size()) {
- LOG_INFO_F("gpid({}): prefered_dropped({}) is invalid according to drop_list(size {}), "
- "reset it to {} (drop_list.size - 1)",
- gpid,
- cc.prefered_dropped,
- cc.dropped.size(),
- cc.dropped.size() - 1);
+ LOG_INFO("gpid({}): prefered_dropped({}) is invalid according to drop_list(size {}), "
+ "reset it to {} (drop_list.size - 1)",
+ gpid,
+ cc.prefered_dropped,
+ cc.dropped.size(),
+ cc.dropped.size() - 1);
cc.prefered_dropped = (int)cc.dropped.size() - 1;
}
while (cc.prefered_dropped >= 0) {
const dropped_replica &server = cc.dropped[cc.prefered_dropped];
if (is_node_alive(*view.nodes, server.node)) {
- LOG_INFO_F("gpid({}): node({}) at cc.dropped[{}] is alive now, choose it, "
- "and forward prefered_dropped from {} to {}",
- gpid,
- server.node,
- cc.prefered_dropped,
- cc.prefered_dropped,
- cc.prefered_dropped - 1);
+ LOG_INFO("gpid({}): node({}) at cc.dropped[{}] is alive now, choose it, "
+ "and forward prefered_dropped from {} to {}",
+ gpid,
+ server.node,
+ cc.prefered_dropped,
+ cc.prefered_dropped,
+ cc.prefered_dropped - 1);
action.node = server.node;
cc.prefered_dropped--;
break;
} else {
- LOG_INFO_F("gpid({}): node({}) at cc.dropped[{}] is not alive now, "
- "changed prefered_dropped from {} to {}",
- gpid,
- server.node,
- cc.prefered_dropped,
- cc.prefered_dropped,
- cc.prefered_dropped - 1);
+ LOG_INFO("gpid({}): node({}) at cc.dropped[{}] is not alive now, "
+ "changed prefered_dropped from {} to {}",
+ gpid,
+ server.node,
+ cc.prefered_dropped,
+ cc.prefered_dropped,
+ cc.prefered_dropped - 1);
cc.prefered_dropped--;
}
}
if (action.node.is_invalid() || in_black_list(action.node)) {
if (!action.node.is_invalid()) {
- LOG_INFO_F("gpid({}) refuse to use selected node({}) as it is in black list",
- gpid,
- action.node);
+ LOG_INFO("gpid({}) refuse to use selected node({}) as it is in black list",
+ gpid,
+ action.node);
}
newly_partitions *min_server_np = nullptr;
for (auto &pairs : *view.nodes) {
@@ -573,14 +573,14 @@ pc_status partition_guardian::on_missing_secondary(meta_view &view, const dsn::g
}
if (!action.node.is_invalid()) {
- LOG_INFO_F("gpid({}): can't find valid node in dropped list to add as secondary, "
- "choose new node({}) with minimal partitions serving",
- gpid,
- action.node);
+ LOG_INFO("gpid({}): can't find valid node in dropped list to add as secondary, "
+ "choose new node({}) with minimal partitions serving",
+ gpid,
+ action.node);
} else {
- LOG_INFO_F("gpid({}): can't find valid node in dropped list to add as secondary, "
- "but also we can't find a new node to add as secondary",
- gpid);
+ LOG_INFO("gpid({}): can't find valid node in dropped list to add as secondary, "
+ "but also we can't find a new node to add as secondary",
+ gpid);
}
}
} else {
@@ -594,15 +594,15 @@ pc_status partition_guardian::on_missing_secondary(meta_view &view, const dsn::g
}
if (!action.node.is_invalid()) {
- LOG_INFO_F("gpid({}): choose node({}) as secondary coz it is last_dropped_node and is "
- "alive now",
- gpid,
- server.node);
+ LOG_INFO("gpid({}): choose node({}) as secondary coz it is last_dropped_node and is "
+ "alive now",
+ gpid,
+ server.node);
} else {
- LOG_INFO_F("gpid({}): can't add secondary coz last_dropped_node({}) is not alive now, "
- "ignore this as not in emergency",
- gpid,
- server.node);
+ LOG_INFO("gpid({}): can't add secondary coz last_dropped_node({}) is not alive now, "
+ "ignore this as not in emergency",
+ gpid,
+ server.node);
}
}
@@ -650,9 +650,9 @@ void partition_guardian::finish_cure_proposal(meta_view &view,
{
newly_partitions *np = get_newly_partitions(*(view.nodes), act.node);
if (np == nullptr) {
- LOG_INFO_F("can't get the newly_partitions extension structure for node({}), "
- "the node may be dead and removed",
- act.node);
+ LOG_INFO("can't get the newly_partitions extension structure for node({}), "
+ "the node may be dead and removed",
+ act.node);
} else {
if (act.type == config_type::CT_ASSIGN_PRIMARY) {
np->newly_remove_primary(gpid.get_app_id(), false);
diff --git a/src/meta/server_state.cpp b/src/meta/server_state.cpp
index 593a11fb3..c766d439e 100644
--- a/src/meta/server_state.cpp
+++ b/src/meta/server_state.cpp
@@ -215,7 +215,7 @@ bool server_state::spin_wait_staging(int timeout_seconds)
if (c == 0) {
return true;
}
- LOG_INFO_F("there are {} apps still in staging, just wait...", c);
+ LOG_INFO("there are {} apps still in staging, just wait...", c);
std::this_thread::sleep_for(std::chrono::seconds(1));
if (timeout_seconds > 0) {
--timeout_seconds;
@@ -272,10 +272,10 @@ void server_state::transition_staging_state(std::shared_ptr<app_state> &app)
enum_to_string(app->status));
}
- LOG_INFO_F("app({}) transfer from {} to {}",
- app->get_logname(),
- enum_to_string(old_status),
- enum_to_string(app->status));
+ LOG_INFO("app({}) transfer from {} to {}",
+ app->get_logname(),
+ enum_to_string(old_status),
+ enum_to_string(app->status));
#undef send_response
}
@@ -283,10 +283,10 @@ void server_state::process_one_partition(std::shared_ptr<app_state> &app)
{
int ans = --app->helpers->partitions_in_progress;
if (ans > 0) {
- LOG_DEBUG_F("app({}) in status {}, can't transfer to stable state as some partition is in "
- "progressing",
- app->get_logname(),
- enum_to_string(app->status));
+ LOG_DEBUG("app({}) in status {}, can't transfer to stable state as some partition is in "
+ "progressing",
+ app->get_logname(),
+ enum_to_string(app->status));
return;
} else if (ans == 0) {
transition_staging_state(app);
@@ -300,7 +300,7 @@ error_code server_state::dump_app_states(const char *local_path,
{
std::shared_ptr<dump_file> file = dump_file::open_file(local_path, true);
if (file == nullptr) {
- LOG_ERROR_F("open file failed, file({})", local_path);
+ LOG_ERROR("open file failed, file({})", local_path);
return ERR_FILE_OPERATION_FAILED;
}
@@ -328,10 +328,10 @@ error_code server_state::dump_from_remote_storage(const char *local_path, bool s
if (sync_immediately) {
ec = sync_apps_from_remote_storage();
if (ec == ERR_OBJECT_NOT_FOUND) {
- LOG_INFO_F("remote storage is empty, just stop the dump");
+ LOG_INFO("remote storage is empty, just stop the dump");
return ERR_OK;
} else if (ec != ERR_OK) {
- LOG_ERROR_F("sync from remote storage failed, err({})", ec);
+ LOG_ERROR("sync from remote storage failed, err({})", ec);
return ec;
} else {
spin_wait_staging();
@@ -350,7 +350,7 @@ error_code server_state::dump_from_remote_storage(const char *local_path, bool s
{
zauto_read_lock l(_lock);
if (count_staging_app() != 0) {
- LOG_INFO_F("there are apps in staging, skip this dump");
+ LOG_INFO("there are apps in staging, skip this dump");
return ERR_INVALID_STATE;
}
snapshots.reserve(_all_apps.size());
@@ -374,7 +374,7 @@ error_code server_state::restore_from_local_storage(const char *local_path)
std::shared_ptr<dump_file> file = dump_file::open_file(local_path, false);
if (file == nullptr) {
- LOG_ERROR_F("open file failed, file({})", local_path);
+ LOG_ERROR("open file failed, file({})", local_path);
return ERR_FILE_OPERATION_FAILED;
}
@@ -429,7 +429,7 @@ error_code server_state::initialize_default_apps()
{
std::vector<const char *> sections;
dsn_config_get_all_sections(sections);
- LOG_INFO_F("start to do initialize");
+ LOG_INFO("start to do initialize");
app_info default_app;
for (int i = 0; i < sections.size(); i++) {
@@ -442,7 +442,7 @@ error_code server_state::initialize_default_apps()
default_app.app_name = dsn_config_get_value_string(s, "app_name", "", "app name");
if (default_app.app_name.length() == 0) {
- LOG_WARNING_F("'[{}] app_name' not specified, ignore this section", s);
+ LOG_WARNING("'[{}] app_name' not specified, ignore this section", s);
continue;
}
@@ -499,10 +499,10 @@ error_code server_state::sync_apps_to_remote_storage()
t->wait();
if (err != ERR_NODE_ALREADY_EXIST && err != ERR_OK) {
- LOG_ERROR_F("create root node /apps in meta store failed, err = {}", err);
+ LOG_ERROR("create root node /apps in meta store failed, err = {}", err);
return err;
} else {
- LOG_INFO_F("set {} to lock state in remote storage", _apps_root);
+ LOG_INFO("set {} to lock state in remote storage", _apps_root);
}
err = ERR_OK;
@@ -519,11 +519,11 @@ error_code server_state::sync_apps_to_remote_storage()
LPC_META_CALLBACK,
[&err, path](error_code ec) {
if (ec != ERR_OK && ec != ERR_NODE_ALREADY_EXIST) {
- LOG_WARNING_F(
+ LOG_WARNING(
"create app node failed, path({}) reason({})", path, ec);
err = ec;
} else {
- LOG_INFO_F("create app node {} ok", path);
+ LOG_INFO("create app node {} ok", path);
}
},
value,
@@ -550,10 +550,10 @@ error_code server_state::sync_apps_to_remote_storage()
[&err](dsn::error_code e) { err = e; });
t->wait();
if (dsn::ERR_OK == err) {
- LOG_INFO_F("set {} to unlock state in remote storage", _apps_root);
+ LOG_INFO("set {} to unlock state in remote storage", _apps_root);
return err;
} else {
- LOG_ERROR_F("set {} to unlock state in remote storage failed, reason({})", _apps_root, err);
+ LOG_ERROR("set {} to unlock state in remote storage failed, reason({})", _apps_root, err);
return err;
}
}
@@ -607,12 +607,12 @@ dsn::error_code server_state::sync_apps_from_remote_storage()
? app->init_partition_count
: app->partition_count;
if (partition_id < init_partition_count) {
- LOG_WARNING_F(
+ LOG_WARNING(
"partition node {} not exist on remote storage, may half create before",
partition_path);
init_app_partition_node(app, partition_id, nullptr);
} else if (partition_id >= app->partition_count / 2) {
- LOG_WARNING_F(
+ LOG_WARNING(
"partition node {} not exist on remote storage, may half split before",
partition_path);
zauto_write_lock l(_lock);
@@ -625,7 +625,7 @@ dsn::error_code server_state::sync_apps_from_remote_storage()
}
} else {
- LOG_ERROR_F("get partition node failed, reason({})", ec);
+ LOG_ERROR("get partition node failed, reason({})", ec);
err = ec;
}
},
@@ -664,9 +664,9 @@ dsn::error_code server_state::sync_apps_from_remote_storage()
sync_partition(app, i, partition_path);
}
} else {
- LOG_ERROR_F("get app info from meta state service failed, path = {}, err = {}",
- app_path,
- ec);
+ LOG_ERROR("get app info from meta state service failed, path = {}, err = {}",
+ app_path,
+ ec);
err = ec;
}
},
@@ -704,9 +704,9 @@ dsn::error_code server_state::sync_apps_from_remote_storage()
sync_app(_apps_root + "/" + appid_str);
}
} else {
- LOG_ERROR_F("get app list from meta state service failed, path = {}, err = {}",
- _apps_root,
- ec);
+ LOG_ERROR("get app list from meta state service failed, path = {}, err = {}",
+ _apps_root,
+ ec);
err = ec;
}
},
@@ -753,7 +753,7 @@ error_code server_state::initialize_data_structure()
if (_meta_svc->get_meta_options().recover_from_replica_server) {
return ERR_OBJECT_NOT_FOUND;
} else {
- LOG_INFO_F("can't find apps from remote storage, start to initialize default apps");
+ LOG_INFO("can't find apps from remote storage, start to initialize default apps");
err = initialize_default_apps();
}
} else if (err == ERR_OK) {
@@ -762,7 +762,7 @@ error_code server_state::initialize_data_structure()
"find apps from remote storage, but "
"[meta_server].recover_from_replica_server = true");
} else {
- LOG_INFO_F(
+ LOG_INFO(
"sync apps from remote storage ok, get {} apps, init the node state accordingly",
_all_apps.size());
initialize_node_state();
@@ -791,9 +791,9 @@ void server_state::on_config_sync(configuration_query_by_node_rpc rpc)
bool reject_this_request = false;
response.__isset.gc_replicas = false;
- LOG_INFO_F("got config sync request from {}, stored_replicas_count({})",
- request.node,
- request.stored_replicas.size());
+ LOG_INFO("got config sync request from {}, stored_replicas_count({})",
+ request.node,
+ request.stored_replicas.size());
{
zauto_read_lock l(_lock);
@@ -801,7 +801,7 @@ void server_state::on_config_sync(configuration_query_by_node_rpc rpc)
// sync the partitions to the replica server
node_state *ns = get_node_state(_nodes, request.node, false);
if (ns == nullptr) {
- LOG_INFO_F("node({}) not found in meta server", request.node);
+ LOG_INFO("node({}) not found in meta server", request.node);
response.err = ERR_OBJECT_NOT_FOUND;
} else {
response.err = ERR_OK;
@@ -855,7 +855,7 @@ void server_state::on_config_sync(configuration_query_by_node_rpc rpc)
// the app is deleted but not expired, we need to ignore it
// if the app is deleted and expired, we need to gc it
for (const replica_info &rep : replicas) {
- LOG_DEBUG_F("receive stored replica from {}, pid({})", request.node, rep.pid);
+ LOG_DEBUG("receive stored replica from {}, pid({})", request.node, rep.pid);
std::shared_ptr<app_state> app = get_app(rep.pid.get_app_id());
if (app == nullptr || rep.pid.get_partition_index() >= app->partition_count) {
// This app has garbage partition after cancel split, the canceled child
@@ -864,7 +864,7 @@ void server_state::on_config_sync(configuration_query_by_node_rpc rpc)
rep.pid.get_partition_index() < app->partition_count * 2 &&
rep.status == partition_status::PS_ERROR) {
response.gc_replicas.push_back(rep);
- LOG_WARNING_F(
+ LOG_WARNING(
"notify node({}) to gc replica({}) because it is useless partition "
"which is caused by cancel split",
request.node.to_string(),
@@ -879,26 +879,26 @@ void server_state::on_config_sync(configuration_query_by_node_rpc rpc)
}
} else if (app->status == app_status::AS_DROPPED) {
if (app->expire_second == 0) {
- LOG_INFO_F("gpid({}) on node({}) is of dropped table, but expire second is "
- "not specified, do not delete it for safety reason",
- rep.pid,
- request.node);
+ LOG_INFO("gpid({}) on node({}) is of dropped table, but expire second is "
+ "not specified, do not delete it for safety reason",
+ rep.pid,
+ request.node);
} else if (has_seconds_expired(app->expire_second)) {
// can delete replica only when expire second is explicitely specified and
// expired.
if (level <= meta_function_level::fl_steady) {
- LOG_INFO_F("gpid({}) on node({}) is of dropped and expired table, but "
- "current function level is {}, do not delete it for safety "
- "reason",
- rep.pid,
- request.node,
- _meta_function_level_VALUES_TO_NAMES.find(level)->second);
+ LOG_INFO("gpid({}) on node({}) is of dropped and expired table, but "
+ "current function level is {}, do not delete it for safety "
+ "reason",
+ rep.pid,
+ request.node,
+ _meta_function_level_VALUES_TO_NAMES.find(level)->second);
} else {
response.gc_replicas.push_back(rep);
- LOG_WARNING_F("notify node({}) to gc replica({}) coz the app is "
- "dropped and expired",
- request.node,
- rep.pid);
+ LOG_WARNING("notify node({}) to gc replica({}) coz the app is "
+ "dropped and expired",
+ request.node,
+ rep.pid);
}
}
} else if (app->status == app_status::AS_AVAILABLE) {
@@ -906,16 +906,16 @@ void server_state::on_config_sync(configuration_query_by_node_rpc rpc)
collect_replica({&_all_apps, &_nodes}, request.node, rep);
if (!is_useful_replica) {
if (level <= meta_function_level::fl_steady) {
- LOG_INFO_F("gpid({}) on node({}) is useless, but current function "
- "level is {}, do not delete it for safety reason",
- rep.pid,
- request.node,
- _meta_function_level_VALUES_TO_NAMES.find(level)->second);
+ LOG_INFO("gpid({}) on node({}) is useless, but current function "
+ "level is {}, do not delete it for safety reason",
+ rep.pid,
+ request.node,
+ _meta_function_level_VALUES_TO_NAMES.find(level)->second);
} else {
response.gc_replicas.push_back(rep);
- LOG_WARNING_F("notify node({}) to gc replica({}) coz it is useless",
- request.node,
- rep.pid);
+ LOG_WARNING("notify node({}) to gc replica({}) coz it is useless",
+ request.node,
+ rep.pid);
}
}
}
@@ -931,12 +931,12 @@ void server_state::on_config_sync(configuration_query_by_node_rpc rpc)
response.err = ERR_BUSY;
response.partitions.clear();
}
- LOG_INFO_F("send config sync response to {}, err({}), partitions_count({}), "
- "gc_replicas_count({})",
- request.node.to_string(),
- response.err,
- response.partitions.size(),
- response.gc_replicas.size());
+ LOG_INFO("send config sync response to {}, err({}), partitions_count({}), "
+ "gc_replicas_count({})",
+ request.node.to_string(),
+ response.err,
+ response.partitions.size(),
+ response.gc_replicas.size());
}
bool server_state::query_configuration_by_gpid(dsn::gpid id,
@@ -963,10 +963,10 @@ void server_state::query_configuration_by_index(const query_cfg_request &request
std::shared_ptr<app_state> &app = iter->second;
if (app->status != app_status::AS_AVAILABLE) {
- LOG_ERROR_F("invalid status({}) in exist app({}), app_id({})",
- enum_to_string(app->status),
- app->app_name,
- app->app_id);
+ LOG_ERROR("invalid status({}) in exist app({}), app_id({})",
+ enum_to_string(app->status),
+ app->app_name,
+ app->app_id);
switch (app->status) {
case app_status::AS_CREATING:
@@ -1000,7 +1000,7 @@ void server_state::init_app_partition_node(std::shared_ptr<app_state> &app,
task_ptr callback)
{
auto on_create_app_partition = [this, pidx, app, callback](error_code ec) mutable {
- LOG_DEBUG_F("create partition node: gpid({}.{}), result: {}", app->app_id, pidx, ec);
+ LOG_DEBUG("create partition node: gpid({}.{}), result: {}", app->app_id, pidx, ec);
if (ERR_OK == ec || ERR_NODE_ALREADY_EXIST == ec) {
{
zauto_write_lock l(_lock);
@@ -1010,7 +1010,7 @@ void server_state::init_app_partition_node(std::shared_ptr<app_state> &app,
callback->enqueue();
}
} else if (ERR_TIMEOUT == ec) {
- LOG_WARNING_F(
+ LOG_WARNING(
"create partition node failed, gpid({}.{}), retry later", app->app_id, pidx);
// TODO: add parameter of the retry time interval in config file
tasking::enqueue(
@@ -1039,13 +1039,12 @@ void server_state::do_app_create(std::shared_ptr<app_state> &app)
{
auto on_create_app_root = [this, app](error_code ec) mutable {
if (ERR_OK == ec || ERR_NODE_ALREADY_EXIST == ec) {
- LOG_DEBUG_F("create app({}) on storage service ok", app->get_logname());
+ LOG_DEBUG("create app({}) on storage service ok", app->get_logname());
for (unsigned int i = 0; i != app->partition_count; ++i) {
init_app_partition_node(app, i, nullptr);
}
} else if (ERR_TIMEOUT == ec) {
- LOG_WARNING_F(
- "the storage service is not available currently, continue to create later");
+ LOG_WARNING("the storage service is not available currently, continue to create later");
tasking::enqueue(LPC_META_STATE_HIGH,
tracker(),
std::bind(&server_state::do_app_create, this, app),
@@ -1072,19 +1071,18 @@ void server_state::create_app(dsn::message_ex *msg)
const auto &duplication_env_iterator =
request.options.envs.find(duplication_constants::kDuplicationEnvMasterClusterKey);
- LOG_INFO_F(
- "create app request, name({}), type({}), partition_count({}), replica_count({}), "
- "duplication({})",
- request.app_name,
- request.options.app_type,
- request.options.partition_count,
- request.options.replica_count,
- duplication_env_iterator == request.options.envs.end()
- ? "false"
- : fmt::format(
- "{}.{}",
- request.options.envs[duplication_constants::kDuplicationEnvMasterClusterKey],
- request.app_name));
+ LOG_INFO("create app request, name({}), type({}), partition_count({}), replica_count({}), "
+ "duplication({})",
+ request.app_name,
+ request.options.app_type,
+ request.options.partition_count,
+ request.options.replica_count,
+ duplication_env_iterator == request.options.envs.end()
+ ? "false"
+ : fmt::format(
+ "{}.{}",
+ request.options.envs[duplication_constants::kDuplicationEnvMasterClusterKey],
+ request.app_name));
auto option_match_check = [](const create_app_options &opt, const app_state &exist_app) {
return opt.partition_count == exist_app.partition_count &&
@@ -1095,7 +1093,7 @@ void server_state::create_app(dsn::message_ex *msg)
auto level = _meta_svc->get_function_level();
if (level <= meta_function_level::fl_freezed) {
- LOG_ERROR_F("current meta function level is freezed, since there are too few alive nodes");
+ LOG_ERROR("current meta function level is freezed, since there are too few alive nodes");
response.err = ERR_STATE_FREEZED;
will_create_app = false;
} else if (request.options.partition_count <= 0 ||
@@ -1169,7 +1167,7 @@ void server_state::do_app_drop(std::shared_ptr<app_state> &app)
drop_partition(app, i);
}
} else if (ERR_TIMEOUT == ec) {
- LOG_DEBUG_F("drop app({}) prepare timeout, continue to drop later", app->get_logname());
+ LOG_DEBUG("drop app({}) prepare timeout, continue to drop later", app->get_logname());
tasking::enqueue(LPC_META_STATE_HIGH,
tracker(),
std::bind(&server_state::do_app_drop, this, app),
@@ -1194,7 +1192,7 @@ void server_state::drop_app(dsn::message_ex *msg)
bool do_dropping = false;
std::shared_ptr<app_state> app;
dsn::unmarshall(msg, request);
- LOG_INFO_F("drop app request, name({})", request.app_name);
+ LOG_INFO("drop app request, name({})", request.app_name);
{
zauto_write_lock l(_lock);
app = get_app(request.app_name);
@@ -1251,8 +1249,7 @@ void server_state::rename_app(configuration_rename_app_rpc rpc)
const auto &old_app_name = rpc.request().old_app_name;
const auto &new_app_name = rpc.request().new_app_name;
- LOG_INFO_F(
- "rename app request, old_app_name({}), new_app_name({})", old_app_name, new_app_name);
+ LOG_INFO("rename app request, old_app_name({}), new_app_name({})", old_app_name, new_app_name);
zauto_write_lock l(_lock);
auto target_app = get_app(old_app_name);
@@ -1315,11 +1312,11 @@ void server_state::rename_app(configuration_rename_app_rpc rpc)
zauto_write_lock l(_lock);
_exist_apps.erase(old_app_name);
- LOG_INFO_F("both remote and local app info of app_name have been updated "
- "successfully: app_id={}, old_app_name={}, new_app_name={}",
- app_id,
- old_app_name,
- new_app_name);
+ LOG_INFO("both remote and local app info of app_name have been updated "
+ "successfully: app_id={}, old_app_name={}, new_app_name={}",
+ app_id,
+ old_app_name,
+ new_app_name);
});
}
@@ -1345,7 +1342,7 @@ void server_state::recall_app(dsn::message_ex *msg)
std::shared_ptr<app_state> target_app;
dsn::unmarshall(msg, request);
- LOG_INFO_F("recall app request, app_id({})", request.app_id);
+ LOG_INFO("recall app request, app_id({})", request.app_id);
bool do_recalling = false;
{
@@ -1394,7 +1391,7 @@ void server_state::recall_app(dsn::message_ex *msg)
void server_state::list_apps(const configuration_list_apps_request &request,
configuration_list_apps_response &response)
{
- LOG_DEBUG_F("list app request, status({})", request.status);
+ LOG_DEBUG("list app request, status({})", request.status);
zauto_read_lock l(_lock);
for (auto &kv : _all_apps) {
app_state &app = *(kv.second);
@@ -1407,12 +1404,12 @@ void server_state::list_apps(const configuration_list_apps_request &request,
void server_state::send_proposal(rpc_address target, const configuration_update_request &proposal)
{
- LOG_INFO_F("send proposal {} for gpid({}), ballot = {}, target = {}, node = {}",
- ::dsn::enum_to_string(proposal.type),
- proposal.config.pid,
- proposal.config.ballot,
- target,
- proposal.node);
+ LOG_INFO("send proposal {} for gpid({}), ballot = {}, target = {}, node = {}",
+ ::dsn::enum_to_string(proposal.type),
+ proposal.config.pid,
+ proposal.config.ballot,
+ target,
+ proposal.node);
dsn::message_ex *msg =
dsn::message_ex::create_request(RPC_CONFIG_PROPOSAL, 0, proposal.config.pid.thread_hash());
::marshall(msg, proposal);
@@ -1581,15 +1578,15 @@ void server_state::update_configuration_locally(
old_cfg = config_request->config;
auto find_name = _config_type_VALUES_TO_NAMES.find(config_request->type);
if (find_name != _config_type_VALUES_TO_NAMES.end()) {
- LOG_INFO_F("meta update config ok: type({}), old_config={}, {}",
- find_name->second,
- old_config_str,
- boost::lexical_cast<std::string>(*config_request));
+ LOG_INFO("meta update config ok: type({}), old_config={}, {}",
+ find_name->second,
+ old_config_str,
+ boost::lexical_cast<std::string>(*config_request));
} else {
- LOG_INFO_F("meta update config ok: type({}), old_config={}, {}",
- config_request->type,
- old_config_str,
- boost::lexical_cast<std::string>(*config_request));
+ LOG_INFO("meta update config ok: type({}), old_config={}, {}",
+ config_request->type,
+ old_config_str,
+ boost::lexical_cast<std::string>(*config_request));
}
#ifndef NDEBUG
@@ -1613,8 +1610,8 @@ task_ptr server_state::update_configuration_on_remote(
{
meta_function_level::type l = _meta_svc->get_function_level();
if (l <= meta_function_level::fl_blind) {
- LOG_INFO_F("ignore update configuration on remote due to level is {}",
- _meta_function_level_VALUES_TO_NAMES.find(l)->second);
+ LOG_INFO("ignore update configuration on remote due to level is {}",
+ _meta_function_level_VALUES_TO_NAMES.find(l)->second);
// NOTICE: pending_sync_task need to be reassigned
return tasking::enqueue(
LPC_META_STATE_HIGH,
@@ -1765,10 +1762,10 @@ void server_state::drop_partition(std::shared_ptr<app_state> &app, int pidx)
request.config.ballot++;
if (config_status::pending_remote_sync == cc.stage) {
- LOG_WARNING_F("gpid({}.{}) is syncing another request with remote, cancel it due to "
- "partition is dropped",
- app->app_id,
- pidx);
+ LOG_WARNING("gpid({}.{}) is syncing another request with remote, cancel it due to "
+ "partition is dropped",
+ app->app_id,
+ pidx);
cc.cancel_sync();
}
cc.stage = config_status::pending_remote_sync;
@@ -1790,14 +1787,14 @@ void server_state::downgrade_primary_to_inactive(std::shared_ptr<app_state> &app
"app({}) not in dropping state ({})",
app->get_logname(),
enum_to_string(app->status));
- LOG_WARNING_F(
+ LOG_WARNING(
"stop downgrade primary as the partitions({}.{}) is dropping", app->app_id, pidx);
return;
} else {
- LOG_WARNING_F("gpid({}) is syncing another request with remote, cancel it due to the "
- "primary({}) is down",
- pc.pid,
- pc.primary);
+ LOG_WARNING("gpid({}) is syncing another request with remote, cancel it due to the "
+ "primary({}) is down",
+ pc.pid,
+ pc.primary);
cc.cancel_sync();
}
}
@@ -1836,10 +1833,10 @@ void server_state::downgrade_secondary_to_inactive(std::shared_ptr<app_state> &a
request.node = node;
send_proposal(pc.primary, request);
} else {
- LOG_INFO_F("gpid({}.{}) is syncing with remote storage, ignore the remove seconary({})",
- app->app_id,
- pidx,
- node);
+ LOG_INFO("gpid({}.{}) is syncing with remote storage, ignore the remove seconary({})",
+ app->app_id,
+ pidx,
+ node);
}
}
@@ -1875,11 +1872,11 @@ void server_state::downgrade_stateless_nodes(std::shared_ptr<app_state> &app,
pc.last_drops.pop_back();
if (config_status::pending_remote_sync == cc.stage) {
- LOG_WARNING_F("gpid({}) is syncing another request with remote, cancel it due to meta is "
- "removing host({}) worker({})",
- pc.pid,
- req->host_node,
- req->node);
+ LOG_WARNING("gpid({}) is syncing another request with remote, cancel it due to meta is "
+ "removing host({}) worker({})",
+ pc.pid,
+ req->host_node,
+ req->node);
cc.cancel_sync();
}
cc.stage = config_status::pending_remote_sync;
@@ -1904,17 +1901,17 @@ void server_state::on_update_configuration(
CHECK(app->is_stateful, "don't support stateless apps currently, id({})", gpid.get_app_id());
auto find_name = _config_type_VALUES_TO_NAMES.find(cfg_request->type);
if (find_name != _config_type_VALUES_TO_NAMES.end()) {
- LOG_INFO_F("recv update config request: type({}), {}",
- find_name->second,
- boost::lexical_cast<std::string>(*cfg_request));
+ LOG_INFO("recv update config request: type({}), {}",
+ find_name->second,
+ boost::lexical_cast<std::string>(*cfg_request));
} else {
- LOG_INFO_F("recv update config request: type({}), {}",
- cfg_request->type,
- boost::lexical_cast<std::string>(*cfg_request));
+ LOG_INFO("recv update config request: type({}), {}",
+ cfg_request->type,
+ boost::lexical_cast<std::string>(*cfg_request));
}
if (is_partition_config_equal(pc, cfg_request->config)) {
- LOG_INFO_F("duplicated update request for gpid({}), ballot: {}", gpid, pc.ballot);
+ LOG_INFO("duplicated update request for gpid({}), ballot: {}", gpid, pc.ballot);
response.err = ERR_OK;
//
// NOTICE:
@@ -1923,18 +1920,18 @@ void server_state::on_update_configuration(
//
response.config = pc;
} else if (pc.ballot + 1 != cfg_request->config.ballot) {
- LOG_INFO_F("update configuration for gpid({}) reject coz ballot not match, request ballot: "
- "{}, meta ballot: {}",
- gpid,
- cfg_request->config.ballot,
- pc.ballot);
+ LOG_INFO("update configuration for gpid({}) reject coz ballot not match, request ballot: "
+ "{}, meta ballot: {}",
+ gpid,
+ cfg_request->config.ballot,
+ pc.ballot);
response.err = ERR_INVALID_VERSION;
response.config = pc;
} else if (config_status::pending_remote_sync == cc.stage) {
- LOG_INFO_F("another request is syncing with remote storage, ignore current request, "
- "gpid({}), request ballot({})",
- gpid,
- cfg_request->config.ballot);
+ LOG_INFO("another request is syncing with remote storage, ignore current request, "
+ "gpid({}), request ballot({})",
+ gpid,
+ cfg_request->config.ballot);
// we don't reply the replica server, expect it to retry
msg->release_ref();
return;
@@ -1968,10 +1965,10 @@ void server_state::on_partition_node_dead(std::shared_ptr<app_state> &app,
if (!pc.primary.is_invalid())
downgrade_secondary_to_inactive(app, pidx, address);
else if (is_secondary(pc, address)) {
- LOG_INFO_F("gpid({}): secondary({}) is down, ignored it due to no primary for this "
- "partition available",
- pc.pid,
- address);
+ LOG_INFO("gpid({}): secondary({}) is down, ignored it due to no primary for this "
+ "partition available",
+ pc.pid,
+ address);
} else {
CHECK(false, "no primary/secondary on this node, node address = {}", address);
}
@@ -1983,12 +1980,12 @@ void server_state::on_partition_node_dead(std::shared_ptr<app_state> &app,
void server_state::on_change_node_state(rpc_address node, bool is_alive)
{
- LOG_DEBUG_F("change node({}) state to {}", node, is_alive ? "alive" : "dead");
+ LOG_DEBUG("change node({}) state to {}", node, is_alive ? "alive" : "dead");
zauto_write_lock l(_lock);
if (!is_alive) {
auto iter = _nodes.find(node);
if (iter == _nodes.end()) {
- LOG_INFO_F("node({}) doesn't exist in the node state, just ignore", node);
+ LOG_INFO("node({}) doesn't exist in the node state, just ignore", node);
} else {
node_state &ns = iter->second;
ns.set_alive(false);
@@ -2045,10 +2042,10 @@ server_state::construct_apps(const std::vector<query_app_info_response> &query_a
auto iter = _all_apps.find(info.app_id);
if (iter == _all_apps.end()) {
std::shared_ptr<app_state> app = app_state::create(info);
- LOG_INFO_F("create app info from ({}) for id({}): {}",
- replica_nodes[i],
- info.app_id,
- boost::lexical_cast<std::string>(info));
+ LOG_INFO("create app info from ({}) for id({}): {}",
+ replica_nodes[i],
+ info.app_id,
+ boost::lexical_cast<std::string>(info));
_all_apps.emplace(app->app_id, app);
max_app_id = std::max(app->app_id, max_app_id);
} else {
@@ -2106,10 +2103,10 @@ server_state::construct_apps(const std::vector<query_app_info_response> &query_a
app->app_name = app->app_name + "__" + boost::lexical_cast<std::string>(app_id);
}
if (app->app_name != old_name) {
- LOG_WARNING_F("app({})'s old name({}) is conflict with others, rename it to ({})",
- app_id,
- old_name,
- app->app_name);
+ LOG_WARNING("app({})'s old name({}) is conflict with others, rename it to ({})",
+ app_id,
+ old_name,
+ app->app_name);
std::ostringstream oss;
oss << "WARNING: app(" << app_id << ")'s old name(" << old_name
<< ") is conflict with others, rename it to (" << app->app_name << ")" << std::endl;
@@ -2118,7 +2115,7 @@ server_state::construct_apps(const std::vector<query_app_info_response> &query_a
checked_names.emplace(app->app_name, app_id);
}
- LOG_INFO_F("construct apps done, max_app_id = {}", max_app_id);
+ LOG_INFO("construct apps done, max_app_id = {}", max_app_id);
return dsn::ERR_OK;
}
@@ -2138,13 +2135,13 @@ error_code server_state::construct_partitions(
CHECK(_all_apps.find(r.pid.get_app_id()) != _all_apps.end(), "");
bool is_accepted = collect_replica({&_all_apps, &_nodes}, replica_nodes[i], r);
if (is_accepted) {
- LOG_INFO_F("accept replica({}) from node({})",
- boost::lexical_cast<std::string>(r),
- replica_nodes[i]);
+ LOG_INFO("accept replica({}) from node({})",
+ boost::lexical_cast<std::string>(r),
+ replica_nodes[i]);
} else {
- LOG_INFO_F("ignore replica({}) from node({})",
- boost::lexical_cast<std::string>(r),
- replica_nodes[i]);
+ LOG_INFO("ignore replica({}) from node({})",
+ boost::lexical_cast<std::string>(r),
+ replica_nodes[i]);
}
}
}
@@ -2157,16 +2154,16 @@ error_code server_state::construct_partitions(
"invalid app status, status = {}",
enum_to_string(app->status));
if (app->status == app_status::AS_DROPPING) {
- LOG_INFO_F("ignore constructing partitions for dropping app({})", app->app_id);
+ LOG_INFO("ignore constructing partitions for dropping app({})", app->app_id);
} else {
for (partition_configuration &pc : app->partitions) {
bool is_succeed =
construct_replica({&_all_apps, &_nodes}, pc.pid, app->max_replica_count);
if (is_succeed) {
- LOG_INFO_F("construct partition({}.{}) succeed: {}",
- app->app_id,
- pc.pid.get_partition_index(),
- boost::lexical_cast<std::string>(pc));
+ LOG_INFO("construct partition({}.{}) succeed: {}",
+ app->app_id,
+ pc.pid.get_partition_index(),
+ boost::lexical_cast<std::string>(pc));
if (pc.last_drops.size() + 1 < pc.max_replica_count) {
std::ostringstream oss;
oss << "WARNING: partition(" << app->app_id << "."
@@ -2177,9 +2174,9 @@ error_code server_state::construct_partitions(
}
succeed_count++;
} else {
- LOG_WARNING_F("construct partition({}.{}) failed",
- app->app_id,
- pc.pid.get_partition_index());
+ LOG_WARNING("construct partition({}.{}) failed",
+ app->app_id,
+ pc.pid.get_partition_index());
std::ostringstream oss;
if (skip_lost_partitions) {
oss << "WARNING: partition(" << app->app_id << "."
@@ -2200,11 +2197,11 @@ error_code server_state::construct_partitions(
}
}
- LOG_INFO_F("construct partition done, succeed_count = {}, failed_count = {}, "
- "skip_lost_partitions = {}",
- succeed_count,
- failed_count,
- skip_lost_partitions ? "true" : "false");
+ LOG_INFO("construct partition done, succeed_count = {}, failed_count = {}, "
+ "skip_lost_partitions = {}",
+ succeed_count,
+ failed_count,
+ skip_lost_partitions ? "true" : "false");
if (failed_count > 0 && !skip_lost_partitions) {
return dsn::ERR_TRY_AGAIN;
@@ -2227,7 +2224,7 @@ server_state::sync_apps_from_replica_nodes(const std::vector<dsn::rpc_address> &
dsn::task_tracker tracker;
for (int i = 0; i < n_replicas; ++i) {
- LOG_INFO_F("send query app and replica request to node({})", replica_nodes[i]);
+ LOG_INFO("send query app and replica request to node({})", replica_nodes[i]);
auto app_query_req = std::make_unique<query_app_info_request>();
app_query_req->meta_server = dsn_primary_address();
@@ -2237,7 +2234,7 @@ server_state::sync_apps_from_replica_nodes(const std::vector<dsn::rpc_address> &
[app_rpc, i, &replica_nodes, &query_app_errors, &query_app_responses](
error_code err) mutable {
auto resp = app_rpc.response();
- LOG_INFO_F(
+ LOG_INFO(
"received query app response from node({}), err({}), apps_count({})",
replica_nodes[i],
err,
@@ -2257,7 +2254,7 @@ server_state::sync_apps_from_replica_nodes(const std::vector<dsn::rpc_address> &
[replica_rpc, i, &replica_nodes, &query_replica_errors, &query_replica_responses](
error_code err) mutable {
auto resp = replica_rpc.response();
- LOG_INFO_F(
+ LOG_INFO(
"received query replica response from node({}), err({}), replicas_count({})",
replica_nodes[i],
err,
@@ -2275,15 +2272,15 @@ server_state::sync_apps_from_replica_nodes(const std::vector<dsn::rpc_address> &
for (int i = 0; i < n_replicas; ++i) {
error_code err = dsn::ERR_OK;
if (query_app_errors[i] != dsn::ERR_OK) {
- LOG_WARNING_F("query app info from node({}) failed, reason: {}",
- replica_nodes[i],
- query_app_errors[i]);
+ LOG_WARNING("query app info from node({}) failed, reason: {}",
+ replica_nodes[i],
+ query_app_errors[i]);
err = query_app_errors[i];
}
if (query_replica_errors[i] != dsn::ERR_OK) {
- LOG_WARNING_F("query replica info from node({}) failed, reason: {}",
- replica_nodes[i],
- query_replica_errors[i]);
+ LOG_WARNING("query replica info from node({}) failed, reason: {}",
+ replica_nodes[i],
+ query_replica_errors[i]);
err = query_replica_errors[i];
}
if (err != dsn::ERR_OK) {
@@ -2306,11 +2303,11 @@ server_state::sync_apps_from_replica_nodes(const std::vector<dsn::rpc_address> &
}
}
- LOG_INFO_F("sync apps and replicas from replica nodes done, succeed_count = {}, failed_count = "
- "{}, skip_bad_nodes = {}",
- succeed_count,
- failed_count,
- skip_bad_nodes ? "true" : "false");
+ LOG_INFO("sync apps and replicas from replica nodes done, succeed_count = {}, failed_count = "
+ "{}, skip_bad_nodes = {}",
+ succeed_count,
+ failed_count,
+ skip_bad_nodes ? "true" : "false");
if (failed_count > 0 && !skip_bad_nodes) {
return dsn::ERR_TRY_AGAIN;
@@ -2320,14 +2317,14 @@ server_state::sync_apps_from_replica_nodes(const std::vector<dsn::rpc_address> &
dsn::error_code err = construct_apps(query_app_responses, replica_nodes, hint_message);
if (err != dsn::ERR_OK) {
- LOG_ERROR_F("construct apps failed, err = {}", err);
+ LOG_ERROR("construct apps failed, err = {}", err);
return err;
}
err = construct_partitions(
query_replica_responses, replica_nodes, skip_lost_partitions, hint_message);
if (err != dsn::ERR_OK) {
- LOG_ERROR_F("construct partitions failed, err = {}", err);
+ LOG_ERROR("construct partitions failed, err = {}", err);
return err;
}
@@ -2337,15 +2334,15 @@ server_state::sync_apps_from_replica_nodes(const std::vector<dsn::rpc_address> &
void server_state::on_start_recovery(const configuration_recovery_request &req,
configuration_recovery_response &resp)
{
- LOG_INFO_F("start recovery, node_count = {}, skip_bad_nodes = {}, skip_lost_partitions = {}",
- req.recovery_set.size(),
- req.skip_bad_nodes ? "true" : "false",
- req.skip_lost_partitions ? "true" : "false");
+ LOG_INFO("start recovery, node_count = {}, skip_bad_nodes = {}, skip_lost_partitions = {}",
+ req.recovery_set.size(),
+ req.skip_bad_nodes ? "true" : "false",
+ req.skip_lost_partitions ? "true" : "false");
resp.err = sync_apps_from_replica_nodes(
req.recovery_set, req.skip_bad_nodes, req.skip_lost_partitions, resp.hint_message);
if (resp.err != dsn::ERR_OK) {
- LOG_ERROR_F("sync apps from replica nodes failed when do recovery, err = {}", resp.err);
+ LOG_ERROR("sync apps from replica nodes failed when do recovery, err = {}", resp.err);
_all_apps.clear();
return;
}
@@ -2362,7 +2359,7 @@ void server_state::on_start_recovery(const configuration_recovery_request &req,
void server_state::clear_proposals()
{
- LOG_INFO_F("clear all exist proposals");
+ LOG_INFO("clear all exist proposals");
zauto_write_lock l(_lock);
for (auto &kv : _exist_apps) {
std::shared_ptr<app_state> &app = kv.second;
@@ -2376,7 +2373,7 @@ bool server_state::can_run_balancer()
for (auto iter = _nodes.begin(); iter != _nodes.end();) {
if (!iter->second.alive()) {
if (iter->second.partition_count() != 0) {
- LOG_INFO_F(
+ LOG_INFO(
"don't do replica migration coz dead node({}) has {} partitions not removed",
iter->second.addr(),
iter->second.partition_count());
@@ -2390,7 +2387,7 @@ bool server_state::can_run_balancer()
// table stability check
int c = count_staging_app();
if (c != 0) {
- LOG_INFO_F("don't do replica migration coz {} table(s) is(are) in staging state", c);
+ LOG_INFO("don't do replica migration coz {} table(s) is(are) in staging state", c);
return false;
}
return true;
@@ -2429,14 +2426,14 @@ bool server_state::check_all_partitions()
// first the cure stage
if (level <= meta_function_level::fl_freezed) {
- LOG_INFO_F("service is in level({}), don't do any cure or balancer actions",
- _meta_function_level_VALUES_TO_NAMES.find(level)->second);
+ LOG_INFO("service is in level({}), don't do any cure or balancer actions",
+ _meta_function_level_VALUES_TO_NAMES.find(level)->second);
return false;
}
- LOG_INFO_F("start to check all partitions, add_secondary_enable_flow_control = {}, "
- "add_secondary_max_count_for_one_node = {}",
- _add_secondary_enable_flow_control ? "true" : "false",
- _add_secondary_max_count_for_one_node);
+ LOG_INFO("start to check all partitions, add_secondary_enable_flow_control = {}, "
+ "add_secondary_max_count_for_one_node = {}",
+ _add_secondary_enable_flow_control ? "true" : "false",
+ _add_secondary_max_count_for_one_node);
_meta_svc->get_partition_guardian()->clear_ddd_partitions();
int send_proposal_count = 0;
std::vector<configuration_proposal_action> add_secondary_actions;
@@ -2446,10 +2443,10 @@ bool server_state::check_all_partitions()
for (auto &app_pair : _exist_apps) {
std::shared_ptr<app_state> &app = app_pair.second;
if (app->status == app_status::AS_CREATING || app->status == app_status::AS_DROPPING) {
- LOG_INFO_F("ignore app({})({}) because it's status is {}",
- app->app_name,
- app->app_id,
- ::dsn::enum_to_string(app->status));
+ LOG_INFO("ignore app({})({}) because it's status is {}",
+ app->app_name,
+ app->app_id,
+ ::dsn::enum_to_string(app->status));
continue;
}
for (unsigned int i = 0; i != app->partition_count; ++i) {
@@ -2460,7 +2457,7 @@ bool server_state::check_all_partitions()
configuration_proposal_action action;
pc_status s = _meta_svc->get_partition_guardian()->cure(
{&_all_apps, &_nodes}, pc.pid, action);
- LOG_DEBUG_F("gpid({}) is in status({})", pc.pid, enum_to_string(s));
+ LOG_DEBUG("gpid({}) is in status({})", pc.pid, enum_to_string(s));
if (pc_status::healthy != s) {
if (action.type != config_type::CT_INVALID) {
if (action.type == config_type::CT_ADD_SECONDARY ||
@@ -2477,7 +2474,7 @@ bool server_state::check_all_partitions()
healthy_partitions++;
}
} else {
- LOG_INFO_F("ignore gpid({}) as it's stage is pending_remote_sync", pc.pid);
+ LOG_INFO("ignore gpid({}) as it's stage is pending_remote_sync", pc.pid);
}
}
total_partitions += app->partition_count;
@@ -2510,12 +2507,12 @@ bool server_state::check_all_partitions()
partition_configuration &pc = *get_config(_all_apps, pid);
if (_add_secondary_enable_flow_control &&
add_secondary_running_nodes[action.node] >= _add_secondary_max_count_for_one_node) {
- LOG_INFO_F("do not send {} proposal for gpid({}) for flow control reason, target = "
- "{}, node = {}",
- ::dsn::enum_to_string(action.type),
- pc.pid,
- action.target,
- action.node);
+ LOG_INFO("do not send {} proposal for gpid({}) for flow control reason, target = "
+ "{}, node = {}",
+ ::dsn::enum_to_string(action.type),
+ pc.pid,
+ action.target,
+ action.node);
continue;
}
std::shared_ptr<app_state> app = get_app(pid.get_app_id());
@@ -2536,43 +2533,43 @@ bool server_state::check_all_partitions()
}
}
- LOG_INFO_F("check all partitions done, send_proposal_count = {}, add_secondary_count = {}, "
- "ignored_add_secondary_count = {}",
- send_proposal_count,
- add_secondary_count,
- ignored_add_secondary_count);
+ LOG_INFO("check all partitions done, send_proposal_count = {}, add_secondary_count = {}, "
+ "ignored_add_secondary_count = {}",
+ send_proposal_count,
+ add_secondary_count,
+ ignored_add_secondary_count);
// then the balancer stage
if (level < meta_function_level::fl_steady) {
- LOG_INFO_F("don't do replica migration coz meta server is in level({})",
- _meta_function_level_VALUES_TO_NAMES.find(level)->second);
+ LOG_INFO("don't do replica migration coz meta server is in level({})",
+ _meta_function_level_VALUES_TO_NAMES.find(level)->second);
return false;
}
if (healthy_partitions != total_partitions) {
- LOG_INFO_F("don't do replica migration coz {}/{} partitions aren't healthy",
- total_partitions - healthy_partitions,
- total_partitions);
+ LOG_INFO("don't do replica migration coz {}/{} partitions aren't healthy",
+ total_partitions - healthy_partitions,
+ total_partitions);
return false;
}
if (!can_run_balancer()) {
- LOG_INFO_F("don't do replica migration coz can_run_balancer() returns false");
+ LOG_INFO("don't do replica migration coz can_run_balancer() returns false");
return false;
}
if (level == meta_function_level::fl_steady) {
- LOG_INFO_F("check if any replica migration can be done when meta server is in level({})",
- _meta_function_level_VALUES_TO_NAMES.find(level)->second);
+ LOG_INFO("check if any replica migration can be done when meta server is in level({})",
+ _meta_function_level_VALUES_TO_NAMES.find(level)->second);
_meta_svc->get_balancer()->check({&_all_apps, &_nodes}, _temporary_list);
- LOG_INFO_F("balance checker operation count = {}", _temporary_list.size());
+ LOG_INFO("balance checker operation count = {}", _temporary_list.size());
// update balance checker operation count
_meta_svc->get_balancer()->report(_temporary_list, true);
return false;
}
if (_meta_svc->get_balancer()->balance({&_all_apps, &_nodes}, _temporary_list)) {
- LOG_INFO_F("try to do replica migration");
+ LOG_INFO("try to do replica migration");
_meta_svc->get_balancer()->apply_balancer({&_all_apps, &_nodes}, _temporary_list);
// update balancer action details
_meta_svc->get_balancer()->report(_temporary_list, false);
@@ -2584,9 +2581,9 @@ bool server_state::check_all_partitions()
return false;
}
- LOG_INFO_F("check if any replica migration left");
+ LOG_INFO("check if any replica migration left");
_meta_svc->get_balancer()->check({&_all_apps, &_nodes}, _temporary_list);
- LOG_INFO_F("balance checker operation count = {}", _temporary_list.size());
+ LOG_INFO("balance checker operation count = {}", _temporary_list.size());
// update balance checker operation count
_meta_svc->get_balancer()->report(_temporary_list, true);
@@ -2661,7 +2658,7 @@ void server_state::do_update_app_info(const std::string &app_path,
if (ec == ERR_OK) {
user_cb(ec);
} else if (ec == ERR_TIMEOUT) {
- LOG_WARNING_F(
+ LOG_WARNING(
"update app_info(app = {}) to remote storage timeout, continue to update later",
info.app_name);
tasking::enqueue(
@@ -2687,7 +2684,7 @@ void server_state::set_app_envs(const app_env_rpc &env_rpc)
if (!request.__isset.keys || !request.__isset.values ||
request.keys.size() != request.values.size() || request.keys.size() <= 0) {
env_rpc.response().err = ERR_INVALID_PARAMETERS;
- LOG_WARNING_F("set app envs failed with invalid request");
+ LOG_WARNING("set app envs failed with invalid request");
return;
}
const std::vector<std::string> &keys = request.keys;
@@ -2706,10 +2703,10 @@ void server_state::set_app_envs(const app_env_rpc &env_rpc)
os << keys[i] << "=" << values[i];
}
- LOG_INFO_F("set app envs for app({}) from remote({}): kvs = {}",
- app_name,
- env_rpc.remote_address(),
- os.str());
+ LOG_INFO("set app envs for app({}) from remote({}): kvs = {}",
+ app_name,
+ env_rpc.remote_address(),
+ os.str());
app_info ainfo;
std::string app_path;
@@ -2717,7 +2714,7 @@ void server_state::set_app_envs(const app_env_rpc &env_rpc)
zauto_read_lock l(_lock);
std::shared_ptr<app_state> app = get_app(app_name);
if (app == nullptr) {
- LOG_WARNING_F("set app envs failed with invalid app_name({})", app_name);
+ LOG_WARNING("set app envs failed with invalid app_name({})", app_name);
env_rpc.response().err = ERR_INVALID_PARAMETERS;
env_rpc.response().hint_message = "invalid app name";
return;
@@ -2739,7 +2736,7 @@ void server_state::set_app_envs(const app_env_rpc &env_rpc)
app->envs[keys[idx]] = values[idx];
}
std::string new_envs = dsn::utils::kv_map_to_string(app->envs, ',', '=');
- LOG_INFO_F("app envs changed: old_envs = {}, new_envs = {}", old_envs, new_envs);
+ LOG_INFO("app envs changed: old_envs = {}, new_envs = {}", old_envs, new_envs);
});
}
@@ -2748,7 +2745,7 @@ void server_state::del_app_envs(const app_env_rpc &env_rpc)
const configuration_update_app_env_request &request = env_rpc.request();
if (!request.__isset.keys || request.keys.size() <= 0) {
env_rpc.response().err = ERR_INVALID_PARAMETERS;
- LOG_WARNING_F("del app envs failed with invalid request");
+ LOG_WARNING("del app envs failed with invalid request");
return;
}
const std::vector<std::string> &keys = request.keys;
@@ -2760,10 +2757,10 @@ void server_state::del_app_envs(const app_env_rpc &env_rpc)
os << ",";
os << keys[i];
}
- LOG_INFO_F("del app envs for app({}) from remote({}): keys = {}",
- app_name,
- env_rpc.remote_address(),
- os.str());
+ LOG_INFO("del app envs for app({}) from remote({}): keys = {}",
+ app_name,
+ env_rpc.remote_address(),
+ os.str());
app_info ainfo;
std::string app_path;
@@ -2771,7 +2768,7 @@ void server_state::del_app_envs(const app_env_rpc &env_rpc)
zauto_read_lock l(_lock);
std::shared_ptr<app_state> app = get_app(app_name);
if (app == nullptr) {
- LOG_WARNING_F("del app envs failed with invalid app_name({})", app_name);
+ LOG_WARNING("del app envs failed with invalid app_name({})", app_name);
env_rpc.response().err = ERR_INVALID_PARAMETERS;
env_rpc.response().hint_message = "invalid app name";
return;
@@ -2792,7 +2789,7 @@ void server_state::del_app_envs(const app_env_rpc &env_rpc)
}
if (deleted == 0) {
- LOG_INFO_F("no key need to delete");
+ LOG_INFO("no key need to delete");
env_rpc.response().hint_message = "no key need to delete";
return;
} else {
@@ -2809,7 +2806,7 @@ void server_state::del_app_envs(const app_env_rpc &env_rpc)
app->envs.erase(key);
}
std::string new_envs = dsn::utils::kv_map_to_string(app->envs, ',', '=');
- LOG_INFO_F("app envs changed: old_envs = {}, new_envs = {}", old_envs, new_envs);
+ LOG_INFO("app envs changed: old_envs = {}, new_envs = {}", old_envs, new_envs);
});
}
@@ -2818,16 +2815,16 @@ void server_state::clear_app_envs(const app_env_rpc &env_rpc)
const configuration_update_app_env_request &request = env_rpc.request();
if (!request.__isset.clear_prefix) {
env_rpc.response().err = ERR_INVALID_PARAMETERS;
- LOG_WARNING_F("clear app envs failed with invalid request");
+ LOG_WARNING("clear app envs failed with invalid request");
return;
}
const std::string &prefix = request.clear_prefix;
const std::string &app_name = request.app_name;
- LOG_INFO_F("clear app envs for app({}) from remote({}): prefix = {}",
- app_name,
- env_rpc.remote_address(),
- prefix);
+ LOG_INFO("clear app envs for app({}) from remote({}): prefix = {}",
+ app_name,
+ env_rpc.remote_address(),
+ prefix);
app_info ainfo;
std::string app_path;
@@ -2835,7 +2832,7 @@ void server_state::clear_app_envs(const app_env_rpc &env_rpc)
zauto_read_lock l(_lock);
std::shared_ptr<app_state> app = get_app(app_name);
if (app == nullptr) {
- LOG_WARNING_F("clear app envs failed with invalid app_name({})", app_name);
+ LOG_WARNING("clear app envs failed with invalid app_name({})", app_name);
env_rpc.response().err = ERR_INVALID_PARAMETERS;
env_rpc.response().hint_message = "invalid app name";
return;
@@ -2846,7 +2843,7 @@ void server_state::clear_app_envs(const app_env_rpc &env_rpc)
}
if (ainfo.envs.empty()) {
- LOG_INFO_F("no key need to delete");
+ LOG_INFO("no key need to delete");
env_rpc.response().hint_message = "no key need to delete";
return;
}
@@ -2881,7 +2878,7 @@ void server_state::clear_app_envs(const app_env_rpc &env_rpc)
if (!prefix.empty() && erase_keys.empty()) {
// no need update app_info
- LOG_INFO_F("no key need to delete");
+ LOG_INFO("no key need to delete");
env_rpc.response().hint_message = "no key need to delete";
return;
} else {
@@ -2903,7 +2900,7 @@ void server_state::clear_app_envs(const app_env_rpc &env_rpc)
}
}
std::string new_envs = dsn::utils::kv_map_to_string(app->envs, ',', '=');
- LOG_INFO_F("app envs changed: old_envs = {}, new_envs = {}", old_envs, new_envs);
+ LOG_INFO("app envs changed: old_envs = {}, new_envs = {}", old_envs, new_envs);
});
}
@@ -2950,7 +2947,7 @@ bool server_state::validate_target_max_replica_count(int32_t max_replica_count)
std::string hint_message;
const auto valid = validate_target_max_replica_count(max_replica_count, hint_message);
if (!valid) {
- LOG_ERROR_F("target max replica count is invalid: message={}", hint_message);
+ LOG_ERROR("target max replica count is invalid: message={}", hint_message);
}
return valid;
@@ -2971,7 +2968,7 @@ void server_state::on_start_manual_compact(start_manual_compact_rpc rpc)
fmt::format("app {} is {}",
app_name,
response.err == ERR_APP_NOT_EXIST ? "not existed" : "not available");
- LOG_ERROR_F("{}", response.hint_msg);
+ LOG_ERROR("{}", response.hint_msg);
return;
}
envs = app->envs;
@@ -2981,7 +2978,7 @@ void server_state::on_start_manual_compact(start_manual_compact_rpc rpc)
if (iter != envs.end() && iter->second == "true") {
response.err = ERR_OPERATION_DISABLED;
response.hint_msg = fmt::format("app {} disable manual compaction", app_name);
- LOG_ERROR_F("{}", response.hint_msg);
+ LOG_ERROR("{}", response.hint_msg);
return;
}
@@ -3015,7 +3012,7 @@ bool server_state::parse_compaction_envs(start_manual_compact_rpc rpc,
response.err = ERR_INVALID_PARAMETERS;
response.hint_msg = fmt::format(
"invalid target_level({}), should in range of [-1, num_levels]", target_level);
- LOG_ERROR_F("{}", response.hint_msg);
+ LOG_ERROR("{}", response.hint_msg);
return false;
}
}
@@ -3028,7 +3025,7 @@ bool server_state::parse_compaction_envs(start_manual_compact_rpc rpc,
response.hint_msg =
fmt::format("invalid max_running_count({}), should be greater than 0",
request.max_running_count);
- LOG_ERROR_F("{}", response.hint_msg);
+ LOG_ERROR("{}", response.hint_msg);
return false;
}
if (request.max_running_count > 0) {
@@ -3080,9 +3077,9 @@ void server_state::update_compaction_envs_on_remote_storage(start_manual_compact
app->envs[keys[idx]] = values[idx];
}
std::string new_envs = dsn::utils::kv_map_to_string(app->envs, ',', '=');
- LOG_INFO_F("update manual compaction envs succeed: old_envs = {}, new_envs = {}",
- old_envs,
- new_envs);
+ LOG_INFO("update manual compaction envs succeed: old_envs = {}, new_envs = {}",
+ old_envs,
+ new_envs);
rpc.response().err = ERR_OK;
rpc.response().hint_msg = "succeed";
@@ -3106,7 +3103,7 @@ void server_state::on_query_manual_compact_status(query_manual_compact_rpc rpc)
fmt::format("app {} is {}",
app_name,
response.err == ERR_APP_NOT_EXIST ? "not existed" : "not available");
- LOG_ERROR_F("{}", response.hint_msg);
+ LOG_ERROR("{}", response.hint_msg);
return;
}
@@ -3114,12 +3111,11 @@ void server_state::on_query_manual_compact_status(query_manual_compact_rpc rpc)
if (!app->helpers->get_manual_compact_progress(total_progress)) {
response.err = ERR_INVALID_STATE;
response.hint_msg = fmt::format("app {} is not manual compaction", app_name);
- LOG_WARNING_F("{}", response.hint_msg);
+ LOG_WARNING("{}", response.hint_msg);
return;
}
- LOG_INFO_F(
- "query app {} manual compact succeed, total_progress = {}", app_name, total_progress);
+ LOG_INFO("query app {} manual compact succeed, total_progress = {}", app_name, total_progress);
response.err = ERR_OK;
response.hint_msg = "succeed";
response.__set_progress(total_progress);
@@ -3171,33 +3167,32 @@ void server_state::get_max_replica_count(configuration_get_max_replica_count_rpc
auto app = get_app_and_check_exist(app_name, response);
if (app == nullptr) {
response.max_replica_count = 0;
- LOG_WARNING_F(
- "failed to get max_replica_count: app_name={}, error_code={}, hint_message={}",
- app_name,
- response.err.to_string(),
- response.hint_message);
+ LOG_WARNING("failed to get max_replica_count: app_name={}, error_code={}, hint_message={}",
+ app_name,
+ response.err.to_string(),
+ response.hint_message);
return;
}
if (!check_max_replica_count_consistent(app, response)) {
response.max_replica_count = 0;
- LOG_ERROR_F("failed to get max_replica_count: app_name={}, app_id={}, error_code={}, "
- "hint_message={}",
- app_name,
- app->app_id,
- response.err.to_string(),
- response.hint_message);
+ LOG_ERROR("failed to get max_replica_count: app_name={}, app_id={}, error_code={}, "
+ "hint_message={}",
+ app_name,
+ app->app_id,
+ response.err.to_string(),
+ response.hint_message);
return;
}
response.err = ERR_OK;
response.max_replica_count = app->max_replica_count;
- LOG_INFO_F("get max_replica_count successfully: app_name={}, app_id={}, "
- "max_replica_count={}",
- app_name,
- app->app_id,
- response.max_replica_count);
+ LOG_INFO("get max_replica_count successfully: app_name={}, app_id={}, "
+ "max_replica_count={}",
+ app_name,
+ app->app_id,
+ response.max_replica_count);
}
// ThreadPool: THREAD_POOL_META_STATE
@@ -3216,7 +3211,7 @@ void server_state::set_max_replica_count(configuration_set_max_replica_count_rpc
app = get_app_and_check_exist(app_name, response);
if (app == nullptr) {
response.old_max_replica_count = 0;
- LOG_WARNING_F(
+ LOG_WARNING(
"failed to set max_replica_count: app_name={}, error_code={}, hint_message={}",
app_name,
response.err.to_string(),
@@ -3228,12 +3223,12 @@ void server_state::set_max_replica_count(configuration_set_max_replica_count_rpc
if (!check_max_replica_count_consistent(app, response)) {
response.old_max_replica_count = 0;
- LOG_ERROR_F("failed to set max_replica_count: app_name={}, app_id={}, error_code={}, "
- "hint_message={}",
- app_name,
- app_id,
- response.err.to_string(),
- response.hint_message);
+ LOG_ERROR("failed to set max_replica_count: app_name={}, app_id={}, error_code={}, "
+ "hint_message={}",
+ app_name,
+ app_id,
+ response.err.to_string(),
+ response.hint_message);
return;
}
@@ -3242,12 +3237,12 @@ void server_state::set_max_replica_count(configuration_set_max_replica_count_rpc
if (app->status != app_status::AS_AVAILABLE) {
response.err = ERR_INVALID_PARAMETERS;
response.hint_message = fmt::format("app({}) is not in available status", app_name);
- LOG_ERROR_F("failed to set max_replica_count: app_name={}, app_id={}, error_code={}, "
- "hint_message={}",
- app_name,
- app_id,
- response.err.to_string(),
- response.hint_message);
+ LOG_ERROR("failed to set max_replica_count: app_name={}, app_id={}, error_code={}, "
+ "hint_message={}",
+ app_name,
+ app_id,
+ response.err.to_string(),
+ response.hint_message);
return;
}
}
@@ -3257,7 +3252,7 @@ void server_state::set_max_replica_count(configuration_set_max_replica_count_rpc
response.err = ERR_STATE_FREEZED;
response.hint_message =
"current meta function level is freezed, since there are too few alive nodes";
- LOG_ERROR_F(
+ LOG_ERROR(
"failed to set max_replica_count: app_name={}, app_id={}, error_code={}, message={}",
app_name,
app_id,
@@ -3268,7 +3263,7 @@ void server_state::set_max_replica_count(configuration_set_max_replica_count_rpc
if (!validate_target_max_replica_count(new_max_replica_count, response.hint_message)) {
response.err = ERR_INVALID_PARAMETERS;
- LOG_WARNING_F(
+ LOG_WARNING(
"failed to set max_replica_count: app_name={}, app_id={}, error_code={}, message={}",
app_name,
app_id,
@@ -3280,17 +3275,17 @@ void server_state::set_max_replica_count(configuration_set_max_replica_count_rpc
if (new_max_replica_count == response.old_max_replica_count) {
response.err = ERR_OK;
response.hint_message = "no need to update max_replica_count since it's not changed";
- LOG_WARNING_F("{}: app_name={}, app_id={}", response.hint_message, app_name, app_id);
+ LOG_WARNING("{}: app_name={}, app_id={}", response.hint_message, app_name, app_id);
return;
}
- LOG_INFO_F("request for {} max_replica_count: app_name={}, app_id={}, "
- "old_max_replica_count={}, new_max_replica_count={}",
- new_max_replica_count > response.old_max_replica_count ? "increasing" : "decreasing",
- app_name,
- app_id,
- response.old_max_replica_count,
- new_max_replica_count);
+ LOG_INFO("request for {} max_replica_count: app_name={}, app_id={}, "
+ "old_max_replica_count={}, new_max_replica_count={}",
+ new_max_replica_count > response.old_max_replica_count ? "increasing" : "decreasing",
+ app_name,
+ app_id,
+ response.old_max_replica_count,
+ new_max_replica_count);
set_max_replica_count_env_updating(app, rpc);
}
@@ -3311,12 +3306,12 @@ void server_state::set_max_replica_count_env_updating(std::shared_ptr<app_state>
response.hint_message = fmt::format("max_replica_count of app({}) is being updated, "
"thus this request would be rejected",
app->app_name);
- LOG_ERROR_F("failed to set max_replica_count: app_name={}, app_id={}, error_code={}, "
- "hint_message={}",
- app->app_name,
- app->app_id,
- response.err.to_string(),
- response.hint_message);
+ LOG_ERROR("failed to set max_replica_count: app_name={}, app_id={}, error_code={}, "
+ "hint_message={}",
+ app->app_name,
+ app->app_id,
+ response.err.to_string(),
+ response.hint_message);
return;
}
}
@@ -3324,14 +3319,14 @@ void server_state::set_max_replica_count_env_updating(std::shared_ptr<app_state>
const auto new_max_replica_count = rpc.request().max_replica_count;
const auto old_max_replica_count = rpc.response().old_max_replica_count;
- LOG_INFO_F("ready to update remote env of max_replica_count: app_name={}, app_id={}, "
- "old_max_replica_count={}, new_max_replica_count={}, {}={}",
- app->app_name,
- app->app_id,
- old_max_replica_count,
- new_max_replica_count,
- replica_envs::UPDATE_MAX_REPLICA_COUNT,
- app->envs[replica_envs::UPDATE_MAX_REPLICA_COUNT]);
+ LOG_INFO("ready to update remote env of max_replica_count: app_name={}, app_id={}, "
+ "old_max_replica_count={}, new_max_replica_count={}, {}={}",
+ app->app_name,
+ app->app_id,
+ old_max_replica_count,
+ new_max_replica_count,
+ replica_envs::UPDATE_MAX_REPLICA_COUNT,
+ app->envs[replica_envs::UPDATE_MAX_REPLICA_COUNT]);
auto ainfo = *(reinterpret_cast<app_info *>(app.get()));
ainfo.envs[replica_envs::UPDATE_MAX_REPLICA_COUNT] =
@@ -3357,13 +3352,13 @@ void server_state::set_max_replica_count_env_updating(std::shared_ptr<app_state>
app->envs[replica_envs::UPDATE_MAX_REPLICA_COUNT] =
fmt::format("updating;{}", new_max_replica_count);
- LOG_INFO_F("both remote and local env of max_replica_count have been updated "
- "successfully: app_name={}, app_id={}, new_max_replica_count={}, {}={}",
- app->app_name,
- app->app_id,
- new_max_replica_count,
- replica_envs::UPDATE_MAX_REPLICA_COUNT,
- app->envs[replica_envs::UPDATE_MAX_REPLICA_COUNT]);
+ LOG_INFO("both remote and local env of max_replica_count have been updated "
+ "successfully: app_name={}, app_id={}, new_max_replica_count={}, {}={}",
+ app->app_name,
+ app->app_id,
+ new_max_replica_count,
+ replica_envs::UPDATE_MAX_REPLICA_COUNT,
+ app->envs[replica_envs::UPDATE_MAX_REPLICA_COUNT]);
}
do_update_max_replica_count(app, rpc);
@@ -3423,13 +3418,13 @@ void server_state::do_update_max_replica_count(std::shared_ptr<app_state> &app,
new_max_replica_count);
}
- LOG_INFO_F("all partitions have been changed to the new max_replica_count, ready to update "
- "the app-level max_replica_count: app_name={}, app_id={}, partition_count={}, "
- "new_max_replica_count={}",
- app_name,
- app->app_id,
- app->partition_count,
- new_max_replica_count);
+ LOG_INFO("all partitions have been changed to the new max_replica_count, ready to update "
+ "the app-level max_replica_count: app_name={}, app_id={}, partition_count={}, "
+ "new_max_replica_count={}",
+ app_name,
+ app->app_id,
+ app->partition_count,
+ new_max_replica_count);
update_app_max_replica_count(app, rpc);
};
@@ -3451,14 +3446,14 @@ void server_state::update_app_max_replica_count(std::shared_ptr<app_state> &app,
const auto new_max_replica_count = rpc.request().max_replica_count;
const auto old_max_replica_count = rpc.response().old_max_replica_count;
- LOG_INFO_F("ready to update remote app-level max_replica_count: app_name={}, app_id={}, "
- "old_max_replica_count={}, new_max_replica_count={}, {}={}",
- app->app_name,
- app->app_id,
- old_max_replica_count,
- new_max_replica_count,
- replica_envs::UPDATE_MAX_REPLICA_COUNT,
- app->envs[replica_envs::UPDATE_MAX_REPLICA_COUNT]);
+ LOG_INFO("ready to update remote app-level max_replica_count: app_name={}, app_id={}, "
+ "old_max_replica_count={}, new_max_replica_count={}, {}={}",
+ app->app_name,
+ app->app_id,
+ old_max_replica_count,
+ new_max_replica_count,
+ replica_envs::UPDATE_MAX_REPLICA_COUNT,
+ app->envs[replica_envs::UPDATE_MAX_REPLICA_COUNT]);
auto ainfo = *(reinterpret_cast<app_info *>(app.get()));
ainfo.max_replica_count = new_max_replica_count;
@@ -3497,13 +3492,13 @@ void server_state::update_app_max_replica_count(std::shared_ptr<app_state> &app,
app->max_replica_count = new_max_replica_count;
app->envs.erase(replica_envs::UPDATE_MAX_REPLICA_COUNT);
- LOG_INFO_F("both remote and local app-level max_replica_count have been updated "
- "successfully: app_name={}, app_id={}, old_max_replica_count={}, "
- "new_max_replica_count={}",
- app->app_name,
- app->app_id,
- old_max_replica_count,
- new_max_replica_count);
+ LOG_INFO("both remote and local app-level max_replica_count have been updated "
+ "successfully: app_name={}, app_id={}, old_max_replica_count={}, "
+ "new_max_replica_count={}",
+ app->app_name,
+ app->app_id,
+ old_max_replica_count,
+ new_max_replica_count);
auto &response = rpc.response();
response.err = ERR_OK;
@@ -3530,24 +3525,24 @@ void server_state::update_partition_max_replica_count(std::shared_ptr<app_state>
const auto old_max_replica_count = old_partition_config.max_replica_count;
if (new_max_replica_count == old_max_replica_count) {
- LOG_WARNING_F("partition-level max_replica_count has been updated: app_name={}, "
- "app_id={}, partition_index={}, new_max_replica_count={}",
- app->app_name,
- app->app_id,
- partition_index,
- new_max_replica_count);
+ LOG_WARNING("partition-level max_replica_count has been updated: app_name={}, "
+ "app_id={}, partition_index={}, new_max_replica_count={}",
+ app->app_name,
+ app->app_id,
+ partition_index,
+ new_max_replica_count);
return;
}
auto &context = app->helpers->contexts[partition_index];
if (context.stage == config_status::pending_remote_sync) {
- LOG_INFO_F("have to wait until another request which is syncing with remote storage "
- "is finished, then process the current request of updating max_replica_count: "
- "app_name={}, app_id={}, partition_index={}, new_max_replica_count={}",
- app->app_name,
- app->app_id,
- partition_index,
- new_max_replica_count);
+ LOG_INFO("have to wait until another request which is syncing with remote storage "
+ "is finished, then process the current request of updating max_replica_count: "
+ "app_name={}, app_id={}, partition_index={}, new_max_replica_count={}",
+ app->app_name,
+ app->app_id,
+ partition_index,
+ new_max_replica_count);
tasking::enqueue(
LPC_META_STATE_HIGH,
@@ -3594,16 +3589,16 @@ task_ptr server_state::update_partition_max_replica_count_on_remote(
const auto level = _meta_svc->get_function_level();
if (level <= meta_function_level::fl_blind) {
- LOG_WARNING_F("have to wait until meta level becomes more than fl_blind, then process the "
- "current request of updating max_replica_count: current_meta_level={}, "
- "app_name={}, app_id={}, partition_index={}, new_max_replica_count={}, "
- "new_ballot={}",
- _meta_function_level_VALUES_TO_NAMES.find(level)->second,
- app->app_name,
- app->app_id,
- partition_index,
- new_max_replica_count,
- new_ballot);
+ LOG_WARNING("have to wait until meta level becomes more than fl_blind, then process the "
+ "current request of updating max_replica_count: current_meta_level={}, "
+ "app_name={}, app_id={}, partition_index={}, new_max_replica_count={}, "
+ "new_ballot={}",
+ _meta_function_level_VALUES_TO_NAMES.find(level)->second,
+ app->app_name,
+ app->app_id,
+ partition_index,
+ new_max_replica_count,
+ new_ballot);
// NOTICE: pending_sync_task should be reassigned
return tasking::enqueue(LPC_META_STATE_HIGH,
@@ -3623,13 +3618,13 @@ task_ptr server_state::update_partition_max_replica_count_on_remote(
std::chrono::seconds(1));
}
- LOG_INFO_F("request for updating partition-level max_replica_count on remote storage: "
- "app_name={}, app_id={}, partition_id={}, new_max_replica_count={}, new_ballot={}",
- app->app_name,
- app->app_id,
- partition_index,
- new_max_replica_count,
- new_ballot);
+ LOG_INFO("request for updating partition-level max_replica_count on remote storage: "
+ "app_name={}, app_id={}, partition_id={}, new_max_replica_count={}, new_ballot={}",
+ app->app_name,
+ app->app_id,
+ partition_index,
+ new_max_replica_count,
+ new_ballot);
auto partition_path = get_partition_path(gpid);
auto json_config =
@@ -3661,15 +3656,15 @@ void server_state::on_update_partition_max_replica_count_on_remote_reply(
zauto_write_lock l(_lock);
- LOG_INFO_F("reply for updating partition-level max_replica_count on remote storage: "
- "error_code={}, app_name={}, app_id={}, partition_id={}, new_max_replica_count={}, "
- "new_ballot={}",
- ec.to_string(),
- app->app_name,
- app->app_id,
- partition_index,
- new_max_replica_count,
- new_ballot);
+ LOG_INFO("reply for updating partition-level max_replica_count on remote storage: "
+ "error_code={}, app_name={}, app_id={}, partition_id={}, new_max_replica_count={}, "
+ "new_ballot={}",
+ ec.to_string(),
+ app->app_name,
+ app->app_id,
+ partition_index,
+ new_max_replica_count,
+ new_ballot);
auto &context = app->helpers->contexts[partition_index];
if (ec == ERR_TIMEOUT) {
@@ -3739,14 +3734,14 @@ void server_state::update_partition_max_replica_count_locally(
old_partition_config = new_partition_config;
- LOG_INFO_F("local partition-level max_replica_count has been changed successfully: ",
- "app_name={}, app_id={}, partition_id={}, old_partition_config={}, "
- "new_partition_config={}",
- app->app_name,
- app->app_id,
- partition_index,
- old_config_str,
- new_config_str);
+ LOG_INFO("local partition-level max_replica_count has been changed successfully: ",
+ "app_name={}, app_id={}, partition_id={}, old_partition_config={}, "
+ "new_partition_config={}",
+ app->app_name,
+ app->app_id,
+ partition_index,
+ old_config_str,
+ new_config_str);
}
// ThreadPool: THREAD_POOL_META_SERVER
@@ -3812,26 +3807,26 @@ void server_state::recover_all_partitions_max_replica_count(std::shared_ptr<app_
auto new_pc = app->partitions[i];
if (new_pc.max_replica_count == new_max_replica_count) {
- LOG_WARNING_F("no need to recover partition-level max_replica_count since it has been "
- "updated before: app_name={}, app_id={}, partition_index={}, "
- "partition_count={}, new_max_replica_count={}",
- app->app_name,
- app->app_id,
- i,
- app->partition_count,
- new_max_replica_count);
+ LOG_WARNING("no need to recover partition-level max_replica_count since it has been "
+ "updated before: app_name={}, app_id={}, partition_index={}, "
+ "partition_count={}, new_max_replica_count={}",
+ app->app_name,
+ app->app_id,
+ i,
+ app->partition_count,
+ new_max_replica_count);
continue;
}
- LOG_INFO_F("ready to recover partition-level max_replica_count: app_name={}, app_id={}, "
- "partition_index={}, partition_count={}, old_max_replica_count={}, "
- "new_max_replica_count={}",
- app->app_name,
- app->app_id,
- i,
- app->partition_count,
- app->max_replica_count,
- new_max_replica_count);
+ LOG_INFO("ready to recover partition-level max_replica_count: app_name={}, app_id={}, "
+ "partition_index={}, partition_count={}, old_max_replica_count={}, "
+ "new_max_replica_count={}",
+ app->app_name,
+ app->app_id,
+ i,
+ app->partition_count,
+ app->max_replica_count,
+ new_max_replica_count);
new_pc.max_replica_count = new_max_replica_count;
++(new_pc.ballot);
@@ -3876,15 +3871,15 @@ void server_state::recover_all_partitions_max_replica_count(std::shared_ptr<app_
old_pc = new_pc;
- LOG_INFO_F("partition-level max_replica_count has been recovered successfully: "
- "app_name={}, app_id={}, partition_index={}, partition_count={}, "
- "old_partition_config={}, new_partition_config={}",
- app->app_name,
- app->app_id,
- i,
- app->partition_count,
- old_pc_str,
- new_pc_str);
+ LOG_INFO("partition-level max_replica_count has been recovered successfully: "
+ "app_name={}, app_id={}, partition_index={}, partition_count={}, "
+ "old_partition_config={}, new_partition_config={}",
+ app->app_name,
+ app->app_id,
+ i,
+ app->partition_count,
+ old_pc_str,
+ new_pc_str);
},
&tracker);
}
@@ -3897,14 +3892,14 @@ void server_state::recover_app_max_replica_count(std::shared_ptr<app_state> &app
{
zauto_read_lock l(_lock);
- LOG_INFO_F("ready to recover app-level max_replica_count: app_name={}, app_id={}, "
- "old_max_replica_count={}, new_max_replica_count={}, {}={}",
- app->app_name,
- app->app_id,
- app->max_replica_count,
- new_max_replica_count,
- replica_envs::UPDATE_MAX_REPLICA_COUNT,
- app->envs[replica_envs::UPDATE_MAX_REPLICA_COUNT]);
+ LOG_INFO("ready to recover app-level max_replica_count: app_name={}, app_id={}, "
+ "old_max_replica_count={}, new_max_replica_count={}, {}={}",
+ app->app_name,
+ app->app_id,
+ app->max_replica_count,
+ new_max_replica_count,
+ replica_envs::UPDATE_MAX_REPLICA_COUNT,
+ app->envs[replica_envs::UPDATE_MAX_REPLICA_COUNT]);
auto ainfo = *(reinterpret_cast<app_info *>(app.get()));
ainfo.max_replica_count = new_max_replica_count;
@@ -3933,13 +3928,13 @@ void server_state::recover_app_max_replica_count(std::shared_ptr<app_state> &app
app->max_replica_count = new_max_replica_count;
app->envs.erase(replica_envs::UPDATE_MAX_REPLICA_COUNT);
- LOG_INFO_F("app-level max_replica_count has been recovered successfully: "
- "app_name={}, app_id={}, old_max_replica_count={}, "
- "new_max_replica_count={}",
- app->app_name,
- app->app_id,
- old_max_replica_count,
- app->max_replica_count);
+ LOG_INFO("app-level max_replica_count has been recovered successfully: "
+ "app_name={}, app_id={}, old_max_replica_count={}, "
+ "new_max_replica_count={}",
+ app->app_name,
+ app->app_id,
+ old_max_replica_count,
+ app->max_replica_count);
},
&tracker);
}
diff --git a/src/meta/server_state_restore.cpp b/src/meta/server_state_restore.cpp
index 07d1957e4..0e945ca67 100644
--- a/src/meta/server_state_restore.cpp
+++ b/src/meta/server_state_restore.cpp
@@ -42,7 +42,7 @@ void server_state::sync_app_from_backup_media(
_meta_svc->get_block_service_manager().get_or_create_block_filesystem(
request.backup_provider_name);
if (blk_fs == nullptr) {
- LOG_ERROR_F("acquire block_filesystem({}) failed", request.backup_provider_name);
+ LOG_ERROR("acquire block_filesystem({}) failed", request.backup_provider_name);
callback_tsk->enqueue_with(ERR_INVALID_PARAMETERS, dsn::blob());
return;
}
@@ -59,7 +59,7 @@ void server_state::sync_app_from_backup_media(
error_code err = ERR_OK;
block_file_ptr file_handle = nullptr;
- LOG_INFO_F("start to create metadata file {}", app_metadata);
+ LOG_INFO("start to create metadata file {}", app_metadata);
blk_fs
->create_file(create_file_request{app_metadata, true},
TASK_CODE_EXEC_INLINED,
@@ -70,7 +70,7 @@ void server_state::sync_app_from_backup_media(
->wait();
if (err != ERR_OK) {
- LOG_ERROR_F("create metadata file {} failed.", app_metadata);
+ LOG_ERROR("create metadata file {} failed.", app_metadata);
callback_tsk->enqueue_with(err, dsn::blob());
return;
}
@@ -89,7 +89,7 @@ std::pair<dsn::error_code, std::shared_ptr<app_state>> server_state::restore_app
dsn::app_info info;
if (!::dsn::json::json_forwarder<dsn::app_info>::decode(app_info, info)) {
std::string b_str(app_info.data(), app_info.length());
- LOG_ERROR_F("decode app_info '{}' failed", b_str);
+ LOG_ERROR("decode app_info '{}' failed", b_str);
// NOTICE : maybe find a better error_code to replace err_corruption
res.first = ERR_CORRUPTION;
return res;
@@ -148,7 +148,7 @@ void server_state::restore_app(dsn::message_ex *msg)
dsn::error_code ec = ERR_OK;
// if err != ERR_OK, then sync_app_from_backup_media ecounter some error
if (err != ERR_OK) {
- LOG_ERROR_F("sync app_info_data from backup media failed with err({})", err);
+ LOG_ERROR("sync app_info_data from backup media failed with err({})", err);
ec = err;
} else {
auto pair = restore_app_info(msg, request, app_info_data);
@@ -196,10 +196,10 @@ void server_state::on_recv_restore_report(configuration_report_restore_status_rp
if (request.__isset.reason) {
r_state.reason = request.reason;
}
- LOG_INFO_F("{} restore report: restore_status({}), progress({})",
- request.pid,
- request.restore_status,
- request.progress);
+ LOG_INFO("{} restore report: restore_status({}), progress({})",
+ request.pid,
+ request.restore_status,
+ request.progress);
}
}
diff --git a/src/meta/test/backup_test.cpp b/src/meta/test/backup_test.cpp
index 0a341cf5f..2792df524 100644
--- a/src/meta/test/backup_test.cpp
+++ b/src/meta/test/backup_test.cpp
@@ -76,7 +76,7 @@ protected:
MOCK_HELPER_FUNCS(method_name) \
void method_name() \
{ \
- LOG_INFO_F("{} is called", #method_name); \
+ LOG_INFO("{} is called", #method_name); \
int &c = counter_##method_name(); \
++c; \
int max_call = maxcall_##method_name(); \
@@ -92,7 +92,7 @@ protected:
MOCK_HELPER_FUNCS(method_name) \
void method_name(type1 arg1) \
{ \
- LOG_INFO_F("{} is called", #method_name); \
+ LOG_INFO("{} is called", #method_name); \
int &c = counter_##method_name(); \
++c; \
int max_call = maxcall_##method_name(); \
@@ -108,7 +108,7 @@ protected:
MOCK_HELPER_FUNCS(method_name) \
void method_name(type1 arg1, type2 arg2) \
{ \
- LOG_INFO_F("{} is called", #method_name); \
+ LOG_INFO("{} is called", #method_name); \
int &c = counter_##method_name(); \
++c; \
int max_call = maxcall_##method_name(); \
@@ -124,7 +124,7 @@ protected:
MOCK_HELPER_FUNCS(method_name) \
void method_name(type1 arg1, type2 arg2, type3, arg3) \
{ \
- LOG_INFO_F("{} is called", #method_name); \
+ LOG_INFO("{} is called", #method_name); \
int &c = counter_##method_name(); \
++c; \
int max_call = maxcall_##method_name(); \
diff --git a/src/meta/test/balancer_simulator/balancer_simulator.cpp b/src/meta/test/balancer_simulator/balancer_simulator.cpp
index 0b8b830e9..4259effdb 100644
--- a/src/meta/test/balancer_simulator/balancer_simulator.cpp
+++ b/src/meta/test/balancer_simulator/balancer_simulator.cpp
@@ -164,7 +164,7 @@ void greedy_balancer_perfect_move_primary()
migration_list ml;
glb.check({&apps, &nodes}, ml);
- LOG_DEBUG_F("balance checker operation count = {}", ml.size());
+ LOG_DEBUG("balance checker operation count = {}", ml.size());
int i = 0;
while (glb.balance({&apps, &nodes}, ml)) {
@@ -175,7 +175,7 @@ void greedy_balancer_perfect_move_primary()
}
}
glb.check({&apps, &nodes}, ml);
- LOG_DEBUG_F("round {}: balance checker operation count = {}", ++i, ml.size());
+ LOG_DEBUG("round {}: balance checker operation count = {}", ++i, ml.size());
}
}
diff --git a/src/meta/test/balancer_validator.cpp b/src/meta/test/balancer_validator.cpp
index 1533da7cc..4dea8a6cb 100644
--- a/src/meta/test/balancer_validator.cpp
+++ b/src/meta/test/balancer_validator.cpp
@@ -239,25 +239,25 @@ void meta_service_test_app::balancer_validator()
migration_list ml;
for (auto &iter : nodes) {
- LOG_DEBUG_F("node({}) have {} primaries, {} partitions",
- iter.first,
- iter.second.primary_count(),
- iter.second.partition_count());
+ LOG_DEBUG("node({}) have {} primaries, {} partitions",
+ iter.first,
+ iter.second.primary_count(),
+ iter.second.partition_count());
}
// iterate 1000000 times
for (int i = 0; i < 1000000 && glb.balance({&apps, &nodes}, ml); ++i) {
- LOG_DEBUG_F("the {}th round of balancer", i);
+ LOG_DEBUG("the {}th round of balancer", i);
migration_check_and_apply(apps, nodes, ml, &manager);
glb.check({&apps, &nodes}, ml);
- LOG_DEBUG_F("balance checker operation count = {}", ml.size());
+ LOG_DEBUG("balance checker operation count = {}", ml.size());
}
for (auto &iter : nodes) {
- LOG_DEBUG_F("node({}) have {} primaries, {} partitions",
- iter.first,
- iter.second.primary_count(),
- iter.second.partition_count());
+ LOG_DEBUG("node({}) have {} primaries, {} partitions",
+ iter.first,
+ iter.second.primary_count(),
+ iter.second.partition_count());
}
std::shared_ptr<app_state> &the_app = apps[1];
@@ -345,10 +345,10 @@ void meta_service_test_app::balance_config_file()
// iterate 1000 times
for (int i = 0; i < 1000 && lb->balance({&apps, &nodes}, ml); ++i) {
- LOG_DEBUG_F("the {}th round of balancer", i);
+ LOG_DEBUG("the {}th round of balancer", i);
migration_check_and_apply(apps, nodes, ml, nullptr);
lb->check({&apps, &nodes}, ml);
- LOG_DEBUG_F("balance checker operation count = {}", ml.size());
+ LOG_DEBUG("balance checker operation count = {}", ml.size());
}
}
}
diff --git a/src/meta/test/main.cpp b/src/meta/test/main.cpp
index cdfb97da1..4691351ba 100644
--- a/src/meta/test/main.cpp
+++ b/src/meta/test/main.cpp
@@ -84,7 +84,7 @@ dsn::error_code meta_service_test_app::start(const std::vector<std::string> &arg
(uint32_t)dsn_config_get_value_uint64("tools.simulator", "random_seed", 0, "random seed");
if (seed == 0) {
seed = time(0);
- LOG_ERROR_F("initial seed: {}", seed);
+ LOG_ERROR("initial seed: {}", seed);
}
srand(seed);
diff --git a/src/meta/test/meta_bulk_load_service_test.cpp b/src/meta/test/meta_bulk_load_service_test.cpp
index ceb3c51f3..80fd0a501 100644
--- a/src/meta/test/meta_bulk_load_service_test.cpp
+++ b/src/meta/test/meta_bulk_load_service_test.cpp
@@ -134,7 +134,7 @@ public:
void mock_partition_bulk_load(const std::string &app_name, const gpid &pid)
{
- LOG_INFO_F("mock function, app({}), pid({})", app_name, pid);
+ LOG_INFO("mock function, app({}), pid({})", app_name, pid);
}
gpid before_check_partition_status(bulk_load_status::type status)
@@ -373,11 +373,11 @@ public:
std::move(app_path),
std::move(value),
[this, app_path, &ainfo, &partition_bulk_load_info_map]() {
- LOG_INFO_F("create app({}) app_id={} bulk load dir({}), bulk_load_status={}",
- ainfo.app_name,
- ainfo.app_id,
- app_path,
- dsn::enum_to_string(ainfo.status));
+ LOG_INFO("create app({}) app_id={} bulk load dir({}), bulk_load_status={}",
+ ainfo.app_name,
+ ainfo.app_id,
+ app_path,
+ dsn::enum_to_string(ainfo.status));
for (const auto &kv : partition_bulk_load_info_map) {
mock_partition_bulk_load_info_on_remote_storage(gpid(ainfo.app_id, kv.first),
kv.second);
@@ -392,10 +392,10 @@ public:
blob value = json::json_forwarder<partition_bulk_load_info>::encode(pinfo);
_ms->get_meta_storage()->create_node(
std::move(partition_path), std::move(value), [partition_path, pid, &pinfo]() {
- LOG_INFO_F("create partition[{}] bulk load dir({}), bulk_load_status={}",
- pid,
- partition_path,
- dsn::enum_to_string(pinfo.status));
+ LOG_INFO("create partition[{}] bulk load dir({}), bulk_load_status={}",
+ pid,
+ partition_path,
+ dsn::enum_to_string(pinfo.status));
});
}
@@ -407,7 +407,7 @@ public:
_ms->get_meta_storage()->create_node(
std::move(path), blob(lock_state, 0, strlen(lock_state)), [this]() {
- LOG_INFO_F("create app root {}", _app_root);
+ LOG_INFO("create app root {}", _app_root);
});
wait_all();
@@ -416,7 +416,7 @@ public:
_app_root + "/" + boost::lexical_cast<std::string>(info.app_id),
std::move(value),
[this, &info]() {
- LOG_INFO_F("create app({}) app_id={}, dir succeed", info.app_name, info.app_id);
+ LOG_INFO("create app({}) app_id={}, dir succeed", info.app_name, info.app_id);
for (int i = 0; i < info.partition_count; ++i) {
partition_configuration config;
config.max_replica_count = 3;
@@ -428,10 +428,10 @@ public:
boost::lexical_cast<std::string>(i),
std::move(v),
[info, i]() {
- LOG_INFO_F("create app({}), partition({}.{}) dir succeed",
- info.app_name,
- info.app_id,
- i);
+ LOG_INFO("create app({}), partition({}.{}) dir succeed",
+ info.app_name,
+ info.app_id,
+ i);
});
}
});
diff --git a/src/meta/test/meta_split_service_test.cpp b/src/meta/test/meta_split_service_test.cpp
index cdd4d0ae9..78ef0d8b9 100644
--- a/src/meta/test/meta_split_service_test.cpp
+++ b/src/meta/test/meta_split_service_test.cpp
@@ -288,7 +288,7 @@ public:
_ms->get_meta_storage()->create_node(
std::move(path), blob(lock_state, 0, strlen(lock_state)), [&app_root]() {
- LOG_INFO_F("create app root {}", app_root);
+ LOG_INFO("create app root {}", app_root);
});
wait_all();
@@ -308,7 +308,7 @@ public:
app_root + "/" + boost::lexical_cast<std::string>(ainfo.app_id),
std::move(value),
[this, &app_root, &ainfo]() {
- LOG_INFO_F("create app({}) app_id={}, dir succeed", ainfo.app_name, ainfo.app_id);
+ LOG_INFO("create app({}) app_id={}, dir succeed", ainfo.app_name, ainfo.app_id);
for (int i = 0; i < ainfo.init_partition_count; ++i) {
create_partition_configuration_on_remote_storage(app_root, ainfo.app_id, i);
}
@@ -337,7 +337,7 @@ public:
boost::lexical_cast<std::string>(pidx),
std::move(value),
[app_id, pidx, this]() {
- LOG_INFO_F("create app({}), partition({}.{}) dir succeed", NAME, app_id, pidx);
+ LOG_INFO("create app({}), partition({}.{}) dir succeed", NAME, app_id, pidx);
});
}
diff --git a/src/meta/test/meta_state/meta_state_service.cpp b/src/meta/test/meta_state/meta_state_service.cpp
index 46bd969d6..60f094dba 100644
--- a/src/meta/test/meta_state/meta_state_service.cpp
+++ b/src/meta/test/meta_state/meta_state_service.cpp
@@ -258,7 +258,7 @@ void provider_recursively_create_delete_test(const service_creator_func &creator
->delete_node("/r",
true,
META_STATE_SERVICE_SIMPLE_TEST_CALLBACK,
- [](error_code ec) { LOG_INFO_F("result: {}", ec); })
+ [](error_code ec) { LOG_INFO("result: {}", ec); })
->wait();
service->create_node(
"/r",
diff --git a/src/meta/test/meta_test_base.cpp b/src/meta/test/meta_test_base.cpp
index cbc5aebc2..2fd486e9e 100644
--- a/src/meta/test/meta_test_base.cpp
+++ b/src/meta/test/meta_test_base.cpp
@@ -128,9 +128,9 @@ std::vector<rpc_address> meta_test_base::ensure_enough_alive_nodes(int min_node_
min_node_count,
node_count);
- LOG_DEBUG_F("already exists {} alive nodes: ", nodes.size());
+ LOG_DEBUG("already exists {} alive nodes: ", nodes.size());
for (const auto &node : nodes) {
- LOG_DEBUG_F(" {}", node.to_string());
+ LOG_DEBUG(" {}", node.to_string());
}
// ensure that _ms->_alive_set is identical with _ss->_nodes
@@ -152,9 +152,9 @@ std::vector<rpc_address> meta_test_base::ensure_enough_alive_nodes(int min_node_
std::this_thread::sleep_for(std::chrono::milliseconds(5));
}
- LOG_DEBUG_F("created {} alive nodes: ", nodes.size());
+ LOG_DEBUG("created {} alive nodes: ", nodes.size());
for (const auto &node : nodes) {
- LOG_DEBUG_F(" {}", node.to_string());
+ LOG_DEBUG(" {}", node.to_string());
}
return nodes;
}
diff --git a/src/meta/test/misc/misc.cpp b/src/meta/test/misc/misc.cpp
index 53ffd94bb..c843fd060 100644
--- a/src/meta/test/misc/misc.cpp
+++ b/src/meta/test/misc/misc.cpp
@@ -163,7 +163,7 @@ void generate_apps(/*out*/ dsn::replication::app_mapper &mapper,
if (generate_serving_info) {
generate_app_serving_replica_info(the_app, disks_per_node);
}
- LOG_DEBUG_F("generated app, partitions({})", info.partition_count);
+ LOG_DEBUG("generated app, partitions({})", info.partition_count);
mapper.emplace(the_app->app_id, the_app);
}
}
@@ -201,7 +201,7 @@ void generate_node_fs_manager(const app_mapper &apps,
cc.find_from_serving(ns.addr())->disk_tag.c_str(),
pid.get_app_id(),
pid.get_partition_index());
- LOG_DEBUG_F("concat pid_dir({}) of node({})", pid_dir, ns.addr());
+ LOG_DEBUG("concat pid_dir({}) of node({})", pid_dir, ns.addr());
manager.add_replica(pid, pid_dir);
return true;
});
@@ -356,7 +356,7 @@ void migration_check_and_apply(app_mapper &apps,
int i = 0;
for (auto kv = ml.begin(); kv != ml.end(); ++kv) {
std::shared_ptr<configuration_balancer_request> &proposal = kv->second;
- LOG_DEBUG_F("the {}th round of proposal, gpid({})", i++, proposal->gpid);
+ LOG_DEBUG("the {}th round of proposal, gpid({})", i++, proposal->gpid);
std::shared_ptr<app_state> &the_app = apps.find(proposal->gpid.get_app_id())->second;
CHECK_EQ(proposal->gpid.get_app_id(), the_app->app_id);
@@ -373,11 +373,11 @@ void migration_check_and_apply(app_mapper &apps,
for (unsigned int j = 0; j < proposal->action_list.size(); ++j) {
configuration_proposal_action &act = proposal->action_list[j];
- LOG_DEBUG_F("the {}th round of action, type: {}, node: {}, target: {}",
- j,
- dsn::enum_to_string(act.type),
- act.node,
- act.target);
+ LOG_DEBUG("the {}th round of action, type: {}, node: {}, target: {}",
+ j,
+ dsn::enum_to_string(act.type),
+ act.node,
+ act.target);
proposal_action_check_and_apply(act, proposal->gpid, apps, nodes, manager);
}
}
diff --git a/src/meta/test/update_configuration_test.cpp b/src/meta/test/update_configuration_test.cpp
index 1a5d17c96..40cd2e225 100644
--- a/src/meta/test/update_configuration_test.cpp
+++ b/src/meta/test/update_configuration_test.cpp
@@ -120,7 +120,7 @@ class null_meta_service : public dsn::replication::meta_service
public:
void send_message(const dsn::rpc_address &target, dsn::message_ex *request)
{
- LOG_INFO_F("send request to {}", target);
+ LOG_INFO("send request to {}", target);
request->add_ref();
request->release_ref();
}
diff --git a/src/nfs/nfs_client_impl.cpp b/src/nfs/nfs_client_impl.cpp
index 2230fd8d7..309280e97 100644
--- a/src/nfs/nfs_client_impl.cpp
+++ b/src/nfs/nfs_client_impl.cpp
@@ -147,20 +147,20 @@ void nfs_client_impl::end_get_file_size(::dsn::error_code err,
const user_request_ptr &ureq)
{
if (err != ::dsn::ERR_OK) {
- LOG_ERROR_F("[nfs_service] remote get file size failed, source = {}, dir = {}, err = {}",
- ureq->file_size_req.source,
- ureq->file_size_req.source_dir,
- err);
+ LOG_ERROR("[nfs_service] remote get file size failed, source = {}, dir = {}, err = {}",
+ ureq->file_size_req.source,
+ ureq->file_size_req.source_dir,
+ err);
ureq->nfs_task->enqueue(err, 0);
return;
}
err = dsn::error_code(resp.error);
if (err != ::dsn::ERR_OK) {
- LOG_ERROR_F("[nfs_service] remote get file size failed, source = {}, dir = {}, err = {}",
- ureq->file_size_req.source,
- ureq->file_size_req.source_dir,
- err);
+ LOG_ERROR("[nfs_service] remote get file size failed, source = {}, dir = {}, err = {}",
+ ureq->file_size_req.source,
+ ureq->file_size_req.source_dir,
+ err);
ureq->nfs_task->enqueue(err, 0);
return;
}
@@ -334,13 +334,13 @@ void nfs_client_impl::end_copy(::dsn::error_code err,
if (!fc->user_req->is_finished) {
if (reqc->retry_count > 0) {
- LOG_WARNING_F("[nfs_service] remote copy failed, source = {}, dir = {}, file = {}, "
- "err = {}, retry_count = {}",
- fc->user_req->file_size_req.source,
- fc->user_req->file_size_req.source_dir,
- fc->file_name,
- err,
- reqc->retry_count);
+ LOG_WARNING("[nfs_service] remote copy failed, source = {}, dir = {}, file = {}, "
+ "err = {}, retry_count = {}",
+ fc->user_req->file_size_req.source,
+ fc->user_req->file_size_req.source_dir,
+ fc->file_name,
+ err,
+ reqc->retry_count);
// retry copy
reqc->retry_count--;
@@ -352,13 +352,13 @@ void nfs_client_impl::end_copy(::dsn::error_code err,
else
_copy_requests_low.push_retry(reqc);
} else {
- LOG_ERROR_F("[nfs_service] remote copy failed, source = {}, dir = {}, file = {}, "
- "err = {}, retry_count = {}",
- fc->user_req->file_size_req.source,
- fc->user_req->file_size_req.source_dir,
- fc->file_name,
- err,
- reqc->retry_count);
+ LOG_ERROR("[nfs_service] remote copy failed, source = {}, dir = {}, file = {}, "
+ "err = {}, retry_count = {}",
+ fc->user_req->file_size_req.source,
+ fc->user_req->file_size_req.source_dir,
+ fc->file_name,
+ err,
+ reqc->retry_count);
handle_completion(fc->user_req, err);
}
@@ -458,7 +458,7 @@ void nfs_client_impl::continue_write()
if (!fc->file_holder->file_handle) {
--_concurrent_local_write_count;
- LOG_ERROR_F("open file {} failed", file_path);
+ LOG_ERROR("open file {} failed", file_path);
handle_completion(fc->user_req, ERR_FILE_OPERATION_FAILED);
} else {
zauto_lock l(reqc->lock);
@@ -499,10 +499,10 @@ void nfs_client_impl::end_write(error_code err, size_t sz, const copy_request_ex
if (err != ERR_OK) {
_recent_write_fail_count->increment();
- LOG_ERROR_F("[nfs_service] local write failed, dir = {}, file = {}, err = {}",
- fc->user_req->file_size_req.dst_dir,
- fc->file_name,
- err);
+ LOG_ERROR("[nfs_service] local write failed, dir = {}, file = {}, err = {}",
+ fc->user_req->file_size_req.dst_dir,
+ fc->file_name,
+ err);
completed = true;
} else {
_recent_write_data_size->add(sz);
diff --git a/src/nfs/nfs_server_impl.cpp b/src/nfs/nfs_server_impl.cpp
index 71723b17b..c3c10496d 100644
--- a/src/nfs/nfs_server_impl.cpp
+++ b/src/nfs/nfs_server_impl.cpp
@@ -99,11 +99,11 @@ void nfs_service_impl::on_copy(const ::dsn::service::copy_request &request,
}
}
- LOG_DEBUG_F(
+ LOG_DEBUG(
"nfs: copy file {} [{}, {}]", file_path, request.offset, request.offset + request.size);
if (dfile == nullptr) {
- LOG_ERROR_F("[nfs_service] open file {} failed", file_path);
+ LOG_ERROR("[nfs_service] open file {} failed", file_path);
::dsn::service::copy_response resp;
resp.error = ERR_OBJECT_NOT_FOUND;
reply(resp);
@@ -149,7 +149,7 @@ void nfs_service_impl::internal_read_callback(error_code err, size_t sz, callbac
}
if (err != ERR_OK) {
- LOG_ERROR_F("[nfs_service] read file {} failed, err = {}", cp.file_path, err);
+ LOG_ERROR("[nfs_service] read file {} failed, err = {}", cp.file_path, err);
_recent_copy_fail_count->increment();
} else {
_recent_copy_data_size->add(sz);
@@ -176,11 +176,11 @@ void nfs_service_impl::on_get_file_size(
if (request.file_list.size() == 0) // return all file size in the destination file folder
{
if (!dsn::utils::filesystem::directory_exists(folder)) {
- LOG_ERROR_F("[nfs_service] directory {} not exist", folder);
+ LOG_ERROR("[nfs_service] directory {} not exist", folder);
err = ERR_OBJECT_NOT_FOUND;
} else {
if (!dsn::utils::filesystem::get_subfiles(folder, file_list, true)) {
- LOG_ERROR_F("[nfs_service] get subfiles of directory {} failed", folder);
+ LOG_ERROR("[nfs_service] get subfiles of directory {} failed", folder);
err = ERR_FILE_OPERATION_FAILED;
} else {
for (auto &fpath : file_list) {
@@ -188,7 +188,7 @@ void nfs_service_impl::on_get_file_size(
// Done
int64_t sz;
if (!dsn::utils::filesystem::file_size(fpath, sz)) {
- LOG_ERROR_F("[nfs_service] get size of file {} failed", fpath);
+ LOG_ERROR("[nfs_service] get size of file {} failed", fpath);
err = ERR_FILE_OPERATION_FAILED;
break;
}
@@ -208,9 +208,9 @@ void nfs_service_impl::on_get_file_size(
struct stat st;
if (0 != ::stat(file_path.c_str(), &st)) {
- LOG_ERROR_F("[nfs_service] get stat of file {} failed, err = {}",
- file_path,
- dsn::utils::safe_strerror(errno));
+ LOG_ERROR("[nfs_service] get stat of file {} failed, err = {}",
+ file_path,
+ dsn::utils::safe_strerror(errno));
err = ERR_OBJECT_NOT_FOUND;
break;
}
@@ -240,7 +240,7 @@ void nfs_service_impl::close_file() // release out-of-date file handle
// not used and expired
if (fptr->file_access_count == 0 &&
dsn_now_ms() - fptr->last_access_time > (uint64_t)FLAGS_file_close_expire_time_ms) {
- LOG_DEBUG_F("nfs: close file handle {}", it->first);
+ LOG_DEBUG("nfs: close file handle {}", it->first);
it = _handles_map.erase(it);
} else
it++;
diff --git a/src/perf_counter/builtin_counters.cpp b/src/perf_counter/builtin_counters.cpp
index fdbb670f6..2dca48ec0 100644
--- a/src/perf_counter/builtin_counters.cpp
+++ b/src/perf_counter/builtin_counters.cpp
@@ -48,7 +48,7 @@ void builtin_counters::update_counters()
uint64_t memused_res = (uint64_t)resident_set / 1024;
_memused_virt->set(memused_virt);
_memused_res->set(memused_res);
- LOG_INFO_F("memused_virt = {} MB, memused_res = {} MB", memused_virt, memused_res);
+ LOG_INFO("memused_virt = {} MB, memused_res = {} MB", memused_virt, memused_res);
}
} // namespace dsn
diff --git a/src/perf_counter/perf_counters.cpp b/src/perf_counter/perf_counters.cpp
index 6ce274118..9c7a1db0a 100644
--- a/src/perf_counter/perf_counters.cpp
+++ b/src/perf_counter/perf_counters.cpp
@@ -235,8 +235,7 @@ bool perf_counters::remove_counter(const std::string &full_name)
}
}
- LOG_DEBUG_F(
- "performance counter {} is removed, remaining reference ({})", full_name, remain_ref);
+ LOG_DEBUG("performance counter {} is removed, remaining reference ({})", full_name, remain_ref);
return true;
}
diff --git a/src/perf_counter/test/perf_counter_test.cpp b/src/perf_counter/test/perf_counter_test.cpp
index 609317cf5..f4de5c309 100644
--- a/src/perf_counter/test/perf_counter_test.cpp
+++ b/src/perf_counter/test/perf_counter_test.cpp
@@ -97,19 +97,19 @@ TEST(perf_counter, perf_counter_atomic)
"", "", "", dsn_perf_counter_type_t::COUNTER_TYPE_NUMBER, "");
perf_counter_inc_dec(counter);
perf_counter_add(counter, vec);
- LOG_INFO_F("{}", counter->get_value());
+ LOG_INFO("{}", counter->get_value());
counter = new perf_counter_volatile_number_atomic(
"", "", "", dsn_perf_counter_type_t::COUNTER_TYPE_VOLATILE_NUMBER, "");
perf_counter_inc_dec(counter);
perf_counter_add(counter, vec);
- LOG_INFO_F("{}", counter->get_value());
+ LOG_INFO("{}", counter->get_value());
counter =
new perf_counter_rate_atomic("", "", "", dsn_perf_counter_type_t::COUNTER_TYPE_RATE, "");
perf_counter_inc_dec(counter);
perf_counter_add(counter, vec);
- LOG_INFO_F("{}", counter->get_value());
+ LOG_INFO("{}", counter->get_value());
counter = new perf_counter_number_percentile_atomic(
"", "", "", dsn_perf_counter_type_t::COUNTER_TYPE_NUMBER_PERCENTILES, "");
@@ -119,7 +119,7 @@ TEST(perf_counter, perf_counter_atomic)
counter->set(rand() % 10000);
// std::this_thread::sleep_for(std::chrono::seconds(sleep_interval));
for (int i = 0; i != COUNTER_PERCENTILE_COUNT; ++i)
- LOG_INFO_F("{}", counter->get_percentile((dsn_perf_counter_percentile_type_t)i));
+ LOG_INFO("{}", counter->get_percentile((dsn_perf_counter_percentile_type_t)i));
}
}
diff --git a/src/redis_protocol/proxy_lib/proxy_layer.cpp b/src/redis_protocol/proxy_lib/proxy_layer.cpp
index 05d52cc3c..4f263f8ce 100644
--- a/src/redis_protocol/proxy_lib/proxy_layer.cpp
+++ b/src/redis_protocol/proxy_lib/proxy_layer.cpp
@@ -93,10 +93,10 @@ void proxy_stub::remove_session(dsn::rpc_address remote_address)
::dsn::zauto_write_lock l(_lock);
auto iter = _sessions.find(remote_address);
if (iter == _sessions.end()) {
- LOG_WARNING_F("{} has been removed from proxy stub", remote_address);
+ LOG_WARNING("{} has been removed from proxy stub", remote_address);
return;
}
- LOG_INFO_F("remove {} from proxy stub", remote_address);
+ LOG_INFO("remove {} from proxy stub", remote_address);
session = std::move(iter->second);
_sessions.erase(iter);
}
@@ -116,7 +116,7 @@ proxy_session::proxy_session(proxy_stub *op, dsn::message_ex *first_msg)
proxy_session::~proxy_session()
{
_backup_one_request->release_ref();
- LOG_INFO_F("proxy session {} destroyed", _remote_address);
+ LOG_INFO("proxy session {} destroyed", _remote_address);
}
void proxy_session::on_recv_request(dsn::message_ex *msg)
@@ -130,11 +130,11 @@ void proxy_session::on_recv_request(dsn::message_ex *msg)
// 2. as "on_recv_request" won't be called concurrently, it's not necessary to call
// "parse" with a lock. a subclass may implement a lock inside parse if necessary
if (!parse(msg)) {
- LOG_ERROR_F("{}: got invalid message, try to remove proxy session from proxy stub",
- _remote_address);
+ LOG_ERROR("{}: got invalid message, try to remove proxy session from proxy stub",
+ _remote_address);
_stub->remove_session(_remote_address);
- LOG_ERROR_F("close the rpc session {}", _remote_address);
+ LOG_ERROR("close the rpc session {}", _remote_address);
((dsn::message_ex *)_backup_one_request)->io_session->close();
}
}
diff --git a/src/redis_protocol/proxy_lib/redis_parser.cpp b/src/redis_protocol/proxy_lib/redis_parser.cpp
index ab0f49a65..b59a56202 100644
--- a/src/redis_protocol/proxy_lib/redis_parser.cpp
+++ b/src/redis_protocol/proxy_lib/redis_parser.cpp
@@ -164,7 +164,7 @@ bool redis_parser::eat(char c)
--_total_length;
return true;
} else {
- LOG_ERROR_F("{}: expect token: {}, got {}", _remote_address.to_string(), c, peek());
+ LOG_ERROR("{}: expect token: {}, got {}", _remote_address.to_string(), c, peek());
return false;
}
}
@@ -190,14 +190,14 @@ bool redis_parser::end_array_size()
{
int32_t count = 0;
if (dsn_unlikely(!dsn::buf2int32(dsn::string_view(_current_size), count))) {
- LOG_ERROR_F(
+ LOG_ERROR(
"{}: invalid size string \"{}\"", _remote_address.to_string(), _current_size.c_str());
return false;
}
if (dsn_unlikely(count <= 0)) {
- LOG_ERROR_F("{}: array size should be positive in redis request, but got {}",
- _remote_address.to_string(),
- count);
+ LOG_ERROR("{}: array size should be positive in redis request, but got {}",
+ _remote_address.to_string(),
+ count);
return false;
}
@@ -229,7 +229,7 @@ bool redis_parser::end_bulk_string_size()
int32_t length = 0;
if (dsn_unlikely(!dsn::buf2int32(
dsn::string_view(_current_size.c_str(), _current_size.length()), length))) {
- LOG_ERROR_F(
+ LOG_ERROR(
"{}: invalid size string \"{}\"", _remote_address.to_string(), _current_size.c_str());
return false;
}
@@ -248,7 +248,7 @@ bool redis_parser::end_bulk_string_size()
return true;
}
- LOG_ERROR_F(
+ LOG_ERROR(
"{}: invalid bulk string length: {}", _remote_address.to_string(), _current_str.length);
return false;
}
@@ -791,12 +791,12 @@ void redis_parser::geo_radius(message_entry &entry)
double lng_degrees = 0.0;
const std::string &str_lng_degrees = redis_request.sub_requests[2].data.to_string();
if (!dsn::buf2double(str_lng_degrees, lng_degrees)) {
- LOG_WARNING_F("longitude parameter '{}' is error, use {}", str_lng_degrees, lng_degrees);
+ LOG_WARNING("longitude parameter '{}' is error, use {}", str_lng_degrees, lng_degrees);
}
double lat_degrees = 0.0;
const std::string &str_lat_degrees = redis_request.sub_requests[3].data.to_string();
if (!dsn::buf2double(str_lat_degrees, lat_degrees)) {
- LOG_WARNING_F("latitude parameter '{}' is error, use {}", str_lat_degrees, lat_degrees);
+ LOG_WARNING("latitude parameter '{}' is error, use {}", str_lat_degrees, lat_degrees);
}
// radius m|km|ft|mi [WITHCOORD] [WITHDIST] [COUNT count] [ASC|DESC]
@@ -898,36 +898,36 @@ void redis_parser::counter_internal(message_entry &entry)
int64_t increment = 1;
if (dsn::utils::iequals(command, "INCR") || dsn::utils::iequals(command, "DECR")) {
if (entry.request.sub_requests.size() != 2) {
- LOG_WARNING_F("{}: command {} seqid({}) with invalid arguments count: {}",
- _remote_address,
- command,
- entry.sequence_id,
- entry.request.sub_requests.size());
+ LOG_WARNING("{}: command {} seqid({}) with invalid arguments count: {}",
+ _remote_address,
+ command,
+ entry.sequence_id,
+ entry.request.sub_requests.size());
simple_error_reply(entry, fmt::format("wrong number of arguments for '{}'", command));
return;
}
} else if (dsn::utils::iequals(command, "INCRBY") || dsn::utils::iequals(command, "DECRBY")) {
if (entry.request.sub_requests.size() != 3) {
- LOG_WARNING_F("{}: command {} seqid({}) with invalid arguments count: {}",
- _remote_address,
- command,
- entry.sequence_id,
- entry.request.sub_requests.size());
+ LOG_WARNING("{}: command {} seqid({}) with invalid arguments count: {}",
+ _remote_address,
+ command,
+ entry.sequence_id,
+ entry.request.sub_requests.size());
simple_error_reply(entry, fmt::format("wrong number of arguments for '{}'", command));
return;
}
if (!dsn::buf2int64(entry.request.sub_requests[2].data, increment)) {
- LOG_WARNING_F("{}: command {} seqid({}) with invalid 'increment': {}",
- _remote_address,
- command,
- entry.sequence_id,
- entry.request.sub_requests[2].data.to_string());
+ LOG_WARNING("{}: command {} seqid({}) with invalid 'increment': {}",
+ _remote_address,
+ command,
+ entry.sequence_id,
+ entry.request.sub_requests[2].data.to_string());
simple_error_reply(entry,
fmt::format("wrong type of argument 'increment 'for '{}'", command));
return;
}
} else {
- LOG_FATAL_F("command not support: {}", command);
+ LOG_FATAL("command not support: {}", command);
}
if (dsn::utils::iequals(command, "DECR", 4)) {
increment = -increment;
@@ -937,19 +937,19 @@ void redis_parser::counter_internal(message_entry &entry)
auto on_incr_reply = [ref_this, this, command, &entry](
::dsn::error_code ec, dsn::message_ex *, dsn::message_ex *response) {
if (_is_session_reset.load(std::memory_order_acquire)) {
- LOG_WARNING_F("{}: command {} seqid({}) got reply, but session has reset",
- _remote_address,
- command,
- entry.sequence_id);
+ LOG_WARNING("{}: command {} seqid({}) got reply, but session has reset",
+ _remote_address,
+ command,
+ entry.sequence_id);
return;
}
if (::dsn::ERR_OK != ec) {
- LOG_WARNING_F("{}: command {} seqid({}) got reply with error = {}",
- _remote_address,
- command,
- entry.sequence_id,
- ec);
+ LOG_WARNING("{}: command {} seqid({}) got reply with error = {}",
+ _remote_address,
+ command,
+ entry.sequence_id,
+ ec);
simple_error_reply(entry, ec.to_string());
} else {
::dsn::apps::incr_response incr_resp;
@@ -977,10 +977,10 @@ void redis_parser::parse_set_parameters(const std::vector<redis_bulk_string> &op
if (dsn::utils::iequals(opt, "EX") && i + 1 < opts.size()) {
const std::string &str_ttl_seconds = opts[i + 1].data.to_string();
if (!dsn::buf2int32(str_ttl_seconds, ttl_seconds)) {
- LOG_WARNING_F("'EX {}' option is error, use {}", str_ttl_seconds, ttl_seconds);
+ LOG_WARNING("'EX {}' option is error, use {}", str_ttl_seconds, ttl_seconds);
}
} else {
- LOG_WARNING_F("only 'EX' option is supported");
+ LOG_WARNING("only 'EX' option is supported");
}
}
}
@@ -1001,7 +1001,7 @@ void redis_parser::parse_geo_radius_parameters(const std::vector<redis_bulk_stri
}
const std::string &str_radius = opts[base_index++].data.to_string();
if (!dsn::buf2double(str_radius, radius_m)) {
- LOG_WARNING_F("radius parameter '{}' is error, use {}", str_radius, radius_m);
+ LOG_WARNING("radius parameter '{}' is error, use {}", str_radius, radius_m);
}
// m|km|ft|mi
@@ -1033,7 +1033,7 @@ void redis_parser::parse_geo_radius_parameters(const std::vector<redis_bulk_stri
} else if (dsn::utils::iequals(opt, "COUNT") && base_index + 1 < opts.size()) {
const std::string &str_count = opts[base_index + 1].data.to_string();
if (!dsn::buf2int32(str_count, count)) {
- LOG_ERROR_F("'COUNT {}' option is error, use {}", str_count, count);
+ LOG_ERROR("'COUNT {}' option is error, use {}", str_count, count);
}
} else if (dsn::utils::iequals(opt, "ASC")) {
sort_type = geo::geo_client::SortType::asc;
diff --git a/src/redis_protocol/proxy_ut/redis_proxy_test.cpp b/src/redis_protocol/proxy_ut/redis_proxy_test.cpp
index 40e6764f7..e2b312a27 100644
--- a/src/redis_protocol/proxy_ut/redis_proxy_test.cpp
+++ b/src/redis_protocol/proxy_ut/redis_proxy_test.cpp
@@ -605,7 +605,7 @@ TEST(proxy, connection)
client_socket.shutdown(boost::asio::socket_base::shutdown_both);
client_socket.close();
} catch (...) {
- LOG_INFO_F("exception in shutdown");
+ LOG_INFO("exception in shutdown");
}
}
}
diff --git a/src/replica/backup/cold_backup_context.cpp b/src/replica/backup/cold_backup_context.cpp
index 28625726f..70a15d294 100644
--- a/src/replica/backup/cold_backup_context.cpp
+++ b/src/replica/backup/cold_backup_context.cpp
@@ -189,27 +189,26 @@ void cold_backup_context::check_backup_on_remote()
LPC_BACKGROUND_COLD_BACKUP,
[this, current_chkpt_file](const dist::block_service::create_file_response &resp) {
if (!is_ready_for_check()) {
- LOG_INFO_F("{}: backup status has changed to {}, ignore checking backup on remote",
- name,
- cold_backup_status_to_string(status()));
+ LOG_INFO("{}: backup status has changed to {}, ignore checking backup on remote",
+ name,
+ cold_backup_status_to_string(status()));
ignore_check();
} else if (resp.err == ERR_OK) {
const dist::block_service::block_file_ptr &file_handle = resp.file_handle;
CHECK_NOTNULL(file_handle, "");
if (file_handle->get_md5sum().empty() && file_handle->get_size() <= 0) {
- LOG_INFO_F(
- "{}: check backup on remote, current_checkpoint file {} is not exist",
- name,
- current_chkpt_file);
+ LOG_INFO("{}: check backup on remote, current_checkpoint file {} is not exist",
+ name,
+ current_chkpt_file);
complete_check(false);
} else {
- LOG_INFO_F("{}: check backup on remote, current_checkpoint file {} is exist",
- name,
- current_chkpt_file);
+ LOG_INFO("{}: check backup on remote, current_checkpoint file {} is exist",
+ name,
+ current_chkpt_file);
read_current_chkpt_file(file_handle);
}
} else if (resp.err == ERR_TIMEOUT) {
- LOG_ERROR_F(
+ LOG_ERROR(
"{}: block service create file timeout, retry after 10 seconds, file = {}",
name,
current_chkpt_file);
@@ -223,10 +222,10 @@ void cold_backup_context::check_backup_on_remote()
// before retry, should check whether the status is ready for
// check
if (!is_ready_for_check()) {
- LOG_INFO_F("{}: backup status has changed to {}, ignore "
- "checking backup on remote",
- name,
- cold_backup_status_to_string(status()));
+ LOG_INFO("{}: backup status has changed to {}, ignore "
+ "checking backup on remote",
+ name,
+ cold_backup_status_to_string(status()));
ignore_check();
} else {
check_backup_on_remote();
@@ -236,10 +235,10 @@ void cold_backup_context::check_backup_on_remote()
0,
std::chrono::seconds(10));
} else {
- LOG_ERROR_F("{}: block service create file failed, file = {}, err = {}",
- name,
- current_chkpt_file,
- resp.err);
+ LOG_ERROR("{}: block service create file failed, file = {}, err = {}",
+ name,
+ current_chkpt_file,
+ resp.err);
fail_check("block service create file failed");
}
release_ref();
@@ -260,35 +259,35 @@ void cold_backup_context::read_current_chkpt_file(
LPC_BACKGROUND_COLD_BACKUP,
[this, file_handle](const dist::block_service::read_response &resp) {
if (!is_ready_for_check()) {
- LOG_INFO_F("{}: backup status has changed to {}, ignore checking backup on remote",
- name,
- cold_backup_status_to_string(status()));
+ LOG_INFO("{}: backup status has changed to {}, ignore checking backup on remote",
+ name,
+ cold_backup_status_to_string(status()));
ignore_check();
} else if (resp.err == ERR_OK) {
std::string chkpt_dirname(resp.buffer.data(), resp.buffer.length());
if (chkpt_dirname.empty()) {
complete_check(false);
} else {
- LOG_INFO_F("{}: after read current_checkpoint_file, check whether remote "
- "checkpoint dir = {} is exist",
- name,
- chkpt_dirname);
+ LOG_INFO("{}: after read current_checkpoint_file, check whether remote "
+ "checkpoint dir = {} is exist",
+ name,
+ chkpt_dirname);
remote_chkpt_dir_exist(chkpt_dirname);
}
} else if (resp.err == ERR_TIMEOUT) {
- LOG_ERROR_F("{}: read remote file timeout, retry after 10s, file = {}",
- name,
- file_handle->file_name());
+ LOG_ERROR("{}: read remote file timeout, retry after 10s, file = {}",
+ name,
+ file_handle->file_name());
add_ref();
tasking::enqueue(LPC_BACKGROUND_COLD_BACKUP,
nullptr,
[this, file_handle]() {
if (!is_ready_for_check()) {
- LOG_INFO_F("{}: backup status has changed to {}, ignore "
- "checking backup on remote",
- name,
- cold_backup_status_to_string(status()));
+ LOG_INFO("{}: backup status has changed to {}, ignore "
+ "checking backup on remote",
+ name,
+ cold_backup_status_to_string(status()));
ignore_check();
} else {
read_current_chkpt_file(file_handle);
@@ -298,10 +297,10 @@ void cold_backup_context::read_current_chkpt_file(
0,
std::chrono::seconds(10));
} else {
- LOG_ERROR_F("{}: read remote file failed, file = {}, err = {}",
- name,
- file_handle->file_name(),
- resp.err);
+ LOG_ERROR("{}: read remote file failed, file = {}, err = {}",
+ name,
+ file_handle->file_name(),
+ resp.err);
fail_check("read remote file failed");
}
release_ref();
@@ -322,9 +321,9 @@ void cold_backup_context::remote_chkpt_dir_exist(const std::string &chkpt_dirnam
LPC_BACKGROUND_COLD_BACKUP,
[this, chkpt_dirname](const dist::block_service::ls_response &resp) {
if (!is_ready_for_check()) {
- LOG_INFO_F("{}: backup status has changed to {}, ignore checking backup on remote",
- name,
- cold_backup_status_to_string(status()));
+ LOG_INFO("{}: backup status has changed to {}, ignore checking backup on remote",
+ name,
+ cold_backup_status_to_string(status()));
ignore_check();
} else if (resp.err == ERR_OK) {
bool found_chkpt_dir = false;
@@ -335,28 +334,26 @@ void cold_backup_context::remote_chkpt_dir_exist(const std::string &chkpt_dirnam
}
}
if (found_chkpt_dir) {
- LOG_INFO_F("{}: remote checkpoint dir is already exist, so upload have already "
- "complete, remote_checkpoint_dirname = {}",
- name,
- chkpt_dirname);
+ LOG_INFO("{}: remote checkpoint dir is already exist, so upload have already "
+ "complete, remote_checkpoint_dirname = {}",
+ name,
+ chkpt_dirname);
complete_check(true);
} else {
- LOG_INFO_F(
- "{}: remote checkpoint dir is not exist, should re-upload checkpoint "
- "dir, remote_checkpoint_dirname = {}",
- name,
- chkpt_dirname);
+ LOG_INFO("{}: remote checkpoint dir is not exist, should re-upload checkpoint "
+ "dir, remote_checkpoint_dirname = {}",
+ name,
+ chkpt_dirname);
complete_check(false);
}
} else if (resp.err == ERR_OBJECT_NOT_FOUND) {
- LOG_INFO_F(
- "{}: remote checkpoint dir is not exist, should re-upload checkpoint dir, "
- "remote_checkpoint_dirname = {}",
- name,
- chkpt_dirname);
+ LOG_INFO("{}: remote checkpoint dir is not exist, should re-upload checkpoint dir, "
+ "remote_checkpoint_dirname = {}",
+ name,
+ chkpt_dirname);
complete_check(false);
} else if (resp.err == ERR_TIMEOUT) {
- LOG_ERROR_F(
+ LOG_ERROR(
"{}: block service list remote dir timeout, retry after 10s, dirname = {}",
name,
chkpt_dirname);
@@ -366,10 +363,10 @@ void cold_backup_context::remote_chkpt_dir_exist(const std::string &chkpt_dirnam
nullptr,
[this, chkpt_dirname]() {
if (!is_ready_for_check()) {
- LOG_INFO_F("{}: backup status has changed to {}, ignore "
- "checking backup on remote",
- name,
- cold_backup_status_to_string(status()));
+ LOG_INFO("{}: backup status has changed to {}, ignore "
+ "checking backup on remote",
+ name,
+ cold_backup_status_to_string(status()));
ignore_check();
} else {
remote_chkpt_dir_exist(chkpt_dirname);
@@ -379,10 +376,10 @@ void cold_backup_context::remote_chkpt_dir_exist(const std::string &chkpt_dirnam
0,
std::chrono::seconds(10));
} else {
- LOG_ERROR_F("{}: block service list remote dir failed, dirname = {}, err = {}",
- name,
- chkpt_dirname,
- resp.err);
+ LOG_ERROR("{}: block service list remote dir failed, dirname = {}, err = {}",
+ name,
+ chkpt_dirname,
+ resp.err);
fail_check("list remote dir failed");
}
release_ref();
@@ -393,9 +390,9 @@ void cold_backup_context::remote_chkpt_dir_exist(const std::string &chkpt_dirnam
void cold_backup_context::upload_checkpoint_to_remote()
{
if (!is_ready_for_upload()) {
- LOG_INFO_F("{}: backup status has changed to {}, ignore upload checkpoint",
- name,
- cold_backup_status_to_string(status()));
+ LOG_INFO("{}: backup status has changed to {}, ignore upload checkpoint",
+ name,
+ cold_backup_status_to_string(status()));
return;
}
@@ -404,9 +401,8 @@ void cold_backup_context::upload_checkpoint_to_remote()
// the result it has checked; But, because of upload_checkpoint_to_remote maybe call multi-times
... 8026 lines suppressed ...
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pegasus.apache.org
For additional commands, e-mail: commits-help@pegasus.apache.org