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 8d7c91b04 feat(dup): parameterize the period seconds of duplication
sync (#1639)
8d7c91b04 is described below
commit 8d7c91b0474ff5c99a19d41c7d16e64a0c55098b
Author: Yingchun Lai <[email protected]>
AuthorDate: Wed Oct 18 21:08:04 2023 +0800
feat(dup): parameterize the period seconds of duplication sync (#1639)
https://github.com/apache/incubator-pegasus/issues/766
The period seconds of duplication to sync data from local cluster to remote
cluster is hard code (10 seconds) now, this patch adds a parameter for it.
config changes:
```diff
+[replication]
+duplication_sync_period_second = 10
```
---
src/replica/duplication/duplication_sync_timer.cpp | 15 ++++++++++++---
src/replica/duplication/duplication_sync_timer.h | 5 -----
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/replica/duplication/duplication_sync_timer.cpp
b/src/replica/duplication/duplication_sync_timer.cpp
index d04d014fe..9e315c111 100644
--- a/src/replica/duplication/duplication_sync_timer.cpp
+++ b/src/replica/duplication/duplication_sync_timer.cpp
@@ -35,12 +35,21 @@
#include "runtime/task/async_calls.h"
#include "runtime/task/task_code.h"
#include "utils/autoref_ptr.h"
+#include "utils/chrono_literals.h"
#include "utils/error_code.h"
+#include "utils/flags.h"
#include "utils/fmt_logging.h"
#include "utils/threadpool_code.h"
+DSN_DEFINE_uint64(
+ replication,
+ duplication_sync_period_second,
+ 10,
+ "The period seconds of duplication to sync data from local cluster to
remote cluster");
+
namespace dsn {
namespace replication {
+using namespace literals::chrono_literals;
DEFINE_TASK_CODE(LPC_DUPLICATION_SYNC_TIMER, TASK_PRIORITY_COMMON,
THREAD_POOL_DEFAULT)
@@ -169,14 +178,14 @@ void duplication_sync_timer::close()
void duplication_sync_timer::start()
{
- LOG_INFO("run duplication sync periodically in {}s",
DUPLICATION_SYNC_PERIOD_SECOND);
+ LOG_INFO("run duplication sync periodically in {}s",
FLAGS_duplication_sync_period_second);
_timer_task = tasking::enqueue_timer(LPC_DUPLICATION_SYNC_TIMER,
&_stub->_tracker,
[this]() { run(); },
- DUPLICATION_SYNC_PERIOD_SECOND * 1_s,
+ FLAGS_duplication_sync_period_second
* 1_s,
0,
- DUPLICATION_SYNC_PERIOD_SECOND * 1_s);
+ FLAGS_duplication_sync_period_second
* 1_s);
}
std::multimap<dupid_t, duplication_sync_timer::replica_dup_state>
diff --git a/src/replica/duplication/duplication_sync_timer.h
b/src/replica/duplication/duplication_sync_timer.h
index 4a112b1d5..ff1b6c066 100644
--- a/src/replica/duplication/duplication_sync_timer.h
+++ b/src/replica/duplication/duplication_sync_timer.h
@@ -26,7 +26,6 @@
#include "duplication_types.h"
#include "replica/replica.h"
#include "runtime/task/task.h"
-#include "utils/chrono_literals.h"
#include "utils/zlocks.h"
namespace dsn {
@@ -35,10 +34,6 @@ class error_code;
namespace replication {
class replica_stub;
-using namespace literals::chrono_literals;
-
-constexpr int DUPLICATION_SYNC_PERIOD_SECOND = 10;
-
// Per-server(replica_stub)-instance.
class duplication_sync_timer
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]