Skip to content

Conversation

@dao-jun
Copy link
Member

@dao-jun dao-jun commented May 30, 2024

Motivation

#6404 is to fix duplicated messages after broker restart(Especially for delayed messages).
However, since we introduced #19035, it has to some extent solved this problem,
but this logic still exists, in some cases, it may lead to more serious duplication problems.

#6404 wants to skip read entries which are to replay. Say, if entry [1] is
a delay message, and the current readPosition is [1], it can move the readPosition to [2] to avoid normal read operations read the entry to resolve message duplication.

However, it may have a chance to move the Cursor#readPosition backward:

replay read normal read
step 1 read entry 1 read entries [1, 10]
step 2 the readPosition equals 1
step 3 read [1, 10] complete
step 4 update readPosition to 11
step 5 update readPosition to 2

Since it moved the readPosition backward to 2, so even though broker read [1, 10] from BK and dispatched them to client, but it will also read [2, 11] from BK then dispatch in the next reading, [2, 10] will be duplicated.

Modifications

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.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

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:

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label May 30, 2024
@lhotari
Copy link
Member

lhotari commented May 30, 2024

but this logic still exists, in some cases, it may lead to more serious duplication problems.

please share more details. Do you have a chance to add a test case for this PR?

@dao-jun
Copy link
Member Author

dao-jun commented May 31, 2024

@lhotari I updated the description

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