chore: add timeout to replication sockets (#3434)

* chore: add timeout fo replication sockets

Master will stop the replication flow if writes could not progress for more than K millis.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
Signed-off-by: Roman Gershman <romange@gmail.com>
Co-authored-by: Shahar Mike <chakaz@users.noreply.github.com>
This commit is contained in:
Roman Gershman 2024-08-07 16:33:03 +03:00 committed by GitHub
parent 7c84b8e524
commit 1cbfcd4912
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 133 additions and 41 deletions

View file

@ -13,9 +13,9 @@
using namespace facade;
ABSL_FLAG(uint32_t, replication_stream_timeout, 500,
"Time in milliseconds to wait for the replication output buffer go below "
"the throttle limit.");
ABSL_FLAG(uint32_t, replication_timeout, 10000,
"Time in milliseconds to wait for the replication writes being stuck.");
ABSL_FLAG(uint32_t, replication_stream_output_limit, 64_KB,
"Time to wait for the replication output buffer go below the throttle limit");
@ -155,8 +155,8 @@ void JournalStreamer::ThrottleIfNeeded() {
if (IsStopped() || !IsStalled())
return;
auto next = chrono::steady_clock::now() +
chrono::milliseconds(absl::GetFlag(FLAGS_replication_stream_timeout));
auto next =
chrono::steady_clock::now() + chrono::milliseconds(absl::GetFlag(FLAGS_replication_timeout));
size_t inflight_start = in_flight_bytes_;
size_t sent_start = total_sent_;