1
0
Fork 0
mirror of https://github.com/dragonflydb/dragonfly.git synced 2024-12-15 17:51:06 +00:00

Add a feature flag for partial_sync (#1957)

This commit is contained in:
Roy Jacobson 2023-09-28 13:15:05 +03:00 committed by GitHub
parent 7ad29ab919
commit 4ecab6e786
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -655,6 +655,7 @@ void Service::Init(util::AcceptServer* acceptor, std::vector<facade::Listener*>
config_registry.RegisterMutable("requirepass");
config_registry.RegisterMutable("masterauth");
config_registry.RegisterMutable("tcp_keepalive");
config_registry.RegisterMutable("replica_partial_sync");
acl::UserRegistry* reg = &user_registry_;
pp_.Await([reg](uint32_t index, ProactorBase* pb) { ServerState::Init(index, reg); });

View file

@ -37,6 +37,8 @@ ABSL_FLAG(int, master_connect_timeout_ms, 20000,
"Timeout for establishing connection to a replication master");
ABSL_FLAG(int, master_reconnect_timeout_ms, 1000,
"Timeout for re-establishing connection to a replication master");
ABSL_FLAG(bool, replica_partial_sync, true,
"Use partial sync to reconnect when a replica connection is interrupted.");
ABSL_DECLARE_FLAG(int32_t, port);
namespace dfly {
@ -667,7 +669,8 @@ io::Result<bool> DflyShardReplica::StartSyncFlow(BlockingCounter sb, Context* cn
std::string cmd = StrCat("DFLY FLOW ", master_context_.master_repl_id, " ",
master_context_.dfly_session_id, " ", flow_id_);
// Try to negotiate a partial sync if possible.
if (lsn.has_value() && master_context_.version > DflyVersion::VER1) {
if (lsn.has_value() && master_context_.version > DflyVersion::VER1 &&
absl::GetFlag(FLAGS_replica_partial_sync)) {
absl::StrAppend(&cmd, " ", *lsn);
}