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

[fix] [broker] fix startNewSnapshot when lastDataMessagePublishedTimestamp not change. #22461

Closed

Conversation

thetumbled
Copy link
Member

@thetumbled thetumbled commented Apr 8, 2024

Motivation

#16618 introduce a feature that we could skip creating a subscription replication snapshot if no messages have been published.
So it is reasonable that if lastDataMessagePublishedTimestamp not change, we should skip taking snapshot.
But it don't check for equality, and i don't get the explanation:
#16618 (comment)

Modifications

Add the check for equality.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

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

Matching PR in forked repository

PR in forked repository: thetumbled#47

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Apr 8, 2024
@thetumbled
Copy link
Member Author

thetumbled commented Apr 8, 2024

Could you help to review this pr? @lhotari @codelipenghui @BewareMyPower @dao-jun @merlimat

@lhotari
Copy link
Member

lhotari commented Apr 8, 2024

@thetumbled I've been trying to get a review for PR #16651 for quite some time without response. It's slightly related. Can you please check it?

@lhotari
Copy link
Member

lhotari commented Apr 8, 2024

But it don't check for equality, and i don't get the explanation:
#16618 (comment)

I'll explain. In the current code in master branch,

if (topic.getLastDataMessagePublishedTimestamp() < lastCompletedSnapshotStartTime
|| topic.getLastDataMessagePublishedTimestamp() == 0) {
.

The condition topic.getLastDataMessagePublishedTimestamp() < lastCompletedSnapshotStartTime is comparing 2 different types of timestamps: the first one is the timestamp of publishing the last message. The other one is the completion of the snapshot starting time. Checking for equality isn't necessary since those timestamps won't be the same. Does this explanation clarify that?

The problem of duplicate snapshots is solved by #16651.

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.

I don't think that this change makes a difference. I explained it in comments. I have created another PR a long time ago to eliminate unnecessary snapshots, that is #16651

@thetumbled
Copy link
Member Author

But it don't check for equality, and i don't get the explanation:
#16618 (comment)

I'll explain. In the current code in master branch,

if (topic.getLastDataMessagePublishedTimestamp() < lastCompletedSnapshotStartTime
|| topic.getLastDataMessagePublishedTimestamp() == 0) {

.
The condition topic.getLastDataMessagePublishedTimestamp() < lastCompletedSnapshotStartTime is comparing 2 different types of timestamps: the first one is the timestamp of publishing the last message. The other one is the completion of the snapshot starting time. Checking for equality isn't necessary since those timestamps won't be the same. Does this explanation clarify that?

The problem of duplicate snapshots is solved by #16651.

I get it. thanks for explanation!

@thetumbled thetumbled closed this Apr 8, 2024
@thetumbled
Copy link
Member Author

@thetumbled I've been trying to get a review for PR #16651 for quite some time without response. It's slightly related. Can you please check it?

I am not that familiar with ReplicatedSubscription implementation, but try to solve another problem related to it. #22452
Maybe you could refer for @merlimat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants