do not merge duplicate replication requests (#14037)
do not merge duplicate replication requests - just ignore them
Costa Tsaousis committed
Nov 22, 2022 at 23:18 UTC
131dacb5121b1a1393e4079dbac545c836bfb607
1 file changed
+39
-39
streaming/replication.c
+39
-39
@@ -693,51 +693,51 @@ static bool replication_request_conflict_callback(const DICTIONARY_ITEM *item __
693
694
internal_error(
695
true,
696
- "STREAM %s [send to %s]: REPLAY ERROR: merging duplicate replication command received for chart '%s' (existing from %llu to %llu [%s], new from %llu to %llu [%s])",
696
+ "STREAM %s [send to %s]: REPLAY ERROR: ignoring duplicate replication command received for chart '%s' (existing from %llu to %llu [%s], new from %llu to %llu [%s])",
697
rrdhost_hostname(s->host), s->connected_to, dictionary_acquired_item_name(item),
698
(unsigned long long)rq->after, (unsigned long long)rq->before, rq->start_streaming ? "true" : "false",
699
(unsigned long long)rq_new->after, (unsigned long long)rq_new->before, rq_new->start_streaming ? "true" : "false");
700
701
- bool updated_after = false, updated_before = false, updated_start_streaming = false, updated = false;
702
-
703
- if(rq_new->after < rq->after && rq_new->after != 0)
704
- updated_after = true;
705
-
706
- if(rq_new->before > rq->before)
707
- updated_before = true;
708
-
709
- if(rq_new->start_streaming != rq->start_streaming)
710
- updated_start_streaming = true;
711
-
712
- if(updated_after || updated_before || updated_start_streaming) {
713
- replication_recursive_lock();
714
-
715
- if(rq->indexed_in_judy)
716
- replication_sort_entry_del(rq);
717
-
718
- if(rq_new->after < rq->after && rq_new->after != 0)
719
- rq->after = rq_new->after;
720
-
721
- if(rq->after == 0)
722
- rq->before = 0;
723
- else if(rq_new->before > rq->before)
724
- rq->before = rq_new->before;
725
-
726
- rq->start_streaming = rq->start_streaming;
727
- replication_sort_entry_add(rq);
728
-
729
- replication_recursive_unlock();
730
- updated = true;
731
-
732
- internal_error(
733
- true,
734
- "STREAM %s [send to %s]: REPLAY ERROR: updated duplicate replication command for chart '%s' (from %llu to %llu [%s])",
735
- rrdhost_hostname(s->host), s->connected_to, dictionary_acquired_item_name(item),
736
- (unsigned long long)rq->after, (unsigned long long)rq->before, rq->start_streaming ? "true" : "false");
737
- }
701
+// bool updated_after = false, updated_before = false, updated_start_streaming = false, updated = false;
702
+//
703
+// if(rq_new->after < rq->after && rq_new->after != 0)
704
+// updated_after = true;
705
+//
706
+// if(rq_new->before > rq->before)
707
+// updated_before = true;
708
+//
709
+// if(rq_new->start_streaming != rq->start_streaming)
710
+// updated_start_streaming = true;
711
+//
712
+// if(updated_after || updated_before || updated_start_streaming) {
713
+// replication_recursive_lock();
714
+//
715
+// if(rq->indexed_in_judy)
716
+// replication_sort_entry_del(rq);
717
+//
718
+// if(rq_new->after < rq->after && rq_new->after != 0)
719
+// rq->after = rq_new->after;
720
+//
721
+// if(rq->after == 0)
722
+// rq->before = 0;
723
+// else if(rq_new->before > rq->before)
724
+// rq->before = rq_new->before;
725
+//
726
+// rq->start_streaming = rq->start_streaming;
727
+// replication_sort_entry_add(rq);
728
+//
729
+// replication_recursive_unlock();
730
+// updated = true;
731
+//
732
+// internal_error(
733
+// true,
734
+// "STREAM %s [send to %s]: REPLAY ERROR: updated duplicate replication command for chart '%s' (from %llu to %llu [%s])",
735
+// rrdhost_hostname(s->host), s->connected_to, dictionary_acquired_item_name(item),
736
+// (unsigned long long)rq->after, (unsigned long long)rq->before, rq->start_streaming ? "true" : "false");
737
+// }
738
739
string_freez(rq_new->chart_id);
740
- return updated;
740
+ return false;
741
}
742
743
static void replication_request_delete_callback(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *sender_state __maybe_unused) {