From 6ece2f3b1842c9fd10d97142a194255a97a7f90b Mon Sep 17 00:00:00 2001 From: Dan Wang Date: Thu, 28 Nov 2024 17:04:28 +0800 Subject: [PATCH] feat(remote_command): allow empty writes to be queried/enabled/disabled by remote command (#2153) Support querying/enabling/disabling empty writes on one, multiple or all replica servers by just one remote command conveniently. For example, after a table is migrated from a cluster A to another cluster B by duplication, we want to check whether that migration has been finished by decree. However, since empty writes would increase the decree, it is necessary to use only one command to disable empty writes on all replica servers of cluster A without need to restart all of them. --- src/replica/replica_stub.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/replica/replica_stub.cpp b/src/replica/replica_stub.cpp index 6389ed50c0..18b5566e63 100644 --- a/src/replica/replica_stub.cpp +++ b/src/replica/replica_stub.cpp @@ -229,6 +229,7 @@ METRIC_DEFINE_gauge_int64(server, "The max size of copied files among all splitting replicas"); DSN_DECLARE_bool(duplication_enabled); +DSN_DECLARE_bool(empty_write_disabled); DSN_DECLARE_bool(enable_acl); DSN_DECLARE_bool(encrypt_data_at_rest); DSN_DECLARE_int32(fd_beacon_interval_seconds); @@ -2354,6 +2355,11 @@ void replica_stub::register_ctrl_command() }); })); + _cmds.emplace_back(::dsn::command_manager::instance().register_bool_command( + FLAGS_empty_write_disabled, + "replica.disable-empty-write", + "whether to disable empty writes")); + #ifdef DSN_ENABLE_GPERF _cmds.emplace_back(::dsn::command_manager::instance().register_bool_command( _release_tcmalloc_memory,