Skip to content

Conversation

@merlimat
Copy link
Contributor

Motivation

The updates on the managed cursor are (by default) rate limited to avoid generating a lot of write operations when consumers are acknowledging messages.

Due to the nature of the rate limiting, if the traffic on topic suddenly stops, the last updates to the cursor position are kept only in memory and they would be flushed only in 2 conditions, either:

  1. The traffic resumes and the consumer acks again
  2. The topic is gracefully closed

If the topic is not gracefully closed, the cursor will be rolled back to the last persisted position.

That will trigger re-delivery of potentially very old messages. Instead we should have a time-bound period after which we ensure that all cursor updates are flushed on disk.

@merlimat merlimat added the type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages label Nov 19, 2020
@merlimat merlimat added this to the 2.7.0 milestone Nov 19, 2020
@merlimat merlimat self-assigned this Nov 19, 2020
Copy link
Contributor

@rdhabalia rdhabalia left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@merlimat merlimat merged commit a8cd908 into apache:master Nov 20, 2020
@merlimat merlimat deleted the flush-cursor branch November 20, 2020 17:18
zymap pushed a commit to zymap/pulsar that referenced this pull request Nov 21, 2020
merlimat added a commit to merlimat/pulsar that referenced this pull request Dec 19, 2020
addisonj pushed a commit to streamnative/pulsar-archived that referenced this pull request Feb 16, 2021
@lhotari
Copy link
Member

lhotari commented Apr 12, 2022

#15031 and #15067 are needed to fix some race conditions caused by the periodic flushing.

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

Labels

release/2.6.4 type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants