Skip to content

Fix message TTL on Key_Shared subscription and Fix ordering issue when replay messages. - #8292

Merged
merlimat merged 1 commit into
apache:masterfrom
codelipenghui:penghui/key_shared_ttl
Oct 19, 2020
Merged

merlimat merged 1 commit into
apache:masterfrom
codelipenghui:penghui/key_shared_ttl

Conversation

@codelipenghui

@codelipenghui codelipenghui commented Oct 19, 2020 •

Copy link
Copy Markdown
Contributor

Related to #8115 #7455

Motivation

Fix message TTL on Key_Shared subscription.

The message TTL will move the mark delete position of the cursor. But did not trigger read entries for the Key_Shared subscription. This will lead to an earlier position which does not acked cause consumers under the Key_Shared subscription stucked even if users enable the message TTL.

Fix ordering issue when replaying messages in the Key_Shared subscription.

For example, we have 10 messages [0,1,2,3,4,5,6,7,8,9]
If the consumer0 get message 0 and 1, and does not acked message 0, then consumer1 joined,
when consumer1 get message 2,3, the broker will not dispatch messages to consumer1
because of the mark delete position did not move forward. So message 2,3 will stored in the redeliver tracker.
Now, consumer2 joined, it will read new messages from the cursor, so the recentJoinedPosition is 4 for consumer2
Because of there are messages that need to redeliver, so the broker will read the redelivery message first [2,3]
message [2,3] is lower than the recentJoinedPosition 4, so the message [2,3] will be dispatched to the consumer2
But the message [2,3] should not dispatch to consumer2.

Verifying this change

  1. To trigger message read operation when the TTL happens on Key_Shared subscription
  2. Only dispatch the messages than lower than the min read position of recentJoined consumer.

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

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API: (no)
  • The schema: (no)
  • The default values of configurations: (no)
  • The wire protocol: (no)
  • The rest endpoints: (no)
  • The admin cli options: (no)
  • Anything that affects deployment: (no)

Documentation

  • Does this pull request introduce a new feature? (no)

@codelipenghui
codelipenghui requested review from jiazhai, merlimat, rdhabalia and sijie and removed request for merlimat October 19, 2020 04:39
@codelipenghui codelipenghui self-assigned this Oct 19, 2020
@codelipenghui codelipenghui added release/2.6.2 type/bug The PR fixed a bug or issue reported a bug labels Oct 19, 2020
@codelipenghui codelipenghui added this to the 2.7.0 milestone Oct 19, 2020
@jiazhai

jiazhai commented Oct 19, 2020

Copy link
Copy Markdown
Member

/pulsarbot run-failure-checks

1 similar comment
@jiazhai

jiazhai commented Oct 19, 2020

Copy link
Copy Markdown
Member

/pulsarbot run-failure-checks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/2.6.2 type/bug The PR fixed a bug or issue reported a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants