-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Skip creating a subscription replication snapshot if no messages have been published after the topic gets activated on a broker #16618
Conversation
I was also considering a fix where a single snapshot would be created after topic activation instead of skipping the snapshotting completely. @merlimat what is your recommendation for the fix? |
9091794
to
f4e68b2
Compare
@merlimat @codelipenghui Please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
While reviewing the code surrounding this PR, I noticed that the lastDataMessagePublishedTimestamp
variable is not volatile. It seems like this could lead to behavior where we don't send snapshots as early as expected. Do you think we should make it volatile
?
...main/java/org/apache/pulsar/broker/service/persistent/ReplicatedSubscriptionsController.java
Show resolved
Hide resolved
f4e68b2
to
b58145d
Compare
@michaeljmarshall Good point. I'll cover that as part of #17252. |
… been published after the topic gets activated on a broker (apache#16618) * Skip creating a replication snapshot if no messages have been published * Adapt test to new behavior where replication snapshots happen only when there are new messages (cherry picked from commit 43ad6f9) (cherry picked from commit eac65c0)
(cherry picked from commit f056d9d)
… been published after the topic gets activated on a broker (apache#16618) * Skip creating a replication snapshot if no messages have been published * Adapt test to new behavior where replication snapshots happen only when there are new messages (cherry picked from commit 43ad6f9) (cherry picked from commit eac65c0)
(cherry picked from commit f056d9d)
Motivation
There's a bug in replicated subscriptions snapshotting. Snapshots get continuously created after a topic gets activated and before new messages are published. This is a gap in the logic introduced in #11922.
Additional context
The intention of the #10292 and #11922 changes were to pause replication snapshots when there are no new messages.
These changes were made to address #6437 and as an alternative to #7299 changes.
Modifications
testReplicationSnapshotStopWhenNoTraffic
to verify that snapshots aren't published before messages have been published.doc-not-needed