1
0
Fork 0
mirror of https://github.com/dragonflydb/dragonfly.git synced 2024-12-14 11:58:02 +00:00

feat: add migration_finalization_timeout_ms flag (#4301)

This commit is contained in:
Borys 2024-12-13 11:05:27 +02:00 committed by GitHub
parent 53637790e8
commit 55bc981a7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 5 deletions

View file

@ -16,7 +16,7 @@
#include "server/main_service.h"
#include "util/fibers/synchronization.h"
ABSL_DECLARE_FLAG(int, slot_migration_connection_timeout_ms);
ABSL_DECLARE_FLAG(int, migration_finalization_timeout_ms);
namespace dfly::cluster {
@ -173,7 +173,7 @@ void IncomingSlotMigration::Pause(bool pause) {
bool IncomingSlotMigration::Join(long attempt) {
const absl::Time start = absl::Now();
const absl::Duration timeout =
absl::Milliseconds(absl::GetFlag(FLAGS_slot_migration_connection_timeout_ms));
absl::Milliseconds(absl::GetFlag(FLAGS_migration_finalization_timeout_ms));
while (true) {
const absl::Time now = absl::Now();
@ -209,7 +209,7 @@ void IncomingSlotMigration::Stop() {
// we need to Join the migration process to prevent data corruption
const absl::Time start = absl::Now();
const absl::Duration timeout =
absl::Milliseconds(absl::GetFlag(FLAGS_slot_migration_connection_timeout_ms));
absl::Milliseconds(absl::GetFlag(FLAGS_migration_finalization_timeout_ms));
while (true) {
const absl::Time now = absl::Now();

View file

@ -20,7 +20,10 @@
#include "server/server_family.h"
#include "util/fibers/synchronization.h"
ABSL_FLAG(int, slot_migration_connection_timeout_ms, 5000, "Timeout for network operations");
ABSL_FLAG(int, slot_migration_connection_timeout_ms, 2000,
"Connection creating timeout for migration operations");
ABSL_FLAG(int, migration_finalization_timeout_ms, 30000,
"Timeout for migration finalization operation");
using namespace std;
using namespace facade;
@ -333,7 +336,7 @@ bool OutgoingMigration::FinalizeMigration(long attempt) {
const absl::Time start = absl::Now();
const absl::Duration timeout =
absl::Milliseconds(absl::GetFlag(FLAGS_slot_migration_connection_timeout_ms));
absl::Milliseconds(absl::GetFlag(FLAGS_migration_finalization_timeout_ms));
while (true) {
const absl::Time now = absl::Now();
const absl::Duration passed = now - start;

View file

@ -813,6 +813,7 @@ void Service::Init(util::AcceptServer* acceptor, std::vector<facade::Listener*>
config_registry.RegisterMutable("replica_partial_sync");
config_registry.RegisterMutable("replication_timeout");
config_registry.RegisterMutable("migration_finalization_timeout_ms");
config_registry.RegisterMutable("table_growth_margin");
config_registry.RegisterMutable("tcp_keepalive");
config_registry.RegisterMutable("managed_service_info");