Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dup): parameterize the period seconds of duplication sync #1639

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/replica/duplication/duplication_sync_timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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>
Expand Down
5 changes: 0 additions & 5 deletions src/replica/duplication/duplication_sync_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
{
Expand Down
Loading