You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pegasus.apache.org by wa...@apache.org on 2022/10/25 06:27:25 UTC
[incubator-pegasus] branch master updated: refactor(log): adjust log level and macro names (#1200)
This is an automated email from the ASF dual-hosted git repository.
wangdan 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 fc4668859 refactor(log): adjust log level and macro names (#1200)
fc4668859 is described below
commit fc4668859749fd878efb02011d06794fd2590f6d
Author: Yingchun Lai <la...@apache.org>
AuthorDate: Tue Oct 25 14:27:19 2022 +0800
refactor(log): adjust log level and macro names (#1200)
---
src/aio/disk_engine.cpp | 8 +-
src/aio/native_linux_aio_provider.cpp | 6 +-
src/aio/test/aio.cpp | 2 +-
src/block_service/block_service_manager.cpp | 2 +-
src/block_service/fds/fds_service.cpp | 98 +--
src/block_service/hdfs/hdfs_service.cpp | 4 +-
src/block_service/local/local_service.cpp | 85 +-
src/client/partition_resolver.cpp | 8 +-
src/client/partition_resolver_manager.cpp | 2 +-
src/client/partition_resolver_simple.cpp | 56 +-
src/client/replication_ddl_client.cpp | 2 +-
src/client_lib/pegasus_client_factory_impl.cpp | 6 +-
src/client_lib/pegasus_client_impl.cpp | 91 +--
src/common/fs_manager.cpp | 50 +-
src/common/storage_serverlet.h | 8 +-
src/failure_detector/failure_detector.cpp | 134 +--
.../failure_detector_multimaster.cpp | 16 +-
src/failure_detector/test/config-test.ini | 2 +-
.../test/config-whitelist-test-failed.ini | 2 +-
.../test/config-whitelist-test.ini | 2 +-
src/failure_detector/test/failure_detector.cpp | 22 +-
src/http/http_message_parser.cpp | 8 +-
src/http/http_server.cpp | 2 +-
src/http/pprof_http_service.cpp | 20 +-
src/meta/app_balance_policy.cpp | 4 +-
src/meta/dump_file.h | 12 +-
src/meta/greedy_load_balancer.cpp | 12 +-
src/meta/load_balance_policy.cpp | 36 +-
src/meta/meta_backup_service.cpp | 309 +++----
src/meta/meta_data.cpp | 94 +--
src/meta/meta_server_failure_detector.cpp | 88 +-
src/meta/meta_service.cpp | 66 +-
src/meta/meta_service.h | 10 +-
src/meta/meta_state_service_simple.cpp | 4 +-
src/meta/meta_state_service_zookeeper.cpp | 20 +-
src/meta/partition_guardian.cpp | 207 ++---
src/meta/server_state.cpp | 576 ++++++-------
src/meta/server_state_restore.cpp | 15 +-
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_state/config-test.ini | 2 +-
src/meta/test/meta_state/meta_state_service.cpp | 2 +-
src/meta/test/misc/misc.cpp | 22 +-
src/meta/test/update_configuration_test.cpp | 2 +-
src/nfs/nfs_client_impl.cpp | 54 +-
src/nfs/nfs_server_impl.cpp | 30 +-
src/perf_counter/builtin_counters.cpp | 3 +-
src/perf_counter/perf_counter_atomic.h | 4 +-
src/perf_counter/perf_counters.cpp | 2 +-
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 | 189 ++---
src/redis_protocol/proxy_ut/config.ini | 2 +-
src/redis_protocol/proxy_ut/redis_proxy_test.cpp | 2 +-
src/replica/backup/cold_backup_context.cpp | 448 +++++-----
src/replica/backup/replica_backup_server.cpp | 26 +-
.../bulk_load/test/replica_bulk_loader_test.cpp | 4 +-
src/replica/duplication/duplication_sync_timer.cpp | 2 +-
src/replica/duplication/mutation_batch.cpp | 5 +-
src/replica/log_file.cpp | 47 +-
src/replica/mutation.cpp | 7 +-
src/replica/mutation_log.cpp | 333 ++++----
src/replica/mutation_log_replay.cpp | 30 +-
src/replica/replica.cpp | 46 +-
src/replica/replica_2pc.cpp | 168 ++--
src/replica/replica_backup.cpp | 230 +++---
src/replica/replica_check.cpp | 27 +-
src/replica/replica_chkpt.cpp | 98 +--
src/replica/replica_config.cpp | 241 +++---
src/replica/replica_failover.cpp | 24 +-
src/replica/replica_init.cpp | 180 +++--
src/replica/replica_learn.cpp | 897 +++++++++++----------
src/replica/replica_restore.cpp | 28 +-
src/replica/replica_stub.cpp | 336 ++++----
.../storage/simple_kv/simple_kv.server.impl.cpp | 8 +-
src/replica/storage/simple_kv/test/case-000.ini | 2 +-
src/replica/storage/simple_kv/test/case-001.ini | 2 +-
src/replica/storage/simple_kv/test/case-002.ini | 2 +-
src/replica/storage/simple_kv/test/case-003.ini | 2 +-
src/replica/storage/simple_kv/test/case-004.ini | 2 +-
src/replica/storage/simple_kv/test/case-005.ini | 2 +-
src/replica/storage/simple_kv/test/case-006.ini | 2 +-
src/replica/storage/simple_kv/test/case-100.ini | 2 +-
src/replica/storage/simple_kv/test/case-101.ini | 2 +-
src/replica/storage/simple_kv/test/case-102.ini | 2 +-
src/replica/storage/simple_kv/test/case-103.ini | 2 +-
src/replica/storage/simple_kv/test/case-104.ini | 2 +-
src/replica/storage/simple_kv/test/case-105.ini | 2 +-
src/replica/storage/simple_kv/test/case-106.ini | 2 +-
src/replica/storage/simple_kv/test/case-107.ini | 2 +-
src/replica/storage/simple_kv/test/case-108.ini | 2 +-
src/replica/storage/simple_kv/test/case-109.ini | 2 +-
src/replica/storage/simple_kv/test/case-200.ini | 2 +-
src/replica/storage/simple_kv/test/case-201.ini | 2 +-
src/replica/storage/simple_kv/test/case-202-0.ini | 2 +-
src/replica/storage/simple_kv/test/case-202-1.ini | 2 +-
src/replica/storage/simple_kv/test/case-203-0.ini | 2 +-
src/replica/storage/simple_kv/test/case-204.ini | 2 +-
src/replica/storage/simple_kv/test/case-205.ini | 2 +-
src/replica/storage/simple_kv/test/case-206.ini | 2 +-
src/replica/storage/simple_kv/test/case-207.ini | 2 +-
src/replica/storage/simple_kv/test/case-208.ini | 2 +-
src/replica/storage/simple_kv/test/case-209.ini | 2 +-
src/replica/storage/simple_kv/test/case-210.ini | 2 +-
src/replica/storage/simple_kv/test/case-211.ini | 2 +-
src/replica/storage/simple_kv/test/case-212.ini | 2 +-
src/replica/storage/simple_kv/test/case-213.ini | 2 +-
src/replica/storage/simple_kv/test/case-214.ini | 2 +-
src/replica/storage/simple_kv/test/case-215.ini | 2 +-
src/replica/storage/simple_kv/test/case-216.ini | 2 +-
src/replica/storage/simple_kv/test/case-300-0.ini | 2 +-
src/replica/storage/simple_kv/test/case-300-1.ini | 2 +-
src/replica/storage/simple_kv/test/case-300-2.ini | 2 +-
src/replica/storage/simple_kv/test/case-301.ini | 2 +-
src/replica/storage/simple_kv/test/case-302.ini | 2 +-
src/replica/storage/simple_kv/test/case-303.ini | 2 +-
src/replica/storage/simple_kv/test/case-304.ini | 2 +-
src/replica/storage/simple_kv/test/case-305.ini | 2 +-
src/replica/storage/simple_kv/test/case-306.ini | 2 +-
src/replica/storage/simple_kv/test/case-307.ini | 2 +-
src/replica/storage/simple_kv/test/case-400.ini | 2 +-
src/replica/storage/simple_kv/test/case-401.ini | 2 +-
src/replica/storage/simple_kv/test/case-402.ini | 2 +-
src/replica/storage/simple_kv/test/case-600.ini | 2 +-
src/replica/storage/simple_kv/test/case-601.ini | 2 +-
src/replica/storage/simple_kv/test/case-602.ini | 2 +-
src/replica/storage/simple_kv/test/case-603.ini | 2 +-
src/replica/storage/simple_kv/test/case.cpp | 22 +-
src/replica/storage/simple_kv/test/checker.cpp | 16 +-
src/replica/storage/simple_kv/test/client.cpp | 12 +-
src/replica/storage/simple_kv/test/injector.cpp | 2 +-
.../storage/simple_kv/test/simple_kv.main.cpp | 2 +-
.../simple_kv/test/simple_kv.server.impl.cpp | 44 +-
src/replica/test/mock_utils.h | 6 +-
src/reporter/pegasus_counter_reporter.cpp | 32 +-
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 | 48 +-
src/runtime/rpc/dsn_message_parser.cpp | 18 +-
src/runtime/rpc/network.cpp | 84 +-
src/runtime/rpc/network.sim.cpp | 2 +-
src/runtime/rpc/raw_message_parser.cpp | 4 +-
src/runtime/rpc/rpc_engine.cpp | 109 +--
src/runtime/rpc/thrift_message_parser.cpp | 8 +-
src/runtime/security/init.cpp | 8 +-
src/runtime/security/kinit_context.cpp | 2 +-
src/runtime/security/sasl_init.cpp | 6 +-
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 | 8 +-
src/runtime/task/task_spec.cpp | 20 +-
src/runtime/task/task_spec.h | 2 +-
src/runtime/task/task_worker.cpp | 10 +-
src/runtime/test/async_call.cpp | 14 +-
src/runtime/test/config-test-corrupt-message.ini | 2 +-
src/runtime/test/config-test-sim.ini | 2 +-
src/runtime/test/config-test.ini | 2 +-
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 | 167 ++--
src/runtime/zlocks.cpp | 18 +-
src/server/available_detector.cpp | 156 ++--
src/server/compaction_operation.cpp | 4 +-
src/server/hotspot_partition_calculator.cpp | 2 +-
src/server/info_collector.cpp | 32 +-
src/server/main.cpp | 3 +-
src/server/pegasus_mutation_duplicator.cpp | 2 +-
src/server/pegasus_server_impl.cpp | 418 +++++-----
src/server/result_writer.cpp | 36 +-
src/shell/command_helper.h | 38 +-
src/shell/commands/duplication.cpp | 2 +-
src/test/kill_test/data_verifier.cpp | 255 +++---
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 | 42 +-
src/test/pressure_test/main.cpp | 18 +-
src/utils/api_utilities.h | 16 +-
src/utils/command_manager.h | 4 +-
src/utils/fail_point.cpp | 20 +-
src/utils/filesystem.cpp | 39 +-
src/utils/fmt_logging.h | 6 +-
src/utils/logging.cpp | 6 +-
src/utils/rpc_address.cpp | 20 +-
src/utils/shared_io_service.cpp | 7 +-
src/utils/test/logger.cpp | 2 +-
src/utils/test/logging.cpp | 8 +-
src/utils/token_bucket_throttling_controller.cpp | 4 +-
src/utils/utils.cpp | 10 +-
.../distributed_lock_service_zookeeper.cpp | 14 +-
src/zookeeper/lock_struct.cpp | 158 ++--
src/zookeeper/test/config-test.ini | 2 +-
src/zookeeper/test/distributed_lock_zookeeper.cpp | 16 +-
src/zookeeper/zookeeper_session.cpp | 21 +-
201 files changed, 4050 insertions(+), 3961 deletions(-)
diff --git a/src/aio/disk_engine.cpp b/src/aio/disk_engine.cpp
index 48a7d4ca3..9281b7643 100644
--- a/src/aio/disk_engine.cpp
+++ b/src/aio/disk_engine.cpp
@@ -242,10 +242,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) {
- dinfo("disk operation failure with code %s, err = %s, aio_task_id = %016" PRIx64,
- aio->spec().name.c_str(),
- err.to_string(),
- aio->id());
+ LOG_DEBUG("disk operation failure with code %s, err = %s, aio_task_id = %016" PRIx64,
+ aio->spec().name.c_str(),
+ err.to_string(),
+ aio->id());
}
// batching
diff --git a/src/aio/native_linux_aio_provider.cpp b/src/aio/native_linux_aio_provider.cpp
index b51dbef88..8a9d206d4 100644
--- a/src/aio/native_linux_aio_provider.cpp
+++ b/src/aio/native_linux_aio_provider.cpp
@@ -46,7 +46,7 @@ dsn_handle_t native_linux_aio_provider::open(const char *file_name, int flag, in
{
dsn_handle_t fh = (dsn_handle_t)(uintptr_t)::open(file_name, flag, pmode);
if (fh == DSN_INVALID_FILE_HANDLE) {
- derror("create file failed, err = %s", strerror(errno));
+ LOG_ERROR("create file failed, err = %s", strerror(errno));
}
return fh;
}
@@ -56,7 +56,7 @@ error_code native_linux_aio_provider::close(dsn_handle_t fh)
if (fh == DSN_INVALID_FILE_HANDLE || ::close((int)(uintptr_t)(fh)) == 0) {
return ERR_OK;
} else {
- derror("close file failed, err = %s", strerror(errno));
+ LOG_ERROR("close file failed, err = %s", strerror(errno));
return ERR_FILE_OPERATION_FAILED;
}
}
@@ -66,7 +66,7 @@ error_code native_linux_aio_provider::flush(dsn_handle_t fh)
if (fh == DSN_INVALID_FILE_HANDLE || ::fsync((int)(uintptr_t)(fh)) == 0) {
return ERR_OK;
} else {
- derror("flush file failed, err = %s", strerror(errno));
+ LOG_ERROR("flush file failed, err = %s", strerror(errno));
return ERR_FILE_OPERATION_FAILED;
}
}
diff --git a/src/aio/test/aio.cpp b/src/aio/test/aio.cpp
index b57c0a203..bb1bfb777 100644
--- a/src/aio/test/aio.cpp
+++ b/src/aio/test/aio.cpp
@@ -187,7 +187,7 @@ TEST(core, operation_failed)
t = ::dsn::file::read(fp2, buffer, 512, 100, LPC_AIO_TEST, nullptr, io_callback, 0);
t->wait();
- ddebug("error code: %s", err->to_string());
+ LOG_INFO("error code: %s", err->to_string());
file::close(fp);
file::close(fp2);
fail::teardown();
diff --git a/src/block_service/block_service_manager.cpp b/src/block_service/block_service_manager.cpp
index e9165cd40..1e84dd5ce 100644
--- a/src/block_service/block_service_manager.cpp
+++ b/src/block_service/block_service_manager.cpp
@@ -53,7 +53,7 @@ block_service_manager::block_service_manager()
block_service_manager::~block_service_manager()
{
- ddebug("close block service manager.");
+ LOG_INFO("close block service manager.");
zauto_write_lock l(_fs_lock);
_fs_map.clear();
}
diff --git a/src/block_service/fds/fds_service.cpp b/src/block_service/fds/fds_service.cpp
index 25c8a617c..c458b4e31 100644
--- a/src/block_service/fds/fds_service.cpp
+++ b/src/block_service/fds/fds_service.cpp
@@ -160,26 +160,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) \
{ \
- derror("fds %s timeout: parameter(%s), code(%d), msg(%s)", \
- OPERATION, \
- INPUT_PARAMETER, \
- ex.code(), \
- ex.message().c_str()); \
+ LOG_ERROR("fds %s timeout: parameter(%s), code(%d), msg(%s)", \
+ OPERATION, \
+ INPUT_PARAMETER, \
+ ex.code(), \
+ ex.message().c_str()); \
ERR_REFERENCE = ERR_TIMEOUT; \
} \
catch (const Poco::Exception &ex) \
{ \
- derror("fds %s get poco exception: parameter(%s), code(%d), msg(%s), what(%s)", \
- OPERATION, \
- INPUT_PARAMETER, \
- ex.code(), \
- ex.message().c_str(), \
- ex.what()); \
+ LOG_ERROR("fds %s get poco exception: parameter(%s), code(%d), msg(%s), what(%s)", \
+ OPERATION, \
+ INPUT_PARAMETER, \
+ ex.code(), \
+ ex.message().c_str(), \
+ ex.what()); \
ERR_REFERENCE = ERR_FS_INTERNAL; \
} \
catch (...) \
{ \
- derror("fds %s get unknown exception: parameter(%s)", OPERATION, INPUT_PARAMETER); \
+ LOG_ERROR("fds %s get unknown exception: parameter(%s)", OPERATION, INPUT_PARAMETER); \
ERR_REFERENCE = ERR_FS_INTERNAL; \
}
@@ -232,10 +232,10 @@ dsn::task_ptr fds_service::list_dir(const ls_request &req,
}
}
} catch (const galaxy::fds::GalaxyFDSClientException &ex) {
- derror("fds listObjects failed: parameter(%s), code(%d), msg(%s)",
- req.dir_name.c_str(),
- ex.code(),
- ex.what());
+ LOG_ERROR("fds listObjects failed: parameter(%s), code(%d), msg(%s)",
+ req.dir_name.c_str(),
+ ex.code(),
+ ex.what());
resp.err = ERR_FS_INTERNAL;
}
FDS_EXCEPTION_HANDLE(resp.err, "listObject", req.dir_name.c_str())
@@ -244,19 +244,19 @@ 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))) {
- derror("fds list_dir failed: path not dir, parameter(%s)",
- req.dir_name.c_str());
+ LOG_ERROR("fds list_dir failed: path not dir, parameter(%s)",
+ req.dir_name.c_str());
resp.err = ERR_INVALID_PARAMETERS;
} else {
- derror("fds list_dir failed: path not found, parameter(%s)",
- req.dir_name.c_str());
+ LOG_ERROR("fds list_dir failed: path not found, parameter(%s)",
+ req.dir_name.c_str());
resp.err = ERR_OBJECT_NOT_FOUND;
}
} catch (const galaxy::fds::GalaxyFDSClientException &ex) {
- derror("fds doesObjectExist failed: parameter(%s), code(%d), msg(%s)",
- req.dir_name.c_str(),
- ex.code(),
- ex.what());
+ LOG_ERROR("fds doesObjectExist failed: parameter(%s), code(%d), msg(%s)",
+ req.dir_name.c_str(),
+ ex.code(),
+ ex.what());
resp.err = ERR_FS_INTERNAL;
}
FDS_EXCEPTION_HANDLE(resp.err, "doesObjectExist", req.dir_name.c_str())
@@ -332,24 +332,24 @@ dsn::task_ptr fds_service::remove_path(const remove_path_request &req,
if (req.recursive) {
should_remove_path = true;
} else {
- derror("fds remove_path failed: dir not empty, parameter(%s)",
- req.path.c_str());
+ LOG_ERROR("fds remove_path failed: dir not empty, parameter(%s)",
+ req.path.c_str());
resp.err = ERR_DIR_NOT_EMPTY;
}
} else {
if (_client->doesObjectExist(_bucket_name, utils::path_to_fds(req.path, false))) {
should_remove_path = true;
} else {
- derror("fds remove_path failed: path not found, parameter(%s)",
- req.path.c_str());
+ LOG_ERROR("fds remove_path failed: path not found, parameter(%s)",
+ req.path.c_str());
resp.err = ERR_OBJECT_NOT_FOUND;
}
}
} catch (const galaxy::fds::GalaxyFDSClientException &ex) {
- derror("fds remove_path failed: parameter(%s), code(%d), msg(%s)",
- req.path.c_str(),
- ex.code(),
- ex.what());
+ LOG_ERROR("fds remove_path failed: parameter(%s), code(%d), msg(%s)",
+ req.path.c_str(),
+ ex.code(),
+ ex.what());
resp.err = ERR_FS_INTERNAL;
}
FDS_EXCEPTION_HANDLE(resp.err, "remove_path", req.path.c_str());
@@ -361,16 +361,16 @@ dsn::task_ptr fds_service::remove_path(const remove_path_request &req,
if (deleting->countFailedObjects() <= 0) {
resp.err = ERR_OK;
} else {
- derror("fds remove_path failed: countFailedObjects = %d, parameter(%s)",
- deleting->countFailedObjects(),
- req.path.c_str());
+ LOG_ERROR("fds remove_path failed: countFailedObjects = %d, parameter(%s)",
+ deleting->countFailedObjects(),
+ req.path.c_str());
resp.err = ERR_FS_INTERNAL;
}
} catch (const galaxy::fds::GalaxyFDSClientException &ex) {
- derror("fds remove_path failed: parameter(%s), code(%d), msg(%s)",
- req.path.c_str(),
- ex.code(),
- ex.what());
+ LOG_ERROR("fds remove_path failed: parameter(%s), code(%d), msg(%s)",
+ req.path.c_str(),
+ ex.code(),
+ ex.what());
resp.err = ERR_FS_INTERNAL;
}
FDS_EXCEPTION_HANDLE(resp.err, "remove_path", req.path.c_str());
@@ -499,15 +499,15 @@ error_code fds_file_object::get_content(uint64_t pos,
_fds_path,
pos + transfered_bytes,
length - transfered_bytes);
- dinfo("get object from fds succeed, remote_file(%s)", _fds_path.c_str());
+ LOG_DEBUG("get object from fds succeed, remote_file(%s)", _fds_path.c_str());
std::istream &is = obj->objectContent();
transfered_bytes += utils::copy_stream(is, os, PIECE_SIZE);
err = ERR_OK;
} catch (const galaxy::fds::GalaxyFDSClientException &ex) {
- derror("fds getObject error: remote_file(%s), code(%d), msg(%s)",
- file_name().c_str(),
- ex.code(),
- ex.what());
+ LOG_ERROR("fds getObject error: remote_file(%s), code(%d), msg(%s)",
+ file_name().c_str(),
+ ex.code(),
+ ex.what());
if (ex.code() == Poco::Net::HTTPResponse::HTTP_NOT_FOUND) {
_has_meta_synced = true;
_md5sum = "";
@@ -548,10 +548,10 @@ error_code fds_file_object::put_content(/*in-out*/ std::istream &is,
try {
c->putObject(_service->get_bucket_name(), _fds_path, is, galaxy::fds::FDSObjectMetadata());
} catch (const galaxy::fds::GalaxyFDSClientException &ex) {
- derror("fds putObject error: remote_file(%s), code(%d), msg(%s)",
- file_name().c_str(),
- ex.code(),
- ex.what());
+ LOG_ERROR("fds putObject error: remote_file(%s), code(%d), msg(%s)",
+ file_name().c_str(),
+ ex.code(),
+ ex.what());
err = ERR_FS_INTERNAL;
}
FDS_EXCEPTION_HANDLE(err, "putObject", file_name().c_str())
@@ -560,7 +560,7 @@ error_code fds_file_object::put_content(/*in-out*/ std::istream &is,
return err;
}
- ddebug("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;
diff --git a/src/block_service/hdfs/hdfs_service.cpp b/src/block_service/hdfs/hdfs_service.cpp
index 62c9d68cc..6b8dfb2d3 100644
--- a/src/block_service/hdfs/hdfs_service.cpp
+++ b/src/block_service/hdfs/hdfs_service.cpp
@@ -113,7 +113,7 @@ 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.
- ddebug("Try to disconnect hdfs.");
+ LOG_INFO("Try to disconnect hdfs.");
int result = hdfsDisconnect(_fs);
if (result == -1) {
derror_f("Fail to disconnect from the hdfs file system, error: {}.",
@@ -335,7 +335,7 @@ error_code hdfs_file_object::write_data_in_batches(const char *data,
return ERR_FS_INTERNAL;
}
- ddebug("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();
}
diff --git a/src/block_service/local/local_service.cpp b/src/block_service/local/local_service.cpp
index 46dcff9e3..fc4502f02 100644
--- a/src/block_service/local/local_service.cpp
+++ b/src/block_service/local/local_service.cpp
@@ -78,17 +78,18 @@ error_code local_service::initialize(const std::vector<std::string> &args)
_root = args[0];
if (_root.empty()) {
- ddebug("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)) {
- dwarn("old local block service root dir has already exist, path(%s)", _root.c_str());
+ LOG_WARNING("old local block service root dir has already exist, path(%s)",
+ _root.c_str());
} else {
if (!::dsn::utils::filesystem::create_directory(_root)) {
dassert(false, "local block service create directory(%s) fail", _root.c_str());
return ERR_FS_INTERNAL;
}
}
- ddebug("local block service initialize succeed with root(%s)", _root.c_str());
+ LOG_INFO("local block service initialize succeed with root(%s)", _root.c_str());
}
return ERR_OK;
}
@@ -110,14 +111,14 @@ dsn::task_ptr local_service::list_dir(const ls_request &req,
resp.err = ERR_OK;
if (::dsn::utils::filesystem::file_exists(dir_path)) {
- ddebug("list_dir: invalid parameter(%s)", dir_path.c_str());
+ LOG_INFO("list_dir: invalid parameter(%s)", dir_path.c_str());
resp.err = ERR_INVALID_PARAMETERS;
} else if (!::dsn::utils::filesystem::directory_exists(dir_path)) {
- ddebug("directory does not exist, dir = %s", dir_path.c_str());
+ LOG_INFO("directory does not exist, dir = %s", dir_path.c_str());
resp.err = ERR_OBJECT_NOT_FOUND;
} else {
if (!::dsn::utils::filesystem::get_subfiles(dir_path, children, false)) {
- derror("get files under directory: %s fail", dir_path.c_str());
+ LOG_ERROR("get files under directory: %s fail", dir_path.c_str());
resp.err = ERR_FS_INTERNAL;
children.clear();
} else {
@@ -138,7 +139,7 @@ dsn::task_ptr local_service::list_dir(const ls_request &req,
children.clear();
if (!::dsn::utils::filesystem::get_subdirectories(dir_path, children, false)) {
- derror("get subpaths under directory: %s fail", dir_path.c_str());
+ LOG_ERROR("get subpaths under directory: %s fail", dir_path.c_str());
resp.err = ERR_FS_INTERNAL;
children.clear();
} else {
@@ -186,7 +187,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)) {
- dinfo("file(%s) already exist", file_path.c_str());
+ LOG_DEBUG("file(%s) already exist", file_path.c_str());
resp.err = f->load_metadata();
}
@@ -265,7 +266,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()) {
- dwarn("load meta data from %s failed, err = %s", utils::safe_strerror(errno).c_str());
+ LOG_WARNING("load meta data from %s failed, err = %s", utils::safe_strerror(errno).c_str());
return ERR_FS_INTERNAL;
}
auto cleanup = dsn::defer([&is]() { is.close(); });
@@ -290,9 +291,9 @@ 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()) {
- dwarn("store to metadata file %s failed, err=%s",
- metadata_path.c_str(),
- utils::safe_strerror(errno).c_str());
+ LOG_WARNING("store to metadata file %s failed, err=%s",
+ metadata_path.c_str(),
+ utils::safe_strerror(errno).c_str());
return ERR_FS_INTERNAL;
}
auto cleanup = dsn::defer([&os]() { os.close(); });
@@ -332,7 +333,7 @@ dsn::task_ptr local_file_object::write(const write_request &req,
}
if (resp.err == ERR_OK) {
- dinfo("start write file, file = %s", file_name().c_str());
+ LOG_DEBUG("start write file, file = %s", file_name().c_str());
std::ofstream fout(file_name(), std::ifstream::out | std::ifstream::trunc);
if (!fout.is_open()) {
@@ -376,7 +377,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) {
- dwarn("load meta data of %s failed", file_name().c_str());
+ LOG_WARNING("load meta data of %s failed", file_name().c_str());
} else {
int64_t file_sz = _size;
int64_t total_sz = 0;
@@ -386,7 +387,7 @@ dsn::task_ptr local_file_object::read(const read_request &req,
total_sz = req.remote_length;
}
- dinfo("read file(%s), size = %ld", file_name().c_str(), total_sz);
+ LOG_DEBUG("read file(%s), size = %ld", file_name().c_str(), total_sz);
std::string buf;
buf.resize(total_sz + 1);
std::ifstream fin(file_name(), std::ifstream::in);
@@ -423,25 +424,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()) {
- dwarn("open source file %s for read failed, err(%s)",
- req.input_local_name.c_str(),
- utils::safe_strerror(errno).c_str());
+ LOG_WARNING("open source file %s for read failed, err(%s)",
+ req.input_local_name.c_str(),
+ utils::safe_strerror(errno).c_str());
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()) {
- dwarn("open target file %s for write failed, err(%s)",
- file_name().c_str(),
- utils::safe_strerror(errno).c_str());
+ LOG_WARNING("open target file %s for write failed, err(%s)",
+ file_name().c_str(),
+ utils::safe_strerror(errno).c_str());
resp.err = ERR_FS_INTERNAL;
}
if (resp.err == ERR_OK) {
- dinfo("start to transfer from src_file(%s) to des_file(%s)",
- req.input_local_name.c_str(),
- file_name().c_str());
+ LOG_DEBUG("start to transfer from src_file(%s) to des_file(%s)",
+ req.input_local_name.c_str(),
+ file_name().c_str());
int64_t total_sz = 0;
char buf[max_length] = {'\0'};
while (!fin.eof()) {
@@ -449,7 +450,8 @@ dsn::task_ptr local_file_object::upload(const upload_request &req,
total_sz += fin.gcount();
fout.write(buf, fin.gcount());
}
- dinfo("finish upload file, file = %s, total_size = %d", file_name().c_str(), total_sz);
+ LOG_DEBUG(
+ "finish upload file, file = %s, total_size = %d", file_name().c_str(), total_sz);
fout.close();
fin.close();
@@ -493,9 +495,9 @@ 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()) {
- derror("download %s failed, because target name(%s) is invalid",
- file_name().c_str(),
- target_file.c_str());
+ LOG_ERROR("download %s failed, because target name(%s) is invalid",
+ file_name().c_str(),
+ target_file.c_str());
resp.err = ERR_INVALID_PARAMETERS;
}
@@ -509,9 +511,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()) {
- derror("open block file(%s) failed, err(%s)",
- file_name().c_str(),
- utils::safe_strerror(errno).c_str());
+ LOG_ERROR("open block file(%s) failed, err(%s)",
+ file_name().c_str(),
+ utils::safe_strerror(errno).c_str());
resp.err = ERR_FS_INTERNAL;
}
@@ -519,16 +521,16 @@ dsn::task_ptr local_file_object::download(const download_request &req,
if (!fout.is_open()) {
if (fin.is_open())
fin.close();
- derror("open target file(%s) failed, err(%s)",
- target_file.c_str(),
- utils::safe_strerror(errno).c_str());
+ LOG_ERROR("open target file(%s) failed, err(%s)",
+ target_file.c_str(),
+ utils::safe_strerror(errno).c_str());
resp.err = ERR_FILE_OPERATION_FAILED;
}
if (resp.err == ERR_OK) {
- dinfo("start to transfer, src_file(%s), des_file(%s)",
- file_name().c_str(),
- target_file.c_str());
+ LOG_DEBUG("start to transfer, src_file(%s), des_file(%s)",
+ file_name().c_str(),
+ target_file.c_str());
int64_t total_sz = 0;
char buf[max_length] = {'\0'};
while (!fin.eof()) {
@@ -536,16 +538,17 @@ dsn::task_ptr local_file_object::download(const download_request &req,
total_sz += fin.gcount();
fout.write(buf, fin.gcount());
}
- dinfo("finish download file(%s), total_size = %d", target_file.c_str(), total_sz);
+ LOG_DEBUG(
+ "finish download file(%s), total_size = %d", target_file.c_str(), 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) {
- dwarn("download %s failed when calculate the md5sum of %s",
- file_name().c_str(),
- target_file.c_str());
+ LOG_WARNING("download %s failed when calculate the md5sum of %s",
+ file_name().c_str(),
+ target_file.c_str());
} 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 26b725ec2..236dc9b81 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 {
- derror("service access failed (%s), no more time for further "
- "tries, set error = ERR_TIMEOUT, trace_id = %016" PRIx64,
- err.to_string(),
- req->header->trace_id);
+ LOG_ERROR("service access failed (%s), no more time for further "
+ "tries, set error = ERR_TIMEOUT, trace_id = %016" PRIx64,
+ err.to_string(),
+ req->header->trace_id);
err = ERR_TIMEOUT;
}
}
diff --git a/src/client/partition_resolver_manager.cpp b/src/client/partition_resolver_manager.cpp
index 3f27a6916..c01cbd8e5 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)) {
- derror("meta list not match for cluster(%s)", cluster_name);
+ LOG_ERROR("meta list not match for cluster(%s)", cluster_name);
return nullptr;
}
return ptr;
diff --git a/src/client/partition_resolver_simple.cpp b/src/client/partition_resolver_simple.cpp
index 8d6a5460c..fd428eef6 100644
--- a/src/client/partition_resolver_simple.cpp
+++ b/src/client/partition_resolver_simple.cpp
@@ -105,7 +105,7 @@ partition_resolver_simple::~partition_resolver_simple()
void partition_resolver_simple::clear_all_pending_requests()
{
- dinfo("%s.client: clear all pending tasks", _app_name.c_str());
+ LOG_DEBUG("%s.client: clear all pending tasks", _app_name.c_str());
zauto_lock l(_requests_lock);
// clear _pending_requests
for (auto &pc : _pending_requests) {
@@ -230,11 +230,11 @@ DEFINE_TASK_CODE_RPC(RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX,
task_ptr partition_resolver_simple::query_config(int partition_index, int timeout_ms)
{
- dinfo("%s.client: start query config, gpid = %d.%d, timeout_ms = %d",
- _app_name.c_str(),
- _app_id,
- partition_index,
- timeout_ms);
+ LOG_DEBUG("%s.client: start query config, gpid = %d.%d, timeout_ms = %d",
+ _app_name.c_str(),
+ _app_id,
+ partition_index,
+ timeout_ms);
task_spec *sp = task_spec::get(RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX);
if (timeout_ms >= sp->rpc_timeout_milliseconds)
timeout_ms = 0;
@@ -290,13 +290,13 @@ void partition_resolver_simple::query_config_reply(error_code err,
for (auto it = resp.partitions.begin(); it != resp.partitions.end(); ++it) {
auto &new_config = *it;
- dinfo("%s.client: query config reply, gpid = %d.%d, ballot = %" PRId64
- ", primary = %s",
- _app_name.c_str(),
- new_config.pid.get_app_id(),
- new_config.pid.get_partition_index(),
- new_config.ballot,
- new_config.primary.to_string());
+ LOG_DEBUG("%s.client: query config reply, gpid = %d.%d, ballot = %" PRId64
+ ", primary = %s",
+ _app_name.c_str(),
+ new_config.pid.get_app_id(),
+ new_config.pid.get_partition_index(),
+ new_config.ballot,
+ new_config.primary.to_string());
auto it2 = _config_cache.find(new_config.pid.get_partition_index());
if (it2 == _config_cache.end()) {
@@ -315,28 +315,28 @@ void partition_resolver_simple::query_config_reply(error_code err,
}
}
} else if (resp.err == ERR_OBJECT_NOT_FOUND) {
- derror("%s.client: query config reply, gpid = %d.%d, err = %s",
- _app_name.c_str(),
- _app_id,
- partition_index,
- resp.err.to_string());
+ LOG_ERROR("%s.client: query config reply, gpid = %d.%d, err = %s",
+ _app_name.c_str(),
+ _app_id,
+ partition_index,
+ resp.err.to_string());
client_err = ERR_APP_NOT_EXIST;
} else {
- derror("%s.client: query config reply, gpid = %d.%d, err = %s",
- _app_name.c_str(),
- _app_id,
- partition_index,
- resp.err.to_string());
+ LOG_ERROR("%s.client: query config reply, gpid = %d.%d, err = %s",
+ _app_name.c_str(),
+ _app_id,
+ partition_index,
+ resp.err.to_string());
client_err = resp.err;
}
} else {
- derror("%s.client: query config reply, gpid = %d.%d, err = %s",
- _app_name.c_str(),
- _app_id,
- partition_index,
- err.to_string());
+ LOG_ERROR("%s.client: query config reply, gpid = %d.%d, err = %s",
+ _app_name.c_str(),
+ _app_id,
+ partition_index,
+ err.to_string());
}
// get specific or all partition update
diff --git a/src/client/replication_ddl_client.cpp b/src/client/replication_ddl_client.cpp
index c94fd00cf..05c404460 100644
--- a/src/client/replication_ddl_client.cpp
+++ b/src/client/replication_ddl_client.cpp
@@ -382,7 +382,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) {
- derror("list app(%s) failed, err = %s", info.app_name.c_str(), r.to_string());
+ LOG_ERROR("list app(%s) failed, err = %s", info.app_name.c_str(), r.to_string());
return r;
}
dcheck_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 7629aff1a..2cbac1e79 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)
dassert(is_initialized, "rdsn engine not started, please specify a valid config file");
} else {
if (is_initialized) {
- dwarn("rdsn engine already started, ignore the config file '%s'", config_file);
+ LOG_WARNING("rdsn engine already started, ignore the config file '%s'", 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') {
- derror("invalid parameter 'cluster_name'");
+ LOG_ERROR("invalid parameter 'cluster_name'");
return nullptr;
}
if (app_name == nullptr || app_name[0] == '\0') {
- derror("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 3a4881ad6..19e92d642 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) {
- derror("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
- (int)hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
+ (int)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) {
- derror("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) {
- derror("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
- (int)hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
+ (int)hash_key.size());
if (callback != nullptr)
callback(PERR_INVALID_HASH_KEY, internal_info());
return;
}
if (kvs.empty()) {
- derror("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) {
- derror("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
- (int)hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
+ (int)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) {
- derror("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) {
- derror("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
- (int)hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
+ (int)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) {
- derror("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) {
- derror("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
- (int)hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
+ (int)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) {
- derror("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) {
- derror("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
- (int)hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
+ (int)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) {
- derror("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) {
- derror("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
- (int)hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
+ (int)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) {
- derror("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
- (int)hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
+ (int)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) {
- derror("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) {
- derror("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
- (int)hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
+ (int)hash_key.size());
if (callback != nullptr)
callback(PERR_INVALID_HASH_KEY, 0, internal_info());
return;
}
if (sort_keys.empty()) {
- derror("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) {
- derror("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
- (int)hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
+ (int)hash_key.size());
if (callback != nullptr)
callback(PERR_INVALID_HASH_KEY, 0, internal_info());
return;
}
if (ttl_seconds < -1) {
- derror("invalid ttl seconds: should be no less than -1, but %d", ttl_seconds);
+ LOG_ERROR("invalid ttl seconds: should be no less than -1, but %d", 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) {
- derror("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
- (int)hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
+ (int)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()) {
- derror("invalid check type: %d", (int)check_type);
+ LOG_ERROR("invalid check type: %d", (int)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) {
- derror("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
- (int)hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
+ (int)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()) {
- derror("invalid check type: %d", (int)check_type);
+ LOG_ERROR("invalid check type: %d", (int)check_type);
if (callback != nullptr)
callback(PERR_INVALID_ARGUMENT, check_and_mutate_results(), internal_info());
return;
}
if (mutations.is_empty()) {
- derror("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) {
- derror("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
- (int)hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
+ (int)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) {
- derror("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
- (int)hash_key.size());
+ LOG_ERROR("invalid hash key: hash key length should be less than UINT16_MAX, but %d",
+ (int)hash_key.size());
return PERR_INVALID_HASH_KEY;
}
if (hash_key.empty()) {
- derror("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,7 +1201,8 @@ void pegasus_client_impl::async_get_unordered_scanners(
// check params
if (max_split_count <= 0) {
- derror("invalid max_split_count: which should be greater than 0, but %d", max_split_count);
+ LOG_ERROR("invalid max_split_count: which should be greater than 0, but %d",
+ max_split_count);
callback(PERR_INVALID_SPLIT_COUNT, std::vector<pegasus_scanner *>());
return;
}
@@ -1313,9 +1314,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;
- derror("can't find corresponding client error definition, server error:[%d:%s]",
- server_error,
- ::dsn::error_code(server_error).to_string());
+ LOG_ERROR("can't find corresponding client error definition, server error:[%d:%s]",
+ server_error,
+ ::dsn::error_code(server_error).to_string());
return PERR_UNKNOWN;
}
diff --git a/src/common/fs_manager.cpp b/src/common/fs_manager.cpp
index 7609e9756..9c13de2b6 100644
--- a/src/common/fs_manager.cpp
+++ b/src/common/fs_manager.cpp
@@ -177,10 +177,10 @@ 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);
- ddebug("%s: mark data dir(%s) as tag(%s)",
- dsn_primary_address().to_string(),
- norm_path.c_str(),
- tags[i].c_str());
+ LOG_INFO("%s: mark data dir(%s) as tag(%s)",
+ dsn_primary_address().to_string(),
+ norm_path.c_str(),
+ tags[i].c_str());
}
_available_data_dirs = data_dirs;
@@ -205,27 +205,27 @@ void fs_manager::add_replica(const gpid &pid, const std::string &pid_dir)
{
dir_node *n = get_dir_node(pid_dir);
if (nullptr == n) {
- derror("%s: dir(%s) of gpid(%d.%d) haven't registered",
- dsn_primary_address().to_string(),
- pid_dir.c_str(),
- pid.get_app_id(),
- pid.get_partition_index());
+ LOG_ERROR("%s: dir(%s) of gpid(%d.%d) haven't registered",
+ dsn_primary_address().to_string(),
+ pid_dir.c_str(),
+ pid.get_app_id(),
+ pid.get_partition_index());
} 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) {
- dwarn("%s: gpid(%d.%d) already in the dir_node(%s)",
- dsn_primary_address().to_string(),
- pid.get_app_id(),
- pid.get_partition_index(),
- n->tag.c_str());
+ LOG_WARNING("%s: gpid(%d.%d) already in the dir_node(%s)",
+ dsn_primary_address().to_string(),
+ pid.get_app_id(),
+ pid.get_partition_index(),
+ n->tag.c_str());
} else {
- ddebug("%s: add gpid(%d.%d) to dir_node(%s)",
- dsn_primary_address().to_string(),
- pid.get_app_id(),
- pid.get_partition_index(),
- n->tag.c_str());
+ LOG_INFO("%s: add gpid(%d.%d) to dir_node(%s)",
+ dsn_primary_address().to_string(),
+ pid.get_app_id(),
+ pid.get_partition_index(),
+ n->tag.c_str());
}
}
}
@@ -262,7 +262,7 @@ void fs_manager::allocate_dir(const gpid &pid, const std::string &type, /*out*/
}
}
- ddebug(
+ LOG_INFO(
"%s: put pid(%d.%d) to dir(%s), which has %u replicas of current app, %u replicas totally",
dsn_primary_address().to_string(),
pid.get_app_id(),
@@ -287,11 +287,11 @@ void fs_manager::remove_replica(const gpid &pid)
pid.get_partition_index(),
n->tag.c_str());
if (r != 0) {
- ddebug("%s: remove gpid(%d.%d) from dir(%s)",
- dsn_primary_address().to_string(),
- pid.get_app_id(),
- pid.get_partition_index(),
- n->tag.c_str());
+ LOG_INFO("%s: remove gpid(%d.%d) from dir(%s)",
+ dsn_primary_address().to_string(),
+ pid.get_app_id(),
+ pid.get_partition_index(),
+ n->tag.c_str());
}
remove_count += r;
}
diff --git a/src/common/storage_serverlet.h b/src/common/storage_serverlet.h
index 4c73d6aab..e1d43a62b 100644
--- a/src/common/storage_serverlet.h
+++ b/src/common/storage_serverlet.h
@@ -130,10 +130,10 @@ protected:
if (ptr != nullptr) {
(*ptr)(static_cast<T *>(this), request);
} else {
- dwarn("recv message with unhandled rpc name %s from %s, trace_id = %016" PRIx64,
- t.to_string(),
- request->header->from_address.to_string(),
- request->header->trace_id);
+ LOG_WARNING("recv message with unhandled rpc name %s from %s, trace_id = %016" PRIx64,
+ t.to_string(),
+ request->header->from_address.to_string(),
+ 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 66e027af3..e03db236d 100644
--- a/src/failure_detector/failure_detector.cpp
+++ b/src/failure_detector/failure_detector.cpp
@@ -129,7 +129,7 @@ void failure_detector::register_master(::dsn::rpc_address target)
auto ret = _masters.insert(std::make_pair(target, record));
if (ret.second) {
- dinfo("register master[%s] successfully", target.to_string());
+ LOG_DEBUG("register master[%s] successfully", target.to_string());
setup_timer = true;
} else {
// active the beacon again in case previously local node is not in target's allow list
@@ -137,7 +137,7 @@ void failure_detector::register_master(::dsn::rpc_address target)
ret.first->second.rejected = false;
setup_timer = true;
}
- dinfo("master[%s] already registered", target.to_string());
+ LOG_DEBUG("master[%s] already registered", target.to_string());
}
if (setup_timer) {
@@ -162,9 +162,9 @@ bool failure_detector::switch_master(::dsn::rpc_address from,
auto it2 = _masters.find(to);
if (it != _masters.end()) {
if (it2 != _masters.end()) {
- dwarn("switch master failed as both are already registered, from[%s], to[%s]",
- from.to_string(),
- to.to_string());
+ LOG_WARNING("switch master failed as both are already registered, from[%s], to[%s]",
+ from.to_string(),
+ to.to_string());
return false;
}
@@ -182,11 +182,11 @@ bool failure_detector::switch_master(::dsn::rpc_address from,
_masters.insert(std::make_pair(to, it->second));
_masters.erase(from);
- ddebug("switch master successfully, from[%s], to[%s]", from.to_string(), to.to_string());
+ LOG_INFO("switch master successfully, from[%s], to[%s]", from.to_string(), to.to_string());
} else {
- dwarn("switch master failed as from node is not registered yet, from[%s], to[%s]",
- from.to_string(),
- to.to_string());
+ LOG_WARNING("switch master failed as from node is not registered yet, from[%s], to[%s]",
+ from.to_string(),
+ to.to_string());
return false;
}
return true;
@@ -196,10 +196,10 @@ 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)
{
- ddebug("%s %sconnected: %s",
- is_master ? "master" : "worker",
- is_connected ? "" : "dis",
- node.to_string());
+ LOG_INFO("%s %sconnected: %s",
+ is_master ? "master" : "worker",
+ is_connected ? "" : "dis",
+ node.to_string());
}
/*
@@ -241,13 +241,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) {
- derror("master %s disconnected, now=%" PRId64 ", last_send_time=%" PRId64
- ", now+check_interval-last_send_time=%" PRId64,
- record.node.to_string(),
- now,
- record.last_send_time_for_beacon_with_ack,
- now + _check_interval_milliseconds -
- record.last_send_time_for_beacon_with_ack);
+ LOG_ERROR("master %s disconnected, now=%" PRId64 ", last_send_time=%" PRId64
+ ", now+check_interval-last_send_time=%" PRId64,
+ record.node.to_string(),
+ 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;
@@ -284,12 +284,12 @@ 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) {
- derror("worker %s disconnected, now=%" PRId64 ", last_beacon_recv_time=%" PRId64
- ", now-last_recv=%" PRId64,
- record.node.to_string(),
- now,
- record.last_beacon_recv_time,
- now - record.last_beacon_recv_time);
+ LOG_ERROR("worker %s disconnected, now=%" PRId64 ", last_beacon_recv_time=%" PRId64
+ ", now-last_recv=%" PRId64,
+ record.node.to_string(),
+ now,
+ record.last_beacon_recv_time,
+ now - record.last_beacon_recv_time);
expire.push_back(record.node);
record.is_alive = false;
@@ -326,8 +326,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())) {
- dwarn("replica_white_list has invalid ip %s, the allow list won't be modified",
- addr.c_str());
+ LOG_WARNING("replica_white_list has invalid ip %s, the allow list won't be modified",
+ addr.c_str());
return;
}
nodes.push_back(node);
@@ -370,7 +370,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()) {
- dwarn("new worker[%s] is rejected", node.to_string());
+ LOG_WARNING("new worker[%s] is rejected", node.to_string());
ack.allowed = false;
return;
}
@@ -386,9 +386,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;
- ddebug("master %s update last_beacon_recv_time=%" PRId64,
- itr->second.node.to_string(),
- itr->second.last_beacon_recv_time);
+ LOG_INFO("master %s update last_beacon_recv_time=%" PRId64,
+ itr->second.node.to_string(),
+ itr->second.last_beacon_recv_time);
if (itr->second.is_alive == false) {
itr->second.is_alive = true;
@@ -397,9 +397,9 @@ void failure_detector::on_ping_internal(const beacon_msg &beacon, /*out*/ beacon
on_worker_connected(node);
}
} else {
- ddebug("now[%" PRId64 "] <= last_recv_time[%" PRId64 "]",
- now,
- itr->second.last_beacon_recv_time);
+ LOG_INFO("now[%" PRId64 "] <= last_recv_time[%" PRId64 "]",
+ now,
+ itr->second.last_beacon_recv_time);
}
}
@@ -424,29 +424,29 @@ bool failure_detector::end_ping_internal(::dsn::error_code err, const beacon_ack
auto node = ack.this_node;
if (err != ERR_OK) {
- dwarn("ping master(%s) failed, timeout_ms = %u, err = %s",
- node.to_string(),
- _beacon_timeout_milliseconds,
- err.to_string());
+ LOG_WARNING("ping master(%s) failed, timeout_ms = %u, err = %s",
+ node.to_string(),
+ _beacon_timeout_milliseconds,
+ err.to_string());
_recent_beacon_fail_count->increment();
}
master_map::iterator itr = _masters.find(node);
if (itr == _masters.end()) {
- dwarn("received beacon ack without corresponding master, ignore it, "
- "remote_master[%s], local_worker[%s]",
- node.to_string(),
- dsn_primary_address().to_string());
+ LOG_WARNING("received beacon ack without corresponding master, ignore it, "
+ "remote_master[%s], local_worker[%s]",
+ node.to_string(),
+ dsn_primary_address().to_string());
return false;
}
master_record &record = itr->second;
if (!ack.allowed) {
- dwarn("worker rejected, stop sending beacon message, "
- "remote_master[%s], local_worker[%s]",
- node.to_string(),
- dsn_primary_address().to_string());
+ LOG_WARNING("worker rejected, stop sending beacon message, "
+ "remote_master[%s], local_worker[%s]",
+ node.to_string(),
+ dsn_primary_address().to_string());
record.rejected = true;
record.send_beacon_timer->cancel(true);
return false;
@@ -454,9 +454,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
- ddebug("ignore out dated beacon acks, send_time(%lld), last_beacon(%lld)",
- beacon_send_time,
- record.last_send_time_for_beacon_with_ack);
+ LOG_INFO("ignore out dated beacon acks, send_time(%lld), last_beacon(%lld)",
+ beacon_send_time,
+ record.last_send_time_for_beacon_with_ack);
return false;
}
@@ -467,9 +467,9 @@ 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) {
- dwarn("node[%s] is not master, ack.primary_node[%s] is real master",
- node.to_string(),
- ack.primary_node.to_string());
+ LOG_WARNING("node[%s] is not master, ack.primary_node[%s] is real master",
+ node.to_string(),
+ ack.primary_node.to_string());
return true;
}
@@ -477,9 +477,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;
- ddebug("worker %s send beacon succeed, update last_send_time=%" PRId64,
- record.node.to_string(),
- record.last_send_time_for_beacon_with_ack);
+ LOG_INFO("worker %s send beacon succeed, update last_send_time=%" PRId64,
+ record.node.to_string(),
+ 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
@@ -502,10 +502,10 @@ bool failure_detector::unregister_master(::dsn::rpc_address node)
if (it != _masters.end()) {
it->second.send_beacon_timer->cancel(true);
_masters.erase(it);
- ddebug("unregister master[%s] successfully", node.to_string());
+ LOG_INFO("unregister master[%s] successfully", node.to_string());
return true;
} else {
- ddebug("unregister master[%s] failed, cannot find it in FD", node.to_string());
+ LOG_INFO("unregister master[%s] failed, cannot find it in FD", node.to_string());
return false;
}
}
@@ -530,9 +530,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) {
- dinfo("register worker[%s] successfully", target.to_string());
+ LOG_DEBUG("register worker[%s] successfully", target.to_string());
} else {
- dinfo("worker[%s] already registered", target.to_string());
+ LOG_DEBUG("worker[%s] already registered", target.to_string());
}
}
@@ -551,9 +551,9 @@ bool failure_detector::unregister_worker(::dsn::rpc_address node)
ret = true;
}
- dinfo("unregister worker[%s] successfully, removed entry count is %u",
- node.to_string(),
- (uint32_t)count);
+ LOG_DEBUG("unregister worker[%s] successfully, removed entry count is %u",
+ node.to_string(),
+ (uint32_t)count);
return ret;
}
@@ -582,10 +582,10 @@ 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()));
- ddebug("send ping message, from[%s], to[%s], time[%" PRId64 "]",
- beacon.from_addr.to_string(),
- beacon.to_addr.to_string(),
- time);
+ LOG_INFO("send ping message, from[%s], to[%s], time[%" PRId64 "]",
+ beacon.from_addr.to_string(),
+ beacon.to_addr.to_string(),
+ time);
::dsn::rpc::call(target,
RPC_FD_FAILURE_DETECTOR_PING,
diff --git a/src/failure_detector/failure_detector_multimaster.cpp b/src/failure_detector/failure_detector_multimaster.cpp
index b834fa064..28fbeb4ec 100644
--- a/src/failure_detector/failure_detector_multimaster.cpp
+++ b/src/failure_detector/failure_detector_multimaster.cpp
@@ -72,14 +72,14 @@ void slave_failure_detector_with_multimaster::end_ping(::dsn::error_code err,
const fd::beacon_ack &ack,
void *)
{
- ddebug("end ping result, error[%s], time[%" PRId64
- "], ack.this_node[%s], ack.primary_node[%s], ack.is_master[%s], ack.allowed[%s]",
- err.to_string(),
- ack.time,
- ack.this_node.to_string(),
- ack.primary_node.to_string(),
- ack.is_master ? "true" : "false",
- ack.allowed ? "true" : "false");
+ LOG_INFO("end ping result, error[%s], time[%" PRId64
+ "], ack.this_node[%s], ack.primary_node[%s], ack.is_master[%s], ack.allowed[%s]",
+ err.to_string(),
+ ack.time,
+ ack.this_node.to_string(),
+ ack.primary_node.to_string(),
+ 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/config-test.ini b/src/failure_detector/test/config-test.ini
index 9f03be49d..b1b830807 100644
--- a/src/failure_detector/test/config-test.ini
+++ b/src/failure_detector/test/config-test.ini
@@ -70,7 +70,7 @@ tool = nativerun
;fault_injector
pause_on_start = false
-logging_start_level = LOG_LEVEL_INFORMATION
+logging_start_level = LOG_LEVEL_DEBUG
logging_factory_name = dsn::tools::simple_logger
diff --git a/src/failure_detector/test/config-whitelist-test-failed.ini b/src/failure_detector/test/config-whitelist-test-failed.ini
index 0bf9f4621..0399e9d19 100644
--- a/src/failure_detector/test/config-whitelist-test-failed.ini
+++ b/src/failure_detector/test/config-whitelist-test-failed.ini
@@ -71,7 +71,7 @@ tool = nativerun
;fault_injector
pause_on_start = false
-logging_start_level = LOG_LEVEL_INFORMATION
+logging_start_level = LOG_LEVEL_DEBUG
logging_factory_name = dsn::tools::simple_logger
diff --git a/src/failure_detector/test/config-whitelist-test.ini b/src/failure_detector/test/config-whitelist-test.ini
index 4d977761e..c5b595dca 100644
--- a/src/failure_detector/test/config-whitelist-test.ini
+++ b/src/failure_detector/test/config-whitelist-test.ini
@@ -71,7 +71,7 @@ tool = nativerun
;fault_injector
pause_on_start = false
-logging_start_level = LOG_LEVEL_INFORMATION
+logging_start_level = LOG_LEVEL_DEBUG
logging_factory_name = dsn::tools::simple_logger
diff --git a/src/failure_detector/test/failure_detector.cpp b/src/failure_detector/test/failure_detector.cpp
index f111d304c..42a7011b8 100644
--- a/src/failure_detector/test/failure_detector.cpp
+++ b/src/failure_detector/test/failure_detector.cpp
@@ -69,7 +69,7 @@ protected:
if (_send_ping_switch)
failure_detector::send_beacon(node, time);
else {
- dinfo("ignore send beacon, to node[%s], time[%" PRId64 "]", node.to_string(), time);
+ LOG_DEBUG("ignore send beacon, to node[%s], time[%" PRId64 "]", node.to_string(), time);
}
}
@@ -119,10 +119,10 @@ public:
if (_response_ping_switch)
meta_server_failure_detector::on_ping(beacon, reply);
else {
- dinfo("ignore on ping, beacon msg, time[%" PRId64 "], from[%s], to[%s]",
- beacon.time,
- beacon.from_addr.to_string(),
- beacon.to_addr.to_string());
+ LOG_DEBUG("ignore on ping, beacon msg, time[%" PRId64 "], from[%s], to[%s]",
+ beacon.time,
+ beacon.from_addr.to_string(),
+ beacon.to_addr.to_string());
}
}
@@ -181,9 +181,9 @@ public:
void on_master_config(const config_master_message &request, bool &response)
{
- dinfo("master config: request:%s, type:%s",
- request.master.to_string(),
- request.is_register ? "reg" : "unreg");
+ LOG_DEBUG("master config: request:%s, type:%s",
+ request.master.to_string(),
+ request.is_register ? "reg" : "unreg");
if (request.is_register)
_worker_fd->register_master(request.master);
else
@@ -221,7 +221,7 @@ public:
}
_master_fd->start(1, 1, 9, 10, use_allow_list);
- dinfo("%s", _master_fd->get_allow_list(std::vector<std::string>{}).c_str());
+ LOG_DEBUG("%s", _master_fd->get_allow_list(std::vector<std::string>{}).c_str());
++started_apps;
return ERR_OK;
@@ -329,7 +329,7 @@ void clear(test_worker *worker, std::vector<test_master *> masters)
void finish(test_worker *worker, test_master *master, int master_index)
{
- dwarn("start to finish");
+ LOG_WARNING("start to finish");
std::atomic_int wait_count;
wait_count.store(2);
worker->fd()->when_disconnected(
@@ -508,7 +508,7 @@ TEST(fd, old_master_died)
worker->fd()->when_disconnected([](const std::vector<rpc_address> &masters_list) {
ASSERT_EQ(masters_list.size(), 1);
- dinfo("disconnect from master: %s", masters_list[0].to_string());
+ LOG_DEBUG("disconnect from master: %s", masters_list[0].to_string());
});
/*first let's stop the old master*/
diff --git a/src/http/http_message_parser.cpp b/src/http/http_message_parser.cpp
index 6c4871ad9..5b1f508ff 100644
--- a/src/http/http_message_parser.cpp
+++ b/src/http/http_message_parser.cpp
@@ -134,7 +134,7 @@ http_message_parser::http_message_parser()
header->hdr_type = http_method::HTTP_METHOD_POST;
header->context.u.is_request = 1;
} else {
- derror("invalid http type %d and method %d", parser->type, parser->method);
+ LOG_ERROR("invalid http type %d and method %d", parser->type, parser->method);
return 1;
}
return 0;
@@ -177,9 +177,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);
- derror("failed on stage %s [%s]",
- http_parser_stage_to_string(_stage),
- http_errno_description(err));
+ LOG_ERROR("failed on stage %s [%s]",
+ 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 9619bd1bc..fcc6d68d4 100644
--- a/src/http/http_server.cpp
+++ b/src/http/http_server.cpp
@@ -46,7 +46,7 @@ DSN_DEFINE_bool("http", enable_http_server, true, "whether to enable the embedde
case http_status_code::internal_server_error:
return "500 Internal Server Error";
default:
- dfatal("invalid code: %d", code);
+ LOG_FATAL("invalid code: %d", code);
__builtin_unreachable();
}
}
diff --git a/src/http/pprof_http_service.cpp b/src/http/pprof_http_service.cpp
index d5ab2ddc1..8e6758fd0 100644
--- a/src/http/pprof_http_service.cpp
+++ b/src/http/pprof_http_service.cpp
@@ -72,10 +72,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;
- ddebug("executing `%s`", cmd.c_str());
+ LOG_INFO("executing `%s`", cmd.c_str());
const int rc = utils::pipe_execute(cmd.c_str(), ss);
if (rc < 0) {
- derror("fail to popen `%s`", cmd.c_str());
+ LOG_ERROR("fail to popen `%s`", cmd.c_str());
return -1;
}
std::string line;
@@ -161,7 +161,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();
- ddebug("Loaded %s in %zdms", lib_info.path.c_str(), tm.m_elapsed());
+ LOG_INFO("Loaded %s in %zdms", lib_info.path.c_str(), tm.m_elapsed());
return 0;
}
@@ -258,11 +258,11 @@ static void load_symbols()
}
tm2.stop();
if (num_removed) {
- ddebug("Removed %zd entries in %zdms", num_removed, tm2.m_elapsed());
+ LOG_INFO("Removed %zd entries in %zdms", num_removed, tm2.m_elapsed());
}
tm.stop();
- ddebug("Loaded all symbols in %zdms", tm.m_elapsed());
+ LOG_INFO("Loaded all symbols in %zdms", tm.m_elapsed());
}
static void find_symbols(std::string *out, std::vector<uintptr_t> &addr_list)
@@ -371,19 +371,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) {
- derror("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) {
- derror("Fail to read /proc/self/cmdline");
+ LOG_ERROR("Fail to read /proc/self/cmdline");
return -1;
}
if (with_args) {
if ((size_t)nr == len) {
- derror("buf is not big enough");
+ LOG_ERROR("buf is not big enough");
return -1;
}
for (ssize_t i = 0; i < nr; ++i) {
@@ -400,7 +400,7 @@ ssize_t read_command_line(char *buf, size_t len, bool with_args)
}
}
if ((size_t)nr == len) {
- ddebug("buf is not big enough");
+ LOG_INFO("buf is not big enough");
return -1;
}
return nr;
@@ -431,7 +431,7 @@ void pprof_http_service::growth_handler(const http_request &req, http_response &
}
MallocExtension *malloc_ext = MallocExtension::instance();
- ddebug("received requests for growth profile");
+ LOG_INFO("received requests for growth profile");
malloc_ext->GetHeapGrowthStacks(&resp.body);
_in_pprof_action.store(false);
diff --git a/src/meta/app_balance_policy.cpp b/src/meta/app_balance_policy.cpp
index 49db0b8df..b404f6d48 100644
--- a/src/meta/app_balance_policy.cpp
+++ b/src/meta/app_balance_policy.cpp
@@ -118,11 +118,11 @@ void app_balance_policy::unregister_ctrl_commands()
bool app_balance_policy::need_balance_secondaries(bool balance_checker)
{
if (!balance_checker && !_migration_result->empty()) {
- ddebug("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) {
- ddebug("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;
diff --git a/src/meta/dump_file.h b/src/meta/dump_file.h
index f888ef2d1..c136470e5 100644
--- a/src/meta/dump_file.h
+++ b/src/meta/dump_file.h
@@ -63,7 +63,7 @@
#define log_error_and_return(buffer, length) \
do { \
::dsn::utils::safe_strerror_r(errno, buffer, length); \
- derror("append file failed, reason(%s)", buffer); \
+ LOG_ERROR("append file failed, reason(%s)", buffer); \
return -1; \
} while (0)
@@ -141,8 +141,8 @@ public:
size_t cnt = fread(raw_mem + len, 1, hdr.length - len, _file_handle);
if (len + cnt < hdr.length) {
if (feof(_file_handle)) {
- derror("unexpected file end, start offset of this block (%u)",
- ftell(_file_handle) - len - sizeof(hdr));
+ LOG_ERROR("unexpected file end, start offset of this block (%u)",
+ ftell(_file_handle) - len - sizeof(hdr));
return -1;
} else if (errno != EINTR) {
log_error_and_return(msg_buffer, 128);
@@ -152,9 +152,9 @@ public:
}
_crc = dsn::utils::crc32_calc(raw_mem, len, _crc);
if (_crc != hdr.crc32) {
- derror("file %s data error, block offset(%ld)",
- _filename.c_str(),
- ftell(_file_handle) - hdr.length - sizeof(hdr));
+ LOG_ERROR("file %s data error, block offset(%ld)",
+ _filename.c_str(),
+ ftell(_file_handle) - hdr.length - sizeof(hdr));
return -1;
}
diff --git a/src/meta/greedy_load_balancer.cpp b/src/meta/greedy_load_balancer.cpp
index 3e4d571b9..3899eb333 100644
--- a/src/meta/greedy_load_balancer.cpp
+++ b/src/meta/greedy_load_balancer.cpp
@@ -160,10 +160,10 @@ 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()) {
- ddebug("meta server hasn't collected gpid(%d.%d)'s info of %s",
- pid.get_app_id(),
- pid.get_partition_index(),
- n.to_string());
+ LOG_INFO("meta server hasn't collected gpid(%d.%d)'s info of %s",
+ pid.get_app_id(),
+ pid.get_partition_index(),
+ n.to_string());
return false;
}
return true;
@@ -195,7 +195,7 @@ void greedy_load_balancer::greedy_balancer(const bool balance_checker)
bool greedy_load_balancer::balance(meta_view view, migration_list &list)
{
- ddebug("balancer round");
+ LOG_INFO("balancer round");
list.clear();
t_alive_nodes = view.nodes->size();
@@ -209,7 +209,7 @@ bool greedy_load_balancer::balance(meta_view view, migration_list &list)
bool greedy_load_balancer::check(meta_view view, migration_list &list)
{
- ddebug("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 123ce9612..b83f029ea 100644
--- a/src/meta/load_balance_policy.cpp
+++ b/src/meta/load_balance_policy.cpp
@@ -41,7 +41,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 << ">>>>>>>>>>";
- dinfo("%s", load_string.str().c_str());
+ LOG_DEBUG("%s", load_string.str().c_str());
}
bool calc_disk_load(node_mapper &nodes,
@@ -56,17 +56,17 @@ bool calc_disk_load(node_mapper &nodes,
dassert(ns != nullptr, "can't find node(%s) from node_state", node.to_string());
auto add_one_replica_to_disk_load = [&](const gpid &pid) {
- dinfo("add gpid(%d.%d) to node(%s) disk load",
- pid.get_app_id(),
- pid.get_partition_index(),
- node.to_string());
- const config_context &cc = *get_config_context(apps, pid);
- auto iter = cc.find_from_serving(node);
- if (iter == cc.serving.end()) {
- dwarn("can't collect gpid(%d.%d)'s info from %s, which should be primary",
+ LOG_DEBUG("add gpid(%d.%d) to node(%s) disk load",
pid.get_app_id(),
pid.get_partition_index(),
node.to_string());
+ const config_context &cc = *get_config_context(apps, pid);
+ auto iter = cc.find_from_serving(node);
+ if (iter == cc.serving.end()) {
+ LOG_WARNING("can't collect gpid(%d.%d)'s info from %s, which should be primary",
+ pid.get_app_id(),
+ pid.get_partition_index(),
+ node.to_string());
return false;
} else {
load[iter->disk_tag]++;
@@ -160,13 +160,13 @@ generate_balancer_request(const app_mapper &apps,
default:
dassert(false, "");
}
- ddebug("generate balancer: %d.%d %s from %s of disk_tag(%s) to %s",
- pc.pid.get_app_id(),
- pc.pid.get_partition_index(),
- ans.c_str(),
- from.to_string(),
- get_disk_tag(apps, from, pc.pid).c_str(),
- to.to_string());
+ LOG_INFO("generate balancer: %d.%d %s from %s of disk_tag(%s) to %s",
+ pc.pid.get_app_id(),
+ pc.pid.get_partition_index(),
+ ans.c_str(),
+ from.to_string(),
+ get_disk_tag(apps, from, pc.pid).c_str(),
+ to.to_string());
return std::make_shared<configuration_balancer_request>(std::move(result));
}
@@ -365,8 +365,8 @@ bool load_balance_policy::execute_balance(
if (!balance_checker) {
if (!_migration_result->empty()) {
if (balance_in_turn) {
- ddebug("stop to handle more apps after we found some actions for %s",
- app->get_logname());
+ LOG_INFO("stop to handle more apps after we found some actions for %s",
+ app->get_logname());
return false;
}
}
diff --git a/src/meta/meta_backup_service.cpp b/src/meta/meta_backup_service.cpp
index e5b264794..15ab9a4a4 100644
--- a/src/meta/meta_backup_service.cpp
+++ b/src/meta/meta_backup_service.cpp
@@ -58,9 +58,10 @@ 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) {
- dwarn("%s: can't encode app_info for app(%d), perhaps removed, treat it as backup finished",
- _backup_sig.c_str(),
- app_id);
+ LOG_WARNING(
+ "%s: can't encode app_info for app(%d), perhaps removed, treat it as backup finished",
+ _backup_sig.c_str(),
+ app_id);
auto iter = _progress.unfinished_partitions_per_app.find(app_id);
dassert(iter != _progress.unfinished_partitions_per_app.end(),
"%s: can't find app(%d) in unfished_map",
@@ -94,9 +95,9 @@ void policy_context::start_backup_app_meta_unlocked(int32_t app_id)
})
->wait();
if (err != dsn::ERR_OK) {
- derror("%s: create file %s failed, restart this backup later",
- _backup_sig.c_str(),
- create_file_req.file_name.c_str());
+ LOG_ERROR("%s: create file %s failed, restart this backup later",
+ _backup_sig.c_str(),
+ create_file_req.file_name.c_str());
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this, app_id]() {
@@ -120,9 +121,9 @@ void policy_context::start_backup_app_meta_unlocked(int32_t app_id)
dcheck_eq(resp.written_size, buffer.length());
{
zauto_lock l(_lock);
- ddebug("%s: successfully backup app metadata to %s",
- _policy.policy_name.c_str(),
- remote_file->file_name().c_str());
+ LOG_INFO("%s: successfully backup app metadata to %s",
+ _policy.policy_name.c_str(),
+ remote_file->file_name().c_str());
start_backup_app_partitions_unlocked(app_id);
}
} else if (resp.err == ERR_FS_INTERNAL) {
@@ -133,9 +134,9 @@ void policy_context::start_backup_app_meta_unlocked(int32_t app_id)
resp.err.to_string());
return;
} else {
- dwarn("write %s failed, reason(%s), try it later",
- remote_file->file_name().c_str(),
- resp.err.to_string());
+ LOG_WARNING("write %s failed, reason(%s), try it later",
+ remote_file->file_name().c_str(),
+ resp.err.to_string());
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this, app_id]() {
@@ -165,7 +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]) {
- dwarn("app is unavaliable, skip write finish flag for this app(app_id = %d)", app_id);
+ LOG_WARNING("app is unavaliable, skip write finish flag for this app(app_id = %d)", app_id);
if (write_callback != nullptr) {
write_callback->enqueue();
}
@@ -200,9 +201,9 @@ void policy_context::write_backup_app_finish_flag_unlocked(int32_t app_id,
->wait();
if (err != ERR_OK) {
- derror("%s: create file %s failed, restart this backup later",
- _backup_sig.c_str(),
- create_file_req.file_name.c_str());
+ LOG_ERROR("%s: create file %s failed, restart this backup later",
+ _backup_sig.c_str(),
+ create_file_req.file_name.c_str());
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this, app_id, write_callback]() {
@@ -221,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
- ddebug("app(%d) already write finish-flag on block service", app_id);
+ LOG_INFO("app(%d) already write finish-flag on block service", app_id);
if (write_callback != nullptr) {
write_callback->enqueue();
}
@@ -236,8 +237,8 @@ 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) {
- ddebug("app(%d) finish backup and write finish-flag on block service succeed",
- app_id);
+ LOG_INFO("app(%d) finish backup and write finish-flag on block service succeed",
+ app_id);
if (write_callback != nullptr) {
write_callback->enqueue();
}
@@ -249,9 +250,9 @@ void policy_context::write_backup_app_finish_flag_unlocked(int32_t app_id,
resp.err.to_string());
return;
} else {
- dwarn("write %s failed, reason(%s), try it later",
- remote_file->file_name().c_str(),
- resp.err.to_string());
+ LOG_WARNING("write %s failed, reason(%s), try it later",
+ remote_file->file_name().c_str(),
+ resp.err.to_string());
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this, app_id, write_callback]() {
@@ -266,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)
{
- ddebug("%s: finish backup for app(%d), progress(%d)",
- _backup_sig.c_str(),
- app_id,
- _progress.unfinished_apps);
+ LOG_INFO("%s: finish backup for app(%d), progress(%d)",
+ _backup_sig.c_str(),
+ app_id,
+ _progress.unfinished_apps);
if (--_progress.unfinished_apps == 0) {
- ddebug("%s: finish current backup for all apps", _backup_sig.c_str());
+ LOG_INFO("%s: finish current backup for all apps", _backup_sig.c_str());
_cur_backup.end_time_ms = dsn_now_ms();
task_ptr write_backup_info_callback =
@@ -286,8 +287,8 @@ 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;
- ddebug("%s: finish an old backup, try to start a new one",
- _backup_sig.c_str());
+ LOG_INFO("%s: finish an old backup, try to start a new one",
+ _backup_sig.c_str());
issue_new_backup_unlocked();
});
sync_backup_to_remote_storage_unlocked(_cur_backup, start_a_new_backup, false);
@@ -317,9 +318,9 @@ void policy_context::write_backup_info_unlocked(const backup_info &b_info,
->wait();
if (err != ERR_OK) {
- derror("%s: create file %s failed, restart this backup later",
- _backup_sig.c_str(),
- create_file_req.file_name.c_str());
+ LOG_ERROR("%s: create file %s failed, restart this backup later",
+ _backup_sig.c_str(),
+ create_file_req.file_name.c_str());
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this, b_info, write_callback]() {
@@ -344,8 +345,8 @@ 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) {
- ddebug("policy(%s) write backup_info to cold backup media succeed",
- _policy.policy_name.c_str());
+ LOG_INFO("policy(%s) write backup_info to cold backup media succeed",
+ _policy.policy_name.c_str());
if (write_callback != nullptr) {
write_callback->enqueue();
}
@@ -357,9 +358,9 @@ void policy_context::write_backup_info_unlocked(const backup_info &b_info,
resp.err.to_string());
return;
} else {
- dwarn("write %s failed, reason(%s), try it later",
- remote_file->file_name().c_str(),
- resp.err.to_string());
+ LOG_WARNING("write %s failed, reason(%s), try it later",
+ remote_file->file_name().c_str(),
+ resp.err.to_string());
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this, b_info, write_callback]() {
@@ -571,12 +572,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) {
- dwarn("%s: app id(%d) is invalid", _policy.policy_name.c_str(), app_id);
+ LOG_WARNING("%s: app id(%d) is invalid", _policy.policy_name.c_str(), app_id);
} else if (app->status != app_status::AS_AVAILABLE) {
- dwarn("%s: %s is not available, status(%s)",
- _policy.policy_name.c_str(),
- app->get_logname(),
- enum_to_string(app->status));
+ LOG_WARNING("%s: %s is not available, status(%s)",
+ _policy.policy_name.c_str(),
+ 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
@@ -615,20 +616,21 @@ 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)) {
- ddebug("%s: synced backup_info(%" PRId64 ") to remote storage successfully,"
- " start real backup work, new_node_create(%s)",
- _policy.policy_name.c_str(),
- b_info.backup_id,
- create_new_node ? "true" : "false");
+ LOG_INFO("%s: synced backup_info(%" PRId64 ") to remote storage successfully,"
+ " start real backup work, new_node_create(%s)",
+ _policy.policy_name.c_str(),
+ b_info.backup_id,
+ create_new_node ? "true" : "false");
if (sync_callback != nullptr) {
sync_callback->enqueue();
} else {
- dwarn("%s: empty callback", _policy.policy_name.c_str());
+ LOG_WARNING("%s: empty callback", _policy.policy_name.c_str());
}
} else if (ERR_TIMEOUT == err) {
- derror("%s: sync backup info(" PRId64 ") to remote storage got timeout, retry it later",
- _policy.policy_name.c_str(),
- b_info.backup_id);
+ LOG_ERROR("%s: sync backup info(" PRId64
+ ") to remote storage got timeout, retry it later",
+ _policy.policy_name.c_str(),
+ b_info.backup_id);
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this, b_info, sync_callback, create_new_node]() {
@@ -744,8 +746,8 @@ void policy_context::issue_new_backup_unlocked()
{
// before issue new backup, we check whether the policy is dropped
if (_policy.is_disable) {
- ddebug("%s: policy is disabled, just ignore backup, try it later",
- _policy.policy_name.c_str());
+ LOG_INFO("%s: policy is disabled, just ignore backup, try it later",
+ _policy.policy_name.c_str());
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this]() {
@@ -766,9 +768,9 @@ void policy_context::issue_new_backup_unlocked()
},
0,
_backup_service->backup_option().issue_backup_interval_ms);
- ddebug("%s: start issue new backup %" PRId64 "ms later",
- _policy.policy_name.c_str(),
- _backup_service->backup_option().issue_backup_interval_ms.count());
+ LOG_INFO("%s: start issue new backup %" PRId64 "ms later",
+ _policy.policy_name.c_str(),
+ _backup_service->backup_option().issue_backup_interval_ms.count());
return;
}
@@ -776,8 +778,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
- dwarn("%s: all apps have been dropped, ignore this backup and retry it later",
- _backup_sig.c_str());
+ LOG_WARNING("%s: all apps have been dropped, ignore this backup and retry it later",
+ _backup_sig.c_str());
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
[this]() {
@@ -814,17 +816,17 @@ void policy_context::start()
"policy recent backup duration time");
issue_gc_backup_info_task_unlocked();
- ddebug("%s: start gc backup info task succeed", _policy.policy_name.c_str());
+ LOG_INFO("%s: start gc backup info task succeed", _policy.policy_name.c_str());
}
void policy_context::add_backup_history(const backup_info &info)
{
zauto_lock l(_lock);
if (info.end_time_ms <= 0) {
- ddebug("%s: encounter an unfished backup_info(%lld), start_time(%lld), continue it later",
- _policy.policy_name.c_str(),
- info.backup_id,
- info.start_time_ms);
+ LOG_INFO("%s: encounter an unfished backup_info(%lld), start_time(%lld), continue it later",
+ _policy.policy_name.c_str(),
+ info.backup_id,
+ info.start_time_ms);
dassert(_cur_backup.start_time_ms == 0,
"%s: shouldn't have multiple unfinished backup instance in a policy, %lld vs %lld",
_policy.policy_name.c_str(),
@@ -840,11 +842,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 {
- ddebug("%s: add backup history, id(%lld), start_time(%lld), endtime(%lld)",
- _policy.policy_name.c_str(),
- info.backup_id,
- info.start_time_ms,
- info.end_time_ms);
+ LOG_INFO("%s: add backup history, id(%lld), start_time(%lld), endtime(%lld)",
+ _policy.policy_name.c_str(),
+ info.backup_id,
+ info.start_time_ms,
+ info.end_time_ms);
dassert(_cur_backup.end_time_ms == 0 || info.backup_id < _cur_backup.backup_id,
"%s: backup_id(%lld) in history larger than current(%lld)",
_policy.policy_name.c_str(),
@@ -915,11 +917,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);
- ddebug("%s: start to gc backup info, backup_id(%" PRId64 "), start_time(%s), end_time(%s)",
- _policy.policy_name.c_str(),
- info_to_gc.backup_id,
- start_time,
- end_time);
+ LOG_INFO("%s: start to gc backup info, backup_id(%" PRId64 "), start_time(%s), end_time(%s)",
+ _policy.policy_name.c_str(),
+ 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]() {
@@ -941,11 +943,11 @@ 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
- dwarn("%s: gc backup info, id(%" PRId64
- ") failed, with err = %s, just try again",
- _policy.policy_name.c_str(),
- info_to_gc.backup_id,
- resp.err.to_string());
+ LOG_WARNING("%s: gc backup info, id(%" PRId64
+ ") failed, with err = %s, just try again",
+ _policy.policy_name.c_str(),
+ info_to_gc.backup_id,
+ resp.err.to_string());
gc_backup_info_unlocked(info_to_gc);
}
});
@@ -958,9 +960,9 @@ 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;
- ddebug("%s: start to gc backup info with id(%" PRId64 ")",
- _policy.policy_name.c_str(),
- info.backup_id);
+ LOG_INFO("%s: start to gc backup info with id(%" PRId64 ")",
+ _policy.policy_name.c_str(),
+ info.backup_id);
tasking::create_task(LPC_DEFAULT_CALLBACK, &_tracker, [this, info]() {
gc_backup_info_unlocked(info);
@@ -968,7 +970,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
- dinfo("%s: no need to gc backup info, start it later", _policy.policy_name.c_str());
+ LOG_DEBUG("%s: no need to gc backup info, start it later", _policy.policy_name.c_str());
tasking::create_task(LPC_DEFAULT_CALLBACK, &_tracker, [this]() {
zauto_lock l(_lock);
issue_gc_backup_info_task_unlocked();
@@ -998,16 +1000,17 @@ 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) {
- ddebug("%s: sync remove backup_info on remote storage successfully, backup_id(%" PRId64
- ")",
- _policy.policy_name.c_str(),
- info.backup_id);
+ LOG_INFO(
+ "%s: sync remove backup_info on remote storage successfully, backup_id(%" PRId64
+ ")",
+ _policy.policy_name.c_str(),
+ info.backup_id);
if (sync_callback != nullptr) {
sync_callback->enqueue();
}
} else if (err == ERR_TIMEOUT) {
- derror("%s: sync remove backup info on remote storage got timeout, retry it later",
- _policy.policy_name.c_str());
+ LOG_ERROR("%s: sync remove backup info on remote storage got timeout, retry it later",
+ _policy.policy_name.c_str());
tasking::enqueue(
LPC_DEFAULT_CALLBACK,
&_tracker,
@@ -1049,17 +1052,17 @@ backup_service::backup_service(meta_service *meta_svc,
void backup_service::start_create_policy_meta_root(dsn::task_ptr callback)
{
- dinfo("create policy meta root(%s) on remote_storage", _policy_meta_root.c_str());
+ LOG_DEBUG("create policy meta root(%s) on remote_storage", _policy_meta_root.c_str());
_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) {
- ddebug("create policy meta root(%s) succeed, with err(%s)",
- _policy_meta_root.c_str(),
- err.to_string());
+ LOG_INFO("create policy meta root(%s) succeed, with err(%s)",
+ _policy_meta_root.c_str(),
+ err.to_string());
callback->enqueue();
} else if (err == dsn::ERR_TIMEOUT) {
- derror("create policy meta root(%s) timeout, try it later",
- _policy_meta_root.c_str());
+ LOG_ERROR("create policy meta root(%s) timeout, try it later",
+ _policy_meta_root.c_str());
dsn::tasking::enqueue(
LPC_DEFAULT_CALLBACK,
&_tracker,
@@ -1076,19 +1079,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
- ddebug("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) {
- ddebug("policy(%s) start to backup", policy_kv.first.c_str());
+ LOG_INFO("policy(%s) start to backup", policy_kv.first.c_str());
policy_kv.second->start();
}
if (_policy_states.empty()) {
- dwarn("can't sync policies from remote storage, user should config some policies");
+ LOG_WARNING(
+ "can't sync policies from remote storage, user should config some policies");
}
_in_initialize.store(false);
} else if (err == dsn::ERR_TIMEOUT) {
- derror("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),
@@ -1112,7 +1116,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) {
- dinfo("sync a backup string(%s) from remote storage", value.data());
+ LOG_DEBUG("sync a backup string(%s) from remote storage", value.data());
backup_info tbackup_info;
dsn::json::json_forwarder<backup_info>::decode(value, tbackup_info);
@@ -1130,8 +1134,8 @@ error_code backup_service::sync_policies_from_remote_storage()
ptr->add_backup_history(tbackup_info);
} else {
err = ec;
- ddebug("init backup_info from remote storage fail, error_code = %s",
- ec.to_string());
+ LOG_INFO("init backup_info from remote storage fail, error_code = %s",
+ ec.to_string());
}
};
std::string backup_info_root = get_policy_path(policy_name);
@@ -1146,9 +1150,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);
- ddebug("start to acquire backup_info(%" PRId64 ") of policy(%s)",
- backup_id,
- policy_name.c_str());
+ LOG_INFO("start to acquire backup_info(%" PRId64 ") of policy(%s)",
+ backup_id,
+ policy_name.c_str());
_meta_svc->get_remote_storage()->get_data(
backup_path,
TASK_CODE_EXEC_INLINED,
@@ -1157,15 +1161,16 @@ error_code backup_service::sync_policies_from_remote_storage()
}
} else // have not backup
{
- ddebug("policy has not started a backup process, policy_name = %s",
- policy_name.c_str());
+ LOG_INFO("policy has not started a backup process, policy_name = %s",
+ policy_name.c_str());
}
} else {
err = ec;
- derror("get backup info dirs fail from remote storage, backup_dirs_root = %s, "
- "err = %s",
- get_policy_path(policy_name).c_str(),
- ec.to_string());
+ LOG_ERROR(
+ "get backup info dirs fail from remote storage, backup_dirs_root = %s, "
+ "err = %s",
+ get_policy_path(policy_name).c_str(),
+ ec.to_string());
}
},
&tracker);
@@ -1174,7 +1179,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);
- ddebug("start to acquire the context of policy(%s)", policy_name.c_str());
+ LOG_INFO("start to acquire the context of policy(%s)", policy_name.c_str());
_meta_svc->get_remote_storage()->get_data(
policy_path,
LPC_DEFAULT_CALLBACK, // TASK_CODE_EXEC_INLINED,
@@ -1193,9 +1198,9 @@ error_code backup_service::sync_policies_from_remote_storage()
init_backup_info(policy_name);
} else {
err = ec;
- derror("init policy fail, policy_path = %s, error_code = %s",
- policy_path.c_str(),
- ec.to_string());
+ LOG_ERROR("init policy fail, policy_path = %s, error_code = %s",
+ policy_path.c_str(),
+ ec.to_string());
}
},
&tracker);
@@ -1212,7 +1217,8 @@ error_code backup_service::sync_policies_from_remote_storage()
}
} else {
err = ec;
- derror("get policy dirs from remote storage fail, error_code = %s", ec.to_string());
+ LOG_ERROR("get policy dirs from remote storage fail, error_code = %s",
+ ec.to_string());
}
},
&tracker);
@@ -1323,7 +1329,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;
- ddebug("add backup policy succeed, policy_name = %s", policy_name.c_str());
+ LOG_INFO("add backup policy succeed, policy_name = %s", policy_name.c_str());
_meta_svc->reply_data(req, resp);
req->release_ref();
@@ -1333,9 +1339,9 @@ void backup_service::do_add_policy(dsn::message_ex *req,
}
p->start();
} else if (err == ERR_TIMEOUT) {
- derror("create backup policy on remote storage timeout, retry after %" PRId64
- "(ms)",
- _opt.meta_retry_delay_ms.count());
+ LOG_ERROR("create backup policy on remote storage timeout, retry after %" PRId64
+ "(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),
@@ -1363,14 +1369,14 @@ void backup_service::do_update_policy_to_remote_storage(
if (err == ERR_OK) {
configuration_modify_backup_policy_response resp;
resp.err = ERR_OK;
- ddebug("update backup policy to remote storage succeed, policy_name = %s",
- p.policy_name.c_str());
+ LOG_INFO("update backup policy to remote storage succeed, policy_name = %s",
+ p.policy_name.c_str());
p_context_ptr->set_policy(p);
} else if (err == ERR_TIMEOUT) {
- derror("update backup policy to remote storage failed, policy_name = %s, retry "
- "after %" PRId64 "(ms)",
- p.policy_name.c_str(),
- _opt.meta_retry_delay_ms.count());
+ LOG_ERROR("update backup policy to remote storage failed, policy_name = %s, retry "
+ "after %" PRId64 "(ms)",
+ p.policy_name.c_str(),
+ _opt.meta_retry_delay_ms.count());
tasking::enqueue(LPC_DEFAULT_CALLBACK,
&_tracker,
std::bind(&backup_service::do_update_policy_to_remote_storage,
@@ -1498,9 +1504,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) {
- dwarn("%s: add app to policy failed, because invalid app(%d), ignore it",
- cur_policy.policy_name.c_str(),
- appid);
+ LOG_WARNING("%s: add app to policy failed, because invalid app(%d), ignore it",
+ cur_policy.policy_name.c_str(),
+ appid);
} else {
valid_app_ids_to_add.emplace_back(appid);
id_to_app_names.insert(std::make_pair(appid, app->app_name));
@@ -1512,23 +1518,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) {
- ddebug("%s: policy is under backuping, not allow to disable",
- cur_policy.policy_name.c_str());
+ LOG_INFO("%s: policy is under backuping, not allow to disable",
+ cur_policy.policy_name.c_str());
response.err = ERR_BUSY;
} else if (!cur_policy.is_disable) {
- ddebug("%s: policy is marked to disable", cur_policy.policy_name.c_str());
+ LOG_INFO("%s: policy is marked to disable", cur_policy.policy_name.c_str());
cur_policy.is_disable = true;
have_modify_policy = true;
} else { // cur_policy.is_disable = true
- ddebug("%s: policy is already disabled", cur_policy.policy_name.c_str());
+ LOG_INFO("%s: policy is already disabled", cur_policy.policy_name.c_str());
}
} else {
if (cur_policy.is_disable) {
cur_policy.is_disable = false;
- ddebug("%s: policy is marked to enable", cur_policy.policy_name.c_str());
+ LOG_INFO("%s: policy is marked to enable", cur_policy.policy_name.c_str());
have_modify_policy = true;
} else {
- ddebug("%s: policy is already enabled", cur_policy.policy_name.c_str());
+ LOG_INFO("%s: policy is already enabled", cur_policy.policy_name.c_str());
response.err = ERR_OK;
response.hint_message = std::string("policy is already enabled");
}
@@ -1547,35 +1553,36 @@ 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);
- ddebug("%s: remove app(%d) to policy", cur_policy.policy_name.c_str(), appid);
+ LOG_INFO("%s: remove app(%d) to policy", cur_policy.policy_name.c_str(), appid);
have_modify_policy = true;
} else {
- dwarn("%s: invalid app_id(%d)", cur_policy.policy_name.c_str(), (int32_t)appid);
+ LOG_WARNING(
+ "%s: invalid app_id(%d)", cur_policy.policy_name.c_str(), (int32_t)appid);
}
}
}
if (request.__isset.new_backup_interval_sec) {
if (request.new_backup_interval_sec > 0) {
- ddebug("%s: policy will change backup interval from %" PRId64 "(s) to %" PRId64 "(s)",
- cur_policy.policy_name.c_str(),
- cur_policy.backup_interval_seconds,
- request.new_backup_interval_sec);
+ LOG_INFO("%s: policy will change backup interval from %" PRId64 "(s) to %" PRId64 "(s)",
+ cur_policy.policy_name.c_str(),
+ 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 {
- dwarn("%s: invalid backup_interval_sec(%" PRId64 ")",
- cur_policy.policy_name.c_str(),
- request.new_backup_interval_sec);
+ LOG_WARNING("%s: invalid backup_interval_sec(%" PRId64 ")",
+ cur_policy.policy_name.c_str(),
+ request.new_backup_interval_sec);
}
}
if (request.__isset.backup_history_count_to_keep) {
if (request.backup_history_count_to_keep > 0) {
- ddebug("%s: policy will change backup_history_count_to_keep from (%d) to (%d)",
- cur_policy.policy_name.c_str(),
- cur_policy.backup_history_count_to_keep,
- request.backup_history_count_to_keep);
+ LOG_INFO("%s: policy will change backup_history_count_to_keep from (%d) to (%d)",
+ cur_policy.policy_name.c_str(),
+ 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;
}
@@ -1584,10 +1591,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)) {
- ddebug("%s: policy change start_time from (%s) to (%s)",
- cur_policy.policy_name.c_str(),
- cur_policy.start_time.to_string().c_str(),
- t_start_time.to_string().c_str());
+ LOG_INFO("%s: policy change start_time from (%s) to (%s)",
+ cur_policy.policy_name.c_str(),
+ cur_policy.start_time.to_string().c_str(),
+ t_start_time.to_string().c_str());
cur_policy.start_time = t_start_time;
have_modify_policy = true;
}
diff --git a/src/meta/meta_data.cpp b/src/meta/meta_data.cpp
index 9c10a56f3..f0853d6cf 100644
--- a/src/meta/meta_data.cpp
+++ b/src/meta/meta_data.cpp
@@ -144,9 +144,9 @@ 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()) {
- dwarn("construct for (%d.%d) failed, coz no replicas collected",
- pid.get_app_id(),
- pid.get_partition_index());
+ LOG_WARNING("construct for (%d.%d) failed, coz no replicas collected",
+ pid.get_app_id(),
+ pid.get_partition_index());
return false;
}
@@ -160,14 +160,14 @@ bool construct_replica(meta_view view, const gpid &pid, int max_replica_count)
pc.partition_flags = 0;
pc.max_replica_count = max_replica_count;
- ddebug("construct for (%d.%d), select %s as primary, ballot(%" PRId64
- "), committed_decree(%" PRId64 "), prepare_decree(%" PRId64 ")",
- pid.get_app_id(),
- pid.get_partition_index(),
- server.node.to_string(),
- server.ballot,
- server.last_committed_decree,
- server.last_prepared_decree);
+ LOG_INFO("construct for (%d.%d), select %s as primary, ballot(%" PRId64
+ "), committed_decree(%" PRId64 "), prepare_decree(%" PRId64 ")",
+ pid.get_app_id(),
+ pid.get_partition_index(),
+ server.node.to_string(),
+ server.ballot,
+ server.last_committed_decree,
+ server.last_prepared_decree);
drop_list.pop_back();
@@ -183,14 +183,14 @@ 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);
- ddebug("construct for (%d.%d), select %s into last_drops, ballot(%" PRId64
- "), committed_decree(%" PRId64 "), prepare_decree(%" PRId64 ")",
- pid.get_app_id(),
- pid.get_partition_index(),
- iter->node.to_string(),
- iter->ballot,
- iter->last_committed_decree,
- iter->last_prepared_decree);
+ LOG_INFO("construct for (%d.%d), select %s into last_drops, ballot(%" PRId64
+ "), committed_decree(%" PRId64 "), prepare_decree(%" PRId64 ")",
+ pid.get_app_id(),
+ pid.get_partition_index(),
+ iter->node.to_string(),
+ iter->ballot,
+ iter->last_committed_decree,
+ iter->last_prepared_decree);
}
cc.prefered_dropped = (int)drop_list.size() - 1;
@@ -249,16 +249,16 @@ 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) {
- ddebug("%d.%d: a learner's is down to status(%s), perhaps learn failed",
- info.pid.get_app_id(),
- info.pid.get_partition_index(),
- dsn::enum_to_string(info.status));
+ LOG_INFO("%d.%d: a learner's is down to status(%s), perhaps learn failed",
+ info.pid.get_app_id(),
+ info.pid.get_partition_index(),
+ dsn::enum_to_string(info.status));
learning_progress_abnormal_detected = true;
} else {
- dinfo("%d.%d: ignore abnormal status of %s, perhaps learn not start",
- info.pid.get_app_id(),
- info.pid.get_partition_index(),
- node.to_string());
+ LOG_DEBUG("%d.%d: ignore abnormal status of %s, perhaps learn not start",
+ info.pid.get_app_id(),
+ info.pid.get_partition_index(),
+ node.to_string());
}
} else if (info.status == partition_status::PS_POTENTIAL_SECONDARY) {
if (current_learner.ballot > info.ballot ||
@@ -266,10 +266,10 @@ 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
- dwarn("%d.%d: learner(%s)'s progress step back, please trace this carefully",
- info.pid.get_app_id(),
- info.pid.get_partition_index(),
- node.to_string());
+ LOG_WARNING("%d.%d: learner(%s)'s progress step back, please trace this carefully",
+ info.pid.get_app_id(),
+ info.pid.get_partition_index(),
+ node.to_string());
}
// NOTICE: the flag may be abormal currently. it's balancer's duty to make use of the
@@ -437,22 +437,22 @@ 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) {
- derror("check dropped order for gpid(%d.%d) failed, [%s,%llu,%lld,%lld,%lld@%d] vs "
- "[%s,%llu,%lld,%lld,%lld@%d]",
- config_owner->pid.get_app_id(),
- config_owner->pid.get_partition_index(),
- dropped[i].node.to_string(),
- dropped[i].time,
- dropped[i].ballot,
- dropped[i].last_committed_decree,
- dropped[i].last_prepared_decree,
- i,
- dropped[i].node.to_string(),
- dropped[i].time,
- dropped[i].ballot,
- dropped[i].last_committed_decree,
- dropped[i].last_prepared_decree,
- i + 1);
+ LOG_ERROR("check dropped order for gpid(%d.%d) failed, [%s,%llu,%lld,%lld,%lld@%d] vs "
+ "[%s,%llu,%lld,%lld,%lld@%d]",
+ config_owner->pid.get_app_id(),
+ config_owner->pid.get_partition_index(),
+ dropped[i].node.to_string(),
+ dropped[i].time,
+ dropped[i].ballot,
+ dropped[i].last_committed_decree,
+ dropped[i].last_prepared_decree,
+ i,
+ dropped[i].node.to_string(),
+ dropped[i].time,
+ dropped[i].ballot,
+ dropped[i].last_committed_decree,
+ dropped[i].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 bc19e4a30..2b5ddd33c 100644
--- a/src/meta/meta_server_failure_detector.cpp
+++ b/src/meta/meta_server_failure_detector.cpp
@@ -121,7 +121,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 {
- dwarn("query leader from cache got error(%s)", err.to_string());
+ LOG_WARNING("query leader from cache got error(%s)", err.to_string());
leader->set_invalid();
return false;
}
@@ -143,10 +143,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) {
- ddebug("leader lock granted callback: err(%s), owner(%s), version(%llu)",
- ec.to_string(),
- owner.c_str(),
- version);
+ LOG_INFO("leader lock granted callback: err(%s), owner(%s), version(%llu)",
+ ec.to_string(),
+ owner.c_str(),
+ version);
err = ec;
if (err == dsn::ERR_OK) {
leader_initialize(owner);
@@ -156,10 +156,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) {
- derror("leader lock expired callback: err(%s), owner(%s), version(%llu)",
- ec.to_string(),
- owner.c_str(),
- version);
+ LOG_ERROR("leader lock expired callback: err(%s), owner(%s), version(%llu)",
+ ec.to_string(),
+ owner.c_str(),
+ version);
// let's take the easy way right now
dsn_exit(0);
},
@@ -185,11 +185,11 @@ void meta_server_failure_detector::reset_stability_stat(const rpc_address &node)
if (iter == _stablity.end())
return;
else {
- ddebug("old stability stat: node(%s), start_time(%lld), unstable_count(%d), will reset "
- "unstable count to 0",
- node.to_string(),
- iter->second.last_start_time_ms,
- iter->second.unstable_restart_count);
+ LOG_INFO("old stability stat: node(%s), start_time(%lld), unstable_count(%d), will reset "
+ "unstable count to 0",
+ node.to_string(),
+ iter->second.last_start_time_ms,
+ iter->second.unstable_restart_count);
iter->second.unstable_restart_count = 0;
}
}
@@ -218,41 +218,41 @@ 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) {
- dinfo("%s isn't restarted, last_start_time(%lld)",
- beacon.from_addr.to_string(),
- w.last_start_time_ms);
+ LOG_DEBUG("%s isn't restarted, last_start_time(%lld)",
+ beacon.from_addr.to_string(),
+ 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) {
- ddebug("%s has stably run for a while, reset it's unstable count(%d) to 0",
- beacon.from_addr.to_string(),
- w.unstable_restart_count);
+ LOG_INFO("%s has stably run for a while, reset it's unstable count(%d) to 0",
+ beacon.from_addr.to_string(),
+ w.unstable_restart_count);
w.unstable_restart_count = 0;
}
} else if (beacon.start_time > w.last_start_time_ms) {
- ddebug("check %s restarted, last_time(%lld), this_time(%lld)",
- beacon.from_addr.to_string(),
- w.last_start_time_ms,
- beacon.start_time);
+ LOG_INFO("check %s restarted, last_time(%lld), this_time(%lld)",
+ beacon.from_addr.to_string(),
+ 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++;
- dwarn("%s encounter an unstable restart, total_count(%d)",
- beacon.from_addr.to_string(),
- w.unstable_restart_count);
+ LOG_WARNING("%s encounter an unstable restart, total_count(%d)",
+ beacon.from_addr.to_string(),
+ w.unstable_restart_count);
} else if (w.unstable_restart_count > 0) {
- ddebug("%s restart in %lld ms after last restart, may recover ok, reset "
- "it's unstable count(%d) to 0",
- beacon.from_addr.to_string(),
- beacon.start_time - w.last_start_time_ms,
- w.unstable_restart_count);
+ LOG_INFO("%s restart in %lld ms after last restart, may recover ok, reset "
+ "it's unstable count(%d) to 0",
+ beacon.from_addr.to_string(),
+ 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 {
- dwarn("%s: possible encounter a staled message, ignore it",
- beacon.from_addr.to_string());
+ LOG_WARNING("%s: possible encounter a staled message, ignore it",
+ beacon.from_addr.to_string());
}
return w.unstable_restart_count < _fd_opts->max_succssive_unstable_restart;
}
@@ -267,7 +267,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)) {
- dwarn("%s is unstable, don't response to it's beacon", beacon.from_addr.to_string());
+ LOG_WARNING("%s is unstable, don't response to it's beacon", beacon.from_addr.to_string());
return;
}
@@ -281,13 +281,13 @@ void meta_server_failure_detector::on_ping(const fd::beacon_msg &beacon,
failure_detector::on_ping_internal(beacon, ack);
}
- ddebug("on_ping, beacon send time[%ld], is_master(%s), from_node(%s), this_node(%s), "
- "primary_node(%s)",
- ack.time,
- ack.is_master ? "true" : "false",
- beacon.from_addr.to_string(),
- ack.this_node.to_string(),
- ack.primary_node.to_string());
+ LOG_INFO("on_ping, beacon send time[%ld], is_master(%s), from_node(%s), this_node(%s), "
+ "primary_node(%s)",
+ ack.time,
+ ack.is_master ? "true" : "false",
+ beacon.from_addr.to_string(),
+ ack.this_node.to_string(),
+ ack.primary_node.to_string());
reply(ack);
}
@@ -296,7 +296,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)
{
- ddebug("set %s as leader", leader_address.to_string());
+ LOG_INFO("set %s as leader", leader_address.to_string());
_lock_svc = nullptr;
_is_leader.store(is_myself_leader);
}
@@ -304,7 +304,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)
{
- ddebug("set %s as leader", leader_address.to_string());
+ LOG_INFO("set %s as leader", leader_address.to_string());
_is_leader.store(is_myself_leader);
}
diff --git a/src/meta/meta_service.cpp b/src/meta/meta_service.cpp
index 9aece6b07..bed803b63 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) {
- ddebug("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) {
- ddebug("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);
}
}
@@ -121,7 +121,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) {
- derror("init meta_state_service failed, err = %s", err.to_string());
+ LOG_ERROR("init meta_state_service failed, err = %s", err.to_string());
return err;
}
_storage.reset(storage);
@@ -136,14 +136,14 @@ 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) {
- derror(
+ LOG_ERROR(
"create node failed, node_path = %s, err = %s", current.c_str(), err.to_string());
return err;
}
}
_cluster_root = current.empty() ? "/" : current;
- ddebug("init meta_state_service succeed, cluster_root = %s", _cluster_root.c_str());
+ LOG_INFO("init meta_state_service succeed, cluster_root = %s", _cluster_root.c_str());
return ERR_OK;
}
@@ -286,14 +286,14 @@ void meta_service::start_service()
std::chrono::milliseconds(_opts.lb_interval_ms));
if (!_meta_opts.cold_backup_disabled) {
- ddebug("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) {
- ddebug("start bulk load service");
+ LOG_INFO("start bulk load service");
tasking::enqueue(LPC_META_CALLBACK, tracker(), [this]() {
_bulk_load_svc->initialize_bulk_load_service();
});
@@ -310,7 +310,7 @@ error_code meta_service::start()
err = remote_storage_initialize();
dreturn_not_ok_logged(err, "init remote storage failed, err = %s", err.to_string());
- ddebug("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));
@@ -325,8 +325,8 @@ error_code meta_service::start()
_meta_opts.enable_white_list);
dreturn_not_ok_logged(err, "start failure_detector failed, err = %s", err.to_string());
- ddebug("meta service failure detector is successfully started %s",
- _meta_opts.enable_white_list ? "with whitelist enabled" : "");
+ LOG_INFO("meta service failure detector is successfully started %s",
+ _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
@@ -338,8 +338,8 @@ error_code meta_service::start()
_failure_detector->acquire_leader_lock();
dassert(_failure_detector->get_leader(nullptr), "must be primary at this point");
- ddebug("%s got the primary lock, start to recover server state from remote storage",
- dsn_primary_address().to_string());
+ LOG_INFO("%s got the primary lock, start to recover server state from remote storage",
+ dsn_primary_address().to_string());
// initialize the load balancer
server_load_balancer *balancer = utils::factory_store<server_load_balancer>::create(
@@ -356,7 +356,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) {
- ddebug("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"),
@@ -371,13 +371,13 @@ 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) {
- ddebug("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;
}
- derror("initialize server state from remote storage failed, err = %s, retry ...",
- err.to_string());
+ LOG_ERROR("initialize server state from remote storage failed, err = %s, retry ...",
+ err.to_string());
}
_state->recover_from_max_replica_count_env();
@@ -391,7 +391,7 @@ error_code meta_service::start()
start_service();
- ddebug("start meta_service succeed");
+ LOG_INFO("start meta_service succeed");
return ERR_OK;
}
@@ -493,7 +493,7 @@ int meta_service::check_leader(dsn::message_ex *req, dsn::rpc_address *forward_a
return -1;
}
- dinfo("leader address: %s", leader.to_string());
+ LOG_DEBUG("leader address: %s", leader.to_string());
if (!leader.is_invalid()) {
dsn_rpc_forward(req, leader);
return 0;
@@ -695,9 +695,9 @@ void meta_service::on_update_configuration(dsn::message_ex *req)
_state->query_configuration_by_gpid(request->config.pid, response.config);
reply(req, response);
- ddebug("refuse request %s coz meta function level is %s",
- boost::lexical_cast<std::string>(*request).c_str(),
- _meta_function_level_VALUES_TO_NAMES.find(level)->second);
+ LOG_INFO("refuse request %s coz meta function level is %s",
+ boost::lexical_cast<std::string>(*request).c_str(),
+ _meta_function_level_VALUES_TO_NAMES.find(level)->second);
return;
}
@@ -739,16 +739,16 @@ void meta_service::on_propose_balancer(configuration_balancer_rpc rpc)
}
const configuration_balancer_request &request = rpc.request();
- ddebug("get proposal balancer request, gpid(%d.%d)",
- request.gpid.get_app_id(),
- request.gpid.get_partition_index());
+ LOG_INFO("get proposal balancer request, gpid(%d.%d)",
+ request.gpid.get_app_id(),
+ request.gpid.get_partition_index());
_state->on_propose_balancer(request, rpc.response());
}
void meta_service::on_start_recovery(configuration_recovery_rpc rpc)
{
configuration_recovery_response &response = rpc.response();
- ddebug("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) {
@@ -760,8 +760,8 @@ void meta_service::on_start_recovery(configuration_recovery_rpc rpc)
} else {
zauto_write_lock l(_meta_lock);
if (_started.load()) {
- ddebug("service(%s) is already started, ignore the recovery request",
- dsn_primary_address().to_string());
+ LOG_INFO("service(%s) is already started, ignore the recovery request",
+ dsn_primary_address().to_string());
response.err = ERR_SERVICE_ALREADY_RUNNING;
} else {
_state->on_start_recovery(rpc.request(), response);
@@ -793,7 +793,7 @@ void meta_service::on_add_backup_policy(dsn::message_ex *req)
}
if (_backup_handler == nullptr) {
- derror("meta doesn't enable backup service");
+ LOG_ERROR("meta doesn't enable backup service");
response.err = ERR_SERVICE_NOT_ACTIVE;
reply(req, response);
} else {
@@ -812,7 +812,7 @@ void meta_service::on_query_backup_policy(query_backup_policy_rpc policy_rpc)
auto &response = policy_rpc.response();
if (_backup_handler == nullptr) {
- derror("meta doesn't enable backup service");
+ LOG_ERROR("meta doesn't enable backup service");
response.err = ERR_SERVICE_NOT_ACTIVE;
} else {
tasking::enqueue(
@@ -829,7 +829,7 @@ void meta_service::on_modify_backup_policy(configuration_modify_backup_policy_rp
}
if (_backup_handler == nullptr) {
- derror("meta doesn't enable backup service");
+ LOG_ERROR("meta doesn't enable backup service");
rpc.response().err = ERR_SERVICE_NOT_ACTIVE;
} else {
tasking::enqueue(
@@ -976,7 +976,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
- dwarn("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";
diff --git a/src/meta/meta_service.h b/src/meta/meta_service.h
index 0a040257b..77e0aece1 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;
}
- dinfo("leader address: %s", leader.to_string());
+ LOG_DEBUG("leader address: %s", leader.to_string());
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;
- ddebug("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;
}
- ddebug("reject request with %s", rpc.response().err.to_string());
+ LOG_INFO("reject request with %s", rpc.response().err.to_string());
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)) {
- ddebug("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;
}
- ddebug("reject request with %s", response_struct.err.to_string());
+ LOG_INFO("reject request with %s", response_struct.err.to_string());
reply(req, response_struct);
return false;
}
diff --git a/src/meta/meta_state_service_simple.cpp b/src/meta/meta_state_service_simple.cpp
index ec08058d9..e74a21163 100644
--- a/src/meta/meta_state_service_simple.cpp
+++ b/src/meta/meta_state_service_simple.cpp
@@ -197,7 +197,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)
{
- dinfo("internal operation after logged");
+ LOG_DEBUG("internal operation after logged");
simple_transaction_entries *entries =
dynamic_cast<simple_transaction_entries *>(t_entries.get());
dassert(entries != nullptr, "invalid input parameter");
@@ -283,7 +283,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) {
- derror("open file failed: %s", log_path.c_str());
+ LOG_ERROR("open file failed: %s", log_path.c_str());
return ERR_FILE_OPERATION_FAILED;
}
return ERR_OK;
diff --git a/src/meta/meta_state_service_zookeeper.cpp b/src/meta/meta_state_service_zookeeper.cpp
index 44360e442..f74f8641d 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;
}
- ddebug("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);
- dinfo("call create, node(%s)", node.c_str());
+ LOG_DEBUG("call create, node(%s)", node.c_str());
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);
- dinfo("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);
- dinfo("call delete, node(%s)", node.c_str());
+ LOG_DEBUG("call delete, node(%s)", node.c_str());
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);
- dinfo("call get, node(%s)", node.c_str());
+ LOG_DEBUG("call get, node(%s)", node.c_str());
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);
- dinfo("call set, node(%s)", node.c_str());
+ LOG_DEBUG("call set, node(%s)", node.c_str());
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);
- dinfo("call node_exist, node(%s)", node.c_str());
+ LOG_DEBUG("call node_exist, node(%s)", node.c_str());
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);
- dinfo("call get children, node(%s)", node.c_str());
+ LOG_DEBUG("call get children, node(%s)", node.c_str());
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
- dwarn("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);
- dinfo(
+ LOG_DEBUG(
"visit zookeeper internal: ans(%s), call type(%d)", zerror(op->_output.error), op->_optype);
switch (op->_optype) {
diff --git a/src/meta/partition_guardian.cpp b/src/meta/partition_guardian.cpp
index c2775b898..f0c7db805 100644
--- a/src/meta/partition_guardian.cpp
+++ b/src/meta/partition_guardian.cpp
@@ -185,11 +185,11 @@ bool partition_guardian::from_proposals(meta_view &view,
invalid_action:
std::stringstream ss;
ss << action;
- ddebug("proposal action(%s) for gpid(%d.%d) is invalid, clear all proposal actions: %s",
- ss.str().c_str(),
- gpid.get_app_id(),
- gpid.get_partition_index(),
- reason);
+ LOG_INFO("proposal action(%s) for gpid(%d.%d) is invalid, clear all proposal actions: %s",
+ ss.str().c_str(),
+ gpid.get_app_id(),
+ gpid.get_partition_index(),
+ reason);
action.type = config_type::CT_INVALID;
while (!cc.lb_actions.empty()) {
@@ -236,8 +236,9 @@ pc_status partition_guardian::on_missing_primary(meta_view &view, const dsn::gpi
}
if (action.node.is_invalid()) {
- derror("all nodes for gpid(%s) are dead, waiting for some secondary to come back....",
- gpid_name);
+ LOG_ERROR(
+ "all nodes for gpid(%s) are dead, waiting for some secondary to come back....",
+ gpid_name);
result = pc_status::dead;
} else {
action.type = config_type::CT_UPGRADE_TO_PRIMARY;
@@ -278,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 {
- dwarn("%s enters DDD state, we are waiting for all replicas to come back, "
- "and select primary according to informations collected",
- gpid_name);
+ LOG_WARNING("%s 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.
@@ -291,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);
- ddebug("%s: config_context.dropped[%d]: "
- "node(%s), time(%" PRIu64 "){%s}, ballot(%" PRId64 "), "
- "commit_decree(%" PRId64 "), prepare_decree(%" PRId64 ")",
- gpid_name,
- i,
- dr.node.to_string(),
- dr.time,
- time_buf,
- dr.ballot,
- dr.last_committed_decree,
- dr.last_prepared_decree);
+ LOG_INFO("%s: config_context.dropped[%d]: "
+ "node(%s), time(%" PRIu64 "){%s}, ballot(%" PRId64 "), "
+ "commit_decree(%" PRId64 "), prepare_decree(%" PRId64 ")",
+ gpid_name,
+ i,
+ dr.node.to_string(),
+ dr.time,
+ time_buf,
+ dr.ballot,
+ dr.last_committed_decree,
+ dr.last_prepared_decree);
}
for (int i = 0; i < pc.last_drops.size(); ++i) {
@@ -312,27 +313,27 @@ pc_status partition_guardian::on_missing_primary(meta_view &view, const dsn::gpi
break;
}
}
- ddebug("%s: config_context.last_drops[%d]: node(%s), dropped_index(%d)",
- gpid_name,
- i,
- pc.last_drops[i].to_string(),
- dropped_index);
+ LOG_INFO("%s: config_context.last_drops[%d]: node(%s), dropped_index(%d)",
+ gpid_name,
+ i,
+ pc.last_drops[i].to_string(),
+ dropped_index);
}
if (pc.last_drops.size() == 1) {
- dwarn("%s: the only node(%s) is dead, waiting it to come back",
- gpid_name,
- pc.last_drops.back().to_string());
+ LOG_WARNING("%s: the only node(%s) is dead, waiting it to come back",
+ gpid_name,
+ pc.last_drops.back().to_string());
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;
- ddebug("%s: last two drops are %s and %s (the latest dropped)",
- gpid_name,
- nodes[0].to_string(),
- nodes[1].to_string());
+ LOG_INFO("%s: last two drops are %s and %s (the latest dropped)",
+ gpid_name,
+ nodes[0].to_string(),
+ nodes[1].to_string());
for (unsigned int i = 0; i < nodes.size(); ++i) {
node_state *ns = get_node_state(*view.nodes, nodes[i], false);
@@ -340,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";
- dwarn("%s: don't select primary: %s", gpid_name, reason.c_str());
+ LOG_WARNING("%s: don't select primary: %s", gpid_name, reason.c_str());
} 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()) {
- ddebug("%s: ignore %s's replica info as it doesn't exist on replica "
- "server",
- gpid_name,
- nodes[i].to_string());
+ LOG_INFO("%s: ignore %s's replica info as it doesn't exist on replica "
+ "server",
+ gpid_name,
+ nodes[i].to_string());
collected_info[i] = {nodes[i], 0, -1, -1, -1};
} else {
ready = false;
@@ -359,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";
}
- dwarn("%s: don't select primary: %s", gpid_name, reason.c_str());
+ LOG_WARNING("%s: don't select primary: %s", gpid_name, reason.c_str());
}
} else {
collected_info[i] = *it;
@@ -370,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";
- dwarn("%s: don't select primary: %s", gpid_name, reason.c_str());
+ LOG_WARNING("%s: don't select primary: %s", gpid_name, reason.c_str());
}
if (ready) {
@@ -401,7 +402,7 @@ pc_status partition_guardian::on_missing_primary(meta_view &view, const dsn::gpi
? previous_dead.node
: recent_dead.node;
}
- ddebug(
+ LOG_INFO(
"%s: select %s as a new primary", gpid_name, action.node.to_string());
} else {
char buf[1000];
@@ -412,12 +413,12 @@ pc_status partition_guardian::on_missing_primary(meta_view &view, const dsn::gpi
larger_pd,
pc.last_committed_decree,
larger_cd);
- dwarn("%s: don't select primary: %s", gpid_name, reason.c_str());
+ LOG_WARNING("%s: don't select primary: %s", gpid_name, reason.c_str());
}
} else {
reason = "for the last two drops, the node with larger ballot has smaller last "
"committed decree";
- dwarn("%s: don't select primary: %s", gpid_name, reason.c_str());
+ LOG_WARNING("%s: don't select primary: %s", gpid_name, reason.c_str());
}
}
}
@@ -429,9 +430,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 {
- dwarn("%s: don't select any node for security reason, administrator can select "
- "a proper one by shell",
- gpid_name);
+ LOG_WARNING("%s: 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 +484,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;
- ddebug("gpid(%s): is emergency due to too few replicas", gpid.to_string());
+ LOG_INFO("gpid(%s): is emergency due to too few replicas", gpid.to_string());
} else if (cc.dropped.empty()) {
is_emergency = true;
- ddebug("gpid(%s): is emergency due to no dropped candidate", gpid.to_string());
+ LOG_INFO("gpid(%s): is emergency due to no dropped candidate", gpid.to_string());
} 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);
- ddebug("gpid(%s): is emergency due to lose secondary for a long time, "
- "last_dropped_node(%s), drop_time(%s), delay_ms(%" PRIu64 ")",
- gpid.to_string(),
- cc.dropped.back().node.to_string(),
- time_buf,
- _replica_assign_delay_ms_for_dropouts);
+ LOG_INFO("gpid(%s): is emergency due to lose secondary for a long time, "
+ "last_dropped_node(%s), drop_time(%s), delay_ms(%" PRIu64 ")",
+ gpid.to_string(),
+ cc.dropped.back().node.to_string(),
+ time_buf,
+ _replica_assign_delay_ms_for_dropouts);
} else if (in_black_list(cc.dropped.back().node)) {
- ddebug("gpid(%s) is emergency due to recent dropped(%s) is in black list",
- gpid.to_string(),
- cc.dropped.back().node.to_string());
+ LOG_INFO("gpid(%s) is emergency due to recent dropped(%s) is in black list",
+ gpid.to_string(),
+ cc.dropped.back().node.to_string());
is_emergency = true;
}
action.node.set_invalid();
@@ -513,51 +514,51 @@ pc_status partition_guardian::on_missing_secondary(meta_view &view, const dsn::g
oss << ",";
oss << cc.dropped[i].node.to_string();
}
- ddebug("gpid(%s): try to choose node in dropped list, dropped_list(%s), "
- "prefered_dropped(%d)",
- gpid.to_string(),
- oss.str().c_str(),
- cc.prefered_dropped);
+ LOG_INFO("gpid(%s): try to choose node in dropped list, dropped_list(%s), "
+ "prefered_dropped(%d)",
+ gpid.to_string(),
+ oss.str().c_str(),
+ cc.prefered_dropped);
if (cc.prefered_dropped < 0 || cc.prefered_dropped >= (int)cc.dropped.size()) {
- ddebug("gpid(%s): prefered_dropped(%d) is invalid according to drop_list(size %d), "
- "reset it to %d (drop_list.size - 1)",
- gpid.to_string(),
- cc.prefered_dropped,
- (int)cc.dropped.size(),
- (int)cc.dropped.size() - 1);
+ LOG_INFO("gpid(%s): prefered_dropped(%d) is invalid according to drop_list(size %d), "
+ "reset it to %d (drop_list.size - 1)",
+ gpid.to_string(),
+ cc.prefered_dropped,
+ (int)cc.dropped.size(),
+ (int)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)) {
- ddebug("gpid(%s): node(%s) at cc.dropped[%d] is alive now, choose it, "
- "and forward prefered_dropped from (%d) to (%d)",
- gpid.to_string(),
- server.node.to_string(),
- cc.prefered_dropped,
- cc.prefered_dropped,
- cc.prefered_dropped - 1);
+ LOG_INFO("gpid(%s): node(%s) at cc.dropped[%d] is alive now, choose it, "
+ "and forward prefered_dropped from (%d) to (%d)",
+ gpid.to_string(),
+ server.node.to_string(),
+ cc.prefered_dropped,
+ cc.prefered_dropped,
+ cc.prefered_dropped - 1);
action.node = server.node;
cc.prefered_dropped--;
break;
} else {
- ddebug("gpid(%s): node(%s) at cc.dropped[%d] is not alive now, "
- "changed prefered_dropped from (%d) to (%d)",
- gpid.to_string(),
- server.node.to_string(),
- cc.prefered_dropped,
- cc.prefered_dropped,
- cc.prefered_dropped - 1);
+ LOG_INFO("gpid(%s): node(%s) at cc.dropped[%d] is not alive now, "
+ "changed prefered_dropped from (%d) to (%d)",
+ gpid.to_string(),
+ server.node.to_string(),
+ 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()) {
- ddebug("gpid(%s) refuse to use selected node(%s) as it is in black list",
- gpid.to_string(),
- action.node.to_string());
+ LOG_INFO("gpid(%s) refuse to use selected node(%s) as it is in black list",
+ gpid.to_string(),
+ action.node.to_string());
}
newly_partitions *min_server_np = nullptr;
for (auto &pairs : *view.nodes) {
@@ -573,14 +574,14 @@ pc_status partition_guardian::on_missing_secondary(meta_view &view, const dsn::g
}
if (!action.node.is_invalid()) {
- ddebug("gpid(%s): can't find valid node in dropped list to add as secondary, "
- "choose new node(%s) with minimal partitions serving",
- gpid.to_string(),
- action.node.to_string());
+ LOG_INFO("gpid(%s): can't find valid node in dropped list to add as secondary, "
+ "choose new node(%s) with minimal partitions serving",
+ gpid.to_string(),
+ action.node.to_string());
} else {
- ddebug("gpid(%s): 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.to_string());
+ LOG_INFO("gpid(%s): 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.to_string());
}
}
} else {
@@ -594,15 +595,15 @@ pc_status partition_guardian::on_missing_secondary(meta_view &view, const dsn::g
}
if (!action.node.is_invalid()) {
- ddebug("gpid(%s): choose node(%s) as secondary coz it is last_dropped_node and is "
- "alive now",
- gpid.to_string(),
- server.node.to_string());
+ LOG_INFO("gpid(%s): choose node(%s) as secondary coz it is last_dropped_node and is "
+ "alive now",
+ gpid.to_string(),
+ server.node.to_string());
} else {
- ddebug("gpid(%s): can't add secondary coz last_dropped_node(%s) is not alive now, "
- "ignore this as not in emergency",
- gpid.to_string(),
- server.node.to_string());
+ LOG_INFO("gpid(%s): can't add secondary coz last_dropped_node(%s) is not alive now, "
+ "ignore this as not in emergency",
+ gpid.to_string(),
+ server.node.to_string());
}
}
@@ -650,9 +651,9 @@ void partition_guardian::finish_cure_proposal(meta_view &view,
{
newly_partitions *np = get_newly_partitions(*(view.nodes), act.node);
if (np == nullptr) {
- ddebug("can't get the newly_partitions extension structure for node(%s), "
- "the node may be dead and removed",
- act.node.to_string());
+ LOG_INFO("can't get the newly_partitions extension structure for node(%s), "
+ "the node may be dead and removed",
+ act.node.to_string());
} 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 d3da7a43b..65d9f0475 100644
--- a/src/meta/server_state.cpp
+++ b/src/meta/server_state.cpp
@@ -227,7 +227,7 @@ bool server_state::spin_wait_staging(int timeout_seconds)
if (c == 0) {
return true;
}
- ddebug("there are (%d) apps still in staging, just wait...", c);
+ LOG_INFO("there are (%d) apps still in staging, just wait...", c);
std::this_thread::sleep_for(std::chrono::seconds(1));
if (timeout_seconds > 0) {
--timeout_seconds;
@@ -284,10 +284,10 @@ void server_state::transition_staging_state(std::shared_ptr<app_state> &app)
enum_to_string(app->status));
}
- ddebug("app(%s) transfer from %s to %s",
- app->get_logname(),
- enum_to_string(old_status),
- enum_to_string(app->status));
+ LOG_INFO("app(%s) transfer from %s to %s",
+ app->get_logname(),
+ enum_to_string(old_status),
+ enum_to_string(app->status));
#undef send_response
}
@@ -295,10 +295,10 @@ void server_state::process_one_partition(std::shared_ptr<app_state> &app)
{
int ans = --app->helpers->partitions_in_progress;
if (ans > 0) {
- dinfo("app(%s) in status %s, can't transfer to stable state as some partition is in "
- "progressing",
- app->get_logname(),
- enum_to_string(app->status));
+ LOG_DEBUG("app(%s) in status %s, 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);
@@ -312,7 +312,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) {
- derror("open file failed, file(%s)", local_path);
+ LOG_ERROR("open file failed, file(%s)", local_path);
return ERR_FILE_OPERATION_FAILED;
}
@@ -340,10 +340,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) {
- ddebug("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) {
- derror("sync from remote storage failed, err(%s)", ec.to_string());
+ LOG_ERROR("sync from remote storage failed, err(%s)", ec.to_string());
return ec;
} else {
spin_wait_staging();
@@ -362,7 +362,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) {
- ddebug("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());
@@ -386,7 +386,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) {
- derror("open file failed, file(%s)", local_path);
+ LOG_ERROR("open file failed, file(%s)", local_path);
return ERR_FILE_OPERATION_FAILED;
}
@@ -442,7 +442,7 @@ error_code server_state::initialize_default_apps()
{
std::vector<const char *> sections;
dsn_config_get_all_sections(sections);
- ddebug("start to do initialize");
+ LOG_INFO("start to do initialize");
app_info default_app;
for (int i = 0; i < sections.size(); i++) {
@@ -455,7 +455,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) {
- dwarn("'[%s] app_name' not specified, ignore this section", s);
+ LOG_WARNING("'[%s] app_name' not specified, ignore this section", s);
continue;
}
@@ -512,10 +512,10 @@ error_code server_state::sync_apps_to_remote_storage()
t->wait();
if (err != ERR_NODE_ALREADY_EXIST && err != ERR_OK) {
- derror("create root node /apps in meta store failed, err = %s", err.to_string());
+ LOG_ERROR("create root node /apps in meta store failed, err = %s", err.to_string());
return err;
} else {
- ddebug("set %s to lock state in remote storage", _apps_root.c_str());
+ LOG_INFO("set %s to lock state in remote storage", _apps_root.c_str());
}
err = ERR_OK;
@@ -532,12 +532,12 @@ 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) {
- dwarn("create app node failed, path(%s) reason(%s)",
- path.c_str(),
- ec.to_string());
+ LOG_WARNING("create app node failed, path(%s) reason(%s)",
+ path.c_str(),
+ ec.to_string());
err = ec;
} else {
- ddebug("create app node %s ok", path.c_str());
+ LOG_INFO("create app node %s ok", path.c_str());
}
},
value,
@@ -564,12 +564,12 @@ error_code server_state::sync_apps_to_remote_storage()
[&err](dsn::error_code e) { err = e; });
t->wait();
if (dsn::ERR_OK == err) {
- ddebug("set %s to unlock state in remote storage", _apps_root.c_str());
+ LOG_INFO("set %s to unlock state in remote storage", _apps_root.c_str());
return err;
} else {
- derror("set %s to unlock state in remote storage failed, reason(%s)",
- _apps_root.c_str(),
- err.to_string());
+ LOG_ERROR("set %s to unlock state in remote storage failed, reason(%s)",
+ _apps_root.c_str(),
+ err.to_string());
return err;
}
}
@@ -641,7 +641,7 @@ dsn::error_code server_state::sync_apps_from_remote_storage()
}
} else {
- derror("get partition node failed, reason(%s)", ec.to_string());
+ LOG_ERROR("get partition node failed, reason(%s)", ec.to_string());
err = ec;
}
},
@@ -680,9 +680,9 @@ dsn::error_code server_state::sync_apps_from_remote_storage()
sync_partition(app, i, partition_path);
}
} else {
- derror("get app info from meta state service failed, path = %s, err = %s",
- app_path.c_str(),
- ec.to_string());
+ LOG_ERROR("get app info from meta state service failed, path = %s, err = %s",
+ app_path.c_str(),
+ ec.to_string());
err = ec;
}
},
@@ -720,9 +720,9 @@ dsn::error_code server_state::sync_apps_from_remote_storage()
sync_app(_apps_root + "/" + appid_str);
}
} else {
- derror("get app list from meta state service failed, path = %s, err = %s",
- _apps_root.c_str(),
- ec.to_string());
+ LOG_ERROR("get app list from meta state service failed, path = %s, err = %s",
+ _apps_root.c_str(),
+ ec.to_string());
err = ec;
}
},
@@ -769,7 +769,7 @@ error_code server_state::initialize_data_structure()
if (_meta_svc->get_meta_options().recover_from_replica_server) {
return ERR_OBJECT_NOT_FOUND;
} else {
- ddebug("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) {
@@ -778,8 +778,9 @@ error_code server_state::initialize_data_structure()
"find apps from remote storage, but "
"[meta_server].recover_from_replica_server = true");
} else {
- ddebug("sync apps from remote storage ok, get %d apps, init the node state accordingly",
- _all_apps.size());
+ LOG_INFO(
+ "sync apps from remote storage ok, get %d apps, init the node state accordingly",
+ _all_apps.size());
initialize_node_state();
}
}
@@ -806,9 +807,9 @@ void server_state::on_config_sync(configuration_query_by_node_rpc rpc)
bool reject_this_request = false;
response.__isset.gc_replicas = false;
- ddebug("got config sync request from %s, stored_replicas_count(%d)",
- request.node.to_string(),
- (int)request.stored_replicas.size());
+ LOG_INFO("got config sync request from %s, stored_replicas_count(%d)",
+ request.node.to_string(),
+ (int)request.stored_replicas.size());
{
zauto_read_lock l(_lock);
@@ -816,7 +817,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) {
- ddebug("node(%s) not found in meta server", request.node.to_string());
+ LOG_INFO("node(%s) not found in meta server", request.node.to_string());
response.err = ERR_OBJECT_NOT_FOUND;
} else {
response.err = ERR_OK;
@@ -870,10 +871,10 @@ 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) {
- dinfo("receive stored replica from %s, pid(%d.%d)",
- request.node.to_string(),
- rep.pid.get_app_id(),
- rep.pid.get_partition_index());
+ LOG_DEBUG("receive stored replica from %s, pid(%d.%d)",
+ request.node.to_string(),
+ rep.pid.get_app_id(),
+ rep.pid.get_partition_index());
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
@@ -896,29 +897,31 @@ 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) {
- ddebug("gpid(%d.%d) on node(%s) is of dropped table, but expire second is "
- "not specified, do not delete it for safety reason",
- rep.pid.get_app_id(),
- rep.pid.get_partition_index(),
- request.node.to_string());
+ LOG_INFO(
+ "gpid(%d.%d) on node(%s) is of dropped table, but expire second is "
+ "not specified, do not delete it for safety reason",
+ rep.pid.get_app_id(),
+ rep.pid.get_partition_index(),
+ request.node.to_string());
} 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) {
- ddebug("gpid(%d.%d) on node(%s) is of dropped and expired table, but "
- "current function level is %s, do not delete it for safety "
- "reason",
- rep.pid.get_app_id(),
- rep.pid.get_partition_index(),
- request.node.to_string(),
- _meta_function_level_VALUES_TO_NAMES.find(level)->second);
+ LOG_INFO("gpid(%d.%d) on node(%s) is of dropped and expired table, but "
+ "current function level is %s, do not delete it for safety "
+ "reason",
+ rep.pid.get_app_id(),
+ rep.pid.get_partition_index(),
+ request.node.to_string(),
+ _meta_function_level_VALUES_TO_NAMES.find(level)->second);
} else {
response.gc_replicas.push_back(rep);
- dwarn("notify node(%s) to gc replica(%d.%d) coz the app is dropped and "
- "expired",
- request.node.to_string(),
- rep.pid.get_app_id(),
- rep.pid.get_partition_index());
+ LOG_WARNING(
+ "notify node(%s) to gc replica(%d.%d) coz the app is dropped and "
+ "expired",
+ request.node.to_string(),
+ rep.pid.get_app_id(),
+ rep.pid.get_partition_index());
}
}
} else if (app->status == app_status::AS_AVAILABLE) {
@@ -926,18 +929,19 @@ 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) {
- ddebug("gpid(%d.%d) on node(%s) is useless, but current function level "
- "is %s, do not delete it for safety reason",
- rep.pid.get_app_id(),
- rep.pid.get_partition_index(),
- request.node.to_string(),
- _meta_function_level_VALUES_TO_NAMES.find(level)->second);
+ LOG_INFO(
+ "gpid(%d.%d) on node(%s) is useless, but current function level "
+ "is %s, do not delete it for safety reason",
+ rep.pid.get_app_id(),
+ rep.pid.get_partition_index(),
+ request.node.to_string(),
+ _meta_function_level_VALUES_TO_NAMES.find(level)->second);
} else {
response.gc_replicas.push_back(rep);
- dwarn("notify node(%s) to gc replica(%d.%d) coz it is useless",
- request.node.to_string(),
- rep.pid.get_app_id(),
- rep.pid.get_partition_index());
+ LOG_WARNING("notify node(%s) to gc replica(%d.%d) coz it is useless",
+ request.node.to_string(),
+ rep.pid.get_app_id(),
+ rep.pid.get_partition_index());
}
}
}
@@ -986,10 +990,10 @@ void server_state::query_configuration_by_index(
std::shared_ptr<app_state> &app = iter->second;
if (app->status != app_status::AS_AVAILABLE) {
- derror("invalid status(%s) in exist app(%s), app_id(%d)",
- enum_to_string(app->status),
- (app->app_name).c_str(),
- app->app_id);
+ LOG_ERROR("invalid status(%s) in exist app(%s), app_id(%d)",
+ enum_to_string(app->status),
+ (app->app_name).c_str(),
+ app->app_id);
switch (app->status) {
case app_status::AS_CREATING:
@@ -1023,7 +1027,8 @@ 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 {
- dinfo("create partition node: gpid(%d.%d), result: %s", app->app_id, pidx, ec.to_string());
+ LOG_DEBUG(
+ "create partition node: gpid(%d.%d), result: %s", app->app_id, pidx, ec.to_string());
if (ERR_OK == ec || ERR_NODE_ALREADY_EXIST == ec) {
{
zauto_write_lock l(_lock);
@@ -1033,7 +1038,8 @@ void server_state::init_app_partition_node(std::shared_ptr<app_state> &app,
callback->enqueue();
}
} else if (ERR_TIMEOUT == ec) {
- dwarn("create partition node failed, gpid(%d.%d), retry later", app->app_id, pidx);
+ LOG_WARNING(
+ "create partition node failed, gpid(%d.%d), retry later", app->app_id, pidx);
// TODO: add parameter of the retry time interval in config file
tasking::enqueue(
LPC_META_STATE_HIGH,
@@ -1061,12 +1067,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) {
- dinfo("create app(%s) on storage service ok", app->get_logname());
+ LOG_DEBUG("create app(%s) 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) {
- dwarn("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),
@@ -1115,7 +1121,7 @@ void server_state::create_app(dsn::message_ex *msg)
auto level = _meta_svc->get_function_level();
if (level <= meta_function_level::fl_freezed) {
- derror("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 ||
@@ -1189,7 +1195,7 @@ void server_state::do_app_drop(std::shared_ptr<app_state> &app)
drop_partition(app, i);
}
} else if (ERR_TIMEOUT == ec) {
- dinfo("drop app(%s) prepare timeout, continue to drop later", app->get_logname());
+ LOG_DEBUG("drop app(%s) 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),
@@ -1214,7 +1220,7 @@ void server_state::drop_app(dsn::message_ex *msg)
bool do_dropping = false;
std::shared_ptr<app_state> app;
dsn::unmarshall(msg, request);
- ddebug("drop app request, name(%s)", request.app_name.c_str());
+ LOG_INFO("drop app request, name(%s)", request.app_name.c_str());
{
zauto_write_lock l(_lock);
app = get_app(request.app_name);
@@ -1289,7 +1295,7 @@ void server_state::recall_app(dsn::message_ex *msg)
std::shared_ptr<app_state> target_app;
dsn::unmarshall(msg, request);
- ddebug("recall app request, app_id(%d)", request.app_id);
+ LOG_INFO("recall app request, app_id(%d)", request.app_id);
bool do_recalling = false;
{
@@ -1340,7 +1346,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)
{
- dinfo("list app request, status(%d)", request.status);
+ LOG_DEBUG("list app request, status(%d)", request.status);
zauto_read_lock l(_lock);
for (auto &kv : _all_apps) {
app_state &app = *(kv.second);
@@ -1353,13 +1359,13 @@ void server_state::list_apps(const configuration_list_apps_request &request,
void server_state::send_proposal(rpc_address target, const configuration_update_request &proposal)
{
- ddebug("send proposal %s for gpid(%d.%d), ballot = %" PRId64 ", target = %s, node = %s",
- ::dsn::enum_to_string(proposal.type),
- proposal.config.pid.get_app_id(),
- proposal.config.pid.get_partition_index(),
- proposal.config.ballot,
- target.to_string(),
- proposal.node.to_string());
+ LOG_INFO("send proposal %s for gpid(%d.%d), ballot = %" PRId64 ", target = %s, node = %s",
+ ::dsn::enum_to_string(proposal.type),
+ proposal.config.pid.get_app_id(),
+ proposal.config.pid.get_partition_index(),
+ proposal.config.ballot,
+ target.to_string(),
+ proposal.node.to_string());
dsn::message_ex *msg =
dsn::message_ex::create_request(RPC_CONFIG_PROPOSAL, 0, proposal.config.pid.thread_hash());
::marshall(msg, proposal);
@@ -1551,15 +1557,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()) {
- ddebug("meta update config ok: type(%s), old_config=%s, %s",
- find_name->second,
- old_config_str.c_str(),
- boost::lexical_cast<std::string>(*config_request).c_str());
+ LOG_INFO("meta update config ok: type(%s), old_config=%s, %s",
+ find_name->second,
+ old_config_str.c_str(),
+ boost::lexical_cast<std::string>(*config_request).c_str());
} else {
- ddebug("meta update config ok: type(%d), old_config=%s, %s",
- config_request->type,
- old_config_str.c_str(),
- boost::lexical_cast<std::string>(*config_request).c_str());
+ LOG_INFO("meta update config ok: type(%d), old_config=%s, %s",
+ config_request->type,
+ old_config_str.c_str(),
+ boost::lexical_cast<std::string>(*config_request).c_str());
}
#ifndef NDEBUG
@@ -1583,8 +1589,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) {
- ddebug("ignore update configuration on remote due to level is %s",
- _meta_function_level_VALUES_TO_NAMES.find(l)->second);
+ LOG_INFO("ignore update configuration on remote due to level is %s",
+ _meta_function_level_VALUES_TO_NAMES.find(l)->second);
// NOTICE: pending_sync_task need to be reassigned
return tasking::enqueue(
LPC_META_STATE_HIGH,
@@ -1735,10 +1741,11 @@ void server_state::drop_partition(std::shared_ptr<app_state> &app, int pidx)
request.config.ballot++;
if (config_status::pending_remote_sync == cc.stage) {
- dwarn("gpid(%d.%d) is syncing another request with remote, cancel it due to partition is "
- "dropped",
- app->app_id,
- pidx);
+ LOG_WARNING(
+ "gpid(%d.%d) 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;
@@ -1759,14 +1766,15 @@ void server_state::downgrade_primary_to_inactive(std::shared_ptr<app_state> &app
"app(%s) not in dropping state (%s)",
app->get_logname(),
enum_to_string(app->status));
- dwarn("stop downgrade primary as the partitions(%d.%d) is dropping", app->app_id, pidx);
+ LOG_WARNING(
+ "stop downgrade primary as the partitions(%d.%d) is dropping", app->app_id, pidx);
return;
} else {
- dwarn("gpid(%d.%d) is syncing another request with remote, cancel it due to the "
- "primary(%s) is down",
- pc.pid.get_app_id(),
- pc.pid.get_partition_index(),
- pc.primary.to_string());
+ LOG_WARNING("gpid(%d.%d) is syncing another request with remote, cancel it due to the "
+ "primary(%s) is down",
+ pc.pid.get_app_id(),
+ pc.pid.get_partition_index(),
+ pc.primary.to_string());
cc.cancel_sync();
}
}
@@ -1805,10 +1813,10 @@ void server_state::downgrade_secondary_to_inactive(std::shared_ptr<app_state> &a
request.node = node;
send_proposal(pc.primary, request);
} else {
- ddebug("gpid(%d.%d) is syncing with remote storage, ignore the remove seconary(%s)",
- app->app_id,
- pidx,
- node.to_string());
+ LOG_INFO("gpid(%d.%d) is syncing with remote storage, ignore the remove seconary(%s)",
+ app->app_id,
+ pidx,
+ node.to_string());
}
}
@@ -1844,12 +1852,12 @@ 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) {
- dwarn("gpid(%d.%d) is syncing another request with remote, cancel it due to meta is "
- "removing host(%s) worker(%s)",
- pc.pid.get_app_id(),
- pc.pid.get_partition_index(),
- req->host_node.to_string(),
- req->node.to_string());
+ LOG_WARNING("gpid(%d.%d) is syncing another request with remote, cancel it due to meta is "
+ "removing host(%s) worker(%s)",
+ pc.pid.get_app_id(),
+ pc.pid.get_partition_index(),
+ req->host_node.to_string(),
+ req->node.to_string());
cc.cancel_sync();
}
cc.stage = config_status::pending_remote_sync;
@@ -1874,20 +1882,20 @@ void server_state::on_update_configuration(
dassert(app->is_stateful, "don't support stateless apps currently, id(%d)", 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()) {
- ddebug("recv update config request: type(%s), %s",
- find_name->second,
- boost::lexical_cast<std::string>(*cfg_request).c_str());
+ LOG_INFO("recv update config request: type(%s), %s",
+ find_name->second,
+ boost::lexical_cast<std::string>(*cfg_request).c_str());
} else {
- ddebug("recv update config request: type(%d), %s",
- cfg_request->type,
- boost::lexical_cast<std::string>(*cfg_request).c_str());
+ LOG_INFO("recv update config request: type(%d), %s",
+ cfg_request->type,
+ boost::lexical_cast<std::string>(*cfg_request).c_str());
}
if (is_partition_config_equal(pc, cfg_request->config)) {
- ddebug("duplicated update request for gpid(%d.%d), ballot: %" PRId64 "",
- gpid.get_app_id(),
- gpid.get_partition_index(),
- pc.ballot);
+ LOG_INFO("duplicated update request for gpid(%d.%d), ballot: %" PRId64 "",
+ gpid.get_app_id(),
+ gpid.get_partition_index(),
+ pc.ballot);
response.err = ERR_OK;
//
// NOTICE:
@@ -1896,20 +1904,21 @@ void server_state::on_update_configuration(
//
response.config = pc;
} else if (pc.ballot + 1 != cfg_request->config.ballot) {
- ddebug("update configuration for gpid(%d.%d) reject coz ballot not match, request ballot: "
- "%" PRId64 ", meta ballot: %" PRId64 "",
- gpid.get_app_id(),
- gpid.get_partition_index(),
- cfg_request->config.ballot,
- pc.ballot);
+ LOG_INFO(
+ "update configuration for gpid(%d.%d) reject coz ballot not match, request ballot: "
+ "%" PRId64 ", meta ballot: %" PRId64 "",
+ gpid.get_app_id(),
+ gpid.get_partition_index(),
+ cfg_request->config.ballot,
+ pc.ballot);
response.err = ERR_INVALID_VERSION;
response.config = pc;
} else if (config_status::pending_remote_sync == cc.stage) {
- ddebug("another request is syncing with remote storage, ignore current request, "
- "gpid(%d.%d), request ballot(%" PRId64 ")",
- gpid.get_app_id(),
- gpid.get_partition_index(),
- cfg_request->config.ballot);
+ LOG_INFO("another request is syncing with remote storage, ignore current request, "
+ "gpid(%d.%d), request ballot(%" PRId64 ")",
+ gpid.get_app_id(),
+ gpid.get_partition_index(),
+ cfg_request->config.ballot);
// we don't reply the replica server, expect it to retry
msg->release_ref();
return;
@@ -1943,11 +1952,12 @@ 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)) {
- ddebug("gpid(%d.%d): secondary(%s) is down, ignored it due to no primary for this "
- "partition available",
- pc.pid.get_app_id(),
- pc.pid.get_partition_index(),
- address.to_string());
+ LOG_INFO(
+ "gpid(%d.%d): secondary(%s) is down, ignored it due to no primary for this "
+ "partition available",
+ pc.pid.get_app_id(),
+ pc.pid.get_partition_index(),
+ address.to_string());
} else {
dassert(false,
"no primary/secondary on this node, node address = %s",
@@ -1961,12 +1971,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)
{
- dinfo("change node(%s) state to %s", node.to_string(), is_alive ? "alive" : "dead");
+ LOG_DEBUG("change node(%s) state to %s", node.to_string(), is_alive ? "alive" : "dead");
zauto_write_lock l(_lock);
if (!is_alive) {
auto iter = _nodes.find(node);
if (iter == _nodes.end()) {
- ddebug("node(%s) doesn't exist in the node state, just ignore", node.to_string());
+ LOG_INFO("node(%s) doesn't exist in the node state, just ignore", node.to_string());
} else {
node_state &ns = iter->second;
ns.set_alive(false);
@@ -2023,10 +2033,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);
- ddebug("create app info from (%s) for id(%d): %s",
- replica_nodes[i].to_string(),
- info.app_id,
- boost::lexical_cast<std::string>(info).c_str());
+ LOG_INFO("create app info from (%s) for id(%d): %s",
+ replica_nodes[i].to_string(),
+ info.app_id,
+ boost::lexical_cast<std::string>(info).c_str());
_all_apps.emplace(app->app_id, app);
max_app_id = std::max(app->app_id, max_app_id);
} else {
@@ -2087,10 +2097,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) {
- dwarn("app(%d)'s old name(%s) is conflict with others, rename it to (%s)",
- app_id,
- old_name.c_str(),
- app->app_name.c_str());
+ LOG_WARNING("app(%d)'s old name(%s) is conflict with others, rename it to (%s)",
+ app_id,
+ old_name.c_str(),
+ app->app_name.c_str());
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;
@@ -2099,7 +2109,7 @@ server_state::construct_apps(const std::vector<query_app_info_response> &query_a
checked_names.emplace(app->app_name, app_id);
}
- ddebug("construct apps done, max_app_id = %d", max_app_id);
+ LOG_INFO("construct apps done, max_app_id = %d", max_app_id);
return dsn::ERR_OK;
}
@@ -2119,13 +2129,13 @@ error_code server_state::construct_partitions(
dassert(_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) {
- ddebug("accept replica(%s) from node(%s)",
- boost::lexical_cast<std::string>(r).c_str(),
- replica_nodes[i].to_string());
+ LOG_INFO("accept replica(%s) from node(%s)",
+ boost::lexical_cast<std::string>(r).c_str(),
+ replica_nodes[i].to_string());
} else {
- ddebug("ignore replica(%s) from node(%s)",
- boost::lexical_cast<std::string>(r).c_str(),
- replica_nodes[i].to_string());
+ LOG_INFO("ignore replica(%s) from node(%s)",
+ boost::lexical_cast<std::string>(r).c_str(),
+ replica_nodes[i].to_string());
}
}
}
@@ -2138,16 +2148,16 @@ error_code server_state::construct_partitions(
"invalid app status, status = %s",
enum_to_string(app->status));
if (app->status == app_status::AS_DROPPING) {
- ddebug("ignore constructing partitions for dropping app(%d)", app->app_id);
+ LOG_INFO("ignore constructing partitions for dropping app(%d)", 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) {
- ddebug("construct partition(%d.%d) succeed: %s",
- app->app_id,
- pc.pid.get_partition_index(),
- boost::lexical_cast<std::string>(pc).c_str());
+ LOG_INFO("construct partition(%d.%d) succeed: %s",
+ app->app_id,
+ pc.pid.get_partition_index(),
+ boost::lexical_cast<std::string>(pc).c_str());
if (pc.last_drops.size() + 1 < pc.max_replica_count) {
std::ostringstream oss;
oss << "WARNING: partition(" << app->app_id << "."
@@ -2158,9 +2168,9 @@ error_code server_state::construct_partitions(
}
succeed_count++;
} else {
- dwarn("construct partition(%d.%d) failed",
- app->app_id,
- pc.pid.get_partition_index());
+ LOG_WARNING("construct partition(%d.%d) failed",
+ app->app_id,
+ pc.pid.get_partition_index());
std::ostringstream oss;
if (skip_lost_partitions) {
oss << "WARNING: partition(" << app->app_id << "."
@@ -2181,11 +2191,12 @@ error_code server_state::construct_partitions(
}
}
- ddebug("construct partition done, succeed_count = %d, failed_count = %d, skip_lost_partitions "
- "= %s",
- succeed_count,
- failed_count,
- (skip_lost_partitions ? "true" : "false"));
+ LOG_INFO(
+ "construct partition done, succeed_count = %d, failed_count = %d, skip_lost_partitions "
+ "= %s",
+ succeed_count,
+ failed_count,
+ (skip_lost_partitions ? "true" : "false"));
if (failed_count > 0 && !skip_lost_partitions) {
return dsn::ERR_TRY_AGAIN;
@@ -2208,7 +2219,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) {
- ddebug("send query app and replica request to node(%s)", replica_nodes[i].to_string());
+ LOG_INFO("send query app and replica request to node(%s)", replica_nodes[i].to_string());
auto app_query_req = std::make_unique<query_app_info_request>();
app_query_req->meta_server = dsn_primary_address();
@@ -2218,7 +2229,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();
- ddebug(
+ LOG_INFO(
"received query app response from node(%s), err(%s), apps_count(%d)",
replica_nodes[i].to_string(),
err.to_string(),
@@ -2238,10 +2249,11 @@ 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();
- ddebug("received query replica response from node(%s), err(%s), replicas_count(%d)",
- replica_nodes[i].to_string(),
- err.to_string(),
- (int)resp.replicas.size());
+ LOG_INFO(
+ "received query replica response from node(%s), err(%s), replicas_count(%d)",
+ replica_nodes[i].to_string(),
+ err.to_string(),
+ (int)resp.replicas.size());
query_replica_errors[i] = err;
if (err == dsn::ERR_OK) {
query_replica_responses[i] = std::move(resp);
@@ -2255,15 +2267,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) {
- dwarn("query app info from node(%s) failed, reason: %s",
- replica_nodes[i].to_string(),
- query_app_errors[i].to_string());
+ LOG_WARNING("query app info from node(%s) failed, reason: %s",
+ replica_nodes[i].to_string(),
+ query_app_errors[i].to_string());
err = query_app_errors[i];
}
if (query_replica_errors[i] != dsn::ERR_OK) {
- dwarn("query replica info from node(%s) failed, reason: %s",
- replica_nodes[i].to_string(),
- query_replica_errors[i].to_string());
+ LOG_WARNING("query replica info from node(%s) failed, reason: %s",
+ replica_nodes[i].to_string(),
+ query_replica_errors[i].to_string());
err = query_replica_errors[i];
}
if (err != dsn::ERR_OK) {
@@ -2286,11 +2298,12 @@ server_state::sync_apps_from_replica_nodes(const std::vector<dsn::rpc_address> &
}
}
- ddebug("sync apps and replicas from replica nodes done, succeed_count = %d, failed_count = %d, "
- "skip_bad_nodes = %s",
- succeed_count,
- failed_count,
- (skip_bad_nodes ? "true" : "false"));
+ LOG_INFO(
+ "sync apps and replicas from replica nodes done, succeed_count = %d, failed_count = %d, "
+ "skip_bad_nodes = %s",
+ succeed_count,
+ failed_count,
+ (skip_bad_nodes ? "true" : "false"));
if (failed_count > 0 && !skip_bad_nodes) {
return dsn::ERR_TRY_AGAIN;
@@ -2300,14 +2313,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) {
- derror("construct apps failed, err = %s", err.to_string());
+ LOG_ERROR("construct apps failed, err = %s", err.to_string());
return err;
}
err = construct_partitions(
query_replica_responses, replica_nodes, skip_lost_partitions, hint_message);
if (err != dsn::ERR_OK) {
- derror("construct partitions failed, err = %s", err.to_string());
+ LOG_ERROR("construct partitions failed, err = %s", err.to_string());
return err;
}
@@ -2317,16 +2330,16 @@ 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)
{
- ddebug("start recovery, node_count = %d, skip_bad_nodes = %s, skip_lost_partitions = %s",
- (int)req.recovery_set.size(),
- req.skip_bad_nodes ? "true" : "false",
- req.skip_lost_partitions ? "true" : "false");
+ LOG_INFO("start recovery, node_count = %d, skip_bad_nodes = %s, skip_lost_partitions = %s",
+ (int)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) {
- derror("sync apps from replica nodes failed when do recovery, err = %s",
- resp.err.to_string());
+ LOG_ERROR("sync apps from replica nodes failed when do recovery, err = %s",
+ resp.err.to_string());
_all_apps.clear();
return;
}
@@ -2344,7 +2357,7 @@ void server_state::on_start_recovery(const configuration_recovery_request &req,
void server_state::clear_proposals()
{
- ddebug("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;
@@ -2358,9 +2371,10 @@ bool server_state::can_run_balancer()
for (auto iter = _nodes.begin(); iter != _nodes.end();) {
if (!iter->second.alive()) {
if (iter->second.partition_count() != 0) {
- ddebug("don't do replica migration coz dead node(%s) has %d partitions not removed",
- iter->second.addr().to_string(),
- iter->second.partition_count());
+ LOG_INFO(
+ "don't do replica migration coz dead node(%s) has %d partitions not removed",
+ iter->second.addr().to_string(),
+ iter->second.partition_count());
return false;
}
_nodes.erase(iter++);
@@ -2371,7 +2385,7 @@ bool server_state::can_run_balancer()
// table stability check
int c = count_staging_app();
if (c != 0) {
- ddebug("don't do replica migration coz %d table(s) is(are) in staging state", c);
+ LOG_INFO("don't do replica migration coz %d table(s) is(are) in staging state", c);
return false;
}
return true;
@@ -2410,14 +2424,14 @@ bool server_state::check_all_partitions()
// first the cure stage
if (level <= meta_function_level::fl_freezed) {
- ddebug("service is in level(%s), don't do any cure or balancer actions",
- _meta_function_level_VALUES_TO_NAMES.find(level)->second);
+ LOG_INFO("service is in level(%s), don't do any cure or balancer actions",
+ _meta_function_level_VALUES_TO_NAMES.find(level)->second);
return false;
}
- ddebug("start to check all partitions, add_secondary_enable_flow_control = %s, "
- "add_secondary_max_count_for_one_node = %d",
- _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 = %s, "
+ "add_secondary_max_count_for_one_node = %d",
+ _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;
@@ -2427,10 +2441,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) {
- ddebug("ignore app(%s)(%d) because it's status is %s",
- app->app_name.c_str(),
- app->app_id,
- ::dsn::enum_to_string(app->status));
+ LOG_INFO("ignore app(%s)(%d) because it's status is %s",
+ app->app_name.c_str(),
+ app->app_id,
+ ::dsn::enum_to_string(app->status));
continue;
}
for (unsigned int i = 0; i != app->partition_count; ++i) {
@@ -2441,10 +2455,10 @@ 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);
- dinfo("gpid(%d.%d) is in status(%s)",
- pc.pid.get_app_id(),
- pc.pid.get_partition_index(),
- enum_to_string(s));
+ LOG_DEBUG("gpid(%d.%d) is in status(%s)",
+ pc.pid.get_app_id(),
+ pc.pid.get_partition_index(),
+ enum_to_string(s));
if (pc_status::healthy != s) {
if (action.type != config_type::CT_INVALID) {
if (action.type == config_type::CT_ADD_SECONDARY ||
@@ -2461,9 +2475,9 @@ bool server_state::check_all_partitions()
healthy_partitions++;
}
} else {
- ddebug("ignore gpid(%d.%d) as it's stage is pending_remote_sync",
- pc.pid.get_app_id(),
- pc.pid.get_partition_index());
+ LOG_INFO("ignore gpid(%d.%d) as it's stage is pending_remote_sync",
+ pc.pid.get_app_id(),
+ pc.pid.get_partition_index());
}
}
total_partitions += app->partition_count;
@@ -2496,13 +2510,14 @@ 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) {
- ddebug("do not send %s proposal for gpid(%d.%d) for flow control reason, target = "
- "%s, node = %s",
- ::dsn::enum_to_string(action.type),
- pc.pid.get_app_id(),
- pc.pid.get_partition_index(),
- action.target.to_string(),
- action.node.to_string());
+ LOG_INFO(
+ "do not send %s proposal for gpid(%d.%d) for flow control reason, target = "
+ "%s, node = %s",
+ ::dsn::enum_to_string(action.type),
+ pc.pid.get_app_id(),
+ pc.pid.get_partition_index(),
+ action.target.to_string(),
+ action.node.to_string());
continue;
}
std::shared_ptr<app_state> app = get_app(pid.get_app_id());
@@ -2523,43 +2538,43 @@ bool server_state::check_all_partitions()
}
}
- ddebug("check all partitions done, send_proposal_count = %d, add_secondary_count = %d, "
- "ignored_add_secondary_count = %d",
- send_proposal_count,
- add_secondary_count,
- ignored_add_secondary_count);
+ LOG_INFO("check all partitions done, send_proposal_count = %d, add_secondary_count = %d, "
+ "ignored_add_secondary_count = %d",
+ send_proposal_count,
+ add_secondary_count,
+ ignored_add_secondary_count);
// then the balancer stage
if (level < meta_function_level::fl_steady) {
- ddebug("don't do replica migration coz meta server is in level(%s)",
- _meta_function_level_VALUES_TO_NAMES.find(level)->second);
+ LOG_INFO("don't do replica migration coz meta server is in level(%s)",
+ _meta_function_level_VALUES_TO_NAMES.find(level)->second);
return false;
}
if (healthy_partitions != total_partitions) {
- ddebug("don't do replica migration coz %d of %d partitions aren't healthy",
- total_partitions - healthy_partitions,
- total_partitions);
+ LOG_INFO("don't do replica migration coz %d of %d partitions aren't healthy",
+ total_partitions - healthy_partitions,
+ total_partitions);
return false;
}
if (!can_run_balancer()) {
- ddebug("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) {
- ddebug("check if any replica migration can be done when meta server is in level(%s)",
- _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(%s)",
+ _meta_function_level_VALUES_TO_NAMES.find(level)->second);
_meta_svc->get_balancer()->check({&_all_apps, &_nodes}, _temporary_list);
- ddebug("balance checker operation count = %d", _temporary_list.size());
+ LOG_INFO("balance checker operation count = %d", _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)) {
- ddebug("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);
@@ -2571,9 +2586,9 @@ bool server_state::check_all_partitions()
return false;
}
- ddebug("check if any replica migration left");
+ LOG_INFO("check if any replica migration left");
_meta_svc->get_balancer()->check({&_all_apps, &_nodes}, _temporary_list);
- ddebug("balance checker operation count = %d", _temporary_list.size());
+ LOG_INFO("balance checker operation count = %d", _temporary_list.size());
// update balance checker operation count
_meta_svc->get_balancer()->report(_temporary_list, true);
@@ -2665,8 +2680,9 @@ void server_state::do_update_app_info(const std::string &app_path,
if (ec == ERR_OK) {
user_cb(ec);
} else if (ec == ERR_TIMEOUT) {
- dwarn("update app_info(app = %s) to remote storage timeout, continue to update later",
- info.app_name.c_str());
+ LOG_WARNING(
+ "update app_info(app = %s) to remote storage timeout, continue to update later",
+ info.app_name.c_str());
tasking::enqueue(
LPC_META_STATE_NORMAL,
tracker(),
@@ -2690,7 +2706,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;
- dwarn("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;
@@ -2709,10 +2725,10 @@ void server_state::set_app_envs(const app_env_rpc &env_rpc)
os << keys[i] << "=" << values[i];
}
- ddebug("set app envs for app(%s) from remote(%s): kvs = {%s}",
- app_name.c_str(),
- env_rpc.remote_address().to_string(),
- os.str().c_str());
+ LOG_INFO("set app envs for app(%s) from remote(%s): kvs = {%s}",
+ app_name.c_str(),
+ env_rpc.remote_address().to_string(),
+ os.str().c_str());
app_info ainfo;
std::string app_path;
@@ -2720,7 +2736,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) {
- dwarn("set app envs failed with invalid app_name(%s)", app_name.c_str());
+ LOG_WARNING("set app envs failed with invalid app_name(%s)", app_name.c_str());
env_rpc.response().err = ERR_INVALID_PARAMETERS;
env_rpc.response().hint_message = "invalid app name";
return;
@@ -2743,9 +2759,9 @@ 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, ',', '=');
- ddebug("app envs changed: old_envs = {%s}, new_envs = {%s}",
- old_envs.c_str(),
- new_envs.c_str());
+ LOG_INFO("app envs changed: old_envs = {%s}, new_envs = {%s}",
+ old_envs.c_str(),
+ new_envs.c_str());
});
}
@@ -2754,7 +2770,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;
- dwarn("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;
@@ -2766,10 +2782,10 @@ void server_state::del_app_envs(const app_env_rpc &env_rpc)
os << ",";
os << keys[i];
}
- ddebug("del app envs for app(%s) from remote(%s): keys = {%s}",
- app_name.c_str(),
- env_rpc.remote_address().to_string(),
- os.str().c_str());
+ LOG_INFO("del app envs for app(%s) from remote(%s): keys = {%s}",
+ app_name.c_str(),
+ env_rpc.remote_address().to_string(),
+ os.str().c_str());
app_info ainfo;
std::string app_path;
@@ -2777,7 +2793,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) {
- dwarn("del app envs failed with invalid app_name(%s)", app_name.c_str());
+ LOG_WARNING("del app envs failed with invalid app_name(%s)", app_name.c_str());
env_rpc.response().err = ERR_INVALID_PARAMETERS;
env_rpc.response().hint_message = "invalid app name";
return;
@@ -2798,7 +2814,7 @@ void server_state::del_app_envs(const app_env_rpc &env_rpc)
}
if (deleted == 0) {
- ddebug("no key need to delete");
+ LOG_INFO("no key need to delete");
env_rpc.response().hint_message = "no key need to delete";
return;
} else {
@@ -2816,9 +2832,9 @@ 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, ',', '=');
- ddebug("app envs changed: old_envs = {%s}, new_envs = {%s}",
- old_envs.c_str(),
- new_envs.c_str());
+ LOG_INFO("app envs changed: old_envs = {%s}, new_envs = {%s}",
+ old_envs.c_str(),
+ new_envs.c_str());
});
}
@@ -2827,16 +2843,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;
- dwarn("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;
- ddebug("clear app envs for app(%s) from remote(%s): prefix = {%s}",
- app_name.c_str(),
- env_rpc.remote_address().to_string(),
- prefix.c_str());
+ LOG_INFO("clear app envs for app(%s) from remote(%s): prefix = {%s}",
+ app_name.c_str(),
+ env_rpc.remote_address().to_string(),
+ prefix.c_str());
app_info ainfo;
std::string app_path;
@@ -2844,7 +2860,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) {
- dwarn("clear app envs failed with invalid app_name(%s)", app_name.c_str());
+ LOG_WARNING("clear app envs failed with invalid app_name(%s)", app_name.c_str());
env_rpc.response().err = ERR_INVALID_PARAMETERS;
env_rpc.response().hint_message = "invalid app name";
return;
@@ -2855,7 +2871,7 @@ void server_state::clear_app_envs(const app_env_rpc &env_rpc)
}
if (ainfo.envs.empty()) {
- ddebug("no key need to delete");
+ LOG_INFO("no key need to delete");
env_rpc.response().hint_message = "no key need to delete";
return;
}
@@ -2890,7 +2906,7 @@ void server_state::clear_app_envs(const app_env_rpc &env_rpc)
if (!prefix.empty() && erase_keys.empty()) {
// no need update app_info
- ddebug("no key need to delete");
+ LOG_INFO("no key need to delete");
env_rpc.response().hint_message = "no key need to delete";
return;
} else {
@@ -2914,9 +2930,9 @@ void server_state::clear_app_envs(const app_env_rpc &env_rpc)
}
}
std::string new_envs = dsn::utils::kv_map_to_string(app->envs, ',', '=');
- ddebug("app envs changed: old_envs = {%s}, new_envs = {%s}",
- old_envs.c_str(),
- new_envs.c_str());
+ LOG_INFO("app envs changed: old_envs = {%s}, new_envs = {%s}",
+ old_envs.c_str(),
+ new_envs.c_str());
});
}
diff --git a/src/meta/server_state_restore.cpp b/src/meta/server_state_restore.cpp
index d4c6f1205..8fc6b43b3 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) {
- derror("acquire block_filesystem(%s) failed", request.backup_provider_name.c_str());
+ LOG_ERROR("acquire block_filesystem(%s) failed", request.backup_provider_name.c_str());
callback_tsk->enqueue_with(ERR_INVALID_PARAMETERS, dsn::blob());
return;
}
@@ -151,7 +151,8 @@ 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) {
- derror("sync app_info_data from backup media failed with err(%s)", err.to_string());
+ LOG_ERROR("sync app_info_data from backup media failed with err(%s)",
+ err.to_string());
ec = err;
} else {
auto pair = restore_app_info(msg, request, app_info_data);
@@ -199,11 +200,11 @@ void server_state::on_recv_restore_report(configuration_report_restore_status_rp
if (request.__isset.reason) {
r_state.reason = request.reason;
}
- ddebug("%d.%d restore report: restore_status(%s), progress(%d)",
- request.pid.get_app_id(),
- request.pid.get_partition_index(),
- request.restore_status.to_string(),
- request.progress);
+ LOG_INFO("%d.%d restore report: restore_status(%s), progress(%d)",
+ request.pid.get_app_id(),
+ request.pid.get_partition_index(),
+ request.restore_status.to_string(),
+ request.progress);
}
}
diff --git a/src/meta/test/backup_test.cpp b/src/meta/test/backup_test.cpp
index 6bca5956d..0baaaa5ed 100644
--- a/src/meta/test/backup_test.cpp
+++ b/src/meta/test/backup_test.cpp
@@ -77,7 +77,7 @@ protected:
MOCK_HELPER_FUNCS(method_name) \
void method_name() \
{ \
- ddebug("%s is called", #method_name); \
+ LOG_INFO("%s is called", #method_name); \
int &c = counter_##method_name(); \
++c; \
int max_call = maxcall_##method_name(); \
@@ -93,7 +93,7 @@ protected:
MOCK_HELPER_FUNCS(method_name) \
void method_name(type1 arg1) \
{ \
- ddebug("%s is called", #method_name); \
+ LOG_INFO("%s is called", #method_name); \
int &c = counter_##method_name(); \
++c; \
int max_call = maxcall_##method_name(); \
@@ -109,7 +109,7 @@ protected:
MOCK_HELPER_FUNCS(method_name) \
void method_name(type1 arg1, type2 arg2) \
{ \
- ddebug("%s is called", #method_name); \
+ LOG_INFO("%s is called", #method_name); \
int &c = counter_##method_name(); \
++c; \
int max_call = maxcall_##method_name(); \
@@ -125,7 +125,7 @@ protected:
MOCK_HELPER_FUNCS(method_name) \
void method_name(type1 arg1, type2 arg2, type3, arg3) \
{ \
- ddebug("%s is called", #method_name); \
+ LOG_INFO("%s 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 90197af1d..710d9d610 100644
--- a/src/meta/test/balancer_simulator/balancer_simulator.cpp
+++ b/src/meta/test/balancer_simulator/balancer_simulator.cpp
@@ -177,7 +177,7 @@ void greedy_balancer_perfect_move_primary()
migration_list ml;
glb.check({&apps, &nodes}, ml);
- dinfo("balance checker operation count = %d", ml.size());
+ LOG_DEBUG("balance checker operation count = %d", ml.size());
int i = 0;
while (glb.balance({&apps, &nodes}, ml)) {
@@ -188,7 +188,7 @@ void greedy_balancer_perfect_move_primary()
}
}
glb.check({&apps, &nodes}, ml);
- dinfo("round %d: balance checker operation count = %d", ++i, ml.size());
+ LOG_DEBUG("round %d: balance checker operation count = %d", ++i, ml.size());
}
}
diff --git a/src/meta/test/balancer_validator.cpp b/src/meta/test/balancer_validator.cpp
index aaa4dbfa3..10a33d0a1 100644
--- a/src/meta/test/balancer_validator.cpp
+++ b/src/meta/test/balancer_validator.cpp
@@ -263,25 +263,25 @@ void meta_service_test_app::balancer_validator()
migration_list ml;
for (auto &iter : nodes) {
- dinfo("node(%s) have %d primaries, %d partitions",
- iter.first.to_string(),
- iter.second.primary_count(),
- iter.second.partition_count());
+ LOG_DEBUG("node(%s) have %d primaries, %d partitions",
+ iter.first.to_string(),
+ iter.second.primary_count(),
+ iter.second.partition_count());
}
// iterate 1000000 times
for (int i = 0; i < 1000000 && glb.balance({&apps, &nodes}, ml); ++i) {
- dinfo("the %dth round of balancer", i);
+ LOG_DEBUG("the %dth round of balancer", i);
migration_check_and_apply(apps, nodes, ml, &manager);
glb.check({&apps, &nodes}, ml);
- dinfo("balance checker operation count = %d", ml.size());
+ LOG_DEBUG("balance checker operation count = %d", ml.size());
}
for (auto &iter : nodes) {
- dinfo("node(%s) have %d primaries, %d partitions",
- iter.first.to_string(),
- iter.second.primary_count(),
- iter.second.partition_count());
+ LOG_DEBUG("node(%s) have %d primaries, %d partitions",
+ iter.first.to_string(),
+ iter.second.primary_count(),
+ iter.second.partition_count());
}
std::shared_ptr<app_state> &the_app = apps[1];
@@ -369,10 +369,10 @@ void meta_service_test_app::balance_config_file()
// iterate 1000 times
for (int i = 0; i < 1000 && lb->balance({&apps, &nodes}, ml); ++i) {
- dinfo("the %dth round of balancer", i);
+ LOG_DEBUG("the %dth round of balancer", i);
migration_check_and_apply(apps, nodes, ml, nullptr);
lb->check({&apps, &nodes}, ml);
- dinfo("balance checker operation count = %d", ml.size());
+ LOG_DEBUG("balance checker operation count = %d", ml.size());
}
}
}
diff --git a/src/meta/test/main.cpp b/src/meta/test/main.cpp
index fc85a7d75..4f03b487d 100644
--- a/src/meta/test/main.cpp
+++ b/src/meta/test/main.cpp
@@ -85,7 +85,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);
- derror("initial seed: %u", seed);
+ LOG_ERROR("initial seed: %u", seed);
}
srand(seed);
diff --git a/src/meta/test/meta_state/config-test.ini b/src/meta/test/meta_state/config-test.ini
index 75f4fe553..7d438a9ac 100644
--- a/src/meta/test/meta_state/config-test.ini
+++ b/src/meta/test/meta_state/config-test.ini
@@ -54,7 +54,7 @@ tool = nativerun
;fault_injector
pause_on_start = false
-logging_start_level = LOG_LEVEL_INFORMATION
+logging_start_level = LOG_LEVEL_DEBUG
logging_factory_name = dsn::tools::simple_logger
diff --git a/src/meta/test/meta_state/meta_state_service.cpp b/src/meta/test/meta_state/meta_state_service.cpp
index 4b9e3ed37..3ca847479 100644
--- a/src/meta/test/meta_state/meta_state_service.cpp
+++ b/src/meta/test/meta_state/meta_state_service.cpp
@@ -256,7 +256,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) { ddebug("result: %s", ec.to_string()); })
+ [](error_code ec) { LOG_INFO("result: %s", ec.to_string()); })
->wait();
service->create_node(
"/r",
diff --git a/src/meta/test/misc/misc.cpp b/src/meta/test/misc/misc.cpp
index b9c4eafdc..8d6ee7ee3 100644
--- a/src/meta/test/misc/misc.cpp
+++ b/src/meta/test/misc/misc.cpp
@@ -164,7 +164,7 @@ void generate_apps(/*out*/ dsn::replication::app_mapper &mapper,
if (generate_serving_info) {
generate_app_serving_replica_info(the_app, disks_per_node);
}
- dinfo("generated app, partitions(%d)", info.partition_count);
+ LOG_DEBUG("generated app, partitions(%d)", info.partition_count);
mapper.emplace(the_app->app_id, the_app);
}
}
@@ -202,7 +202,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());
- dinfo("concat pid_dir(%s) of node(%s)", pid_dir, ns.addr().to_string());
+ LOG_DEBUG("concat pid_dir(%s) of node(%s)", pid_dir, ns.addr().to_string());
manager.add_replica(pid, pid_dir);
return true;
});
@@ -357,10 +357,10 @@ 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;
- dinfo("the %dth round of proposal, gpid(%d.%d)",
- i++,
- proposal->gpid.get_app_id(),
- proposal->gpid.get_partition_index());
+ LOG_DEBUG("the %dth round of proposal, gpid(%d.%d)",
+ i++,
+ proposal->gpid.get_app_id(),
+ proposal->gpid.get_partition_index());
std::shared_ptr<app_state> &the_app = apps.find(proposal->gpid.get_app_id())->second;
ASSERT_EQ(proposal->gpid.get_app_id(), the_app->app_id);
@@ -376,11 +376,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];
- dinfo("the %dth round of action, type: %s, node: %s, target: %s",
- j,
- dsn::enum_to_string(act.type),
- act.node.to_string(),
- act.target.to_string());
+ LOG_DEBUG("the %dth round of action, type: %s, node: %s, target: %s",
+ j,
+ dsn::enum_to_string(act.type),
+ act.node.to_string(),
+ act.target.to_string());
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 b627a32fe..fbb501823 100644
--- a/src/meta/test/update_configuration_test.cpp
+++ b/src/meta/test/update_configuration_test.cpp
@@ -126,7 +126,7 @@ class null_meta_service : public dsn::replication::meta_service
public:
void send_message(const dsn::rpc_address &target, dsn::message_ex *request)
{
- ddebug("send request to %s", target.to_string());
+ LOG_INFO("send request to %s", target.to_string());
request->add_ref();
request->release_ref();
}
diff --git a/src/nfs/nfs_client_impl.cpp b/src/nfs/nfs_client_impl.cpp
index a9a14cf86..7b728f85c 100644
--- a/src/nfs/nfs_client_impl.cpp
+++ b/src/nfs/nfs_client_impl.cpp
@@ -152,20 +152,20 @@ void nfs_client_impl::end_get_file_size(::dsn::error_code err,
const user_request_ptr &ureq)
{
if (err != ::dsn::ERR_OK) {
- derror("{nfs_service} remote get file size failed, source = %s, dir = %s, err = %s",
- ureq->file_size_req.source.to_string(),
- ureq->file_size_req.source_dir.c_str(),
- err.to_string());
+ LOG_ERROR("{nfs_service} remote get file size failed, source = %s, dir = %s, err = %s",
+ ureq->file_size_req.source.to_string(),
+ ureq->file_size_req.source_dir.c_str(),
+ err.to_string());
ureq->nfs_task->enqueue(err, 0);
return;
}
err = dsn::error_code(resp.error);
if (err != ::dsn::ERR_OK) {
- derror("{nfs_service} remote get file size failed, source = %s, dir = %s, err = %s",
- ureq->file_size_req.source.to_string(),
- ureq->file_size_req.source_dir.c_str(),
- err.to_string());
+ LOG_ERROR("{nfs_service} remote get file size failed, source = %s, dir = %s, err = %s",
+ ureq->file_size_req.source.to_string(),
+ ureq->file_size_req.source_dir.c_str(),
+ err.to_string());
ureq->nfs_task->enqueue(err, 0);
return;
}
@@ -338,13 +338,13 @@ void nfs_client_impl::end_copy(::dsn::error_code err,
if (!fc->user_req->is_finished) {
if (reqc->retry_count > 0) {
- dwarn("{nfs_service} remote copy failed, source = %s, dir = %s, file = %s, "
- "err = %s, retry_count = %d",
- fc->user_req->file_size_req.source.to_string(),
- fc->user_req->file_size_req.source_dir.c_str(),
- fc->file_name.c_str(),
- err.to_string(),
- reqc->retry_count);
+ LOG_WARNING("{nfs_service} remote copy failed, source = %s, dir = %s, file = %s, "
+ "err = %s, retry_count = %d",
+ fc->user_req->file_size_req.source.to_string(),
+ fc->user_req->file_size_req.source_dir.c_str(),
+ fc->file_name.c_str(),
+ err.to_string(),
+ reqc->retry_count);
// retry copy
reqc->retry_count--;
@@ -356,13 +356,13 @@ void nfs_client_impl::end_copy(::dsn::error_code err,
else
_copy_requests_low.push_retry(reqc);
} else {
- derror("{nfs_service} remote copy failed, source = %s, dir = %s, file = %s, "
- "err = %s, retry_count = %d",
- fc->user_req->file_size_req.source.to_string(),
- fc->user_req->file_size_req.source_dir.c_str(),
- fc->file_name.c_str(),
- err.to_string(),
- reqc->retry_count);
+ LOG_ERROR("{nfs_service} remote copy failed, source = %s, dir = %s, file = %s, "
+ "err = %s, retry_count = %d",
+ fc->user_req->file_size_req.source.to_string(),
+ fc->user_req->file_size_req.source_dir.c_str(),
+ fc->file_name.c_str(),
+ err.to_string(),
+ reqc->retry_count);
handle_completion(fc->user_req, err);
}
@@ -464,7 +464,7 @@ void nfs_client_impl::continue_write()
if (!fc->file_holder->file_handle) {
--_concurrent_local_write_count;
- derror("open file %s failed", file_path.c_str());
+ LOG_ERROR("open file %s failed", file_path.c_str());
handle_completion(fc->user_req, ERR_FILE_OPERATION_FAILED);
} else {
zauto_lock l(reqc->lock);
@@ -505,10 +505,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();
- derror("{nfs_service} local write failed, dir = %s, file = %s, err = %s",
- fc->user_req->file_size_req.dst_dir.c_str(),
- fc->file_name.c_str(),
- err.to_string());
+ LOG_ERROR("{nfs_service} local write failed, dir = %s, file = %s, err = %s",
+ fc->user_req->file_size_req.dst_dir.c_str(),
+ fc->file_name.c_str(),
+ err.to_string());
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 ae41d7f2f..3331b77be 100644
--- a/src/nfs/nfs_server_impl.cpp
+++ b/src/nfs/nfs_server_impl.cpp
@@ -72,7 +72,7 @@ nfs_service_impl::nfs_service_impl() : ::dsn::serverlet<nfs_service_impl>("nfs")
void nfs_service_impl::on_copy(const ::dsn::service::copy_request &request,
::dsn::rpc_replier<::dsn::service::copy_response> &reply)
{
- // dinfo(">>> on call RPC_COPY end, exec RPC_NFS_COPY");
+ // LOG_DEBUG(">>> on call RPC_COPY end, exec RPC_NFS_COPY");
std::string file_path =
dsn::utils::filesystem::path_combine(request.source_dir, request.file_name);
@@ -101,13 +101,13 @@ void nfs_service_impl::on_copy(const ::dsn::service::copy_request &request,
}
}
- dinfo("nfs: copy file %s [%" PRId64 ", %" PRId64 ")",
- file_path.c_str(),
- request.offset,
- request.offset + request.size);
+ LOG_DEBUG("nfs: copy file %s [%" PRId64 ", %" PRId64 ")",
+ file_path.c_str(),
+ request.offset,
+ request.offset + request.size);
if (hfile == 0) {
- derror("{nfs_service} open file %s failed", file_path.c_str());
+ LOG_ERROR("{nfs_service} open file %s failed", file_path.c_str());
::dsn::service::copy_response resp;
resp.error = ERR_OBJECT_NOT_FOUND;
reply(resp);
@@ -154,7 +154,7 @@ void nfs_service_impl::internal_read_callback(error_code err, size_t sz, callbac
}
if (err != ERR_OK) {
- derror(
+ LOG_ERROR(
"{nfs_service} read file %s failed, err = %s", cp.file_path.c_str(), err.to_string());
_recent_copy_fail_count->increment();
} else {
@@ -175,7 +175,7 @@ void nfs_service_impl::on_get_file_size(
const ::dsn::service::get_file_size_request &request,
::dsn::rpc_replier<::dsn::service::get_file_size_response> &reply)
{
- // dinfo(">>> on call RPC_NFS_GET_FILE_SIZE end, exec RPC_NFS_GET_FILE_SIZE");
+ // LOG_DEBUG(">>> on call RPC_NFS_GET_FILE_SIZE end, exec RPC_NFS_GET_FILE_SIZE");
get_file_size_response resp;
error_code err = ERR_OK;
@@ -184,11 +184,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)) {
- derror("{nfs_service} directory %s not exist", folder.c_str());
+ LOG_ERROR("{nfs_service} directory %s not exist", folder.c_str());
err = ERR_OBJECT_NOT_FOUND;
} else {
if (!dsn::utils::filesystem::get_subfiles(folder, file_list, true)) {
- derror("{nfs_service} get subfiles of directory %s failed", folder.c_str());
+ LOG_ERROR("{nfs_service} get subfiles of directory %s failed", folder.c_str());
err = ERR_FILE_OPERATION_FAILED;
} else {
for (auto &fpath : file_list) {
@@ -196,7 +196,7 @@ void nfs_service_impl::on_get_file_size(
// Done
int64_t sz;
if (!dsn::utils::filesystem::file_size(fpath, sz)) {
- derror("{nfs_service} get size of file %s failed", fpath.c_str());
+ LOG_ERROR("{nfs_service} get size of file %s failed", fpath.c_str());
err = ERR_FILE_OPERATION_FAILED;
break;
}
@@ -216,9 +216,9 @@ void nfs_service_impl::on_get_file_size(
struct stat st;
if (0 != ::stat(file_path.c_str(), &st)) {
- derror("{nfs_service} get stat of file %s failed, err = %s",
- file_path.c_str(),
- strerror(errno));
+ LOG_ERROR("{nfs_service} get stat of file %s failed, err = %s",
+ file_path.c_str(),
+ strerror(errno));
err = ERR_OBJECT_NOT_FOUND;
break;
}
@@ -248,7 +248,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) {
- dinfo("nfs: close file handle %s", it->first.c_str());
+ LOG_DEBUG("nfs: close file handle %s", it->first.c_str());
it = _handles_map.erase(it);
} else
it++;
diff --git a/src/perf_counter/builtin_counters.cpp b/src/perf_counter/builtin_counters.cpp
index 0855b1a79..ea0bf6f1d 100644
--- a/src/perf_counter/builtin_counters.cpp
+++ b/src/perf_counter/builtin_counters.cpp
@@ -47,6 +47,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);
- ddebug("memused_virt = %" PRIu64 " MB, memused_res = %" PRIu64 "MB", memused_virt, memused_res);
+ LOG_INFO(
+ "memused_virt = %" PRIu64 " MB, memused_res = %" PRIu64 "MB", memused_virt, memused_res);
}
}
diff --git a/src/perf_counter/perf_counter_atomic.h b/src/perf_counter/perf_counter_atomic.h
index a21cce8b4..586ddd574 100644
--- a/src/perf_counter/perf_counter_atomic.h
+++ b/src/perf_counter/perf_counter_atomic.h
@@ -438,8 +438,8 @@ private:
void on_timer(std::shared_ptr<boost::asio::deadline_timer> timer,
const boost::system::error_code &ec)
{
- // as the callback is not in tls context, so the log system calls like ddebug, dassert will
- // cause a lock
+ // as the callback is not in tls context, so the log system calls like LOG_INFO, dassert
+ // will cause a lock
if (!ec) {
calc(boost::make_shared<compute_context>());
diff --git a/src/perf_counter/perf_counters.cpp b/src/perf_counter/perf_counters.cpp
index f184106d8..99ba217bc 100644
--- a/src/perf_counter/perf_counters.cpp
+++ b/src/perf_counter/perf_counters.cpp
@@ -167,7 +167,7 @@ bool perf_counters::remove_counter(const char *full_name)
}
}
- dinfo("performance counter %s is removed, remaining reference (%d)", full_name, remain_ref);
+ LOG_DEBUG("performance counter %s is removed, remaining reference (%d)", 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 81f7246d0..6944ad6b6 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);
- ddebug("%lf", counter->get_value());
+ LOG_INFO("%lf", 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);
- ddebug("%lf", counter->get_value());
+ LOG_INFO("%lf", 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);
- ddebug("%lf", counter->get_value());
+ LOG_INFO("%lf", 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)
- ddebug("%lf", counter->get_percentile((dsn_perf_counter_percentile_type_t)i));
+ LOG_INFO("%lf", 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 cce6b97c3..88e939828 100644
--- a/src/redis_protocol/proxy_lib/proxy_layer.cpp
+++ b/src/redis_protocol/proxy_lib/proxy_layer.cpp
@@ -92,10 +92,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()) {
- dwarn("%s has been removed from proxy stub", remote_address.to_string());
+ LOG_WARNING("%s has been removed from proxy stub", remote_address.to_string());
return;
}
- ddebug("remove %s from proxy stub", remote_address.to_string());
+ LOG_INFO("remove %s from proxy stub", remote_address.to_string());
session = std::move(iter->second);
_sessions.erase(iter);
}
@@ -117,7 +117,7 @@ proxy_session::proxy_session(proxy_stub *op, dsn::message_ex *first_msg)
proxy_session::~proxy_session()
{
_backup_one_request->release_ref();
- ddebug("proxy session %s destroyed", _remote_address.to_string());
+ LOG_INFO("proxy session %s destroyed", _remote_address.to_string());
}
void proxy_session::on_recv_request(dsn::message_ex *msg)
@@ -131,11 +131,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)) {
- derror("%s: got invalid message, try to remove proxy session from proxy stub",
- _remote_address.to_string());
+ LOG_ERROR("%s: got invalid message, try to remove proxy session from proxy stub",
+ _remote_address.to_string());
_stub->remove_session(_remote_address);
- derror("close the rpc session %s", _remote_address.to_string());
+ LOG_ERROR("close the rpc session %s", _remote_address.to_string());
((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 4f41e14ec..cb297c9c6 100644
--- a/src/redis_protocol/proxy_lib/redis_parser.cpp
+++ b/src/redis_protocol/proxy_lib/redis_parser.cpp
@@ -95,7 +95,7 @@ redis_parser::~redis_parser()
{
clear_reply_queue();
reset_parser();
- ddebug("%s: redis parser destroyed", _remote_address.to_string());
+ LOG_INFO("%s: redis parser destroyed", _remote_address.to_string());
}
void redis_parser::prepare_current_buffer()
@@ -425,9 +425,9 @@ void redis_parser::set_internal(redis_parser::message_entry &entry)
{
redis_request &request = entry.request;
if (request.sub_requests.size() < 3) {
- ddebug("%s: set command with invalid arguments, seqid(%" PRId64 ")",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_INFO("%s: set command with invalid arguments, seqid(%" PRId64 ")",
+ _remote_address.to_string(),
+ entry.sequence_id);
simple_error_reply(entry, "wrong number of arguments for 'set' command");
} else {
int ttl_seconds = 0;
@@ -435,15 +435,16 @@ void redis_parser::set_internal(redis_parser::message_entry &entry)
// with a reference to prevent the object from being destroyed
std::shared_ptr<proxy_session> ref_this = shared_from_this();
- dinfo("%s: send set command(%" PRId64 ")", _remote_address.to_string(), entry.sequence_id);
+ LOG_DEBUG(
+ "%s: send set command(%" PRId64 ")", _remote_address.to_string(), entry.sequence_id);
auto on_set_reply = [ref_this, this, &entry](
::dsn::error_code ec, dsn::message_ex *, dsn::message_ex *response) {
// when the "is_session_reset" flag is set, the socket may be broken.
// so continue to reply the message is not necessary
if (_is_session_reset.load(std::memory_order_acquire)) {
- ddebug("%s: set command seqid(%" PRId64 ") got reply, but session has reset",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_INFO("%s: set command seqid(%" PRId64 ") got reply, but session has reset",
+ _remote_address.to_string(),
+ entry.sequence_id);
return;
}
@@ -452,14 +453,14 @@ void redis_parser::set_internal(redis_parser::message_entry &entry)
//
// currently we only clear an entry when it is replied or
// in the redis_parser's destructor
- dinfo("%s: set command seqid(%" PRId64 ") got reply",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_DEBUG("%s: set command seqid(%" PRId64 ") got reply",
+ _remote_address.to_string(),
+ entry.sequence_id);
if (::dsn::ERR_OK != ec) {
- ddebug("%s: set command seqid(%" PRId64 ") got reply with error = %s",
- _remote_address.to_string(),
- entry.sequence_id,
- ec.to_string());
+ LOG_INFO("%s: set command seqid(%" PRId64 ") got reply with error = %s",
+ _remote_address.to_string(),
+ entry.sequence_id,
+ ec.to_string());
simple_error_reply(entry, ec.to_string());
} else {
::dsn::apps::update_response rrdb_response;
@@ -506,9 +507,9 @@ void redis_parser::set_geo_internal(message_entry &entry)
std::shared_ptr<proxy_session> ref_this = shared_from_this();
auto set_callback = [ref_this, this, &entry](int ec, pegasus_client::internal_info &&) {
if (_is_session_reset.load(std::memory_order_acquire)) {
- ddebug("%s: setex command seqid(%" PRId64 ") got reply, but session has reset",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_INFO("%s: setex command seqid(%" PRId64 ") got reply, but session has reset",
+ _remote_address.to_string(),
+ entry.sequence_id);
return;
}
@@ -532,14 +533,14 @@ void redis_parser::setex(message_entry &entry)
redis_request &redis_req = entry.request;
// setex key ttl_SECONDS value
if (redis_req.sub_requests.size() != 4) {
- ddebug("%s: setex command seqid(%" PRId64 ") with invalid arguments",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_INFO("%s: setex command seqid(%" PRId64 ") with invalid arguments",
+ _remote_address.to_string(),
+ entry.sequence_id);
simple_error_reply(entry, "wrong number of arguments for 'setex' command");
} else {
- dinfo("%s: send setex command seqid(%" PRId64 ")",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_DEBUG("%s: send setex command seqid(%" PRId64 ")",
+ _remote_address.to_string(),
+ entry.sequence_id);
::dsn::blob &ttl_blob = redis_req.sub_requests[2].data;
int ttl_seconds;
if (!dsn::buf2int32(ttl_blob, ttl_seconds)) {
@@ -555,17 +556,17 @@ void redis_parser::setex(message_entry &entry)
auto on_setex_reply = [ref_this, this, &entry](
::dsn::error_code ec, dsn::message_ex *, dsn::message_ex *response) {
if (_is_session_reset.load(std::memory_order_acquire)) {
- ddebug("%s: setex command seqid(%" PRId64 ") got reply, but session has reset",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_INFO("%s: setex command seqid(%" PRId64 ") got reply, but session has reset",
+ _remote_address.to_string(),
+ entry.sequence_id);
return;
}
if (::dsn::ERR_OK != ec) {
- ddebug("%s: setex command seqid(%" PRId64 ") got reply with error = %s",
- _remote_address.to_string(),
- entry.sequence_id,
- ec.to_string());
+ LOG_INFO("%s: setex command seqid(%" PRId64 ") got reply with error = %s",
+ _remote_address.to_string(),
+ entry.sequence_id,
+ ec.to_string());
simple_error_reply(entry, ec.to_string());
return;
}
@@ -598,29 +599,29 @@ void redis_parser::get(message_entry &entry)
{
redis_request &redis_req = entry.request;
if (redis_req.sub_requests.size() != 2) {
- ddebug("%s: get command seqid(%" PRId64 ") with invalid arguments",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_INFO("%s: get command seqid(%" PRId64 ") with invalid arguments",
+ _remote_address.to_string(),
+ entry.sequence_id);
simple_error_reply(entry, "wrong number of arguments for 'get' command");
} else {
- dinfo("%s: send get command seqid(%" PRId64 ")",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_DEBUG("%s: send get command seqid(%" PRId64 ")",
+ _remote_address.to_string(),
+ entry.sequence_id);
std::shared_ptr<proxy_session> ref_this = shared_from_this();
auto on_get_reply = [ref_this, this, &entry](
::dsn::error_code ec, dsn::message_ex *, dsn::message_ex *response) {
if (_is_session_reset.load(std::memory_order_acquire)) {
- ddebug("%s: get command(%" PRId64 ") got reply, but session has reset",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_INFO("%s: get command(%" PRId64 ") got reply, but session has reset",
+ _remote_address.to_string(),
+ entry.sequence_id);
return;
}
if (::dsn::ERR_OK != ec) {
- ddebug("%s: get command seqid(%" PRId64 ") got reply with error = %s",
- _remote_address.to_string(),
- entry.sequence_id,
- ec.to_string());
+ LOG_INFO("%s: get command seqid(%" PRId64 ") got reply with error = %s",
+ _remote_address.to_string(),
+ entry.sequence_id,
+ ec.to_string());
simple_error_reply(entry, ec.to_string());
} else {
::dsn::apps::read_response rrdb_response;
@@ -659,32 +660,32 @@ void redis_parser::del_internal(message_entry &entry)
{
redis_request &redis_req = entry.request;
if (redis_req.sub_requests.size() != 2) {
- ddebug("%s: del command seqid(%" PRId64 ") with invalid arguments",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_INFO("%s: del command seqid(%" PRId64 ") with invalid arguments",
+ _remote_address.to_string(),
+ entry.sequence_id);
simple_error_reply(entry, "wrong number of arguments for 'del' command");
} else {
- dinfo("%s: send del command seqid(%" PRId64 ")",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_DEBUG("%s: send del command seqid(%" PRId64 ")",
+ _remote_address.to_string(),
+ entry.sequence_id);
std::shared_ptr<proxy_session> ref_this = shared_from_this();
auto on_del_reply = [ref_this, this, &entry](
::dsn::error_code ec, dsn::message_ex *, dsn::message_ex *response) {
if (_is_session_reset.load(std::memory_order_acquire)) {
- ddebug("%s: del command seqid(%" PRId64 ") got reply, but session has reset",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_INFO("%s: del command seqid(%" PRId64 ") got reply, but session has reset",
+ _remote_address.to_string(),
+ entry.sequence_id);
return;
}
- dinfo("%s: del command seqid(%" PRId64 ") got reply",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_DEBUG("%s: del command seqid(%" PRId64 ") got reply",
+ _remote_address.to_string(),
+ entry.sequence_id);
if (::dsn::ERR_OK != ec) {
- ddebug("%s: del command seqid(%" PRId64 ") got reply with error = %s",
- _remote_address.to_string(),
- entry.sequence_id,
- ec.to_string());
+ LOG_INFO("%s: del command seqid(%" PRId64 ") got reply with error = %s",
+ _remote_address.to_string(),
+ entry.sequence_id,
+ ec.to_string());
simple_error_reply(entry, ec.to_string());
} else {
::dsn::apps::read_response rrdb_response;
@@ -727,9 +728,9 @@ void redis_parser::del_geo_internal(message_entry &entry)
std::shared_ptr<proxy_session> ref_this = shared_from_this();
auto del_callback = [ref_this, this, &entry](int ec, pegasus_client::internal_info &&) {
if (_is_session_reset.load(std::memory_order_acquire)) {
- ddebug("%s: setex command seqid(%" PRId64 ") got reply, but session has reset",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_INFO("%s: setex command seqid(%" PRId64 ") got reply, but session has reset",
+ _remote_address.to_string(),
+ entry.sequence_id);
return;
}
@@ -753,33 +754,33 @@ void redis_parser::ttl(message_entry &entry)
redis_request &redis_req = entry.request;
bool is_ttl = (toupper(redis_req.sub_requests[0].data.data()[0]) == 'T');
if (redis_req.sub_requests.size() != 2) {
- ddebug("%s: ttl/pttl command seqid(%" PRId64 ") with invalid arguments",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_INFO("%s: ttl/pttl command seqid(%" PRId64 ") with invalid arguments",
+ _remote_address.to_string(),
+ entry.sequence_id);
simple_error_reply(
entry, fmt::format("wrong number of arguments for '{}'", is_ttl ? "ttl" : "pttl"));
} else {
- dinfo("%s: send pttl/ttl command seqid(%" PRId64 ")",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_DEBUG("%s: send pttl/ttl command seqid(%" PRId64 ")",
+ _remote_address.to_string(),
+ entry.sequence_id);
std::shared_ptr<proxy_session> ref_this = shared_from_this();
auto on_ttl_reply = [ref_this, this, &entry, is_ttl](
::dsn::error_code ec, dsn::message_ex *, dsn::message_ex *response) {
if (_is_session_reset.load(std::memory_order_acquire)) {
- ddebug("%s: ttl/pttl command seqid(%" PRId64 ") got reply, but session has reset",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_INFO("%s: ttl/pttl command seqid(%" PRId64 ") got reply, but session has reset",
+ _remote_address.to_string(),
+ entry.sequence_id);
return;
}
- dinfo("%s: ttl/pttl command seqid(%" PRId64 ") got reply",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_DEBUG("%s: ttl/pttl command seqid(%" PRId64 ") got reply",
+ _remote_address.to_string(),
+ entry.sequence_id);
if (::dsn::ERR_OK != ec) {
- ddebug("%s: del command seqid(%" PRId64 ") got reply with error = %s",
- _remote_address.to_string(),
- entry.sequence_id,
- ec.to_string());
+ LOG_INFO("%s: del command seqid(%" PRId64 ") got reply with error = %s",
+ _remote_address.to_string(),
+ entry.sequence_id,
+ ec.to_string());
simple_error_reply(entry, ec.to_string());
} else {
::dsn::apps::ttl_response rrdb_response;
@@ -1094,9 +1095,9 @@ void redis_parser::process_geo_radius_result(message_entry &entry,
std::list<geo::SearchResult> &&results)
{
if (_is_session_reset.load(std::memory_order_acquire)) {
- ddebug("%s: setex command seqid(%" PRId64 ") got reply, but session has reset",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_INFO("%s: setex command seqid(%" PRId64 ") got reply, but session has reset",
+ _remote_address.to_string(),
+ entry.sequence_id);
return;
}
@@ -1180,9 +1181,9 @@ void redis_parser::geo_add(message_entry &entry)
auto set_latlng_callback = [ref_this, this, &entry, result, set_count](
int error_code, pegasus_client::internal_info &&info) {
if (_is_session_reset.load(std::memory_order_acquire)) {
- ddebug("%s: GEOADD command seqid(%" PRId64 ") got reply, but session has reset",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_INFO("%s: GEOADD command seqid(%" PRId64 ") got reply, but session has reset",
+ _remote_address.to_string(),
+ entry.sequence_id);
return;
}
@@ -1235,9 +1236,9 @@ void redis_parser::geo_dist(message_entry &entry)
std::shared_ptr<proxy_session> ref_this = shared_from_this();
auto get_callback = [ref_this, this, &entry, unit](int error_code, double &&distance) {
if (_is_session_reset.load(std::memory_order_acquire)) {
- ddebug("%s: GEODIST command seqid(%" PRId64 ") got reply, but session has reset",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_INFO("%s: GEODIST command seqid(%" PRId64 ") got reply, but session has reset",
+ _remote_address.to_string(),
+ entry.sequence_id);
return;
}
@@ -1283,9 +1284,9 @@ void redis_parser::geo_pos(message_entry &entry)
auto get_latlng_callback = [ref_this, this, &entry, result, get_count](
int error_code, int index, double lat_degrees, double lng_degrees) {
if (_is_session_reset.load(std::memory_order_acquire)) {
- ddebug("%s: GEOPOS command seqid(%" PRId64 ") got reply, but session has reset",
- _remote_address.to_string(),
- entry.sequence_id);
+ LOG_INFO("%s: GEOPOS command seqid(%" PRId64 ") got reply, but session has reset",
+ _remote_address.to_string(),
+ entry.sequence_id);
return;
}
@@ -1322,9 +1323,9 @@ void redis_parser::handle_command(std::unique_ptr<message_entry> &&entry)
e.sequence_id = ++s_next_seqid;
e.response.store(nullptr, std::memory_order_relaxed);
- dinfo("%s: new command parsed with new seqid %" PRId64 "",
- _remote_address.to_string(),
- e.sequence_id);
+ LOG_DEBUG("%s: new command parsed with new seqid %" PRId64 "",
+ _remote_address.to_string(),
+ e.sequence_id);
enqueue_pending_response(std::move(entry));
dassert(request.sub_request_count > 0,
diff --git a/src/redis_protocol/proxy_ut/config.ini b/src/redis_protocol/proxy_ut/config.ini
index 56a5eb232..c8a9b2c34 100644
--- a/src/redis_protocol/proxy_ut/config.ini
+++ b/src/redis_protocol/proxy_ut/config.ini
@@ -45,7 +45,7 @@ tool = nativerun
;toollets = tracer, profiler, fault_injector
pause_on_start = false
-logging_start_level = LOG_LEVEL_INFORMATION
+logging_start_level = LOG_LEVEL_DEBUG
logging_factory_name = dsn::tools::simple_logger
;logging_factory_name = dsn::tools::screen_logger
enable_default_app_mimic = true
diff --git a/src/redis_protocol/proxy_ut/redis_proxy_test.cpp b/src/redis_protocol/proxy_ut/redis_proxy_test.cpp
index fa1316a9d..1f1c950cc 100644
--- a/src/redis_protocol/proxy_ut/redis_proxy_test.cpp
+++ b/src/redis_protocol/proxy_ut/redis_proxy_test.cpp
@@ -602,7 +602,7 @@ TEST(proxy, connection)
client_socket.shutdown(boost::asio::socket_base::shutdown_both);
client_socket.close();
} catch (...) {
- ddebug("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 7ed150745..902fef38c 100644
--- a/src/replica/backup/cold_backup_context.cpp
+++ b/src/replica/backup/cold_backup_context.cpp
@@ -189,28 +189,29 @@ 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()) {
- ddebug("%s: backup status has changed to %s, ignore checking backup on remote",
- name,
- cold_backup_status_to_string(status()));
+ LOG_INFO("%s: backup status has changed to %s, 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;
dassert(file_handle != nullptr, "");
if (file_handle->get_md5sum().empty() && file_handle->get_size() <= 0) {
- ddebug("%s: check backup on remote, current_checkpoint file %s is not exist",
- name,
- current_chkpt_file.c_str());
+ LOG_INFO("%s: check backup on remote, current_checkpoint file %s is not exist",
+ name,
+ current_chkpt_file.c_str());
complete_check(false);
} else {
- ddebug("%s: check backup on remote, current_checkpoint file %s is exist",
- name,
- current_chkpt_file.c_str());
+ LOG_INFO("%s: check backup on remote, current_checkpoint file %s is exist",
+ name,
+ current_chkpt_file.c_str());
read_current_chkpt_file(file_handle);
}
} else if (resp.err == ERR_TIMEOUT) {
- derror("%s: block service create file timeout, retry after 10 seconds, file = %s",
- name,
- current_chkpt_file.c_str());
+ LOG_ERROR(
+ "%s: block service create file timeout, retry after 10 seconds, file = %s",
+ name,
+ current_chkpt_file.c_str());
// before retry, should add_ref(), and must release_ref() after retry
add_ref();
@@ -221,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()) {
- ddebug("%s: backup status has changed to %s, ignore "
- "checking backup on remote",
- name,
- cold_backup_status_to_string(status()));
+ LOG_INFO("%s: backup status has changed to %s, ignore "
+ "checking backup on remote",
+ name,
+ cold_backup_status_to_string(status()));
ignore_check();
} else {
check_backup_on_remote();
@@ -234,10 +235,10 @@ void cold_backup_context::check_backup_on_remote()
0,
std::chrono::seconds(10));
} else {
- derror("%s: block service create file failed, file = %s, err = %s",
- name,
- current_chkpt_file.c_str(),
- resp.err.to_string());
+ LOG_ERROR("%s: block service create file failed, file = %s, err = %s",
+ name,
+ current_chkpt_file.c_str(),
+ resp.err.to_string());
fail_check("block service create file failed");
}
release_ref();
@@ -258,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()) {
- ddebug("%s: backup status has changed to %s, ignore checking backup on remote",
- name,
- cold_backup_status_to_string(status()));
+ LOG_INFO("%s: backup status has changed to %s, 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 {
- ddebug("%s: after read current_checkpoint_file, check whether remote "
- "checkpoint dir = %s is exist",
- name,
- chkpt_dirname.c_str());
+ LOG_INFO("%s: after read current_checkpoint_file, check whether remote "
+ "checkpoint dir = %s is exist",
+ name,
+ chkpt_dirname.c_str());
remote_chkpt_dir_exist(chkpt_dirname);
}
} else if (resp.err == ERR_TIMEOUT) {
- derror("%s: read remote file timeout, retry after 10s, file = %s",
- name,
- file_handle->file_name().c_str());
+ LOG_ERROR("%s: read remote file timeout, retry after 10s, file = %s",
+ name,
+ file_handle->file_name().c_str());
add_ref();
tasking::enqueue(LPC_BACKGROUND_COLD_BACKUP,
nullptr,
[this, file_handle]() {
if (!is_ready_for_check()) {
- ddebug("%s: backup status has changed to %s, ignore "
- "checking backup on remote",
- name,
- cold_backup_status_to_string(status()));
+ LOG_INFO("%s: backup status has changed to %s, ignore "
+ "checking backup on remote",
+ name,
+ cold_backup_status_to_string(status()));
ignore_check();
} else {
read_current_chkpt_file(file_handle);
@@ -296,10 +297,10 @@ void cold_backup_context::read_current_chkpt_file(
0,
std::chrono::seconds(10));
} else {
- derror("%s: read remote file failed, file = %s, err = %s",
- name,
- file_handle->file_name().c_str(),
- resp.err.to_string());
+ LOG_ERROR("%s: read remote file failed, file = %s, err = %s",
+ name,
+ file_handle->file_name().c_str(),
+ resp.err.to_string());
fail_check("read remote file failed");
}
release_ref();
@@ -320,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()) {
- ddebug("%s: backup status has changed to %s, ignore checking backup on remote",
- name,
- cold_backup_status_to_string(status()));
+ LOG_INFO("%s: backup status has changed to %s, 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;
@@ -333,38 +334,39 @@ void cold_backup_context::remote_chkpt_dir_exist(const std::string &chkpt_dirnam
}
}
if (found_chkpt_dir) {
- ddebug("%s: remote checkpoint dir is already exist, so upload have already "
- "complete, remote_checkpoint_dirname = %s",
- name,
- chkpt_dirname.c_str());
+ LOG_INFO("%s: remote checkpoint dir is already exist, so upload have already "
+ "complete, remote_checkpoint_dirname = %s",
+ name,
+ chkpt_dirname.c_str());
complete_check(true);
} else {
- ddebug("%s: remote checkpoint dir is not exist, should re-upload checkpoint "
- "dir, remote_checkpoint_dirname = %s",
- name,
- chkpt_dirname.c_str());
+ LOG_INFO("%s: remote checkpoint dir is not exist, should re-upload checkpoint "
+ "dir, remote_checkpoint_dirname = %s",
+ name,
+ chkpt_dirname.c_str());
complete_check(false);
}
} else if (resp.err == ERR_OBJECT_NOT_FOUND) {
- ddebug("%s: remote checkpoint dir is not exist, should re-upload checkpoint dir, "
- "remote_checkpoint_dirname = %s",
- name,
- chkpt_dirname.c_str());
+ LOG_INFO("%s: remote checkpoint dir is not exist, should re-upload checkpoint dir, "
+ "remote_checkpoint_dirname = %s",
+ name,
+ chkpt_dirname.c_str());
complete_check(false);
} else if (resp.err == ERR_TIMEOUT) {
- derror("%s: block service list remote dir timeout, retry after 10s, dirname = %s",
- name,
- chkpt_dirname.c_str());
+ LOG_ERROR(
+ "%s: block service list remote dir timeout, retry after 10s, dirname = %s",
+ name,
+ chkpt_dirname.c_str());
add_ref();
tasking::enqueue(LPC_BACKGROUND_COLD_BACKUP,
nullptr,
[this, chkpt_dirname]() {
if (!is_ready_for_check()) {
- ddebug("%s: backup status has changed to %s, ignore "
- "checking backup on remote",
- name,
- cold_backup_status_to_string(status()));
+ LOG_INFO("%s: backup status has changed to %s, ignore "
+ "checking backup on remote",
+ name,
+ cold_backup_status_to_string(status()));
ignore_check();
} else {
remote_chkpt_dir_exist(chkpt_dirname);
@@ -374,10 +376,10 @@ void cold_backup_context::remote_chkpt_dir_exist(const std::string &chkpt_dirnam
0,
std::chrono::seconds(10));
} else {
- derror("%s: block service list remote dir failed, dirname = %s, err = %s",
- name,
- chkpt_dirname.c_str(),
- resp.err.to_string());
+ LOG_ERROR("%s: block service list remote dir failed, dirname = %s, err = %s",
+ name,
+ chkpt_dirname.c_str(),
+ resp.err.to_string());
fail_check("list remote dir failed");
}
release_ref();
@@ -388,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()) {
- ddebug("%s: backup status has changed to %s, ignore upload checkpoint",
- name,
- cold_backup_status_to_string(status()));
+ LOG_INFO("%s: backup status has changed to %s, ignore upload checkpoint",
+ name,
+ cold_backup_status_to_string(status()));
return;
}
@@ -399,8 +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
// (for pause - uploading), so we use the atomic variant to implement
if (!_have_check_upload_status.compare_exchange_strong(old_status, true)) {
- ddebug("%s: upload status has already been checked, start upload checkpoint dir directly",
- name);
+ LOG_INFO("%s: upload status has already been checked, start upload checkpoint dir directly",
+ name);
on_upload_chkpt_dir();
return;
}
@@ -422,18 +424,18 @@ void cold_backup_context::upload_checkpoint_to_remote()
dassert(resp.file_handle != nullptr, "");
if (resp.file_handle->get_md5sum().empty() && resp.file_handle->get_size() <= 0) {
_upload_status.store(UploadUncomplete);
- ddebug("%s: check upload_status complete, cold_backup_metadata isn't exist, "
- "start upload checkpoint dir",
- name);
+ LOG_INFO("%s: check upload_status complete, cold_backup_metadata isn't exist, "
+ "start upload checkpoint dir",
+ name);
on_upload_chkpt_dir();
} else {
- ddebug("%s: cold_backup_metadata is exist, read it's context", name);
+ LOG_INFO("%s: cold_backup_metadata is exist, read it's context", name);
read_backup_metadata(resp.file_handle);
}
} else if (resp.err == ERR_TIMEOUT) {
- derror("%s: block service create file timeout, retry after 10s, file = %s",
- name,
- metadata.c_str());
+ LOG_ERROR("%s: block service create file timeout, retry after 10s, file = %s",
+ name,
+ metadata.c_str());
// when create backup_metadata timeout, should reset _have_check_upload_status
// false to allow re-check
_have_check_upload_status.store(false);
@@ -444,9 +446,10 @@ void cold_backup_context::upload_checkpoint_to_remote()
nullptr,
[this]() {
if (!is_ready_for_upload()) {
- ddebug("%s: backup status has changed to %s, stop check upload status",
- name,
- cold_backup_status_to_string(status()));
+ LOG_INFO(
+ "%s: backup status has changed to %s, stop check upload status",
+ name,
+ cold_backup_status_to_string(status()));
} else {
upload_checkpoint_to_remote();
}
@@ -455,10 +458,10 @@ void cold_backup_context::upload_checkpoint_to_remote()
0,
std::chrono::seconds(10));
} else {
- derror("%s: block service create file failed, file = %s, err = %s",
- name,
- metadata.c_str(),
- resp.err.to_string());
+ LOG_ERROR("%s: block service create file failed, file = %s, err = %s",
+ name,
+ metadata.c_str(),
+ resp.err.to_string());
_have_check_upload_status.store(false);
fail_upload("block service create file failed");
}
@@ -481,15 +484,15 @@ void cold_backup_context::read_backup_metadata(
LPC_BACKGROUND_COLD_BACKUP,
[this, file_handle](const dist::block_service::read_response &resp) {
if (resp.err == ERR_OK) {
- ddebug("%s: read cold_backup_metadata succeed, verify it's context, file = %s",
- name,
- file_handle->file_name().c_str());
+ LOG_INFO("%s: read cold_backup_metadata succeed, verify it's context, file = %s",
+ name,
+ file_handle->file_name().c_str());
verify_backup_metadata(resp.buffer);
on_upload_chkpt_dir();
} else if (resp.err == ERR_TIMEOUT) {
- derror("%s: read remote file timeout, retry after 10s, file = %s",
- name,
- file_handle->file_name().c_str());
+ LOG_ERROR("%s: read remote file timeout, retry after 10s, file = %s",
+ name,
+ file_handle->file_name().c_str());
add_ref();
tasking::enqueue(
@@ -497,9 +500,10 @@ void cold_backup_context::read_backup_metadata(
nullptr,
[this, file_handle] {
if (!is_ready_for_upload()) {
- ddebug("%s: backup status has changed to %s, stop check upload status",
- name,
- cold_backup_status_to_string(status()));
+ LOG_INFO(
+ "%s: backup status has changed to %s, stop check upload status",
+ name,
+ cold_backup_status_to_string(status()));
_have_check_upload_status.store(false);
} else {
read_backup_metadata(file_handle);
@@ -509,10 +513,10 @@ void cold_backup_context::read_backup_metadata(
0,
std::chrono::seconds(10));
} else {
- derror("%s: read remote file failed, file = %s, err = %s",
- name,
- file_handle->file_name().c_str(),
- resp.err.to_string());
+ LOG_ERROR("%s: read remote file failed, file = %s, err = %s",
+ name,
+ file_handle->file_name().c_str(),
+ resp.err.to_string());
_have_check_upload_status.store(false);
fail_upload("read remote file failed");
}
@@ -525,12 +529,12 @@ void cold_backup_context::verify_backup_metadata(const blob &value)
{
cold_backup_metadata tmp;
if (value.length() > 0 && json::json_forwarder<cold_backup_metadata>::decode(value, tmp)) {
- ddebug("%s: check upload status complete, checkpoint dir uploading has already complete",
- name);
+ LOG_INFO("%s: check upload status complete, checkpoint dir uploading has already complete",
+ name);
_upload_status.store(UploadComplete);
} else {
- ddebug("%s: check upload status complete, checkpoint dir uploading isn't complete yet",
- name);
+ LOG_INFO("%s: check upload status complete, checkpoint dir uploading isn't complete yet",
+ name);
_upload_status.store(UploadUncomplete);
}
}
@@ -538,9 +542,9 @@ void cold_backup_context::verify_backup_metadata(const blob &value)
void cold_backup_context::on_upload_chkpt_dir()
{
if (_upload_status.load() == UploadInvalid || !is_ready_for_upload()) {
- ddebug("%s: replica is not ready for uploading, ignore upload, cold_backup_status(%s)",
- name,
- cold_backup_status_to_string(status()));
+ LOG_INFO("%s: replica is not ready for uploading, ignore upload, cold_backup_status(%s)",
+ name,
+ cold_backup_status_to_string(status()));
return;
}
@@ -556,16 +560,16 @@ void cold_backup_context::on_upload_chkpt_dir()
// prepare_upload maybe fail, so here check status
if (!is_ready_for_upload()) {
- derror("%s: backup status has changed to %s, stop upload checkpoint dir",
- name,
- cold_backup_status_to_string(status()));
+ LOG_ERROR("%s: backup status has changed to %s, stop upload checkpoint dir",
+ name,
+ cold_backup_status_to_string(status()));
return;
}
if (checkpoint_files.size() <= 0) {
- ddebug("%s: checkpoint dir is empty, so upload is complete and just start write "
- "backup_metadata",
- name);
+ LOG_INFO("%s: checkpoint dir is empty, so upload is complete and just start write "
+ "backup_metadata",
+ name);
bool old_status = false;
// using atomic variant _have_write_backup_metadata is to allow one task to
// write backup_metadata because on_upload_chkpt_dir maybe call multi-time
@@ -573,20 +577,21 @@ void cold_backup_context::on_upload_chkpt_dir()
write_backup_metadata();
}
} else {
- ddebug("%s: start upload checkpoint dir, checkpoint dir = %s, total checkpoint file = %d",
- name,
- checkpoint_dir.c_str(),
- checkpoint_files.size());
+ LOG_INFO("%s: start upload checkpoint dir, checkpoint dir = %s, total checkpoint file = %d",
+ name,
+ checkpoint_dir.c_str(),
+ checkpoint_files.size());
std::vector<std::string> files;
if (!upload_complete_or_fetch_uncomplete_files(files)) {
for (auto &file : files) {
- ddebug("%s: start upload checkpoint file to remote, file = %s", name, file.c_str());
+ LOG_INFO(
+ "%s: start upload checkpoint file to remote, file = %s", name, file.c_str());
upload_file(file);
}
} else {
- ddebug("%s: upload checkpoint dir to remote complete, total_file_cnt = %d",
- name,
- checkpoint_files.size());
+ LOG_INFO("%s: upload checkpoint dir to remote complete, total_file_cnt = %d",
+ name,
+ checkpoint_files.size());
bool old_status = false;
if (_have_write_backup_metadata.compare_exchange_strong(old_status, true)) {
write_backup_metadata();
@@ -615,7 +620,8 @@ void cold_backup_context::prepare_upload()
int64_t file_size = checkpoint_file_sizes[idx];
std::string file_md5;
if (::dsn::utils::filesystem::md5sum(file_full_path, file_md5) != ERR_OK) {
- derror("%s: get local file size or md5 fail, file = %s", name, file_full_path.c_str());
+ LOG_ERROR(
+ "%s: get local file size or md5 fail, file = %s", name, file_full_path.c_str());
fail_upload("compute local file size or md5 failed");
return;
}
@@ -651,20 +657,20 @@ void cold_backup_context::upload_file(const std::string &local_filename)
::dsn::utils::filesystem::path_combine(checkpoint_dir, local_filename);
if (md5 == file_handle->get_md5sum() &&
local_file_size == file_handle->get_size()) {
- ddebug("%s: checkpoint file already exist on remote, file = %s",
- name,
- full_path_local_file.c_str());
+ LOG_INFO("%s: checkpoint file already exist on remote, file = %s",
+ name,
+ full_path_local_file.c_str());
on_upload_file_complete(local_filename);
} else {
- ddebug("%s: start upload checkpoint file to remote, file = %s",
- name,
- full_path_local_file.c_str());
+ LOG_INFO("%s: start upload checkpoint file to remote, file = %s",
+ name,
+ full_path_local_file.c_str());
on_upload(file_handle, full_path_local_file);
}
} else if (resp.err == ERR_TIMEOUT) {
- derror("%s: block service create file timeout, retry after 10s, file = %s",
- name,
- local_filename.c_str());
+ LOG_ERROR("%s: block service create file timeout, retry after 10s, file = %s",
+ name,
+ local_filename.c_str());
add_ref();
tasking::enqueue(LPC_BACKGROUND_COLD_BACKUP,
@@ -683,11 +689,12 @@ void cold_backup_context::upload_file(const std::string &local_filename)
std::string full_path_local_file =
::dsn::utils::filesystem::path_combine(checkpoint_dir,
local_filename);
- ddebug("%s: backup status has changed to %s, stop upload "
- "checkpoint file to remote, file = %s",
- name,
- cold_backup_status_to_string(status()),
- full_path_local_file.c_str());
+ LOG_INFO(
+ "%s: backup status has changed to %s, stop upload "
+ "checkpoint file to remote, file = %s",
+ name,
+ cold_backup_status_to_string(status()),
+ full_path_local_file.c_str());
file_upload_uncomplete(local_filename);
} else {
upload_file(local_filename);
@@ -697,10 +704,10 @@ void cold_backup_context::upload_file(const std::string &local_filename)
0,
std::chrono::seconds(10));
} else {
- derror("%s: block service create file failed, file = %s, err = %s",
- name,
- local_filename.c_str(),
- resp.err.to_string());
+ LOG_ERROR("%s: block service create file failed, file = %s, err = %s",
+ name,
+ local_filename.c_str(),
+ resp.err.to_string());
fail_upload("create file failed");
}
if (resp.err != ERR_OK && _owner_replica != nullptr) {
@@ -731,41 +738,41 @@ void cold_backup_context::on_upload(const dist::block_service::block_file_ptr &f
dassert(_file_infos.at(local_filename).first ==
static_cast<int64_t>(resp.uploaded_size),
"");
- ddebug("%s: upload checkpoint file complete, file = %s",
- name,
- full_path_local_file.c_str());
+ LOG_INFO("%s: upload checkpoint file complete, file = %s",
+ name,
+ full_path_local_file.c_str());
on_upload_file_complete(local_filename);
} else if (resp.err == ERR_TIMEOUT) {
- derror("%s: upload checkpoint file timeout, retry after 10s, file = %s",
- name,
- full_path_local_file.c_str());
+ LOG_ERROR("%s: upload checkpoint file timeout, retry after 10s, file = %s",
+ name,
+ full_path_local_file.c_str());
add_ref();
- tasking::enqueue(LPC_BACKGROUND_COLD_BACKUP,
- nullptr,
- [this, file_handle, full_path_local_file]() {
- if (!is_ready_for_upload()) {
- derror("%s: backup status has changed to %s, stop upload "
- "checkpoint file to remote, file = %s",
- name,
- cold_backup_status_to_string(status()),
- full_path_local_file.c_str());
- std::string local_filename =
- ::dsn::utils::filesystem::get_file_name(
- full_path_local_file);
- file_upload_uncomplete(local_filename);
- } else {
- on_upload(file_handle, full_path_local_file);
- }
- release_ref();
- },
- 0,
- std::chrono::seconds(10));
+ tasking::enqueue(
+ LPC_BACKGROUND_COLD_BACKUP,
+ nullptr,
+ [this, file_handle, full_path_local_file]() {
+ if (!is_ready_for_upload()) {
+ LOG_ERROR("%s: backup status has changed to %s, stop upload "
+ "checkpoint file to remote, file = %s",
+ name,
+ cold_backup_status_to_string(status()),
+ full_path_local_file.c_str());
+ std::string local_filename =
+ ::dsn::utils::filesystem::get_file_name(full_path_local_file);
+ file_upload_uncomplete(local_filename);
+ } else {
+ on_upload(file_handle, full_path_local_file);
+ }
+ release_ref();
+ },
+ 0,
+ std::chrono::seconds(10));
} else {
- derror("%s: upload checkpoint file to remote failed, file = %s, err = %s",
- name,
- full_path_local_file.c_str(),
- resp.err.to_string());
+ LOG_ERROR("%s: upload checkpoint file to remote failed, file = %s, err = %s",
+ name,
+ full_path_local_file.c_str(),
+ resp.err.to_string());
fail_upload("upload checkpoint file to remote failed");
}
if (resp.err != ERR_OK && _owner_replica != nullptr) {
@@ -780,7 +787,7 @@ void cold_backup_context::on_upload(const dist::block_service::block_file_ptr &f
void cold_backup_context::write_backup_metadata()
{
if (_upload_status.load() == UploadComplete) {
- ddebug("%s: upload have already done, no need write metadata again", name);
+ LOG_INFO("%s: upload have already done, no need write metadata again", name);
return;
}
std::string metadata = cold_backup::get_remote_chkpt_meta_file(
@@ -800,24 +807,25 @@ void cold_backup_context::write_backup_metadata()
blob buffer = json::json_forwarder<cold_backup_metadata>::encode(_metadata);
// hold itself until callback is executed
add_ref();
- ddebug("%s: create backup metadata file succeed, start to write file, file = %s",
- name,
- metadata.c_str());
+ LOG_INFO("%s: create backup metadata file succeed, start to write file, file = %s",
+ name,
+ metadata.c_str());
this->on_write(resp.file_handle, buffer, [this](bool succeed) {
if (succeed) {
std::string chkpt_dirname = cold_backup::get_remote_chkpt_dirname();
_upload_status.store(UploadComplete);
- ddebug("%s: write backup metadata complete, write current checkpoint file",
- name);
+ LOG_INFO(
+ "%s: write backup metadata complete, write current checkpoint file",
+ name);
write_current_chkpt_file(chkpt_dirname);
}
// NOTICE: write file fail will internal error be processed in on_write()
release_ref();
});
} else if (resp.err == ERR_TIMEOUT) {
- derror("%s: block service create file timeout, retry after 10s, file = %s",
- name,
- metadata.c_str());
+ LOG_ERROR("%s: block service create file timeout, retry after 10s, file = %s",
+ name,
+ metadata.c_str());
add_ref();
tasking::enqueue(
@@ -826,7 +834,7 @@ void cold_backup_context::write_backup_metadata()
[this]() {
if (!is_ready_for_upload()) {
_have_write_backup_metadata.store(false);
- derror(
+ LOG_ERROR(
"%s: backup status has changed to %s, stop write backup_metadata",
name,
cold_backup_status_to_string(status()));
@@ -838,10 +846,10 @@ void cold_backup_context::write_backup_metadata()
0,
std::chrono::seconds(10));
} else {
- derror("%s: block service create file failed, file = %s, err = %s",
- name,
- metadata.c_str(),
- resp.err.to_string());
+ LOG_ERROR("%s: block service create file failed, file = %s, err = %s",
+ name,
+ metadata.c_str(),
+ resp.err.to_string());
_have_write_backup_metadata.store(false);
fail_upload("create file failed");
}
@@ -860,9 +868,9 @@ void cold_backup_context::write_current_chkpt_file(const std::string &value)
_file_status.clear();
if (!is_ready_for_upload()) {
- ddebug("%s: backup status has changed to %s, stop write current checkpoint file",
- name,
- cold_backup_status_to_string(status()));
+ LOG_INFO("%s: backup status has changed to %s, stop write current checkpoint file",
+ name,
+ cold_backup_status_to_string(status()));
return;
}
@@ -884,9 +892,9 @@ void cold_backup_context::write_current_chkpt_file(const std::string &value)
std::shared_ptr<char> buf = utils::make_shared_array<char>(len);
::memcpy(buf.get(), value.c_str(), len);
blob write_buf(std::move(buf), static_cast<unsigned int>(len));
- ddebug("%s: create current checkpoint file succeed, start write file ,file = %s",
- name,
- current_chkpt_file.c_str());
+ LOG_INFO("%s: create current checkpoint file succeed, start write file ,file = %s",
+ name,
+ current_chkpt_file.c_str());
add_ref();
this->on_write(resp.file_handle, write_buf, [this](bool succeed) {
if (succeed) {
@@ -895,19 +903,19 @@ void cold_backup_context::write_current_chkpt_file(const std::string &value)
release_ref();
});
} else if (resp.err == ERR_TIMEOUT) {
- derror("%s: block file create file timeout, retry after 10s, file = %s",
- name,
- current_chkpt_file.c_str());
+ LOG_ERROR("%s: block file create file timeout, retry after 10s, file = %s",
+ name,
+ current_chkpt_file.c_str());
add_ref();
tasking::enqueue(LPC_BACKGROUND_COLD_BACKUP,
nullptr,
[this, value]() {
if (!is_ready_for_upload()) {
- ddebug("%s: backup status has changed to %s, stop write "
- "current checkpoint file",
- name,
- cold_backup_status_to_string(status()));
+ LOG_INFO("%s: backup status has changed to %s, stop write "
+ "current checkpoint file",
+ name,
+ cold_backup_status_to_string(status()));
} else {
write_current_chkpt_file(value);
}
@@ -917,10 +925,10 @@ void cold_backup_context::write_current_chkpt_file(const std::string &value)
0,
std::chrono::seconds(10));
} else {
- derror("%s: block service create file failed, file = %s, err = %s",
- name,
- current_chkpt_file.c_str(),
- resp.err.to_string());
+ LOG_ERROR("%s: block service create file failed, file = %s, err = %s",
+ name,
+ current_chkpt_file.c_str(),
+ resp.err.to_string());
fail_upload("create file failed");
}
release_ref();
@@ -943,25 +951,25 @@ void cold_backup_context::on_write(const dist::block_service::block_file_ptr &fi
LPC_BACKGROUND_COLD_BACKUP,
[this, value, file_handle, callback](const dist::block_service::write_response &resp) {
if (resp.err == ERR_OK) {
- ddebug("%s: write remote file succeed, file = %s",
- name,
- file_handle->file_name().c_str());
+ LOG_INFO("%s: write remote file succeed, file = %s",
+ name,
+ file_handle->file_name().c_str());
callback(true);
} else if (resp.err == ERR_TIMEOUT) {
- ddebug("%s: write remote file timeout, retry after 10s, file = %s",
- name,
- file_handle->file_name().c_str());
+ LOG_INFO("%s: write remote file timeout, retry after 10s, file = %s",
+ name,
+ file_handle->file_name().c_str());
add_ref();
tasking::enqueue(LPC_BACKGROUND_COLD_BACKUP,
nullptr,
[this, file_handle, value, callback]() {
if (!is_ready_for_upload()) {
- ddebug("%s: backup status has changed to %s, stop write "
- "remote file, file = %s",
- name,
- cold_backup_status_to_string(status()),
- file_handle->file_name().c_str());
+ LOG_INFO("%s: backup status has changed to %s, stop write "
+ "remote file, file = %s",
+ name,
+ cold_backup_status_to_string(status()),
+ file_handle->file_name().c_str());
} else {
on_write(file_handle, value, callback);
}
@@ -972,10 +980,10 @@ void cold_backup_context::on_write(const dist::block_service::block_file_ptr &fi
} else {
// here, must call the callback to release_ref
callback(false);
- derror("%s: write remote file failed, file = %s, err = %s",
- name,
- file_handle->file_name().c_str(),
- resp.err.to_string());
+ LOG_ERROR("%s: write remote file failed, file = %s, err = %s",
+ name,
+ file_handle->file_name().c_str(),
+ resp.err.to_string());
fail_upload("write remote file failed");
}
release_ref();
@@ -1001,12 +1009,12 @@ void cold_backup_context::on_upload_file_complete(const std::string &local_filen
auto complete_size = static_cast<double>(_upload_file_size.load());
if (total <= complete_size) {
- ddebug("%s: upload checkpoint to remote complete, checkpoint dir = %s, total file size = "
- "%" PRId64 ", file count = %d",
- name,
- checkpoint_dir.c_str(),
- static_cast<int64_t>(total),
- checkpoint_files.size());
+ LOG_INFO("%s: upload checkpoint to remote complete, checkpoint dir = %s, total file size = "
+ "%" PRId64 ", file count = %d",
+ name,
+ checkpoint_dir.c_str(),
+ static_cast<int64_t>(total),
+ checkpoint_files.size());
bool old_status = false;
if (_have_write_backup_metadata.compare_exchange_strong(old_status, true)) {
write_backup_metadata();
@@ -1015,13 +1023,13 @@ void cold_backup_context::on_upload_file_complete(const std::string &local_filen
} else {
dassert(total != 0.0, "total = %" PRId64 "", total);
update_progress(static_cast<int>(complete_size / total * 1000));
- ddebug("%s: the progress of upload checkpoint is %d", name, _progress.load());
+ LOG_INFO("%s: the progress of upload checkpoint is %d", name, _progress.load());
}
if (is_ready_for_upload()) {
std::vector<std::string> upload_files;
upload_complete_or_fetch_uncomplete_files(upload_files);
for (auto &file : upload_files) {
- ddebug("%s: start upload checkpoint file to remote, file = %s", name, file.c_str());
+ LOG_INFO("%s: start upload checkpoint file to remote, file = %s", name, file.c_str());
upload_file(file);
}
}
diff --git a/src/replica/backup/replica_backup_server.cpp b/src/replica/backup/replica_backup_server.cpp
index 32b5f0f09..c16f97c7e 100644
--- a/src/replica/backup/replica_backup_server.cpp
+++ b/src/replica/backup/replica_backup_server.cpp
@@ -40,20 +40,20 @@ void replica_backup_server::on_cold_backup(backup_rpc rpc)
const backup_request &request = rpc.request();
backup_response &response = rpc.response();
- ddebug("received cold backup request: backup{%s.%s.%" PRId64 "}",
- request.pid.to_string(),
- request.policy.policy_name.c_str(),
- request.backup_id);
+ LOG_INFO("received cold backup request: backup{%s.%s.%" PRId64 "}",
+ request.pid.to_string(),
+ request.policy.policy_name.c_str(),
+ request.backup_id);
response.pid = request.pid;
response.policy_name = request.policy.policy_name;
response.backup_id = request.backup_id;
if (_stub->options().cold_backup_root.empty()) {
- derror("backup{%s.%s.%" PRId64
- "}: cold_backup_root is empty, response ERR_OPERATION_DISABLED",
- request.pid.to_string(),
- request.policy.policy_name.c_str(),
- request.backup_id);
+ LOG_ERROR("backup{%s.%s.%" PRId64
+ "}: cold_backup_root is empty, response ERR_OPERATION_DISABLED",
+ request.pid.to_string(),
+ request.policy.policy_name.c_str(),
+ request.backup_id);
response.err = ERR_OPERATION_DISABLED;
return;
}
@@ -62,10 +62,10 @@ void replica_backup_server::on_cold_backup(backup_rpc rpc)
if (rep != nullptr) {
rep->on_cold_backup(request, response);
} else {
- derror("backup{%s.%s.%" PRId64 "}: replica not found, response ERR_OBJECT_NOT_FOUND",
- request.pid.to_string(),
- request.policy.policy_name.c_str(),
- request.backup_id);
+ LOG_ERROR("backup{%s.%s.%" PRId64 "}: replica not found, response ERR_OBJECT_NOT_FOUND",
+ request.pid.to_string(),
+ request.policy.policy_name.c_str(),
+ request.backup_id);
response.err = ERR_OBJECT_NOT_FOUND;
}
}
diff --git a/src/replica/bulk_load/test/replica_bulk_loader_test.cpp b/src/replica/bulk_load/test/replica_bulk_loader_test.cpp
index 7775e3f98..ee1ae7cf6 100644
--- a/src/replica/bulk_load/test/replica_bulk_loader_test.cpp
+++ b/src/replica/bulk_load/test/replica_bulk_loader_test.cpp
@@ -259,14 +259,14 @@ public:
std::ofstream os(whole_name.c_str(),
(std::ofstream::out | std::ios::binary | std::ofstream::trunc));
if (!os.is_open()) {
- derror("open file %s failed", whole_name.c_str());
+ LOG_ERROR("open file %s failed", whole_name.c_str());
return ERR_FILE_OPERATION_FAILED;
}
blob bb = json::json_forwarder<bulk_load_metadata>::encode(_metadata);
os.write((const char *)bb.data(), (std::streamsize)bb.length());
if (os.bad()) {
- derror("write file %s failed", whole_name.c_str());
+ LOG_ERROR("write file %s failed", whole_name.c_str());
return ERR_FILE_OPERATION_FAILED;
}
os.close();
diff --git a/src/replica/duplication/duplication_sync_timer.cpp b/src/replica/duplication/duplication_sync_timer.cpp
index 361bfb987..6dde87cc3 100644
--- a/src/replica/duplication/duplication_sync_timer.cpp
+++ b/src/replica/duplication/duplication_sync_timer.cpp
@@ -138,7 +138,7 @@ std::vector<replica_ptr> duplication_sync_timer::get_all_replicas()
void duplication_sync_timer::close()
{
- ddebug("stop duplication sync");
+ LOG_INFO("stop duplication sync");
{
zauto_lock l(_lock);
diff --git a/src/replica/duplication/mutation_batch.cpp b/src/replica/duplication/mutation_batch.cpp
index 415006f18..a9df9e49a 100644
--- a/src/replica/duplication/mutation_batch.cpp
+++ b/src/replica/duplication/mutation_batch.cpp
@@ -59,8 +59,9 @@ void mutation_buffer::commit(decree d, commit_type ct)
// | |
// n+m(m>1) n+k(k>=m)
//
- // just derror but not dassert if mutation loss or other problem, it's different from base
- // class implement. And from the error and perf-counter, we can choose restart duplication
+ // just LOG_ERROR but not dassert if mutation loss or other problem, it's different from
+ // base class implement. And from the error and perf-counter, we can choose restart
+ // duplication
// or ignore the loss.
if (next_committed_mutation == nullptr || !next_committed_mutation->is_logged()) {
derror_replica("mutation[{}] is lost in prepare_list: "
diff --git a/src/replica/log_file.cpp b/src/replica/log_file.cpp
index d7ac51d29..841e37370 100644
--- a/src/replica/log_file.cpp
+++ b/src/replica/log_file.cpp
@@ -46,7 +46,7 @@ log_file::~log_file() { close(); }
// log.index.start_offset
if (name.length() < strlen("log.") || name.substr(0, strlen("log.")) != std::string("log.")) {
err = ERR_INVALID_PARAMETERS;
- dwarn("invalid log path %s", path);
+ LOG_WARNING("invalid log path %s", path);
return nullptr;
}
@@ -55,7 +55,7 @@ log_file::~log_file() { close(); }
auto pos2 = name.find_first_of('.', pos + 1);
if (pos2 == std::string::npos) {
err = ERR_INVALID_PARAMETERS;
- dwarn("invalid log path %s", path);
+ LOG_WARNING("invalid log path %s", path);
return nullptr;
}
@@ -64,7 +64,7 @@ log_file::~log_file() { close(); }
std::string start_offset_str = name.substr(pos2 + 1);
if (index_str.empty() || start_offset_str.empty()) {
err = ERR_INVALID_PARAMETERS;
- dwarn("invalid log path %s", path);
+ LOG_WARNING("invalid log path %s", path);
return nullptr;
}
@@ -72,20 +72,20 @@ log_file::~log_file() { close(); }
int index = static_cast<int>(strtol(index_str.c_str(), &p, 10));
if (*p != 0) {
err = ERR_INVALID_PARAMETERS;
- dwarn("invalid log path %s", path);
+ LOG_WARNING("invalid log path %s", path);
return nullptr;
}
int64_t start_offset = static_cast<int64_t>(strtoll(start_offset_str.c_str(), &p, 10));
if (*p != 0) {
err = ERR_INVALID_PARAMETERS;
- dwarn("invalid log path %s", path);
+ LOG_WARNING("invalid log path %s", path);
return nullptr;
}
disk_file *hfile = file::open(path, O_RDONLY | O_BINARY, 0);
if (!hfile) {
err = ERR_FILE_OPERATION_FAILED;
- dwarn("open log file %s failed", path);
+ LOG_WARNING("open log file %s failed", path);
return nullptr;
}
@@ -96,10 +96,10 @@ log_file::~log_file() { close(); }
if (err == ERR_INVALID_DATA || err == ERR_INCOMPLETE_DATA || err == ERR_HANDLE_EOF ||
err == ERR_FILE_OPERATION_FAILED) {
std::string removed = std::string(path) + ".removed";
- derror("read first log entry of file %s failed, err = %s. Rename the file to %s",
- path,
- err.to_string(),
- removed.c_str());
+ LOG_ERROR("read first log entry of file %s failed, err = %s. Rename the file to %s",
+ path,
+ err.to_string(),
+ removed.c_str());
delete lf;
lf = nullptr;
@@ -113,7 +113,8 @@ log_file::~log_file() { close(); }
lf->read_file_header(reader);
if (!lf->is_right_header()) {
std::string removed = std::string(path) + ".removed";
- derror("invalid log file header of file %s. Rename the file to %s", path, removed.c_str());
+ LOG_ERROR(
+ "invalid log file header of file %s. Rename the file to %s", path, removed.c_str());
delete lf;
lf = nullptr;
@@ -134,13 +135,13 @@ log_file::~log_file() { close(); }
sprintf(path, "%s/log.%d.%" PRId64, dir, index, start_offset);
if (dsn::utils::filesystem::path_exists(std::string(path))) {
- dwarn("log file %s already exist", path);
+ LOG_WARNING("log file %s already exist", path);
return nullptr;
}
disk_file *hfile = file::open(path, O_RDWR | O_CREAT | O_BINARY, 0666);
if (!hfile) {
- dwarn("create log %s failed", path);
+ LOG_WARNING("create log %s failed", path);
return nullptr;
}
@@ -204,10 +205,10 @@ error_code log_file::read_next_log_block(/*out*/ ::dsn::blob &bb)
// if read_count is 0, then we meet the end of file
err = (bb.length() == 0 ? ERR_HANDLE_EOF : ERR_INCOMPLETE_DATA);
} else {
- derror("read data block header failed, size = %d vs %d, err = %s",
- bb.length(),
- (int)sizeof(log_block_header),
- err.to_string());
+ LOG_ERROR("read data block header failed, size = %d vs %d, err = %s",
+ bb.length(),
+ (int)sizeof(log_block_header),
+ err.to_string());
}
return err;
@@ -215,16 +216,16 @@ error_code log_file::read_next_log_block(/*out*/ ::dsn::blob &bb)
log_block_header hdr = *reinterpret_cast<const log_block_header *>(bb.data());
if (hdr.magic != 0xdeadbeef) {
- derror("invalid data header magic: 0x%x", hdr.magic);
+ LOG_ERROR("invalid data header magic: 0x%x", hdr.magic);
return ERR_INVALID_DATA;
}
err = _stream->read_next(hdr.length, bb);
if (err != ERR_OK || hdr.length != bb.length()) {
- derror("read data block body failed, size = %d vs %d, err = %s",
- bb.length(),
- (int)hdr.length,
- err.to_string());
+ LOG_ERROR("read data block body failed, size = %d vs %d, err = %s",
+ bb.length(),
+ (int)hdr.length,
+ err.to_string());
if (err == ERR_OK || err == ERR_HANDLE_EOF) {
// because already read log_block_header above, so here must be imcomplete data
@@ -237,7 +238,7 @@ error_code log_file::read_next_log_block(/*out*/ ::dsn::blob &bb)
auto crc = dsn::utils::crc32_calc(
static_cast<const void *>(bb.data()), static_cast<size_t>(hdr.length), _crc32);
if (crc != hdr.body_crc) {
- derror("crc checking failed");
+ LOG_ERROR("crc checking failed");
return ERR_INVALID_DATA;
}
_crc32 = crc;
diff --git a/src/replica/mutation.cpp b/src/replica/mutation.cpp
index 85e4c3e8a..aec7a37bf 100644
--- a/src/replica/mutation.cpp
+++ b/src/replica/mutation.cpp
@@ -364,9 +364,10 @@ mutation_ptr mutation_queue::add_work(task_code code, dsn::message_ex *request,
_pending_mutation = r->new_mutation(invalid_decree);
}
- dinfo("add request with trace_id = %016" PRIx64 " into mutation with mutation_tid = %" PRIu64,
- request->header->trace_id,
- _pending_mutation->tid());
+ LOG_DEBUG("add request with trace_id = %016" PRIx64
+ " into mutation with mutation_tid = %" PRIu64,
+ request->header->trace_id,
+ _pending_mutation->tid());
_pending_mutation->add_client_request(code, request);
diff --git a/src/replica/mutation_log.cpp b/src/replica/mutation_log.cpp
index bf26b4b7d..8bc7dff00 100644
--- a/src/replica/mutation_log.cpp
+++ b/src/replica/mutation_log.cpp
@@ -170,7 +170,7 @@ void mutation_log_shared::commit_pending_mutations(log_file_ptr &lf,
(*_write_size_counter)->add(sz);
}
} else {
- derror("write shared log failed, err = %s", err.to_string());
+ LOG_ERROR("write shared log failed, err = %s", err.to_string());
}
// here we use _is_writing instead of _issued_write.expired() to check writing done,
@@ -426,7 +426,7 @@ void mutation_log_private::commit_pending_mutations(log_file_ptr &lf,
}
if (err != ERR_OK) {
- derror("write private log failed, err = %s", err.to_string());
+ LOG_ERROR("write private log failed, err = %s", err.to_string());
_is_writing.store(false, std::memory_order_relaxed);
if (_io_error_callback) {
_io_error_callback(err);
@@ -518,7 +518,7 @@ error_code mutation_log::open(replay_callback read_callback,
// create dir if necessary
if (!dsn::utils::filesystem::path_exists(_dir)) {
if (!dsn::utils::filesystem::create_directory(_dir)) {
- derror("open mutation_log: create log path failed");
+ LOG_ERROR("open mutation_log: create log path failed");
return ERR_FILE_OPERATION_FAILED;
}
}
@@ -529,7 +529,7 @@ error_code mutation_log::open(replay_callback read_callback,
std::vector<std::string> file_list;
if (!dsn::utils::filesystem::get_subfiles(_dir, file_list, false)) {
- derror("open mutation_log: get subfiles failed.");
+ LOG_ERROR("open mutation_log: get subfiles failed.");
return ERR_FILE_OPERATION_FAILED;
}
@@ -545,7 +545,8 @@ error_code mutation_log::open(replay_callback read_callback,
if (log == nullptr) {
if (err == ERR_HANDLE_EOF || err == ERR_INCOMPLETE_DATA ||
err == ERR_INVALID_PARAMETERS) {
- dwarn("skip file %s during log init, err = %s", fpath.c_str(), err.to_string());
+ LOG_WARNING(
+ "skip file %s during log init, err = %s", fpath.c_str(), err.to_string());
continue;
} else {
return err;
@@ -553,20 +554,21 @@ error_code mutation_log::open(replay_callback read_callback,
}
if (_is_private) {
- ddebug("open private log %s succeed, start_offset = %" PRId64 ", end_offset = %" PRId64
- ", size = %" PRId64 ", previous_max_decree = %" PRId64,
- fpath.c_str(),
- log->start_offset(),
- log->end_offset(),
- log->end_offset() - log->start_offset(),
- log->previous_log_max_decree(_private_gpid));
+ LOG_INFO("open private log %s succeed, start_offset = %" PRId64
+ ", end_offset = %" PRId64 ", size = %" PRId64
+ ", previous_max_decree = %" PRId64,
+ fpath.c_str(),
+ log->start_offset(),
+ log->end_offset(),
+ log->end_offset() - log->start_offset(),
+ log->previous_log_max_decree(_private_gpid));
} else {
- ddebug("open shared log %s succeed, start_offset = %" PRId64 ", end_offset = %" PRId64
- ", size = %" PRId64 "",
- fpath.c_str(),
- log->start_offset(),
- log->end_offset(),
- log->end_offset() - log->start_offset());
+ LOG_INFO("open shared log %s succeed, start_offset = %" PRId64 ", end_offset = %" PRId64
+ ", size = %" PRId64 "",
+ fpath.c_str(),
+ log->start_offset(),
+ log->end_offset(),
+ log->end_offset() - log->start_offset());
}
dassert(_log_files.find(log->index()) == _log_files.end(),
@@ -650,7 +652,7 @@ error_code mutation_log::open(replay_callback read_callback,
}
for (auto it = _log_files.begin(); it != replay_begin; it++) {
- ddebug("ignore log %s", it->second->path().c_str());
+ LOG_INFO("ignore log %s", it->second->path().c_str());
}
}
@@ -706,7 +708,7 @@ void mutation_log::close()
_is_opened = false;
}
- dinfo("close mutation log %s", dir().c_str());
+ LOG_DEBUG("close mutation log %s", dir().c_str());
// make all data is on disk
flush();
@@ -732,7 +734,7 @@ error_code mutation_log::create_new_log_file()
log_file_ptr logf =
log_file::create_write(_dir.c_str(), _last_file_index + 1, _global_end_offset);
if (logf == nullptr) {
- derror("cannot create log file with index %d", _last_file_index + 1);
+ LOG_ERROR("cannot create log file with index %d", _last_file_index + 1);
return ERR_FILE_OPERATION_FAILED;
}
dassert(logf->end_offset() == logf->start_offset(),
@@ -743,9 +745,9 @@ error_code mutation_log::create_new_log_file()
"%" PRId64 " VS %" PRId64 "",
_global_end_offset,
logf->start_offset());
- ddebug("create new log file %s succeed, time_used = %" PRIu64 " ns",
- logf->path().c_str(),
- dsn_now_ns() - start);
+ LOG_INFO("create new log file %s succeed, time_used = %" PRIu64 " ns",
+ logf->path().c_str(),
+ dsn_now_ns() - start);
// update states
_last_file_index++;
@@ -782,7 +784,7 @@ error_code mutation_log::create_new_log_file()
[this, blk, logf](::dsn::error_code err, size_t sz) {
delete blk;
if (ERR_OK != err) {
- derror(
+ LOG_ERROR(
"write mutation log file header failed, file = %s, err = %s",
logf->path().c_str(),
err.to_string());
@@ -831,10 +833,10 @@ std::pair<log_file_ptr, int64_t> mutation_log::mark_new_offset(size_t size,
}
if (create_file) {
- ddebug("switch log file by %s, old_file = %s, size = %" PRId64,
- reason,
- _current_log_file->path().c_str(),
- file_size);
+ LOG_INFO("switch log file by %s, old_file = %s, size = %" PRId64,
+ reason,
+ _current_log_file->path().c_str(),
+ file_size);
}
}
@@ -964,7 +966,7 @@ error_code mutation_log::reset_from(const std::string &dir,
if (err != ERR_OK) {
if (!utils::filesystem::rename_path(temp_dir, _dir)) {
// rollback failed means old log files are not be recovered, it may be lost if only
- // derror, dassert for manual resolve it
+ // LOG_ERROR, dassert for manual resolve it
dassert_f("rollback {} to {} failed", temp_dir, _dir);
}
} else {
@@ -1011,26 +1013,26 @@ int64_t mutation_log::on_partition_reset(gpid gpid, decree max_decree)
replica_log_info old_info = _private_log_info;
_private_log_info.max_decree = max_decree;
_private_log_info.valid_start_offset = _global_end_offset;
- dwarn("replica %d.%d has changed private log max_decree from %" PRId64 " to %" PRId64
- ", valid_start_offset from %" PRId64 " to %" PRId64,
- gpid.get_app_id(),
- gpid.get_partition_index(),
- old_info.max_decree,
- _private_log_info.max_decree,
- old_info.valid_start_offset,
- _private_log_info.valid_start_offset);
+ LOG_WARNING("replica %d.%d has changed private log max_decree from %" PRId64 " to %" PRId64
+ ", valid_start_offset from %" PRId64 " to %" PRId64,
+ gpid.get_app_id(),
+ gpid.get_partition_index(),
+ old_info.max_decree,
+ _private_log_info.max_decree,
+ old_info.valid_start_offset,
+ _private_log_info.valid_start_offset);
} else {
replica_log_info info(max_decree, _global_end_offset);
auto it = _shared_log_info_map.insert(replica_log_info_map::value_type(gpid, info));
if (!it.second) {
- dwarn("replica %d.%d has changed shared log max_decree from %" PRId64 " to %" PRId64
- ", valid_start_offset from %" PRId64 " to %" PRId64,
- gpid.get_app_id(),
- gpid.get_partition_index(),
- it.first->second.max_decree,
- info.max_decree,
- it.first->second.valid_start_offset,
- info.valid_start_offset);
+ LOG_WARNING("replica %d.%d has changed shared log max_decree from %" PRId64
+ " to %" PRId64 ", valid_start_offset from %" PRId64 " to %" PRId64,
+ gpid.get_app_id(),
+ gpid.get_partition_index(),
+ it.first->second.max_decree,
+ info.max_decree,
+ it.first->second.valid_start_offset,
+ info.valid_start_offset);
_shared_log_info_map[gpid] = info;
}
}
@@ -1165,25 +1167,25 @@ bool mutation_log::get_learn_state(gpid gpid, decree start, /*out*/ learn_state
bool ret = (learned_file_start_offset >= _private_log_info.valid_start_offset &&
last_max_decree > 0 && last_max_decree < start);
- ddebug("gpid(%d.%d) get_learn_state returns %s, "
- "private logs count %d (%d => %d), learned files count %d (%d => %d): "
- "learned_file_start_offset(%" PRId64 ") >= valid_start_offset(%" PRId64 ") && "
- "last_max_decree(%" PRId64 ") > 0 && last_max_decree(%" PRId64
- ") < learn_start_decree(%" PRId64 ")",
- gpid.get_app_id(),
- gpid.get_partition_index(),
- ret ? "true" : "false",
- (int)files.size(),
- files.empty() ? 0 : files.begin()->first,
- files.empty() ? 0 : files.rbegin()->first,
- (int)learn_files.size(),
- learned_file_head_index,
- learned_file_tail_index,
- learned_file_start_offset,
- _private_log_info.valid_start_offset,
- last_max_decree,
- last_max_decree,
- start);
+ LOG_INFO("gpid(%d.%d) get_learn_state returns %s, "
+ "private logs count %d (%d => %d), learned files count %d (%d => %d): "
+ "learned_file_start_offset(%" PRId64 ") >= valid_start_offset(%" PRId64 ") && "
+ "last_max_decree(%" PRId64 ") > 0 && last_max_decree(%" PRId64
+ ") < learn_start_decree(%" PRId64 ")",
+ gpid.get_app_id(),
+ gpid.get_partition_index(),
+ ret ? "true" : "false",
+ (int)files.size(),
+ files.empty() ? 0 : files.begin()->first,
+ files.empty() ? 0 : files.rbegin()->first,
+ (int)learn_files.size(),
+ learned_file_head_index,
+ learned_file_tail_index,
+ learned_file_start_offset,
+ _private_log_info.valid_start_offset,
+ last_max_decree,
+ last_max_decree,
+ start);
return ret;
}
@@ -1269,7 +1271,7 @@ static bool should_reserve_file(log_file_ptr log,
time_t tm;
if (!dsn::utils::filesystem::last_write_time(log->path(), tm)) {
// get file last write time failed, reserve it for safety
- dwarn("get last write time of file %s failed", log->path().c_str());
+ LOG_WARNING("get last write time of file %s failed", log->path().c_str());
return true;
}
file_last_write_time = (uint64_t)tm;
@@ -1387,10 +1389,10 @@ int mutation_log::garbage_collection(gpid gpid,
// delete file
auto &fpath = log->path();
if (!dsn::utils::filesystem::remove_path(fpath)) {
- derror("gc_private @ %d.%d: fail to remove %s, stop current gc cycle ...",
- _private_gpid.get_app_id(),
- _private_gpid.get_partition_index(),
- fpath.c_str());
+ LOG_ERROR("gc_private @ %d.%d: fail to remove %s, stop current gc cycle ...",
+ _private_gpid.get_app_id(),
+ _private_gpid.get_partition_index(),
+ fpath.c_str());
break;
}
@@ -1432,12 +1434,12 @@ int mutation_log::garbage_collection(const replica_log_info_map &gc_condition,
if (files.size() <= 1) {
// nothing to do
- ddebug("gc_shared: too few files to delete, file_count_limit = %d, "
- "reserved_log_count = %d, reserved_log_size = %" PRId64 ", current_log_index = %d",
- file_count_limit,
- (int)files.size(),
- total_log_size,
- current_log_index);
+ LOG_INFO("gc_shared: too few files to delete, file_count_limit = %d, "
+ "reserved_log_count = %d, reserved_log_size = %" PRId64 ", current_log_index = %d",
+ file_count_limit,
+ (int)files.size(),
+ total_log_size,
+ current_log_index);
return (int)files.size();
} else {
// the last one should be the current log file
@@ -1498,20 +1500,20 @@ int mutation_log::garbage_collection(const replica_log_info_map &gc_condition,
valid_start_offset == 0 || valid_start_offset >= log->end_offset(),
"valid start offset must be 0 or greater than the end of this log file");
- dinfo("gc @ %d.%d: max_decree for %s is missing vs %" PRId64
- " as garbage max decree,"
- " safe to delete this and all older logs for this replica",
- gpid.get_app_id(),
- gpid.get_partition_index(),
- log->path().c_str(),
- garbage_max_decree);
+ LOG_DEBUG("gc @ %d.%d: max_decree for %s is missing vs %" PRId64
+ " as garbage max decree,"
+ " safe to delete this and all older logs for this replica",
+ gpid.get_app_id(),
+ gpid.get_partition_index(),
+ log->path().c_str(),
+ garbage_max_decree);
delete_ok_for_this_replica = true;
kickout_this_replica = true;
}
// log is invalid for this replica, ok to delete
else if (log->end_offset() <= valid_start_offset) {
- dinfo(
+ LOG_DEBUG(
"gc @ %d.%d: log is invalid for %s, as"
" valid start offset vs log end offset = %" PRId64 " vs %" PRId64 ","
" it is therefore safe to delete this and all older logs for this replica",
@@ -1526,7 +1528,7 @@ int mutation_log::garbage_collection(const replica_log_info_map &gc_condition,
// all decrees are no more than garbage max decree, ok to delete
else if (it3->second.max_decree <= garbage_max_decree) {
- dinfo(
+ LOG_DEBUG(
"gc @ %d.%d: max_decree for %s is %" PRId64 " vs %" PRId64
" as garbage max decree,"
" it is therefore safe to delete this and all older logs for this replica",
@@ -1542,14 +1544,14 @@ int mutation_log::garbage_collection(const replica_log_info_map &gc_condition,
else // it3->second.max_decree > garbage_max_decree
{
// should not delete this file
- dinfo("gc @ %d.%d: max_decree for %s is %" PRId64 " vs %" PRId64
- " as garbage max decree,"
- " it is therefore not allowed to delete this and all older logs",
- gpid.get_app_id(),
- gpid.get_partition_index(),
- log->path().c_str(),
- it3->second.max_decree,
- garbage_max_decree);
+ LOG_DEBUG("gc @ %d.%d: max_decree for %s is %" PRId64 " vs %" PRId64
+ " as garbage max decree,"
+ " it is therefore not allowed to delete this and all older logs",
+ gpid.get_app_id(),
+ gpid.get_partition_index(),
+ log->path().c_str(),
+ it3->second.max_decree,
+ garbage_max_decree);
prevent_gc_replicas_for_this_log.insert(gpid);
decree gap = it3->second.max_decree - garbage_max_decree;
if (log->index() < stop_gc_log_index || gap > stop_gc_decree_gap) {
@@ -1593,33 +1595,34 @@ int mutation_log::garbage_collection(const replica_log_info_map &gc_condition,
if (mark_it == files.rend()) {
// no file to delete
if (stop_gc_decree_gap > 0) {
- ddebug("gc_shared: no file can be deleted, file_count_limit = %d, "
- "reserved_log_count = %d, reserved_log_size = %" PRId64 ", "
- "reserved_smallest_log = %d, reserved_largest_log = %d, "
- "stop_gc_log_index = %d, stop_gc_replica_count = %d, "
- "stop_gc_replica = %d.%d, stop_gc_decree_gap = %" PRId64 ", "
- "stop_gc_garbage_max_decree = %" PRId64 ", stop_gc_log_max_decree = %" PRId64 "",
- file_count_limit,
- reserved_log_count,
- reserved_log_size,
- reserved_smallest_log,
- reserved_largest_log,
- stop_gc_log_index,
- (int)prevent_gc_replicas.size(),
- stop_gc_replica.get_app_id(),
- stop_gc_replica.get_partition_index(),
- stop_gc_decree_gap,
- stop_gc_garbage_max_decree,
- stop_gc_log_max_decree);
+ LOG_INFO("gc_shared: no file can be deleted, file_count_limit = %d, "
+ "reserved_log_count = %d, reserved_log_size = %" PRId64 ", "
+ "reserved_smallest_log = %d, reserved_largest_log = %d, "
+ "stop_gc_log_index = %d, stop_gc_replica_count = %d, "
+ "stop_gc_replica = %d.%d, stop_gc_decree_gap = %" PRId64 ", "
+ "stop_gc_garbage_max_decree = %" PRId64 ", stop_gc_log_max_decree = %" PRId64
+ "",
+ file_count_limit,
+ reserved_log_count,
+ reserved_log_size,
+ reserved_smallest_log,
+ reserved_largest_log,
+ stop_gc_log_index,
+ (int)prevent_gc_replicas.size(),
+ stop_gc_replica.get_app_id(),
+ stop_gc_replica.get_partition_index(),
+ stop_gc_decree_gap,
+ stop_gc_garbage_max_decree,
+ stop_gc_log_max_decree);
} else {
- ddebug("gc_shared: no file can be deleted, file_count_limit = %d, "
- "reserved_log_count = %d, reserved_log_size = %" PRId64 ", "
- "reserved_smallest_log = %d, reserved_largest_log = %d, ",
- file_count_limit,
- reserved_log_count,
- reserved_log_size,
- reserved_smallest_log,
- reserved_largest_log);
+ LOG_INFO("gc_shared: no file can be deleted, file_count_limit = %d, "
+ "reserved_log_count = %d, reserved_log_size = %" PRId64 ", "
+ "reserved_smallest_log = %d, reserved_largest_log = %d, ",
+ file_count_limit,
+ reserved_log_count,
+ reserved_log_size,
+ reserved_smallest_log,
+ reserved_largest_log);
}
return reserved_log_count;
@@ -1647,12 +1650,12 @@ int mutation_log::garbage_collection(const replica_log_info_map &gc_condition,
// delete file
auto &fpath = log->path();
if (!dsn::utils::filesystem::remove_path(fpath)) {
- derror("gc_shared: fail to remove %s, stop current gc cycle ...", fpath.c_str());
+ LOG_ERROR("gc_shared: fail to remove %s, stop current gc cycle ...", fpath.c_str());
break;
}
// delete succeed
- ddebug("gc_shared: log file %s is removed", fpath.c_str());
+ LOG_INFO("gc_shared: log file %s is removed", fpath.c_str());
deleted_log_count++;
deleted_log_size += log->end_offset() - log->start_offset();
if (deleted_smallest_log == 0)
@@ -1678,51 +1681,51 @@ int mutation_log::garbage_collection(const replica_log_info_map &gc_condition,
}
if (stop_gc_decree_gap > 0) {
- ddebug("gc_shared: deleted some files, file_count_limit = %d, "
- "reserved_log_count = %d, reserved_log_size = %" PRId64 ", "
- "reserved_smallest_log = %d, reserved_largest_log = %d, "
- "to_delete_log_count = %d, to_delete_log_size = %" PRId64 ", "
- "deleted_log_count = %d, deleted_log_size = %" PRId64 ", "
- "deleted_smallest_log = %d, deleted_largest_log = %d, "
- "stop_gc_log_index = %d, stop_gc_replica_count = %d, "
- "stop_gc_replica = %d.%d, stop_gc_decree_gap = %" PRId64 ", "
- "stop_gc_garbage_max_decree = %" PRId64 ", stop_gc_log_max_decree = %" PRId64 "",
- file_count_limit,
- reserved_log_count,
- reserved_log_size,
- reserved_smallest_log,
- reserved_largest_log,
- to_delete_log_count,
- to_delete_log_size,
- deleted_log_count,
- deleted_log_size,
- deleted_smallest_log,
- deleted_largest_log,
- stop_gc_log_index,
- (int)prevent_gc_replicas.size(),
- stop_gc_replica.get_app_id(),
- stop_gc_replica.get_partition_index(),
- stop_gc_decree_gap,
- stop_gc_garbage_max_decree,
- stop_gc_log_max_decree);
+ LOG_INFO("gc_shared: deleted some files, file_count_limit = %d, "
+ "reserved_log_count = %d, reserved_log_size = %" PRId64 ", "
+ "reserved_smallest_log = %d, reserved_largest_log = %d, "
+ "to_delete_log_count = %d, to_delete_log_size = %" PRId64 ", "
+ "deleted_log_count = %d, deleted_log_size = %" PRId64 ", "
+ "deleted_smallest_log = %d, deleted_largest_log = %d, "
+ "stop_gc_log_index = %d, stop_gc_replica_count = %d, "
+ "stop_gc_replica = %d.%d, stop_gc_decree_gap = %" PRId64 ", "
+ "stop_gc_garbage_max_decree = %" PRId64 ", stop_gc_log_max_decree = %" PRId64 "",
+ file_count_limit,
+ reserved_log_count,
+ reserved_log_size,
+ reserved_smallest_log,
+ reserved_largest_log,
+ to_delete_log_count,
+ to_delete_log_size,
+ deleted_log_count,
+ deleted_log_size,
+ deleted_smallest_log,
+ deleted_largest_log,
+ stop_gc_log_index,
+ (int)prevent_gc_replicas.size(),
+ stop_gc_replica.get_app_id(),
+ stop_gc_replica.get_partition_index(),
+ stop_gc_decree_gap,
+ stop_gc_garbage_max_decree,
+ stop_gc_log_max_decree);
} else {
- ddebug("gc_shared: deleted some files, file_count_limit = %d, "
- "reserved_log_count = %d, reserved_log_size = %" PRId64 ", "
- "reserved_smallest_log = %d, reserved_largest_log = %d, "
- "to_delete_log_count = %d, to_delete_log_size = %" PRId64 ", "
- "deleted_log_count = %d, deleted_log_size = %" PRId64 ", "
- "deleted_smallest_log = %d, deleted_largest_log = %d",
- file_count_limit,
- reserved_log_count,
- reserved_log_size,
- reserved_smallest_log,
- reserved_largest_log,
- to_delete_log_count,
- to_delete_log_size,
- deleted_log_count,
- deleted_log_size,
- deleted_smallest_log,
- deleted_largest_log);
+ LOG_INFO("gc_shared: deleted some files, file_count_limit = %d, "
+ "reserved_log_count = %d, reserved_log_size = %" PRId64 ", "
+ "reserved_smallest_log = %d, reserved_largest_log = %d, "
+ "to_delete_log_count = %d, to_delete_log_size = %" PRId64 ", "
+ "deleted_log_count = %d, deleted_log_size = %" PRId64 ", "
+ "deleted_smallest_log = %d, deleted_largest_log = %d",
+ file_count_limit,
+ reserved_log_count,
+ reserved_log_size,
+ reserved_smallest_log,
+ reserved_largest_log,
+ to_delete_log_count,
+ to_delete_log_size,
+ deleted_log_count,
+ deleted_log_size,
+ deleted_smallest_log,
+ deleted_largest_log);
}
return reserved_log_count;
diff --git a/src/replica/mutation_log_replay.cpp b/src/replica/mutation_log_replay.cpp
index edae4a248..b34944e20 100644
--- a/src/replica/mutation_log_replay.cpp
+++ b/src/replica/mutation_log_replay.cpp
@@ -29,11 +29,12 @@ namespace replication {
/*out*/ int64_t &end_offset)
{
end_offset = log->start_offset();
- ddebug("start to replay mutation log %s, offset = [%" PRId64 ", %" PRId64 "), size = %" PRId64,
- log->path().c_str(),
- log->start_offset(),
- log->end_offset(),
- log->end_offset() - log->start_offset());
+ LOG_INFO("start to replay mutation log %s, offset = [%" PRId64 ", %" PRId64
+ "), size = %" PRId64,
+ log->path().c_str(),
+ log->start_offset(),
+ log->end_offset(),
+ log->end_offset() - log->start_offset());
::dsn::blob bb;
log->reset_stream();
@@ -49,9 +50,9 @@ namespace replication {
start_offset = static_cast<size_t>(end_offset - log->start_offset());
}
- ddebug("finish to replay mutation log (%s) [err: %s]",
- log->path().c_str(),
- err.description().c_str());
+ LOG_INFO("finish to replay mutation log (%s) [err: %s]",
+ log->path().c_str(),
+ err.description().c_str());
return err.code();
}
@@ -123,7 +124,7 @@ namespace replication {
if (log == nullptr) {
if (err == ERR_HANDLE_EOF || err == ERR_INCOMPLETE_DATA ||
err == ERR_INVALID_PARAMETERS) {
- dinfo("skip file %s during log replay", fpath.c_str());
+ LOG_DEBUG("skip file %s during log replay", fpath.c_str());
continue;
} else {
return err;
@@ -164,9 +165,10 @@ namespace replication {
log_file_ptr &log = kv.second;
if (log->start_offset() != end_offset) {
- derror("offset mismatch in log file offset and global offset %" PRId64 " vs %" PRId64,
- log->start_offset(),
- end_offset);
+ LOG_ERROR("offset mismatch in log file offset and global offset %" PRId64
+ " vs %" PRId64,
+ log->start_offset(),
+ end_offset);
return ERR_INVALID_DATA;
}
@@ -180,7 +182,7 @@ namespace replication {
} else if (err == ERR_INCOMPLETE_DATA) {
// If the file is not corrupted, it may also return the value of ERR_INCOMPLETE_DATA.
// In this case, the correctness is relying on the check of start_offset.
- dwarn("delay handling error: %s", err.to_string());
+ LOG_WARNING("delay handling error: %s", err.to_string());
} else {
// for other errors, we should break
break;
@@ -199,7 +201,7 @@ namespace replication {
err = ERR_OK;
} else {
// bad error
- derror("replay mutation log failed: %s", err.to_string());
+ LOG_ERROR("replay mutation log failed: %s", err.to_string());
}
return err;
diff --git a/src/replica/replica.cpp b/src/replica/replica.cpp
index 7babd81ad..9d44cdbc9 100644
--- a/src/replica/replica.cpp
+++ b/src/replica/replica.cpp
@@ -197,7 +197,7 @@ replica::~replica(void)
{
close();
_prepare_list = nullptr;
- dinfo("%s: replica destroyed", name());
+ LOG_DEBUG("%s: replica destroyed", name());
}
void replica::on_client_read(dsn::message_ex *request, bool ignore_throttling)
@@ -291,10 +291,10 @@ void replica::check_state_completeness()
void replica::execute_mutation(mutation_ptr &mu)
{
- dinfo("%s: execute mutation %s: request_count = %u",
- name(),
- mu->name(),
- static_cast<int>(mu->client_requests.size()));
+ LOG_DEBUG("%s: execute mutation %s: request_count = %u",
+ name(),
+ mu->name(),
+ static_cast<int>(mu->client_requests.size()));
error_code err = ERR_OK;
decree d = mu->data.header.decree;
@@ -304,11 +304,11 @@ void replica::execute_mutation(mutation_ptr &mu)
if (_app->last_committed_decree() + 1 == d) {
err = _app->apply_mutation(mu);
} else {
- dinfo("%s: mutation %s commit to %s skipped, app.last_committed_decree = %" PRId64,
- name(),
- mu->name(),
- enum_to_string(status()),
- _app->last_committed_decree());
+ LOG_DEBUG("%s: mutation %s commit to %s skipped, app.last_committed_decree = %" PRId64,
+ name(),
+ mu->name(),
+ enum_to_string(status()),
+ _app->last_committed_decree());
}
break;
case partition_status::PS_PRIMARY: {
@@ -330,11 +330,11 @@ void replica::execute_mutation(mutation_ptr &mu)
d);
err = _app->apply_mutation(mu);
} else {
- dinfo("%s: mutation %s commit to %s skipped, app.last_committed_decree = %" PRId64,
- name(),
- mu->name(),
- enum_to_string(status()),
- _app->last_committed_decree());
+ LOG_DEBUG("%s: mutation %s commit to %s skipped, app.last_committed_decree = %" PRId64,
+ name(),
+ mu->name(),
+ enum_to_string(status()),
+ _app->last_committed_decree());
// make sure private log saves the state
// catch-up will be done later after checkpoint task is fininished
@@ -351,11 +351,11 @@ void replica::execute_mutation(mutation_ptr &mu)
d);
err = _app->apply_mutation(mu);
} else {
- dinfo("%s: mutation %s commit to %s skipped, app.last_committed_decree = %" PRId64,
- name(),
- mu->name(),
- enum_to_string(status()),
- _app->last_committed_decree());
+ LOG_DEBUG("%s: mutation %s commit to %s skipped, app.last_committed_decree = %" PRId64,
+ name(),
+ mu->name(),
+ enum_to_string(status()),
+ _app->last_committed_decree());
// prepare also happens with learner_status::LearningWithPrepare, in this case
// make sure private log saves the state,
@@ -375,7 +375,7 @@ void replica::execute_mutation(mutation_ptr &mu)
dassert(false, "invalid partition_status, status = %s", enum_to_string(status()));
}
- dinfo(
+ LOG_DEBUG(
"TwoPhaseCommit, %s: mutation %s committed, err = %s", name(), mu->name(), err.to_string());
if (err != ERR_OK) {
@@ -487,7 +487,7 @@ void replica::close()
std::unique_ptr<replication_app_base> tmp_app = std::move(_app);
error_code err = tmp_app->close(false);
if (err != dsn::ERR_OK) {
- dwarn("%s: close app failed, err = %s", name(), err.to_string());
+ LOG_WARNING("%s: close app failed, err = %s", name(), err.to_string());
}
}
@@ -510,7 +510,7 @@ void replica::close()
_split_mgr.reset();
- ddebug("%s: replica closed, time_used = %" PRIu64 "ms", name(), dsn_now_ms() - start_time);
+ LOG_INFO("%s: replica closed, time_used = %" PRIu64 "ms", name(), dsn_now_ms() - start_time);
}
std::string replica::query_manual_compact_state() const
diff --git a/src/replica/replica_2pc.cpp b/src/replica/replica_2pc.cpp
index e9bd848ce..e40ec6d3d 100644
--- a/src/replica/replica_2pc.cpp
+++ b/src/replica/replica_2pc.cpp
@@ -153,7 +153,7 @@ void replica::on_client_write(dsn::message_ex *request, bool ignore_throttling)
return;
}
- dinfo("%s: got write request from %s", name(), request->header->from_address.to_string());
+ LOG_DEBUG("%s: got write request from %s", name(), request->header->from_address.to_string());
auto mu = _primary_states.write_queue.add_work(request->rpc_code(), request, this);
if (mu) {
init_prepare(mu, false);
@@ -174,13 +174,13 @@ void replica::init_prepare(mutation_ptr &mu, bool reconciliation, bool pop_all_c
const auto request_count = mu->client_requests.size();
mu->data.header.last_committed_decree = last_committed_decree();
- dsn_log_level_t level = LOG_LEVEL_INFORMATION;
+ dsn_log_level_t level = LOG_LEVEL_DEBUG;
if (mu->data.header.decree == invalid_decree) {
mu->set_id(get_ballot(), _prepare_list->max_decree() + 1);
// print a debug log if necessary
if (_options->prepare_decree_gap_for_debug_logging > 0 &&
mu->get_decree() % _options->prepare_decree_gap_for_debug_logging == 0)
- level = LOG_LEVEL_DEBUG;
+ level = LOG_LEVEL_INFO;
mu->set_timestamp(_uniq_timestamp_us.next());
} else {
mu->set_id(get_ballot(), mu->data.header.decree);
@@ -297,11 +297,11 @@ void replica::init_prepare(mutation_ptr &mu, bool reconciliation, bool pop_all_c
int delay_ms = _options->log_shared_pending_size_throttling_delay_ms;
for (dsn::message_ex *r : mu->client_requests) {
if (r && r->io_session->delay_recv(delay_ms)) {
- dwarn("too large pending shared log (%" PRId64 "), "
- "delay traffic from %s for %d milliseconds",
- pending_size,
- r->header->from_address.to_string(),
- delay_ms);
+ LOG_WARNING("too large pending shared log (%" PRId64 "), "
+ "delay traffic from %s for %d milliseconds",
+ pending_size,
+ r->header->from_address.to_string(),
+ delay_ms);
}
}
}
@@ -352,11 +352,11 @@ void replica::send_prepare_message(::dsn::rpc_address addr,
},
get_gpid().thread_hash());
- dinfo("%s: mutation %s send_prepare_message to %s as %s",
- name(),
- mu->name(),
- addr.to_string(),
- enum_to_string(rconfig.status));
+ LOG_DEBUG("%s: mutation %s send_prepare_message to %s as %s",
+ name(),
+ mu->name(),
+ addr.to_string(),
+ enum_to_string(rconfig.status));
}
void replica::do_possible_commit_on_primary(mutation_ptr &mu)
@@ -394,7 +394,7 @@ void replica::on_prepare(dsn::message_ex *request)
decree decree = mu->data.header.decree;
- dinfo("%s: mutation %s on_prepare", name(), mu->name());
+ LOG_DEBUG("%s: mutation %s on_prepare", name(), mu->name());
mu->_tracer->set_name(fmt::format("mutation[{}]", mu->name()));
mu->_tracer->set_description("secondary");
ADD_POINT(mu->_tracer);
@@ -411,7 +411,7 @@ void replica::on_prepare(dsn::message_ex *request)
rconfig.ballot);
if (mu->data.header.ballot < get_ballot()) {
- derror("%s: mutation %s on_prepare skipped due to old view", name(), mu->name());
+ LOG_ERROR("%s: mutation %s on_prepare skipped due to old view", name(), mu->name());
// no need response because the rpc should have been cancelled on primary in this case
return;
}
@@ -419,21 +419,22 @@ void replica::on_prepare(dsn::message_ex *request)
// update configuration when necessary
else if (rconfig.ballot > get_ballot()) {
if (!update_local_configuration(rconfig)) {
- derror("%s: mutation %s on_prepare failed as update local configuration failed, state "
- "= %s",
- name(),
- mu->name(),
- enum_to_string(status()));
+ LOG_ERROR(
+ "%s: mutation %s on_prepare failed as update local configuration failed, state "
+ "= %s",
+ name(),
+ mu->name(),
+ enum_to_string(status()));
ack_prepare_message(ERR_INVALID_STATE, mu);
return;
}
}
if (partition_status::PS_INACTIVE == status() || partition_status::PS_ERROR == status()) {
- derror("%s: mutation %s on_prepare failed as invalid replica state, state = %s",
- name(),
- mu->name(),
- enum_to_string(status()));
+ LOG_ERROR("%s: mutation %s on_prepare failed as invalid replica state, state = %s",
+ name(),
+ mu->name(),
+ enum_to_string(status()));
ack_prepare_message((partition_status::PS_INACTIVE == status() && _inactive_is_transient)
? ERR_INACTIVE_STATE
: ERR_INVALID_STATE,
@@ -442,13 +443,14 @@ void replica::on_prepare(dsn::message_ex *request)
} else if (partition_status::PS_POTENTIAL_SECONDARY == status()) {
// new learning process
if (rconfig.learner_signature != _potential_secondary_states.learning_version) {
- derror("%s: mutation %s on_prepare failed as unmatched learning signature, state = %s"
- ", old_signature[%016" PRIx64 "] vs new_signature[%016" PRIx64 "]",
- name(),
- mu->name(),
- enum_to_string(status()),
- _potential_secondary_states.learning_version,
- rconfig.learner_signature);
+ LOG_ERROR(
+ "%s: mutation %s on_prepare failed as unmatched learning signature, state = %s"
+ ", old_signature[%016" PRIx64 "] vs new_signature[%016" PRIx64 "]",
+ name(),
+ mu->name(),
+ enum_to_string(status()),
+ _potential_secondary_states.learning_version,
+ rconfig.learner_signature);
handle_learning_error(ERR_INVALID_STATE, false);
ack_prepare_message(ERR_INVALID_STATE, mu);
return;
@@ -462,13 +464,13 @@ void replica::on_prepare(dsn::message_ex *request)
error_code ack_code =
(learning_status == learner_status::LearningWithoutPrepare ? ERR_TRY_AGAIN
: ERR_INVALID_STATE);
- derror("%s: mutation %s on_prepare skipped as invalid learning status, state = %s, "
- "learning_status = %s, ack %s",
- name(),
- mu->name(),
- enum_to_string(status()),
- enum_to_string(learning_status),
- ack_code.to_string());
+ LOG_ERROR("%s: mutation %s on_prepare skipped as invalid learning status, state = %s, "
+ "learning_status = %s, ack %s",
+ name(),
+ mu->name(),
+ enum_to_string(status()),
+ enum_to_string(learning_status),
+ ack_code.to_string());
ack_prepare_message(ack_code, mu);
return;
}
@@ -510,10 +512,10 @@ void replica::on_prepare(dsn::message_ex *request)
last_committed_decree(),
_options->max_mutation_count_in_prepare_list);
} else {
- derror("%s: mutation %s on_prepare failed as invalid replica state, state = %s",
- name(),
- mu->name(),
- enum_to_string(status()));
+ LOG_ERROR("%s: mutation %s on_prepare failed as invalid replica state, state = %s",
+ name(),
+ mu->name(),
+ enum_to_string(status()));
ack_prepare_message(ERR_INVALID_STATE, mu);
return;
}
@@ -539,21 +541,21 @@ void replica::on_append_log_completed(mutation_ptr &mu, error_code err, size_t s
{
_checker.only_one_thread_access();
- dinfo("%s: append shared log completed for mutation %s, size = %u, err = %s",
- name(),
- mu->name(),
- size,
- err.to_string());
+ LOG_DEBUG("%s: append shared log completed for mutation %s, size = %u, err = %s",
+ name(),
+ mu->name(),
+ size,
+ err.to_string());
ADD_POINT(mu->_tracer);
if (err == ERR_OK) {
mu->set_logged();
} else {
- derror("%s: append shared log failed for mutation %s, err = %s",
- name(),
- mu->name(),
- err.to_string());
+ LOG_ERROR("%s: append shared log failed for mutation %s, err = %s",
+ name(),
+ mu->name(),
+ err.to_string());
}
// skip old mutations
@@ -636,23 +638,23 @@ void replica::on_prepare_reply(std::pair<mutation_ptr, partition_status::type> p
ADD_CUSTOM_POINT(send_prepare_tracer, resp.err.to_string());
if (resp.err == ERR_OK) {
- dinfo("%s: mutation %s on_prepare_reply from %s, appro_data_bytes = %d, "
- "target_status = %s, err = %s",
- name(),
- mu->name(),
- node.to_string(),
- mu->appro_data_bytes(),
- enum_to_string(target_status),
- resp.err.to_string());
+ LOG_DEBUG("%s: mutation %s on_prepare_reply from %s, appro_data_bytes = %d, "
+ "target_status = %s, err = %s",
+ name(),
+ mu->name(),
+ node.to_string(),
+ mu->appro_data_bytes(),
+ enum_to_string(target_status),
+ resp.err.to_string());
} else {
- derror("%s: mutation %s on_prepare_reply from %s, appro_data_bytes = %d, "
- "target_status = %s, err = %s",
- name(),
- mu->name(),
- node.to_string(),
- mu->appro_data_bytes(),
- enum_to_string(target_status),
- resp.err.to_string());
+ LOG_ERROR("%s: mutation %s on_prepare_reply from %s, appro_data_bytes = %d, "
+ "target_status = %s, err = %s",
+ name(),
+ mu->name(),
+ node.to_string(),
+ mu->appro_data_bytes(),
+ enum_to_string(target_status),
+ resp.err.to_string());
}
if (resp.err == ERR_OK) {
@@ -684,9 +686,9 @@ void replica::on_prepare_reply(std::pair<mutation_ptr, partition_status::type> p
}
break;
default:
- dwarn("%s: mutation %s prepare ack skipped coz the node is now inactive",
- name(),
- mu->name());
+ LOG_WARNING("%s: mutation %s prepare ack skipped coz the node is now inactive",
+ name(),
+ mu->name());
break;
}
}
@@ -700,20 +702,20 @@ void replica::on_prepare_reply(std::pair<mutation_ptr, partition_status::type> p
: _options->prepare_timeout_ms_for_potential_secondaries);
int delay_time_ms = 5; // delay some time before retry to avoid sending too frequently
if (mu->is_prepare_close_to_timeout(delay_time_ms + 2, prepare_timeout_ms)) {
- derror("%s: mutation %s do not retry prepare to %s for no enought time left, "
- "prepare_ts_ms = %" PRIu64 ", prepare_timeout_ms = %d, now_ms = %" PRIu64,
- name(),
- mu->name(),
- node.to_string(),
- mu->prepare_ts_ms(),
- prepare_timeout_ms,
- dsn_now_ms());
+ LOG_ERROR("%s: mutation %s do not retry prepare to %s for no enought time left, "
+ "prepare_ts_ms = %" PRIu64 ", prepare_timeout_ms = %d, now_ms = %" PRIu64,
+ name(),
+ mu->name(),
+ node.to_string(),
+ mu->prepare_ts_ms(),
+ prepare_timeout_ms,
+ dsn_now_ms());
} else {
- ddebug("%s: mutation %s retry prepare to %s after %d ms",
- name(),
- mu->name(),
- node.to_string(),
- delay_time_ms);
+ LOG_INFO("%s: mutation %s retry prepare to %s after %d ms",
+ name(),
+ mu->name(),
+ node.to_string(),
+ delay_time_ms);
int64_t learn_signature = invalid_signature;
if (target_status == partition_status::PS_POTENTIAL_SECONDARY) {
auto it = _primary_states.learners.find(node);
diff --git a/src/replica/replica_backup.cpp b/src/replica/replica_backup.cpp
index 8293af188..0a4e21c6b 100644
--- a/src/replica/replica_backup.cpp
+++ b/src/replica/replica_backup.cpp
@@ -63,10 +63,11 @@ void replica::on_cold_backup(const backup_request &request, /*out*/ backup_respo
_stub->_block_service_manager.get_or_create_block_filesystem(
request.policy.backup_provider_type);
if (block_service == nullptr) {
- derror("%s: create cold backup block service failed, provider_type = %s, response "
- "ERR_INVALID_PARAMETERS",
- new_context->name,
- request.policy.backup_provider_type.c_str());
+ LOG_ERROR(
+ "%s: create cold backup block service failed, provider_type = %s, response "
+ "ERR_INVALID_PARAMETERS",
+ new_context->name,
+ request.policy.backup_provider_type.c_str());
response.err = ERR_INVALID_PARAMETERS;
return;
}
@@ -85,9 +86,9 @@ void replica::on_cold_backup(const backup_request &request, /*out*/ backup_respo
if (backup_context->request.backup_id < backup_id || backup_status == ColdBackupCanceled) {
if (backup_status == ColdBackupCheckpointing) {
- ddebug("%s: delay clearing obsoleted cold backup context, cause backup_status == "
- "ColdBackupCheckpointing",
- new_context->name);
+ LOG_INFO("%s: delay clearing obsoleted cold backup context, cause backup_status == "
+ "ColdBackupCheckpointing",
+ new_context->name);
tasking::enqueue(LPC_REPLICATION_COLD_BACKUP,
&_tracker,
[this, request]() {
@@ -100,11 +101,11 @@ void replica::on_cold_backup(const backup_request &request, /*out*/ backup_respo
// TODO(wutao1): deleting cold backup context should be
// extracted as a function like try_delete_cold_backup_context;
// clear obsoleted backup context firstly
- ddebug("%s: clear obsoleted cold backup context, old_backup_id = %" PRId64
- ", old_backup_status = %s",
- new_context->name,
- backup_context->request.backup_id,
- cold_backup_status_to_string(backup_status));
+ LOG_INFO("%s: clear obsoleted cold backup context, old_backup_id = %" PRId64
+ ", old_backup_status = %s",
+ new_context->name,
+ backup_context->request.backup_id,
+ cold_backup_status_to_string(backup_status));
backup_context->cancel();
_cold_backup_contexts.erase(policy_name);
// go to another round
@@ -115,10 +116,10 @@ void replica::on_cold_backup(const backup_request &request, /*out*/ backup_respo
if (backup_context->request.backup_id > backup_id) {
// backup_id is outdated
- derror("%s: request outdated cold backup, current_backup_id = %" PRId64
- ", response ERR_VERSION_OUTDATED",
- new_context->name,
- backup_context->request.backup_id);
+ LOG_ERROR("%s: request outdated cold backup, current_backup_id = %" PRId64
+ ", response ERR_VERSION_OUTDATED",
+ new_context->name,
+ backup_context->request.backup_id);
response.err = ERR_VERSION_OUTDATED;
return;
}
@@ -152,21 +153,22 @@ void replica::on_cold_backup(const backup_request &request, /*out*/ backup_respo
if (backup_status == ColdBackupChecking || backup_status == ColdBackupCheckpointing ||
backup_status == ColdBackupUploading) {
// do nothing
- ddebug("%s: backup is busy, status = %s, progress = %d, response ERR_BUSY",
- backup_context->name,
- cold_backup_status_to_string(backup_status),
- backup_context->progress());
+ LOG_INFO("%s: backup is busy, status = %s, progress = %d, response ERR_BUSY",
+ backup_context->name,
+ cold_backup_status_to_string(backup_status),
+ backup_context->progress());
response.err = ERR_BUSY;
} else if (backup_status == ColdBackupInvalid && backup_context->start_check()) {
_stub->_counter_cold_backup_recent_start_count->increment();
- ddebug("%s: start checking backup on remote, response ERR_BUSY", backup_context->name);
+ LOG_INFO("%s: start checking backup on remote, response ERR_BUSY",
+ backup_context->name);
tasking::enqueue(LPC_BACKGROUND_COLD_BACKUP, nullptr, [backup_context]() {
backup_context->check_backup_on_remote();
});
response.err = ERR_BUSY;
} else if (backup_status == ColdBackupChecked && backup_context->start_checkpoint()) {
// start generating checkpoint
- ddebug("%s: start generating checkpoint, response ERR_BUSY", backup_context->name);
+ LOG_INFO("%s: start generating checkpoint, response ERR_BUSY", backup_context->name);
tasking::enqueue(LPC_BACKGROUND_COLD_BACKUP, &_tracker, [this, backup_context]() {
generate_backup_checkpoint(backup_context);
});
@@ -174,20 +176,20 @@ void replica::on_cold_backup(const backup_request &request, /*out*/ backup_respo
} else if ((backup_status == ColdBackupCheckpointed || backup_status == ColdBackupPaused) &&
backup_context->start_upload()) {
// start uploading checkpoint
- ddebug("%s: start uploading checkpoint, response ERR_BUSY", backup_context->name);
+ LOG_INFO("%s: start uploading checkpoint, response ERR_BUSY", backup_context->name);
tasking::enqueue(LPC_BACKGROUND_COLD_BACKUP, nullptr, [backup_context]() {
backup_context->upload_checkpoint_to_remote();
});
response.err = ERR_BUSY;
} else if (backup_status == ColdBackupFailed) {
- derror("%s: upload checkpoint failed, reason = %s, response ERR_LOCAL_APP_FAILURE",
- backup_context->name,
- backup_context->reason());
+ LOG_ERROR("%s: upload checkpoint failed, reason = %s, response ERR_LOCAL_APP_FAILURE",
+ backup_context->name,
+ backup_context->reason());
response.err = ERR_LOCAL_APP_FAILURE;
backup_context->cancel();
_cold_backup_contexts.erase(policy_name);
} else if (backup_status == ColdBackupCompleted) {
- ddebug("%s: upload checkpoint completed, response ERR_OK", backup_context->name);
+ LOG_INFO("%s: upload checkpoint completed, response ERR_OK", backup_context->name);
_backup_mgr->send_clear_request_to_secondaries(backup_context->request.pid,
policy_name);
@@ -195,7 +197,7 @@ void replica::on_cold_backup(const backup_request &request, /*out*/ backup_respo
_backup_mgr->background_clear_backup_checkpoint(policy_name);
response.err = ERR_OK;
} else {
- dwarn(
+ LOG_WARNING(
"%s: unhandled case, handle_status = %s, real_time_status = %s, response ERR_BUSY",
backup_context->name,
cold_backup_status_to_string(backup_status),
@@ -205,9 +207,9 @@ void replica::on_cold_backup(const backup_request &request, /*out*/ backup_respo
response.progress = backup_context->progress();
response.checkpoint_total_size = backup_context->get_checkpoint_total_size();
- ddebug("%s: backup progress is %d", backup_context->name, response.progress);
+ LOG_INFO("%s: backup progress is %d", backup_context->name, response.progress);
} else {
- derror(
+ LOG_ERROR(
"%s: invalid state for cold backup, partition_status = %s, response ERR_INVALID_STATE",
new_context->name,
enum_to_string(status()));
@@ -294,7 +296,7 @@ static int is_related_or_valid_checkpoint(const std::string &chkpt_dirname,
}
} else {
// unknown dir, ignore it
- dwarn(
+ LOG_WARNING(
"%s: found a invalid checkpoint dir(%s)", backup_context->name, chkpt_dirname.c_str());
}
return 0;
@@ -313,7 +315,7 @@ static bool filter_checkpoint(const std::string &dir,
// list sub dirs
std::vector<std::string> sub_dirs;
if (!utils::filesystem::get_subdirectories(dir, sub_dirs, false)) {
- derror("%s: list sub dirs of dir %s failed", backup_context->name, dir.c_str());
+ LOG_ERROR("%s: list sub dirs of dir %s failed", backup_context->name, dir.c_str());
return false;
}
@@ -341,7 +343,7 @@ statistic_file_infos_under_dir(const std::string &dir,
{
std::vector<std::string> sub_files;
if (!utils::filesystem::get_subfiles(dir, sub_files, false)) {
- derror("list sub files of dir %s failed", dir.c_str());
+ LOG_ERROR("list sub files of dir %s failed", dir.c_str());
return false;
}
@@ -352,7 +354,7 @@ statistic_file_infos_under_dir(const std::string &dir,
std::pair<std::string, int64_t> file_info;
if (!utils::filesystem::file_size(file, file_info.second)) {
- derror("get file size of %s failed", file.c_str());
+ LOG_ERROR("get file size of %s failed", file.c_str());
return false;
}
file_info.first = utils::filesystem::get_file_name(file);
@@ -393,9 +395,9 @@ static bool backup_parse_dir_name(const char *name,
void replica::generate_backup_checkpoint(cold_backup_context_ptr backup_context)
{
if (backup_context->status() != ColdBackupCheckpointing) {
- ddebug("%s: ignore generating backup checkpoint because backup_status = %s",
- backup_context->name,
- cold_backup_status_to_string(backup_context->status()));
+ LOG_INFO("%s: ignore generating backup checkpoint because backup_status = %s",
+ backup_context->name,
+ cold_backup_status_to_string(backup_context->status()));
backup_context->ignore_checkpoint();
return;
}
@@ -404,7 +406,7 @@ void replica::generate_backup_checkpoint(cold_backup_context_ptr backup_context)
auto backup_dir = _app->backup_dir();
if (!utils::filesystem::directory_exists(backup_dir) &&
!utils::filesystem::create_directory(backup_dir)) {
- derror("%s: create backup dir %s failed", backup_context->name, backup_dir.c_str());
+ LOG_ERROR("%s: create backup dir %s failed", backup_context->name, backup_dir.c_str());
backup_context->fail_checkpoint("create backup dir failed");
return;
}
@@ -442,12 +444,12 @@ void replica::generate_backup_checkpoint(cold_backup_context_ptr backup_context)
backup_context->checkpoint_file_total_size = total_size;
backup_context->complete_checkpoint();
- ddebug("%s: backup checkpoint aleady exist, dir = %s, file_count = %d, total_size = "
- "%" PRId64,
- backup_context->name,
- backup_context->checkpoint_dir.c_str(),
- (int)file_infos.size(),
- total_size);
+ LOG_INFO("%s: backup checkpoint aleady exist, dir = %s, file_count = %d, total_size = "
+ "%" PRId64,
+ backup_context->name,
+ backup_context->checkpoint_dir.c_str(),
+ (int)file_infos.size(),
+ total_size);
// TODO: in primary, this will make the request send to secondary again
tasking::enqueue(LPC_REPLICATION_COLD_BACKUP,
&_tracker,
@@ -461,8 +463,8 @@ void replica::generate_backup_checkpoint(cold_backup_context_ptr backup_context)
return;
}
} else {
- ddebug("%s: backup checkpoint not exist, start to trigger async checkpoint",
- backup_context->name);
+ LOG_INFO("%s: backup checkpoint not exist, start to trigger async checkpoint",
+ backup_context->name);
tasking::enqueue(
LPC_REPLICATION_COLD_BACKUP,
&_tracker,
@@ -473,13 +475,13 @@ void replica::generate_backup_checkpoint(cold_backup_context_ptr backup_context)
// clear related but not valid checkpoint
for (const std::string &dirname : related_backup_chkpt_dirname) {
std::string full_path = utils::filesystem::path_combine(backup_dir, dirname);
- ddebug("%s: found obsolete backup checkpoint dir(%s), remove it",
- backup_context->name,
- full_path.c_str());
+ LOG_INFO("%s: found obsolete backup checkpoint dir(%s), remove it",
+ backup_context->name,
+ full_path.c_str());
if (!utils::filesystem::remove_path(full_path)) {
- dwarn("%s: remove obsolete backup checkpoint dir(%s) failed",
- backup_context->name,
- full_path.c_str());
+ LOG_WARNING("%s: remove obsolete backup checkpoint dir(%s) failed",
+ backup_context->name,
+ full_path.c_str());
}
}
}
@@ -494,17 +496,17 @@ void replica::trigger_async_checkpoint_for_backup(cold_backup_context_ptr backup
_checker.only_one_thread_access();
if (backup_context->status() != ColdBackupCheckpointing) {
- ddebug("%s: ignore triggering async checkpoint because backup_status = %s",
- backup_context->name,
- cold_backup_status_to_string(backup_context->status()));
+ LOG_INFO("%s: ignore triggering async checkpoint because backup_status = %s",
+ backup_context->name,
+ cold_backup_status_to_string(backup_context->status()));
backup_context->ignore_checkpoint();
return;
}
if (status() != partition_status::PS_PRIMARY && status() != partition_status::PS_SECONDARY) {
- ddebug("%s: ignore triggering async checkpoint because partition_status = %s",
- backup_context->name,
- enum_to_string(status()));
+ LOG_INFO("%s: ignore triggering async checkpoint because partition_status = %s",
+ backup_context->name,
+ enum_to_string(status()));
backup_context->ignore_checkpoint();
return;
}
@@ -518,14 +520,14 @@ void replica::trigger_async_checkpoint_for_backup(cold_backup_context_ptr backup
// already triggered, just wait
char time_buf[20];
dsn::utils::time_ms_to_date_time(backup_context->checkpoint_timestamp, time_buf, 20);
- ddebug("%s: do not trigger async checkpoint because it is already triggered, "
- "checkpoint_decree = %" PRId64 ", checkpoint_timestamp = %" PRId64 " (%s), "
- "durable_decree_when_checkpoint = %" PRId64,
- backup_context->name,
- backup_context->checkpoint_decree,
- backup_context->checkpoint_timestamp,
- time_buf,
- backup_context->durable_decree_when_checkpoint);
+ LOG_INFO("%s: do not trigger async checkpoint because it is already triggered, "
+ "checkpoint_decree = %" PRId64 ", checkpoint_timestamp = %" PRId64 " (%s), "
+ "durable_decree_when_checkpoint = %" PRId64,
+ backup_context->name,
+ backup_context->checkpoint_decree,
+ backup_context->checkpoint_timestamp,
+ time_buf,
+ backup_context->durable_decree_when_checkpoint);
} else { // backup_context->checkpoint_decree == 0 ||
// backup_context->durable_decree_when_checkpoint != durable_decree
if (backup_context->checkpoint_decree == 0) {
@@ -537,20 +539,20 @@ void replica::trigger_async_checkpoint_for_backup(cold_backup_context_ptr backup
"durable_decree_when_checkpoint(%" PRId64 ") < durable_decree(%" PRId64 ")",
backup_context->durable_decree_when_checkpoint,
durable_decree);
- ddebug("%s: need trigger async checkpoint again", backup_context->name);
+ LOG_INFO("%s: need trigger async checkpoint again", backup_context->name);
}
backup_context->checkpoint_timestamp = dsn_now_ms();
backup_context->durable_decree_when_checkpoint = durable_decree;
char time_buf[20];
dsn::utils::time_ms_to_date_time(backup_context->checkpoint_timestamp, time_buf, 20);
- ddebug("%s: trigger async checkpoint, "
- "checkpoint_decree = %" PRId64 ", checkpoint_timestamp = %" PRId64 " (%s), "
- "durable_decree_when_checkpoint = %" PRId64,
- backup_context->name,
- backup_context->checkpoint_decree,
- backup_context->checkpoint_timestamp,
- time_buf,
- backup_context->durable_decree_when_checkpoint);
+ LOG_INFO("%s: trigger async checkpoint, "
+ "checkpoint_decree = %" PRId64 ", checkpoint_timestamp = %" PRId64 " (%s), "
+ "durable_decree_when_checkpoint = %" PRId64,
+ backup_context->name,
+ backup_context->checkpoint_decree,
+ backup_context->checkpoint_timestamp,
+ time_buf,
+ backup_context->durable_decree_when_checkpoint);
init_checkpoint(true);
}
@@ -569,28 +571,28 @@ void replica::wait_async_checkpoint_for_backup(cold_backup_context_ptr backup_co
_checker.only_one_thread_access();
if (backup_context->status() != ColdBackupCheckpointing) {
- ddebug("%s: ignore waiting async checkpoint because backup_status = %s",
- backup_context->name,
- cold_backup_status_to_string(backup_context->status()));
+ LOG_INFO("%s: ignore waiting async checkpoint because backup_status = %s",
+ backup_context->name,
+ cold_backup_status_to_string(backup_context->status()));
backup_context->ignore_checkpoint();
return;
}
if (status() != partition_status::PS_PRIMARY && status() != partition_status::PS_SECONDARY) {
- ddebug("%s: ignore waiting async checkpoint because partition_status = %s",
- backup_context->name,
- enum_to_string(status()));
+ LOG_INFO("%s: ignore waiting async checkpoint because partition_status = %s",
+ backup_context->name,
+ enum_to_string(status()));
backup_context->ignore_checkpoint();
return;
}
decree du = last_durable_decree();
if (du < backup_context->checkpoint_decree) {
- ddebug("%s: async checkpoint not done, we just wait it done, "
- "last_durable_decree = %" PRId64 ", backup_checkpoint_decree = %" PRId64,
- backup_context->name,
- du,
- backup_context->checkpoint_decree);
+ LOG_INFO("%s: async checkpoint not done, we just wait it done, "
+ "last_durable_decree = %" PRId64 ", backup_checkpoint_decree = %" PRId64,
+ backup_context->name,
+ du,
+ backup_context->checkpoint_decree);
tasking::enqueue(
LPC_REPLICATION_COLD_BACKUP,
&_tracker,
@@ -598,11 +600,11 @@ void replica::wait_async_checkpoint_for_backup(cold_backup_context_ptr backup_co
get_gpid().thread_hash(),
std::chrono::seconds(10));
} else {
- ddebug("%s: async checkpoint done, last_durable_decree = %" PRId64
- ", backup_context->checkpoint_decree = %" PRId64,
- backup_context->name,
- du,
- backup_context->checkpoint_decree);
+ LOG_INFO("%s: async checkpoint done, last_durable_decree = %" PRId64
+ ", backup_context->checkpoint_decree = %" PRId64,
+ backup_context->name,
+ du,
+ backup_context->checkpoint_decree);
tasking::enqueue(LPC_BACKGROUND_COLD_BACKUP, &_tracker, [this, backup_context]() {
local_create_backup_checkpoint(backup_context);
});
@@ -618,9 +620,9 @@ void replica::wait_async_checkpoint_for_backup(cold_backup_context_ptr backup_co
void replica::local_create_backup_checkpoint(cold_backup_context_ptr backup_context)
{
if (backup_context->status() != ColdBackupCheckpointing) {
- ddebug("%s: ignore generating backup checkpoint because backup_status = %s",
- backup_context->name,
- cold_backup_status_to_string(backup_context->status()));
+ LOG_INFO("%s: ignore generating backup checkpoint because backup_status = %s",
+ backup_context->name,
+ cold_backup_status_to_string(backup_context->status()));
backup_context->ignore_checkpoint();
return;
}
@@ -637,10 +639,10 @@ void replica::local_create_backup_checkpoint(cold_backup_context_ptr backup_cont
_app->copy_checkpoint_to_dir(backup_checkpoint_tmp_dir_path.c_str(), &last_decree);
if (err != ERR_OK) {
// try local_create_backup_checkpoint 10s later
- ddebug("%s: create backup checkpoint failed with err = %s, try call "
- "local_create_backup_checkpoint 10s later",
- backup_context->name,
- err.to_string());
+ LOG_INFO("%s: create backup checkpoint failed with err = %s, try call "
+ "local_create_backup_checkpoint 10s later",
+ backup_context->name,
+ err.to_string());
utils::filesystem::remove_path(backup_checkpoint_tmp_dir_path);
tasking::enqueue(
LPC_BACKGROUND_COLD_BACKUP,
@@ -662,10 +664,10 @@ void replica::local_create_backup_checkpoint(cold_backup_context_ptr backup_cont
backup_context->checkpoint_timestamp));
if (!utils::filesystem::rename_path(backup_checkpoint_tmp_dir_path,
backup_checkpoint_dir_path)) {
- derror("%s: rename checkpoint dir(%s) to dir(%s) failed",
- backup_context->name,
- backup_checkpoint_tmp_dir_path.c_str(),
- backup_checkpoint_dir_path.c_str());
+ LOG_ERROR("%s: rename checkpoint dir(%s) to dir(%s) failed",
+ backup_context->name,
+ backup_checkpoint_tmp_dir_path.c_str(),
+ backup_checkpoint_dir_path.c_str());
utils::filesystem::remove_path(backup_checkpoint_tmp_dir_path);
utils::filesystem::remove_path(backup_checkpoint_dir_path);
backup_context->fail_checkpoint("rename checkpoint dir failed");
@@ -675,19 +677,19 @@ void replica::local_create_backup_checkpoint(cold_backup_context_ptr backup_cont
std::vector<std::pair<std::string, int64_t>> file_infos;
int64_t total_size = 0;
if (!statistic_file_infos_under_dir(backup_checkpoint_dir_path, file_infos, total_size)) {
- derror("%s: statistic file info under dir(%s) failed",
- backup_context->name,
- backup_checkpoint_dir_path.c_str());
+ LOG_ERROR("%s: statistic file info under dir(%s) failed",
+ backup_context->name,
+ backup_checkpoint_dir_path.c_str());
backup_context->fail_checkpoint("statistic file info under dir failed");
return;
}
- ddebug("%s: generate backup checkpoint succeed, dir = %s, file_count = %d, total_size = "
- "%" PRId64,
- backup_context->name,
- backup_checkpoint_dir_path.c_str(),
- (int)file_infos.size(),
- total_size);
+ LOG_INFO("%s: generate backup checkpoint succeed, dir = %s, file_count = %d, total_size = "
+ "%" PRId64,
+ backup_context->name,
+ backup_checkpoint_dir_path.c_str(),
+ (int)file_infos.size(),
+ total_size);
backup_context->checkpoint_dir = backup_checkpoint_dir_path;
for (std::pair<std::string, int64_t> &pair : file_infos) {
backup_context->checkpoint_files.emplace_back(std::move(pair.first));
@@ -709,9 +711,9 @@ void replica::set_backup_context_cancel()
{
for (auto &pair : _cold_backup_contexts) {
pair.second->cancel();
- ddebug("%s: cancel backup progress, backup_request = %s",
- name(),
- boost::lexical_cast<std::string>(pair.second->request).c_str());
+ LOG_INFO("%s: cancel backup progress, backup_request = %s",
+ name(),
+ boost::lexical_cast<std::string>(pair.second->request).c_str());
}
}
diff --git a/src/replica/replica_check.cpp b/src/replica/replica_check.cpp
index e4c8d4715..443f759e0 100644
--- a/src/replica/replica_check.cpp
+++ b/src/replica/replica_check.cpp
@@ -55,7 +55,7 @@ void replica::init_group_check()
_checker.only_one_thread_access();
- ddebug("%s: init group check", name());
+ LOG_INFO("%s: init group check", name());
if (partition_status::PS_PRIMARY != status() || _options->group_check_disabled)
return;
@@ -75,13 +75,14 @@ void replica::broadcast_group_check()
dassert(nullptr != _primary_states.group_check_task, "");
- ddebug("%s: start to broadcast group check", name());
+ LOG_INFO("%s: start to broadcast group check", name());
if (_primary_states.group_check_pending_replies.size() > 0) {
- dwarn("%s: %u group check replies are still pending when doing next round check, cancel "
- "first",
- name(),
- static_cast<int>(_primary_states.group_check_pending_replies.size()));
+ LOG_WARNING(
+ "%s: %u group check replies are still pending when doing next round check, cancel "
+ "first",
+ name(),
+ static_cast<int>(_primary_states.group_check_pending_replies.size()));
for (auto it = _primary_states.group_check_pending_replies.begin();
it != _primary_states.group_check_pending_replies.end();
@@ -119,10 +120,10 @@ void replica::broadcast_group_check()
request->config.learner_signature = it->second.signature;
}
- ddebug("%s: send group check to %s with state %s",
- name(),
- addr.to_string(),
- enum_to_string(it->second));
+ LOG_INFO("%s: send group check to %s with state %s",
+ name(),
+ addr.to_string(),
+ enum_to_string(it->second));
dsn::task_ptr callback_task =
rpc::call(addr,
@@ -163,12 +164,12 @@ void replica::on_group_check(const group_check_request &request,
if (request.config.ballot < get_ballot()) {
response.err = ERR_VERSION_OUTDATED;
- dwarn("%s: on_group_check reply %s", name(), response.err.to_string());
+ LOG_WARNING("%s: on_group_check reply %s", name(), response.err.to_string());
return;
} else if (request.config.ballot > get_ballot()) {
if (!update_local_configuration(request.config)) {
response.err = ERR_INVALID_STATE;
- dwarn("%s: on_group_check reply %s", name(), response.err.to_string());
+ LOG_WARNING("%s: on_group_check reply %s", name(), response.err.to_string());
return;
}
} else if (is_same_ballot_status_change_allowed(status(), request.config.status)) {
@@ -202,7 +203,7 @@ void replica::on_group_check(const group_check_request &request,
response.err = ERR_OK;
if (status() == partition_status::PS_ERROR) {
response.err = ERR_INVALID_STATE;
- dwarn("%s: on_group_check reply %s", name(), response.err.to_string());
+ LOG_WARNING("%s: on_group_check reply %s", name(), response.err.to_string());
}
response.last_committed_decree_in_app = _app->last_committed_decree();
diff --git a/src/replica/replica_chkpt.cpp b/src/replica/replica_chkpt.cpp
index 20ac35bac..6ce5cc1e4 100644
--- a/src/replica/replica_chkpt.cpp
+++ b/src/replica/replica_chkpt.cpp
@@ -62,17 +62,17 @@ void replica::on_checkpoint_timer()
if (dsn_now_ms() > _next_checkpoint_interval_trigger_time_ms) {
// we trigger emergency checkpoint if no checkpoint generated for a long time
- ddebug("%s: trigger emergency checkpoint by checkpoint_max_interval_hours, "
- "config_interval = %dh (%" PRIu64 "ms), random_interval = %" PRIu64 "ms",
- name(),
- _options->checkpoint_max_interval_hours,
- _options->checkpoint_max_interval_hours * 3600000UL,
- _next_checkpoint_interval_trigger_time_ms - _last_checkpoint_generate_time_ms);
+ LOG_INFO("%s: trigger emergency checkpoint by checkpoint_max_interval_hours, "
+ "config_interval = %dh (%" PRIu64 "ms), random_interval = %" PRIu64 "ms",
+ name(),
+ _options->checkpoint_max_interval_hours,
+ _options->checkpoint_max_interval_hours * 3600000UL,
+ _next_checkpoint_interval_trigger_time_ms - _last_checkpoint_generate_time_ms);
init_checkpoint(true);
} else {
- ddebug("%s: trigger non-emergency checkpoint",
- name(),
- _options->checkpoint_max_interval_hours);
+ LOG_INFO("%s: trigger non-emergency checkpoint",
+ name(),
+ _options->checkpoint_max_interval_hours);
init_checkpoint(false);
}
@@ -176,10 +176,10 @@ void replica::init_checkpoint(bool is_emergency)
{
// only applicable to primary and secondary replicas
if (status() != partition_status::PS_PRIMARY && status() != partition_status::PS_SECONDARY) {
- ddebug("%s: ignore doing checkpoint for status = %s, is_emergency = %s",
- name(),
- enum_to_string(status()),
- (is_emergency ? "true" : "false"));
+ LOG_INFO("%s: ignore doing checkpoint for status = %s, is_emergency = %s",
+ name(),
+ enum_to_string(status()),
+ (is_emergency ? "true" : "false"));
return;
}
@@ -239,14 +239,14 @@ error_code replica::background_async_checkpoint(bool is_emergency)
if (old_durable != _app->last_durable_decree()) {
// if no need to generate new checkpoint, async_checkpoint() also returns ERR_OK,
// so we should check if a new checkpoint has been generated.
- ddebug("%s: call app.async_checkpoint() succeed, time_used_ns = %" PRIu64 ", "
- "app_last_committed_decree = %" PRId64 ", app_last_durable_decree = (%" PRId64
- " => %" PRId64 ")",
- name(),
- used_time,
- _app->last_committed_decree(),
- old_durable,
- _app->last_durable_decree());
+ LOG_INFO("%s: call app.async_checkpoint() succeed, time_used_ns = %" PRIu64 ", "
+ "app_last_committed_decree = %" PRId64 ", app_last_durable_decree = (%" PRId64
+ " => %" PRId64 ")",
+ name(),
+ used_time,
+ _app->last_committed_decree(),
+ old_durable,
+ _app->last_durable_decree());
update_last_checkpoint_generate_time();
}
@@ -262,10 +262,10 @@ error_code replica::background_async_checkpoint(bool is_emergency)
if (err == ERR_TRY_AGAIN) {
// already triggered memory flushing on async_checkpoint(), then try again later.
- ddebug("%s: call app.async_checkpoint() returns ERR_TRY_AGAIN, time_used_ns = %" PRIu64
- ", schedule later checkpoint after 10 seconds",
- name(),
- used_time);
+ LOG_INFO("%s: call app.async_checkpoint() returns ERR_TRY_AGAIN, time_used_ns = %" PRIu64
+ ", schedule later checkpoint after 10 seconds",
+ name(),
+ used_time);
tasking::enqueue(LPC_PER_REPLICA_CHECKPOINT_TIMER,
&_tracker,
[this] { init_checkpoint(false); },
@@ -282,15 +282,15 @@ error_code replica::background_async_checkpoint(bool is_emergency)
}
if (err == ERR_WRONG_TIMING) {
// do nothing
- ddebug("%s: call app.async_checkpoint() returns ERR_WRONG_TIMING, time_used_ns = %" PRIu64
- ", just ignore",
- name(),
- used_time);
+ LOG_INFO("%s: call app.async_checkpoint() returns ERR_WRONG_TIMING, time_used_ns = %" PRIu64
+ ", just ignore",
+ name(),
+ used_time);
} else {
- derror("%s: call app.async_checkpoint() failed, time_used_ns = %" PRIu64 ", err = %s",
- name(),
- used_time,
- err.to_string());
+ LOG_ERROR("%s: call app.async_checkpoint() failed, time_used_ns = %" PRIu64 ", err = %s",
+ name(),
+ used_time,
+ err.to_string());
}
return err;
}
@@ -307,27 +307,27 @@ error_code replica::background_sync_checkpoint()
if (old_durable != _app->last_durable_decree()) {
// if no need to generate new checkpoint, sync_checkpoint() also returns ERR_OK,
// so we should check if a new checkpoint has been generated.
- ddebug("%s: call app.sync_checkpoint() succeed, time_used_ns = %" PRIu64 ", "
- "app_last_committed_decree = %" PRId64 ", app_last_durable_decree = (%" PRId64
- " => %" PRId64 ")",
- name(),
- used_time,
- _app->last_committed_decree(),
- old_durable,
- _app->last_durable_decree());
+ LOG_INFO("%s: call app.sync_checkpoint() succeed, time_used_ns = %" PRIu64 ", "
+ "app_last_committed_decree = %" PRId64 ", app_last_durable_decree = (%" PRId64
+ " => %" PRId64 ")",
+ name(),
+ used_time,
+ _app->last_committed_decree(),
+ old_durable,
+ _app->last_durable_decree());
update_last_checkpoint_generate_time();
}
} else if (err == ERR_WRONG_TIMING) {
// do nothing
- ddebug("%s: call app.sync_checkpoint() returns ERR_WRONG_TIMING, time_used_ns = %" PRIu64
- ", just ignore",
- name(),
- used_time);
+ LOG_INFO("%s: call app.sync_checkpoint() returns ERR_WRONG_TIMING, time_used_ns = %" PRIu64
+ ", just ignore",
+ name(),
+ used_time);
} else {
- derror("%s: call app.sync_checkpoint() failed, time_used_ns = %" PRIu64 ", err = %s",
- name(),
- used_time,
- err.to_string());
+ LOG_ERROR("%s: call app.sync_checkpoint() failed, time_used_ns = %" PRIu64 ", err = %s",
+ name(),
+ used_time,
+ err.to_string());
}
return err;
}
diff --git a/src/replica/replica_config.cpp b/src/replica/replica_config.cpp
index a9f33ed79..3ad135f44 100644
--- a/src/replica/replica_config.cpp
+++ b/src/replica/replica_config.cpp
@@ -67,21 +67,21 @@ void replica::on_config_proposal(configuration_update_request &proposal)
{
_checker.only_one_thread_access();
- ddebug("%s: process config proposal %s for %s",
- name(),
- enum_to_string(proposal.type),
- proposal.node.to_string());
+ LOG_INFO("%s: process config proposal %s for %s",
+ name(),
+ enum_to_string(proposal.type),
+ proposal.node.to_string());
if (proposal.config.ballot < get_ballot()) {
- dwarn("%s: on_config_proposal out-dated, %" PRId64 " vs %" PRId64,
- name(),
- proposal.config.ballot,
- get_ballot());
+ LOG_WARNING("%s: on_config_proposal out-dated, %" PRId64 " vs %" PRId64,
+ name(),
+ proposal.config.ballot,
+ get_ballot());
return;
}
if (_primary_states.reconfiguration_task != nullptr) {
- dinfo("%s: reconfiguration on the way, skip the incoming proposal", name());
+ LOG_DEBUG("%s: reconfiguration on the way, skip the incoming proposal", name());
return;
}
@@ -124,16 +124,16 @@ void replica::assign_primary(configuration_update_request &proposal)
_stub->_primary_address_str);
if (status() == partition_status::PS_PRIMARY) {
- dwarn("%s: invalid assgin primary proposal as the node is in %s",
- name(),
- enum_to_string(status()));
+ LOG_WARNING("%s: invalid assgin primary proposal as the node is in %s",
+ name(),
+ enum_to_string(status()));
return;
}
if (proposal.type == config_type::CT_UPGRADE_TO_PRIMARY &&
(status() != partition_status::PS_SECONDARY || _secondary_states.checkpoint_is_running) &&
status() != partition_status::PS_PARTITION_SPLIT) {
- dwarn(
+ LOG_WARNING(
"%s: invalid upgrade to primary proposal as the node is in %s or during checkpointing",
name(),
enum_to_string(status()));
@@ -152,9 +152,9 @@ void replica::assign_primary(configuration_update_request &proposal)
void replica::add_potential_secondary(configuration_update_request &proposal)
{
if (status() != partition_status::PS_PRIMARY) {
- dwarn("%s: ignore add secondary proposal for invalid state, state = %s",
- name(),
- enum_to_string(status()));
+ LOG_WARNING("%s: ignore add secondary proposal for invalid state, state = %s",
+ name(),
+ enum_to_string(status()));
return;
}
@@ -188,21 +188,21 @@ void replica::add_potential_secondary(configuration_update_request &proposal)
if (potential_secondaries_count >= _primary_states.membership.max_replica_count - 1) {
if (proposal.type == config_type::CT_ADD_SECONDARY) {
if (_primary_states.learners.find(proposal.node) == _primary_states.learners.end()) {
- ddebug("%s: already have enough secondaries or potential secondaries, ignore new "
- "potential secondary proposal",
- name());
+ LOG_INFO("%s: already have enough secondaries or potential secondaries, ignore new "
+ "potential secondary proposal",
+ name());
return;
}
} else if (proposal.type == config_type::CT_ADD_SECONDARY_FOR_LB) {
if (potential_secondaries_count >= _primary_states.membership.max_replica_count) {
- ddebug("%s: only allow one extra (potential) secondary, ingnore new potential "
- "secondary proposal",
- name());
+ LOG_INFO("%s: only allow one extra (potential) secondary, ingnore new potential "
+ "secondary proposal",
+ name());
return;
} else {
- ddebug("%s: add a new secondary(%s) for future load balancer",
- name(),
- proposal.node.to_string());
+ LOG_INFO("%s: add a new secondary(%s) for future load balancer",
+ name(),
+ proposal.node.to_string());
}
} else {
dassert(false, "invalid config_type, type = %s", enum_to_string(proposal.type));
@@ -229,10 +229,10 @@ void replica::add_potential_secondary(configuration_update_request &proposal)
partition_status::PS_POTENTIAL_SECONDARY, request.config, state.signature);
request.last_committed_decree = last_committed_decree();
- ddebug("%s: call one way %s to start learning with signature [%016" PRIx64 "]",
- name(),
- proposal.node.to_string(),
- state.signature);
+ LOG_INFO("%s: call one way %s to start learning with signature [%016" PRIx64 "]",
+ name(),
+ proposal.node.to_string(),
+ state.signature);
rpc::call_one_way_typed(
proposal.node, RPC_LEARN_ADD_LEARNER, request, get_gpid().thread_hash());
@@ -240,7 +240,7 @@ void replica::add_potential_secondary(configuration_update_request &proposal)
void replica::upgrade_to_secondary_on_primary(::dsn::rpc_address node)
{
- ddebug("%s: upgrade potential secondary %s to secondary", name(), node.to_string());
+ LOG_INFO("%s: upgrade potential secondary %s to secondary", name(), node.to_string());
partition_configuration newConfig = _primary_states.membership;
@@ -363,10 +363,10 @@ void replica::on_remove(const replica_configuration &request)
// - here we ignore the lately arrived remove request, which is proper
//
if (request.ballot == get_ballot() && partition_status::PS_POTENTIAL_SECONDARY == status()) {
- dwarn("this implies that a config proposal request (e.g. add secondary) "
- "with the same ballot arrived before this remove request, "
- "current status is %s",
- enum_to_string(status()));
+ LOG_WARNING("this implies that a config proposal request (e.g. add secondary) "
+ "with the same ballot arrived before this remove request, "
+ "current status is %s",
+ enum_to_string(status()));
return;
}
@@ -428,12 +428,12 @@ void replica::update_configuration_on_meta_server(config_type::type type,
_primary_states.reconfiguration_task->cancel(true);
}
- ddebug("%s: send update configuration request to meta server, ballot = %" PRId64
- ", type = %s, node = %s",
- name(),
- request->config.ballot,
- enum_to_string(request->type),
- request->node.to_string());
+ LOG_INFO("%s: send update configuration request to meta server, ballot = %" PRId64
+ ", type = %s, node = %s",
+ name(),
+ request->config.ballot,
+ enum_to_string(request->type),
+ request->node.to_string());
rpc_address target(_stub->_failure_detector->get_servers());
_primary_states.reconfiguration_task =
@@ -466,10 +466,10 @@ void replica::on_update_configuration_on_meta_server_reply(
}
if (err != ERR_OK) {
- ddebug("%s: update configuration reply with err %s, request ballot %" PRId64,
- name(),
- err.to_string(),
- req->config.ballot);
+ LOG_INFO("%s: update configuration reply with err %s, request ballot %" PRId64,
+ name(),
+ err.to_string(),
+ req->config.ballot);
if (err != ERR_INVALID_VERSION) {
// when the rpc call timeout, we would delay to do the recall
@@ -498,14 +498,14 @@ void replica::on_update_configuration_on_meta_server_reply(
}
}
- ddebug("%s: update configuration %s, reply with err %s, ballot %" PRId64
- ", local ballot %" PRId64 ", local status %s",
- name(),
- enum_to_string(req->type),
- resp.err.to_string(),
- resp.config.ballot,
- get_ballot(),
- enum_to_string(status()));
+ LOG_INFO("%s: update configuration %s, reply with err %s, ballot %" PRId64
+ ", local ballot %" PRId64 ", local status %s",
+ name(),
+ enum_to_string(req->type),
+ resp.err.to_string(),
+ resp.config.ballot,
+ get_ballot(),
+ enum_to_string(status()));
if (resp.config.ballot < get_ballot()) {
_primary_states.reconfiguration_task = nullptr;
@@ -729,38 +729,38 @@ bool replica::update_local_configuration(const replica_configuration &config,
// must be handled immmediately
switch (old_status) {
case partition_status::PS_ERROR: {
- dwarn("%s: status change from %s @ %" PRId64 " to %s @ %" PRId64 " is not allowed",
- name(),
- enum_to_string(old_status),
- old_ballot,
- enum_to_string(config.status),
- config.ballot);
+ LOG_WARNING("%s: status change from %s @ %" PRId64 " to %s @ %" PRId64 " is not allowed",
+ name(),
+ enum_to_string(old_status),
+ old_ballot,
+ enum_to_string(config.status),
+ config.ballot);
return false;
} break;
case partition_status::PS_INACTIVE:
if ((config.status == partition_status::PS_PRIMARY ||
config.status == partition_status::PS_SECONDARY) &&
!_inactive_is_transient) {
- dwarn("%s: status change from %s @ %" PRId64 " to %s @ %" PRId64
- " is not allowed when inactive state is not transient",
- name(),
- enum_to_string(old_status),
- old_ballot,
- enum_to_string(config.status),
- config.ballot);
+ LOG_WARNING("%s: status change from %s @ %" PRId64 " to %s @ %" PRId64
+ " is not allowed when inactive state is not transient",
+ name(),
+ enum_to_string(old_status),
+ old_ballot,
+ enum_to_string(config.status),
+ config.ballot);
return false;
}
break;
case partition_status::PS_POTENTIAL_SECONDARY:
if (config.status == partition_status::PS_INACTIVE) {
if (!_potential_secondary_states.cleanup(false)) {
- dwarn("%s: status change from %s @ %" PRId64 " to %s @ %" PRId64
- " is not allowed coz learning remote state is still running",
- name(),
- enum_to_string(old_status),
- old_ballot,
- enum_to_string(config.status),
- config.ballot);
+ LOG_WARNING("%s: status change from %s @ %" PRId64 " to %s @ %" PRId64
+ " is not allowed coz learning remote state is still running",
+ name(),
+ enum_to_string(old_status),
+ old_ballot,
+ enum_to_string(config.status),
+ config.ballot);
return false;
}
}
@@ -780,14 +780,14 @@ bool replica::update_local_configuration(const replica_configuration &config,
else
native_handle = nullptr;
- dwarn("%s: status change from %s @ %" PRId64 " to %s @ %" PRId64
- " is not allowed coz checkpointing %p is still running",
- name(),
- enum_to_string(old_status),
- old_ballot,
- enum_to_string(config.status),
- config.ballot,
- native_handle);
+ LOG_WARNING("%s: status change from %s @ %" PRId64 " to %s @ %" PRId64
+ " is not allowed coz checkpointing %p is still running",
+ name(),
+ enum_to_string(old_status),
+ old_ballot,
+ enum_to_string(config.status),
+ config.ballot,
+ native_handle);
return false;
}
}
@@ -813,16 +813,16 @@ bool replica::update_local_configuration(const replica_configuration &config,
if (_config.ballot > old_ballot) {
dsn::error_code result = _app->update_init_info_ballot_and_decree(this);
if (result == dsn::ERR_OK) {
- ddebug("%s: update ballot to init file from %" PRId64 " to %" PRId64 " OK",
- name(),
- old_ballot,
- _config.ballot);
+ LOG_INFO("%s: update ballot to init file from %" PRId64 " to %" PRId64 " OK",
+ name(),
+ old_ballot,
+ _config.ballot);
} else {
- dwarn("%s: update ballot to init file from %" PRId64 " to %" PRId64 " %s",
- name(),
- old_ballot,
- _config.ballot,
- result.to_string());
+ LOG_WARNING("%s: update ballot to init file from %" PRId64 " to %" PRId64 " %s",
+ name(),
+ old_ballot,
+ _config.ballot,
+ result.to_string());
}
_split_mgr->parent_cleanup_split_context();
}
@@ -1030,19 +1030,19 @@ bool replica::update_local_configuration(const replica_configuration &config,
dassert(false, "invalid execution path");
}
- ddebug("%s: status change %s @ %" PRId64 " => %s @ %" PRId64 ", pre(%" PRId64 ", %" PRId64
- "), app(%" PRId64 ", %" PRId64 "), duration = %" PRIu64 " ms, %s",
- name(),
- enum_to_string(old_status),
- old_ballot,
- enum_to_string(status()),
- get_ballot(),
- _prepare_list->max_decree(),
- _prepare_list->last_committed_decree(),
- _app->last_committed_decree(),
- _app->last_durable_decree(),
- _last_config_change_time_ms - oldTs,
- boost::lexical_cast<std::string>(_config).c_str());
+ LOG_INFO("%s: status change %s @ %" PRId64 " => %s @ %" PRId64 ", pre(%" PRId64 ", %" PRId64
+ "), app(%" PRId64 ", %" PRId64 "), duration = %" PRIu64 " ms, %s",
+ name(),
+ enum_to_string(old_status),
+ old_ballot,
+ enum_to_string(status()),
+ get_ballot(),
+ _prepare_list->max_decree(),
+ _prepare_list->last_committed_decree(),
+ _app->last_committed_decree(),
+ _app->last_durable_decree(),
+ _last_config_change_time_ms - oldTs,
+ boost::lexical_cast<std::string>(_config).c_str());
if (status() != old_status) {
bool is_closing =
@@ -1051,7 +1051,7 @@ bool replica::update_local_configuration(const replica_configuration &config,
_stub->notify_replica_state_update(config, is_closing);
if (is_closing) {
- ddebug("%s: being close ...", name());
+ LOG_INFO("%s: being close ...", name());
_stub->begin_close_replica(this);
return false;
}
@@ -1132,12 +1132,13 @@ void replica::on_config_sync(const app_info &info,
||
config.primary.is_invalid() // primary is dead (otherwise let primary remove this)
) {
- ddebug("%s: downgrade myself as inactive is not transient, remote_config(%s)",
- name(),
- boost::lexical_cast<std::string>(config).c_str());
+ LOG_INFO("%s: downgrade myself as inactive is not transient, remote_config(%s)",
+ name(),
+ boost::lexical_cast<std::string>(config).c_str());
_stub->remove_replica_on_meta_server(_app_info, config);
} else {
- ddebug("%s: state is non-transient inactive, waiting primary to remove me", name());
+ LOG_INFO("%s: state is non-transient inactive, waiting primary to remove me",
+ name());
}
}
}
@@ -1168,29 +1169,29 @@ void replica::replay_prepare_list()
decree start = last_committed_decree() + 1;
decree end = _prepare_list->max_decree();
- ddebug("%s: replay prepare list from %" PRId64 " to %" PRId64 ", ballot = %" PRId64,
- name(),
- start,
- end,
- get_ballot());
+ LOG_INFO("%s: replay prepare list from %" PRId64 " to %" PRId64 ", ballot = %" PRId64,
+ name(),
+ start,
+ end,
+ get_ballot());
for (decree decree = start; decree <= end; decree++) {
mutation_ptr old = _prepare_list->get_mutation_by_decree(decree);
mutation_ptr mu = new_mutation(decree);
if (old != nullptr) {
- dinfo("copy mutation from mutation_tid=%" PRIu64 " to mutation_tid=%" PRIu64,
- old->tid(),
- mu->tid());
+ LOG_DEBUG("copy mutation from mutation_tid=%" PRIu64 " to mutation_tid=%" PRIu64,
+ old->tid(),
+ mu->tid());
mu->copy_from(old);
} else {
mu->add_client_request(RPC_REPLICATION_WRITE_EMPTY, nullptr);
- ddebug("%s: emit empty mutation %s with mutation_tid=%" PRIu64
- " when replay prepare list",
- name(),
- mu->name(),
- mu->tid());
+ LOG_INFO("%s: emit empty mutation %s with mutation_tid=%" PRIu64
+ " when replay prepare list",
+ name(),
+ mu->name(),
+ mu->tid());
}
init_prepare(mu, true);
diff --git a/src/replica/replica_failover.cpp b/src/replica/replica_failover.cpp
index 68d167f99..7ea95a108 100644
--- a/src/replica/replica_failover.cpp
+++ b/src/replica/replica_failover.cpp
@@ -43,10 +43,10 @@ namespace replication {
void replica::handle_local_failure(error_code error)
{
- ddebug("%s: handle local failure error %s, status = %s",
- name(),
- error.to_string(),
- enum_to_string(status()));
+ LOG_INFO("%s: handle local failure error %s, status = %s",
+ name(),
+ error.to_string(),
+ enum_to_string(status()));
if (status() == partition_status::PS_PRIMARY) {
_stub->remove_replica_on_meta_server(_app_info, _primary_states.membership);
@@ -60,12 +60,12 @@ void replica::handle_remote_failure(partition_status::type st,
error_code error,
const std::string &caused_by)
{
- derror("%s: handle remote failure caused by %s, error = %s, status = %s, node = %s",
- name(),
- caused_by.c_str(),
- error.to_string(),
- enum_to_string(st),
- node.to_string());
+ LOG_ERROR("%s: handle remote failure caused by %s, error = %s, status = %s, node = %s",
+ name(),
+ caused_by.c_str(),
+ error.to_string(),
+ enum_to_string(st),
+ node.to_string());
dassert(status() == partition_status::PS_PRIMARY,
"invalid partition_status, status = %s",
@@ -88,7 +88,7 @@ void replica::handle_remote_failure(partition_status::type st,
}
break;
case partition_status::PS_POTENTIAL_SECONDARY: {
- ddebug("%s: remove learner %s for remote failure", name(), node.to_string());
+ LOG_INFO("%s: remove learner %s for remote failure", name(), node.to_string());
// potential secondary failure does not lead to ballot change
// therefore, it is possible to have multiple exec here
_primary_states.learners.erase(node);
@@ -105,7 +105,7 @@ void replica::handle_remote_failure(partition_status::type st,
void replica::on_meta_server_disconnected()
{
- ddebug("%s: meta server disconnected", name());
+ LOG_INFO("%s: meta server disconnected", name());
auto old_status = status();
update_local_configuration_with_no_ballot_change(partition_status::PS_INACTIVE);
diff --git a/src/replica/replica_init.cpp b/src/replica/replica_init.cpp
index 2ee5a00f6..024371002 100644
--- a/src/replica/replica_init.cpp
+++ b/src/replica/replica_init.cpp
@@ -44,7 +44,7 @@ error_code replica::initialize_on_new()
// if (dsn::utils::filesystem::directory_exists(_dir) &&
// !dsn::utils::filesystem::remove_path(_dir))
//{
- // derror("cannot allocate new replica @ %s, as the dir is already exists", _dir.c_str());
+ // LOG_ERROR("cannot allocate new replica @ %s, as the dir is already exists", _dir.c_str());
// return ERR_PATH_ALREADY_EXIST;
//}
//
@@ -53,7 +53,7 @@ error_code replica::initialize_on_new()
// which is applied to restore from cold backup
if (!dsn::utils::filesystem::directory_exists(_dir) &&
!dsn::utils::filesystem::create_directory(_dir)) {
- derror("cannot allocate new replica @ %s, because create dir failed", _dir.c_str());
+ LOG_ERROR("cannot allocate new replica @ %s, because create dir failed", _dir.c_str());
return ERR_FILE_OPERATION_FAILED;
}
@@ -123,10 +123,10 @@ error_code replica::initialize_on_new()
error_code replica::initialize_on_load()
{
- ddebug("%s: initialize replica on load, dir = %s", name(), _dir.c_str());
+ LOG_INFO("%s: initialize replica on load, dir = %s", name(), _dir.c_str());
if (!dsn::utils::filesystem::directory_exists(_dir)) {
- derror("%s: cannot load replica, because dir %s is not exist", name(), _dir.c_str());
+ LOG_ERROR("%s: cannot load replica, because dir %s is not exist", name(), _dir.c_str());
return ERR_PATH_NOT_FOUND;
}
@@ -140,20 +140,20 @@ error_code replica::initialize_on_load()
char splitters[] = {'\\', '/', 0};
std::string name = utils::get_last_component(std::string(dir), splitters);
if (name == "") {
- derror("invalid replica dir %s", dir);
+ LOG_ERROR("invalid replica dir %s", dir);
return nullptr;
}
char app_type[128];
int32_t app_id, pidx;
if (3 != sscanf(name.c_str(), "%d.%d.%s", &app_id, &pidx, app_type)) {
- derror("invalid replica dir %s", dir);
+ LOG_ERROR("invalid replica dir %s", dir);
return nullptr;
}
gpid pid(app_id, pidx);
if (!utils::filesystem::directory_exists(dir)) {
- derror("replica dir %s not exist", dir);
+ LOG_ERROR("replica dir %s not exist", dir);
return nullptr;
}
@@ -162,12 +162,12 @@ error_code replica::initialize_on_load()
std::string path = utils::filesystem::path_combine(dir, kAppInfo);
auto err = info2.load(path);
if (ERR_OK != err) {
- derror("load app-info from %s failed, err = %s", path.c_str(), err.to_string());
+ LOG_ERROR("load app-info from %s failed, err = %s", path.c_str(), err.to_string());
return nullptr;
}
if (info.app_type != app_type) {
- derror("unmatched app type %s for %s", info.app_type.c_str(), path.c_str());
+ LOG_ERROR("unmatched app type %s for %s", info.app_type.c_str(), path.c_str());
return nullptr;
}
@@ -183,10 +183,10 @@ error_code replica::initialize_on_load()
err = rep->initialize_on_load();
if (err == ERR_OK) {
- ddebug("%s: load replica succeed", rep->name());
+ LOG_INFO("%s: load replica succeed", rep->name());
return rep;
} else {
- derror("%s: load replica failed, err = %s", rep->name(), err.to_string());
+ LOG_ERROR("%s: load replica failed, err = %s", rep->name(), err.to_string());
rep->close();
delete rep;
rep = nullptr;
@@ -197,9 +197,9 @@ error_code replica::initialize_on_load()
sprintf(rename_dir, "%s.%" PRIu64 ".err", dir, dsn_now_us());
bool ret = dsn::utils::filesystem::rename_path(dir, rename_dir);
dassert(ret, "load_replica: failed to move directory '%s' to '%s'", dir, rename_dir);
- dwarn("load_replica: {replica_dir_op} succeed to move directory '%s' to '%s'",
- dir,
- rename_dir);
+ LOG_WARNING("load_replica: {replica_dir_op} succeed to move directory '%s' to '%s'",
+ dir,
+ rename_dir);
stub->_counter_replicas_recent_replica_move_error_count->increment();
stub->_fs_manager.remove_replica(pid);
}
@@ -248,7 +248,7 @@ error_code replica::init_app_and_prepare_list(bool create_new)
_private_log = new mutation_log_private(
log_dir, _options->log_private_file_size_mb, get_gpid(), this);
- ddebug("%s: plog_dir = %s", name(), log_dir.c_str());
+ LOG_INFO("%s: plog_dir = %s", name(), log_dir.c_str());
// sync valid_start_offset between app and logs
_stub->_log->set_valid_start_offset_on_open(
@@ -275,22 +275,22 @@ error_code replica::init_app_and_prepare_list(bool create_new)
uint64_t finish_time = dsn_now_ms();
if (err == ERR_OK) {
- ddebug("%s: replay private log succeed, durable = %" PRId64
- ", committed = %" PRId64 ", "
- "max_prepared = %" PRId64 ", ballot = %" PRId64
- ", valid_offset_in_plog = %" PRId64 ", "
- "max_decree_in_plog = %" PRId64 ", max_commit_on_disk_in_plog = %" PRId64
- ", "
- "time_used = %" PRIu64 " ms",
- name(),
- _app->last_durable_decree(),
- _app->last_committed_decree(),
- max_prepared_decree(),
- get_ballot(),
- _app->init_info().init_offset_in_private_log,
- _private_log->max_decree(get_gpid()),
- _private_log->max_commit_on_disk(),
- finish_time - start_time);
+ LOG_INFO("%s: replay private log succeed, durable = %" PRId64
+ ", committed = %" PRId64 ", "
+ "max_prepared = %" PRId64 ", ballot = %" PRId64
+ ", valid_offset_in_plog = %" PRId64 ", "
+ "max_decree_in_plog = %" PRId64
+ ", max_commit_on_disk_in_plog = %" PRId64 ", "
+ "time_used = %" PRIu64 " ms",
+ name(),
+ _app->last_durable_decree(),
+ _app->last_committed_decree(),
+ max_prepared_decree(),
+ get_ballot(),
+ _app->init_info().init_offset_in_private_log,
+ _private_log->max_decree(get_gpid()),
+ _private_log->max_commit_on_disk(),
+ finish_time - start_time);
_private_log->check_valid_start_offset(
get_gpid(), _app->init_info().init_offset_in_private_log);
@@ -299,19 +299,19 @@ error_code replica::init_app_and_prepare_list(bool create_new)
}
/* in the beginning the prepare_list is reset to the durable_decree */
else {
- derror("%s: replay private log failed, err = %s, durable = %" PRId64
- ", committed = %" PRId64 ", "
- "maxpd = %" PRId64 ", ballot = %" PRId64
- ", valid_offset_in_plog = %" PRId64 ", "
- "time_used = %" PRIu64 " ms",
- name(),
- err.to_string(),
- _app->last_durable_decree(),
- _app->last_committed_decree(),
- max_prepared_decree(),
- get_ballot(),
- _app->init_info().init_offset_in_private_log,
- finish_time - start_time);
+ LOG_ERROR("%s: replay private log failed, err = %s, durable = %" PRId64
+ ", committed = %" PRId64 ", "
+ "maxpd = %" PRId64 ", ballot = %" PRId64
+ ", valid_offset_in_plog = %" PRId64 ", "
+ "time_used = %" PRIu64 " ms",
+ name(),
+ err.to_string(),
+ _app->last_durable_decree(),
+ _app->last_committed_decree(),
+ max_prepared_decree(),
+ get_ballot(),
+ _app->init_info().init_offset_in_private_log,
+ finish_time - start_time);
_private_log->close();
_private_log = nullptr;
@@ -323,7 +323,7 @@ error_code replica::init_app_and_prepare_list(bool create_new)
}
if (err != ERR_OK) {
- derror("%s: open replica failed, err = %s", name(), err.to_string());
+ LOG_ERROR("%s: open replica failed, err = %s", name(), err.to_string());
_app->close(false);
_app = nullptr;
} else {
@@ -331,7 +331,7 @@ error_code replica::init_app_and_prepare_list(bool create_new)
_app->set_partition_version(_app_info.partition_count - 1);
if (nullptr == _private_log) {
- ddebug("%s: clear private log, dir = %s", name(), log_dir.c_str());
+ LOG_INFO("%s: clear private log, dir = %s", name(), log_dir.c_str());
if (!dsn::utils::filesystem::remove_path(log_dir)) {
dassert(false, "Fail to delete directory %s.", log_dir.c_str());
}
@@ -341,7 +341,7 @@ error_code replica::init_app_and_prepare_list(bool create_new)
_private_log = new mutation_log_private(
log_dir, _options->log_private_file_size_mb, get_gpid(), this);
- ddebug("%s: plog_dir = %s", name(), log_dir.c_str());
+ LOG_INFO("%s: plog_dir = %s", name(), log_dir.c_str());
err = _private_log->open(nullptr, [this](error_code err) {
tasking::enqueue(LPC_REPLICATION_ERROR,
@@ -385,24 +385,26 @@ bool replica::replay_mutation(mutation_ptr &mu, bool is_private)
}
if (is_private && offset < _app->init_info().init_offset_in_private_log) {
- dinfo("%s: replay mutation skipped1 as offset is invalid in private log, ballot = %" PRId64
- ", decree = %" PRId64 ", last_committed_decree = %" PRId64 ", offset = %" PRId64,
- name(),
- mu->data.header.ballot,
- d,
- mu->data.header.last_committed_decree,
- offset);
+ LOG_DEBUG(
+ "%s: replay mutation skipped1 as offset is invalid in private log, ballot = %" PRId64
+ ", decree = %" PRId64 ", last_committed_decree = %" PRId64 ", offset = %" PRId64,
+ name(),
+ mu->data.header.ballot,
+ d,
+ mu->data.header.last_committed_decree,
+ offset);
return false;
}
if (!is_private && offset < _app->init_info().init_offset_in_shared_log) {
- dinfo("%s: replay mutation skipped2 as offset is invalid in shared log, ballot = %" PRId64
- ", decree = %" PRId64 ", last_committed_decree = %" PRId64 ", offset = %" PRId64,
- name(),
- mu->data.header.ballot,
- d,
- mu->data.header.last_committed_decree,
- offset);
+ LOG_DEBUG(
+ "%s: replay mutation skipped2 as offset is invalid in shared log, ballot = %" PRId64
+ ", decree = %" PRId64 ", last_committed_decree = %" PRId64 ", offset = %" PRId64,
+ name(),
+ mu->data.header.ballot,
+ d,
+ mu->data.header.last_committed_decree,
+ offset);
return false;
}
@@ -412,39 +414,39 @@ bool replica::replay_mutation(mutation_ptr &mu, bool is_private)
}
if (d <= last_committed_decree()) {
- dinfo("%s: replay mutation skipped3 as decree is outdated, ballot = %" PRId64
- ", decree = %" PRId64 "(vs app %" PRId64 "), last_committed_decree = %" PRId64
- ", offset = %" PRId64,
- name(),
- mu->data.header.ballot,
- d,
- last_committed_decree(),
- mu->data.header.last_committed_decree,
- offset);
+ LOG_DEBUG("%s: replay mutation skipped3 as decree is outdated, ballot = %" PRId64
+ ", decree = %" PRId64 "(vs app %" PRId64 "), last_committed_decree = %" PRId64
+ ", offset = %" PRId64,
+ name(),
+ mu->data.header.ballot,
+ d,
+ last_committed_decree(),
+ mu->data.header.last_committed_decree,
+ offset);
return true;
}
auto old = _prepare_list->get_mutation_by_decree(d);
if (old != nullptr && old->data.header.ballot >= mu->data.header.ballot) {
- dinfo("%s: replay mutation skipped4 as ballot is outdated, ballot = %" PRId64
- " (vs local-ballot=%" PRId64 "), decree = %" PRId64
- ", last_committed_decree = %" PRId64 ", offset = %" PRId64,
- name(),
- mu->data.header.ballot,
- old->data.header.ballot,
- d,
- mu->data.header.last_committed_decree,
- offset);
+ LOG_DEBUG("%s: replay mutation skipped4 as ballot is outdated, ballot = %" PRId64
+ " (vs local-ballot=%" PRId64 "), decree = %" PRId64
+ ", last_committed_decree = %" PRId64 ", offset = %" PRId64,
+ name(),
+ mu->data.header.ballot,
+ old->data.header.ballot,
+ d,
+ mu->data.header.last_committed_decree,
+ offset);
return true;
}
- dinfo("%s: replay mutation ballot = %" PRId64 ", decree = %" PRId64
- ", last_committed_decree = %" PRId64,
- name(),
- mu->data.header.ballot,
- d,
- mu->data.header.last_committed_decree);
+ LOG_DEBUG("%s: replay mutation ballot = %" PRId64 ", decree = %" PRId64
+ ", last_committed_decree = %" PRId64,
+ name(),
+ mu->data.header.ballot,
+ d,
+ mu->data.header.last_committed_decree);
// prepare
_uniq_timestamp_us.try_update(mu->data.header.timestamp);
@@ -457,10 +459,10 @@ bool replica::replay_mutation(mutation_ptr &mu, bool is_private)
void replica::set_inactive_state_transient(bool t)
{
if (status() == partition_status::PS_INACTIVE) {
- ddebug("%s: set inactive_is_transient from %s to %s",
- name(),
- _inactive_is_transient ? "true" : "false",
- t ? "true" : "false");
+ LOG_INFO("%s: set inactive_is_transient from %s to %s",
+ name(),
+ _inactive_is_transient ? "true" : "false",
+ t ? "true" : "false");
_inactive_is_transient = t;
}
}
diff --git a/src/replica/replica_learn.cpp b/src/replica/replica_learn.cpp
index f4e7a7d9c..7623e9f0f 100644
--- a/src/replica/replica_learn.cpp
+++ b/src/replica/replica_learn.cpp
@@ -51,7 +51,7 @@ void replica::init_learn(uint64_t signature)
_checker.only_one_thread_access();
if (status() != partition_status::PS_POTENTIAL_SECONDARY) {
- dwarn(
+ LOG_WARNING(
"%s: state is not potential secondary but %s, skip learning with signature[%016" PRIx64
"]",
name(),
@@ -61,25 +61,25 @@ void replica::init_learn(uint64_t signature)
}
if (signature == invalid_signature) {
- dwarn("%s: invalid learning signature, skip", name());
+ LOG_WARNING("%s: invalid learning signature, skip", name());
return;
}
// at most one learning task running
if (_potential_secondary_states.learning_round_is_running) {
- dwarn("%s: previous learning is still running, skip learning with signature [%016" PRIx64
- "]",
- name(),
- signature);
+ LOG_WARNING(
+ "%s: previous learning is still running, skip learning with signature [%016" PRIx64 "]",
+ name(),
+ signature);
return;
}
if (signature < _potential_secondary_states.learning_version) {
- dwarn("%s: learning request is out-dated, therefore skipped: [%016" PRIx64
- "] vs [%016" PRIx64 "]",
- name(),
- signature,
- _potential_secondary_states.learning_version);
+ LOG_WARNING("%s: learning request is out-dated, therefore skipped: [%016" PRIx64
+ "] vs [%016" PRIx64 "]",
+ name(),
+ signature,
+ _potential_secondary_states.learning_version);
return;
}
@@ -87,11 +87,12 @@ void replica::init_learn(uint64_t signature)
// be cautious: primary should not issue signatures frequently to avoid learning abort
if (signature != _potential_secondary_states.learning_version) {
if (!_potential_secondary_states.cleanup(false)) {
- dwarn("%s: previous learning with signature[%016" PRIx64
- "] is still in-process, skip init new learning with signature [%016" PRIx64 "]",
- name(),
- _potential_secondary_states.learning_version,
- signature);
+ LOG_WARNING("%s: previous learning with signature[%016" PRIx64
+ "] is still in-process, skip init new learning with signature [%016" PRIx64
+ "]",
+ name(),
+ _potential_secondary_states.learning_version,
+ signature);
return;
}
@@ -179,15 +180,15 @@ void replica::init_learn(uint64_t signature)
if (_app->last_committed_decree() == 0 &&
_stub->_learn_app_concurrent_count.load() >= _options->learn_app_max_concurrent_count) {
- dwarn("%s: init_learn[%016" PRIx64 "]: learnee = %s, learn_duration = %" PRIu64
- "ms, need to learn app because app_committed_decree = 0, but "
- "learn_app_concurrent_count(%d) >= learn_app_max_concurrent_count(%d), skip",
- name(),
- _potential_secondary_states.learning_version,
- _config.primary.to_string(),
- _potential_secondary_states.duration_ms(),
- _stub->_learn_app_concurrent_count.load(),
- _options->learn_app_max_concurrent_count);
+ LOG_WARNING("%s: init_learn[%016" PRIx64 "]: learnee = %s, learn_duration = %" PRIu64
+ "ms, need to learn app because app_committed_decree = 0, but "
+ "learn_app_concurrent_count(%d) >= learn_app_max_concurrent_count(%d), skip",
+ name(),
+ _potential_secondary_states.learning_version,
+ _config.primary.to_string(),
+ _potential_secondary_states.duration_ms(),
+ _stub->_learn_app_concurrent_count.load(),
+ _options->learn_app_max_concurrent_count);
return;
}
@@ -203,23 +204,23 @@ void replica::init_learn(uint64_t signature)
request.signature = _potential_secondary_states.learning_version;
_app->prepare_get_checkpoint(request.app_specific_learn_request);
- ddebug("%s: init_learn[%016" PRIx64 "]: learnee = %s, learn_duration = %" PRIu64
- " ms, max_gced_decree = %" PRId64 ", local_committed_decree = %" PRId64 ", "
- "app_committed_decree = %" PRId64 ", app_durable_decree = %" PRId64
- ", current_learning_status = %s, total_copy_file_count = %" PRIu64
- ", total_copy_file_size = %" PRIu64 ", total_copy_buffer_size = %" PRIu64,
- name(),
- request.signature,
- _config.primary.to_string(),
- _potential_secondary_states.duration_ms(),
- request.max_gced_decree,
- last_committed_decree(),
- _app->last_committed_decree(),
- _app->last_durable_decree(),
- enum_to_string(_potential_secondary_states.learning_status),
- _potential_secondary_states.learning_copy_file_count,
- _potential_secondary_states.learning_copy_file_size,
- _potential_secondary_states.learning_copy_buffer_size);
+ LOG_INFO("%s: init_learn[%016" PRIx64 "]: learnee = %s, learn_duration = %" PRIu64
+ " ms, max_gced_decree = %" PRId64 ", local_committed_decree = %" PRId64 ", "
+ "app_committed_decree = %" PRId64 ", app_durable_decree = %" PRId64
+ ", current_learning_status = %s, total_copy_file_count = %" PRIu64
+ ", total_copy_file_size = %" PRIu64 ", total_copy_buffer_size = %" PRIu64,
+ name(),
+ request.signature,
+ _config.primary.to_string(),
+ _potential_secondary_states.duration_ms(),
+ request.max_gced_decree,
+ last_committed_decree(),
+ _app->last_committed_decree(),
+ _app->last_durable_decree(),
+ enum_to_string(_potential_secondary_states.learning_status),
+ _potential_secondary_states.learning_copy_file_count,
+ _potential_secondary_states.learning_copy_file_size,
+ _potential_secondary_states.learning_copy_buffer_size);
dsn::message_ex *msg = dsn::message_ex::create_request(RPC_LEARN, 0, get_gpid().thread_hash());
dsn::marshall(msg, request);
@@ -361,14 +362,15 @@ void replica::on_learn(dsn::message_ex *msg, const learn_request &request)
// TODO: learner machine has been down for a long time, and DDD MUST happened before
// which leads to state lost. Now the lost state is back, what shall we do?
if (request.last_committed_decree_in_app > last_prepared_decree()) {
- derror("%s: on_learn[%016" PRIx64 "]: learner = %s, learner state is newer than learnee, "
- "learner_app_committed_decree = %" PRId64 ", local_committed_decree = %" PRId64
- ", learn from scratch",
- name(),
- request.signature,
- request.learner.to_string(),
- request.last_committed_decree_in_app,
- local_committed_decree);
+ LOG_ERROR("%s: on_learn[%016" PRIx64
+ "]: learner = %s, learner state is newer than learnee, "
+ "learner_app_committed_decree = %" PRId64 ", local_committed_decree = %" PRId64
+ ", learn from scratch",
+ name(),
+ request.signature,
+ request.learner.to_string(),
+ request.last_committed_decree_in_app,
+ local_committed_decree);
*(decree *)&request.last_committed_decree_in_app = 0;
}
@@ -377,29 +379,29 @@ void replica::on_learn(dsn::message_ex *msg, const learn_request &request)
// this happens when the new primary does not commit the previously prepared mutations
// yet, which it should do, so let's help it now.
else if (request.last_committed_decree_in_app > local_committed_decree) {
- derror("%s: on_learn[%016" PRIx64
- "]: learner = %s, learner's last_committed_decree_in_app is newer than learnee, "
- "learner_app_committed_decree = %" PRId64 ", local_committed_decree = %" PRId64
- ", commit local soft",
- name(),
- request.signature,
- request.learner.to_string(),
- request.last_committed_decree_in_app,
- local_committed_decree);
+ LOG_ERROR("%s: on_learn[%016" PRIx64
+ "]: learner = %s, learner's last_committed_decree_in_app is newer than learnee, "
+ "learner_app_committed_decree = %" PRId64 ", local_committed_decree = %" PRId64
+ ", commit local soft",
+ name(),
+ request.signature,
+ request.learner.to_string(),
+ request.last_committed_decree_in_app,
+ local_committed_decree);
// we shouldn't commit mutations hard coz these mutations may preparing on another learner
_prepare_list->commit(request.last_committed_decree_in_app, COMMIT_TO_DECREE_SOFT);
local_committed_decree = last_committed_decree();
if (request.last_committed_decree_in_app > local_committed_decree) {
- derror("%s: on_learn[%016" PRIx64 "]: try to commit primary to %" PRId64
- ", still less than learner(%s)'s committed decree(%" PRId64
- "), wait mutations to be commitable",
- name(),
- request.signature,
- local_committed_decree,
- request.learner.to_string(),
- request.last_committed_decree_in_app);
+ LOG_ERROR("%s: on_learn[%016" PRIx64 "]: try to commit primary to %" PRId64
+ ", still less than learner(%s)'s committed decree(%" PRId64
+ "), wait mutations to be commitable",
+ name(),
+ request.signature,
+ local_committed_decree,
+ request.learner.to_string(),
+ request.last_committed_decree_in_app);
response.err = ERR_INCONSISTENT_STATE;
reply(msg, response);
return;
@@ -415,22 +417,22 @@ void replica::on_learn(dsn::message_ex *msg, const learn_request &request)
response.state.__set_learn_start_decree(learn_start_decree);
bool delayed_replay_prepare_list = false;
- ddebug("%s: on_learn[%016" PRIx64 "]: learner = %s, remote_committed_decree = %" PRId64 ", "
- "remote_app_committed_decree = %" PRId64 ", local_committed_decree = %" PRId64 ", "
- "app_committed_decree = %" PRId64 ", app_durable_decree = %" PRId64 ", "
- "prepare_min_decree = %" PRId64
- ", prepare_list_count = %d, learn_start_decree = %" PRId64,
- name(),
- request.signature,
- request.learner.to_string(),
- request.last_committed_decree_in_prepare_list,
- request.last_committed_decree_in_app,
- local_committed_decree,
- _app->last_committed_decree(),
- _app->last_durable_decree(),
- _prepare_list->min_decree(),
- _prepare_list->count(),
- learn_start_decree);
+ LOG_INFO("%s: on_learn[%016" PRIx64 "]: learner = %s, remote_committed_decree = %" PRId64 ", "
+ "remote_app_committed_decree = %" PRId64 ", local_committed_decree = %" PRId64 ", "
+ "app_committed_decree = %" PRId64 ", app_durable_decree = %" PRId64 ", "
+ "prepare_min_decree = %" PRId64
+ ", prepare_list_count = %d, learn_start_decree = %" PRId64,
+ name(),
+ request.signature,
+ request.learner.to_string(),
+ request.last_committed_decree_in_prepare_list,
+ request.last_committed_decree_in_app,
+ local_committed_decree,
+ _app->last_committed_decree(),
+ _app->last_durable_decree(),
+ _prepare_list->min_decree(),
+ _prepare_list->count(),
+ learn_start_decree);
response.address = _stub->_primary_address;
response.prepare_start_decree = invalid_decree;
@@ -446,40 +448,40 @@ void replica::on_learn(dsn::message_ex *msg, const learn_request &request)
delayed_replay_prepare_list);
if (!should_learn_cache) {
if (learn_start_decree > _app->last_durable_decree()) {
- ddebug("%s: on_learn[%016" PRIx64 "]: learner = %s, choose to learn private logs, "
- "because learn_start_decree(%" PRId64 ") > _app->last_durable_decree(%" PRId64
- ")",
- name(),
- request.signature,
- request.learner.to_string(),
- learn_start_decree,
- _app->last_durable_decree());
+ LOG_INFO("%s: on_learn[%016" PRIx64 "]: learner = %s, choose to learn private logs, "
+ "because learn_start_decree(%" PRId64 ") > _app->last_durable_decree(%" PRId64
+ ")",
+ name(),
+ request.signature,
+ request.learner.to_string(),
+ learn_start_decree,
+ _app->last_durable_decree());
_private_log->get_learn_state(get_gpid(), learn_start_decree, response.state);
response.type = learn_type::LT_LOG;
} else if (_private_log->get_learn_state(get_gpid(), learn_start_decree, response.state)) {
- ddebug("%s: on_learn[%016" PRIx64 "]: learner = %s, choose to learn private logs, "
- "because mutation_log::get_learn_state() returns true",
- name(),
- request.signature,
- request.learner.to_string());
+ LOG_INFO("%s: on_learn[%016" PRIx64 "]: learner = %s, choose to learn private logs, "
+ "because mutation_log::get_learn_state() returns true",
+ name(),
+ request.signature,
+ request.learner.to_string());
response.type = learn_type::LT_LOG;
} else if (learn_start_decree < request.last_committed_decree_in_app + 1) {
- ddebug("%s: on_learn[%016" PRIx64 "]: learner = %s, choose to learn private logs, "
- "because learn_start_decree steps back for duplication",
- name(),
- request.signature,
- request.learner.to_string());
+ LOG_INFO("%s: on_learn[%016" PRIx64 "]: learner = %s, choose to learn private logs, "
+ "because learn_start_decree steps back for duplication",
+ name(),
+ request.signature,
+ request.learner.to_string());
response.type = learn_type::LT_LOG;
} else {
- ddebug("%s: on_learn[%016" PRIx64 "]: learner = %s, choose to learn app, "
- "beacuse learn_start_decree(%" PRId64 ") <= _app->last_durable_decree(%" PRId64
- "), "
- "and mutation_log::get_learn_state() returns false",
- name(),
- request.signature,
- request.learner.to_string(),
- learn_start_decree,
- _app->last_durable_decree());
+ LOG_INFO("%s: on_learn[%016" PRIx64 "]: learner = %s, choose to learn app, "
+ "beacuse learn_start_decree(%" PRId64 ") <= _app->last_durable_decree(%" PRId64
+ "), "
+ "and mutation_log::get_learn_state() returns false",
+ name(),
+ request.signature,
+ request.learner.to_string(),
+ learn_start_decree,
+ _app->last_durable_decree());
response.type = learn_type::LT_APP;
response.state = learn_state();
}
@@ -489,7 +491,7 @@ void replica::on_learn(dsn::message_ex *msg, const learn_request &request)
if (response.state.files.size() > 0) {
auto &last_file = response.state.files.back();
if (last_file == learner_state.last_learn_log_file) {
- ddebug(
+ LOG_INFO(
"%s: on_learn[%016" PRIx64
"]: learner = %s, learn the same file %s repeatedly, hint to switch file",
name(),
@@ -503,31 +505,31 @@ void replica::on_learn(dsn::message_ex *msg, const learn_request &request)
}
// it is safe to commit to last_committed_decree() now
response.state.to_decree_included = last_committed_decree();
- ddebug("%s: on_learn[%016" PRIx64 "]: learner = %s, learn private logs succeed, "
- "learned_meta_size = %u, learned_file_count = %u, "
- "to_decree_included = %" PRId64,
- name(),
- request.signature,
- request.learner.to_string(),
- response.state.meta.length(),
- static_cast<uint32_t>(response.state.files.size()),
- response.state.to_decree_included);
+ LOG_INFO("%s: on_learn[%016" PRIx64 "]: learner = %s, learn private logs succeed, "
+ "learned_meta_size = %u, learned_file_count = %u, "
+ "to_decree_included = %" PRId64,
+ name(),
+ request.signature,
+ request.learner.to_string(),
+ response.state.meta.length(),
+ static_cast<uint32_t>(response.state.files.size()),
+ response.state.to_decree_included);
} else {
::dsn::error_code err = _app->get_checkpoint(
learn_start_decree, request.app_specific_learn_request, response.state);
if (err != ERR_OK) {
response.err = ERR_GET_LEARN_STATE_FAILED;
- derror("%s: on_learn[%016" PRIx64
- "]: learner = %s, get app checkpoint failed, error = %s",
- name(),
- request.signature,
- request.learner.to_string(),
- err.to_string());
+ LOG_ERROR("%s: on_learn[%016" PRIx64
+ "]: learner = %s, get app checkpoint failed, error = %s",
+ name(),
+ request.signature,
+ request.learner.to_string(),
+ err.to_string());
} else {
response.base_local_dir = _app->data_dir();
response.__set_replica_disk_tag(get_replica_disk_tag());
- ddebug(
+ LOG_INFO(
"%s: on_learn[%016" PRIx64 "]: learner = %s, get app learn state succeed, "
"learned_meta_size = %u, learned_file_count = %u, learned_to_decree = %" PRId64,
name(),
@@ -594,12 +596,13 @@ void replica::on_learn_reply(error_code err, learn_request &&req, learn_response
if (resp.err != ERR_OK) {
if (resp.err == ERR_INACTIVE_STATE || resp.err == ERR_INCONSISTENT_STATE) {
- dwarn("%s: on_learn_reply[%016" PRIx64
- "]: learnee = %s, learnee is updating ballot(inactive state) or "
- "reconciliation(inconsistent state), delay to start another round of learning",
- name(),
- req.signature,
- resp.config.primary.to_string());
+ LOG_WARNING(
+ "%s: on_learn_reply[%016" PRIx64
+ "]: learnee = %s, learnee is updating ballot(inactive state) or "
+ "reconciliation(inconsistent state), delay to start another round of learning",
+ name(),
+ req.signature,
+ resp.config.primary.to_string());
_potential_secondary_states.learning_round_is_running = false;
_potential_secondary_states.delay_learning_task =
tasking::create_task(LPC_DELAY_LEARN,
@@ -614,47 +617,47 @@ void replica::on_learn_reply(error_code err, learn_request &&req, learn_response
}
if (resp.config.ballot > get_ballot()) {
- ddebug("%s: on_learn_reply[%016" PRIx64
- "]: learnee = %s, update configuration because ballot have changed",
- name(),
- req.signature,
- resp.config.primary.to_string());
+ LOG_INFO("%s: on_learn_reply[%016" PRIx64
+ "]: learnee = %s, update configuration because ballot have changed",
+ name(),
+ req.signature,
+ resp.config.primary.to_string());
bool ret = update_local_configuration(resp.config);
dassert(ret, "");
}
if (status() != partition_status::PS_POTENTIAL_SECONDARY) {
- derror("%s: on_learn_reply[%016" PRIx64
- "]: learnee = %s, current_status = %s, stop learning",
- name(),
- req.signature,
- resp.config.primary.to_string(),
- enum_to_string(status()));
+ LOG_ERROR("%s: on_learn_reply[%016" PRIx64
+ "]: learnee = %s, current_status = %s, stop learning",
+ name(),
+ req.signature,
+ resp.config.primary.to_string(),
+ enum_to_string(status()));
return;
}
// local state is newer than learnee
if (resp.last_committed_decree < _app->last_committed_decree()) {
- dwarn("%s: on_learn_reply[%016" PRIx64
- "]: learnee = %s, learner state is newer than learnee (primary): %" PRId64
- " vs %" PRId64 ", create new app",
- name(),
- req.signature,
- resp.config.primary.to_string(),
- _app->last_committed_decree(),
- resp.last_committed_decree);
+ LOG_WARNING("%s: on_learn_reply[%016" PRIx64
+ "]: learnee = %s, learner state is newer than learnee (primary): %" PRId64
+ " vs %" PRId64 ", create new app",
+ name(),
+ req.signature,
+ resp.config.primary.to_string(),
+ _app->last_committed_decree(),
+ resp.last_committed_decree);
_stub->_counter_replicas_learning_recent_learn_reset_count->increment();
// close app
auto err = _app->close(true);
if (err != ERR_OK) {
- derror("%s: on_learn_reply[%016" PRIx64
- "]: learnee = %s, close app (with clear_state=true) failed, err = %s",
- name(),
- req.signature,
- resp.config.primary.to_string(),
- err.to_string());
+ LOG_ERROR("%s: on_learn_reply[%016" PRIx64
+ "]: learnee = %s, close app (with clear_state=true) failed, err = %s",
+ name(),
+ req.signature,
+ resp.config.primary.to_string(),
+ err.to_string());
}
// backup old data dir
@@ -664,10 +667,10 @@ void replica::on_learn_reply(error_code err, learn_request &&req, learn_response
char rename_dir[1024];
sprintf(rename_dir, "%s.%" PRIu64 ".discarded", old_dir.c_str(), dsn_now_us());
if (dsn::utils::filesystem::rename_path(old_dir, rename_dir)) {
- dwarn("%s: {replica_dir_op} succeed to move directory from '%s' to '%s'",
- name(),
- old_dir.c_str(),
- rename_dir);
+ LOG_WARNING("%s: {replica_dir_op} succeed to move directory from '%s' to '%s'",
+ name(),
+ old_dir.c_str(),
+ rename_dir);
} else {
dassert(false,
"%s: failed to move directory from '%s' to '%s'",
@@ -684,12 +687,12 @@ void replica::on_learn_reply(error_code err, learn_request &&req, learn_response
_private_log->on_partition_reset(get_gpid(), 0));
if (err != ERR_OK) {
- derror("%s: on_learn_reply[%016" PRIx64
- "]: learnee = %s, open app (with create_new=true) failed, err = %s",
- name(),
- req.signature,
- resp.config.primary.to_string(),
- err.to_string());
+ LOG_ERROR("%s: on_learn_reply[%016" PRIx64
+ "]: learnee = %s, open app (with create_new=true) failed, err = %s",
+ name(),
+ req.signature,
+ resp.config.primary.to_string(),
+ err.to_string());
}
}
@@ -721,24 +724,24 @@ void replica::on_learn_reply(error_code err, learn_request &&req, learn_response
if (resp.type == learn_type::LT_APP) {
if (++_stub->_learn_app_concurrent_count > _options->learn_app_max_concurrent_count) {
--_stub->_learn_app_concurrent_count;
- dwarn("%s: on_learn_reply[%016" PRIx64
- "]: learnee = %s, learn_app_concurrent_count(%d) >= "
- "learn_app_max_concurrent_count(%d), skip this round",
- name(),
- _potential_secondary_states.learning_version,
- _config.primary.to_string(),
- _stub->_learn_app_concurrent_count.load(),
- _options->learn_app_max_concurrent_count);
+ LOG_WARNING("%s: on_learn_reply[%016" PRIx64
+ "]: learnee = %s, learn_app_concurrent_count(%d) >= "
+ "learn_app_max_concurrent_count(%d), skip this round",
+ name(),
+ _potential_secondary_states.learning_version,
+ _config.primary.to_string(),
+ _stub->_learn_app_concurrent_count.load(),
+ _options->learn_app_max_concurrent_count);
_potential_secondary_states.learning_round_is_running = false;
return;
} else {
_potential_secondary_states.learn_app_concurrent_count_increased = true;
- ddebug("%s: on_learn_reply[%016" PRIx64
- "]: learnee = %s, ++learn_app_concurrent_count = %d",
- name(),
- _potential_secondary_states.learning_version,
- _config.primary.to_string(),
- _stub->_learn_app_concurrent_count.load());
+ LOG_INFO("%s: on_learn_reply[%016" PRIx64
+ "]: learnee = %s, ++learn_app_concurrent_count = %d",
+ name(),
+ _potential_secondary_states.learning_version,
+ _config.primary.to_string(),
+ _stub->_learn_app_concurrent_count.load());
}
}
@@ -786,14 +789,14 @@ void replica::on_learn_reply(error_code err, learn_request &&req, learn_response
// reset preparelist
_potential_secondary_states.learning_start_prepare_decree = resp.prepare_start_decree;
_prepare_list->truncate(_app->last_committed_decree());
- ddebug("%s: on_learn_reply[%016" PRIx64
- "]: learnee = %s, truncate prepare list, local_committed_decree = %" PRId64
- ", current_learning_status = %s",
- name(),
- req.signature,
- resp.config.primary.to_string(),
- _app->last_committed_decree(),
- enum_to_string(_potential_secondary_states.learning_status));
+ LOG_INFO("%s: on_learn_reply[%016" PRIx64
+ "]: learnee = %s, truncate prepare list, local_committed_decree = %" PRId64
+ ", current_learning_status = %s",
+ name(),
+ req.signature,
+ resp.config.primary.to_string(),
+ _app->last_committed_decree(),
+ enum_to_string(_potential_secondary_states.learning_status));
// persist incoming mutations into private log and apply them to prepare-list
std::pair<decree, decree> cache_range;
@@ -801,10 +804,10 @@ void replica::on_learn_reply(error_code err, learn_request &&req, learn_response
while (!reader.is_eof()) {
auto mu = mutation::read_from(reader, nullptr);
if (mu->data.header.decree > last_committed_decree()) {
- dinfo("%s: on_learn_reply[%016" PRIx64 "]: apply learned mutation %s",
- name(),
- req.signature,
- mu->name());
+ LOG_DEBUG("%s: on_learn_reply[%016" PRIx64 "]: apply learned mutation %s",
+ name(),
+ req.signature,
+ mu->name());
// write to private log with no callback, the later 2pc ensures that logs
// are written to the disk
@@ -820,13 +823,13 @@ void replica::on_learn_reply(error_code err, learn_request &&req, learn_response
... 7293 lines suppressed ...
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pegasus.apache.org
For additional commands, e-mail: commits-help@pegasus.apache.org