Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve][broker] Reduce unnecessary REPLICATED_SUBSCRIPTION_SNAPSHOT_REQUEST #23839

Merged
merged 3 commits into from
Jan 13, 2025

Conversation

shibd
Copy link
Member

@shibd shibd commented Jan 10, 2025

Motivation

Let's say two clusters to two-way replication: cluster-1 and cluster-2

  • cluster-1: has enabled subscription replication and correctly configured the cluster info for cluster-2
  • cluster-2:has either incorrectly configured the information for cluster-1 or disabled subscription replication.

As a result, cluster-1 will send SNAPSHOT_REQUEST to cluster-2 at a frequency of replicatedSubscriptionsSnapshotFrequencyMillis (1 second by default).

In extreme cases, this can lead to a large number of consecutive marker between cluster-1 and cluster-2 topic.

This may affect the performance of reader and consumer, or cause reader.readNext() to time out.

Modifications

  • When there is no complete snapshot, retry according to replicatedSubscriptionsSnapshotTimeoutSeconds to minimize the number of markers.

Verifying this change

  • Add testReplicatedSubscriptionOneWay to cover this case.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@shibd shibd self-assigned this Jan 10, 2025
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jan 10, 2025
@shibd shibd requested a review from dao-jun January 10, 2025 12:22
@codecov-commenter
Copy link

codecov-commenter commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 74.12%. Comparing base (bbc6224) to head (5f8ee19).
Report is 842 commits behind head on master.

Files with missing lines Patch % Lines
.../persistent/ReplicatedSubscriptionsController.java 50.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23839      +/-   ##
============================================
+ Coverage     73.57%   74.12%   +0.55%     
+ Complexity    32624    32187     -437     
============================================
  Files          1877     1853      -24     
  Lines        139502   143581    +4079     
  Branches      15299    16312    +1013     
============================================
+ Hits         102638   106430    +3792     
+ Misses        28908    28754     -154     
- Partials       7956     8397     +441     
Flag Coverage Δ
inttests 26.62% <0.00%> (+2.04%) ⬆️
systests 23.11% <0.00%> (-1.21%) ⬇️
unittests 73.64% <50.00%> (+0.80%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
.../persistent/ReplicatedSubscriptionsController.java 75.65% <50.00%> (+3.06%) ⬆️

... and 1025 files with indirect coverage changes

@shibd shibd requested a review from lhotari January 12, 2025 10:43
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shibd shibd merged commit d3707c5 into apache:master Jan 13, 2025
52 checks passed
shibd added a commit that referenced this pull request Jan 13, 2025
shibd added a commit that referenced this pull request Jan 13, 2025
shibd added a commit that referenced this pull request Jan 13, 2025
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Jan 13, 2025
…_REQUEST (apache#23839)

(cherry picked from commit d3707c5)
(cherry picked from commit 7c7fadd)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jan 13, 2025
…_REQUEST (apache#23839)

(cherry picked from commit d3707c5)
(cherry picked from commit 7c7fadd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants