summaryrefslogtreecommitdiffstats
path: root/streaming
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@netdata.cloud>2023-02-14 13:10:57 +0200
committerGitHub <noreply@github.com>2023-02-14 13:10:57 +0200
commit8fdeec2e85cf5b1de742d672c57e2c0f276e8867 (patch)
treeb40df18a728b0cbea27a33025c90cb750b1e3d08 /streaming
parent9986391e46260a43319d2539eb5ebd62abf75246 (diff)
replicating gaps (#14506)
* instead of sending RBEGIN/REND without points, jump to the end of the gap on every replication step * Remove check for memory mode NONE so that replication when INTERPOLATE is negotiated will work * Remove unused label --------- Co-authored-by: Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com>
Diffstat (limited to 'streaming')
-rw-r--r--streaming/replication.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/streaming/replication.c b/streaming/replication.c
index 2b96dc6cb0..a1767c234b 100644
--- a/streaming/replication.c
+++ b/streaming/replication.c
@@ -310,7 +310,8 @@ static bool replication_query_execute(BUFFER *wb, struct replication_query *q, s
struct storage_engine_query_ops *ops = q->ops;
time_t wall_clock_time = q->wall_clock_time;
- size_t points_read = q->points_read, points_generated = q->points_generated;
+ bool finished_with_gap = false;
+ size_t points_read = 0, points_generated = 0;
#ifdef NETDATA_LOG_REPLICATION_REQUESTS
time_t actual_after = 0, actual_before = 0;
@@ -469,9 +470,16 @@ static bool replication_query_execute(BUFFER *wb, struct replication_query *q, s
else if(unlikely(min_end_time < now))
// the query does not progress
break;
- else
+ else {
// we have gap - all points are in the future
now = min_start_time;
+
+ if(min_start_time > before && !points_generated) {
+ before = q->query.before = min_start_time - 1;
+ finished_with_gap = true;
+ break;
+ }
+ }
}
#ifdef NETDATA_LOG_REPLICATION_REQUESTS
@@ -492,10 +500,9 @@ static bool replication_query_execute(BUFFER *wb, struct replication_query *q, s
(unsigned long long)after, (unsigned long long)before);
#endif // NETDATA_LOG_REPLICATION_REQUESTS
- q->points_read = points_read;
- q->points_generated = points_generated;
+ q->points_read += points_read;
+ q->points_generated += points_generated;
- bool finished_with_gap = false;
if(last_end_time_in_buffer < before - q->st->update_every)
finished_with_gap = true;