OpenSearch icon indicating copy to clipboard operation
OpenSearch copied to clipboard

[BUG] Fix corner case in pull-based ingestion where messages can be skipped on shard recovery

Open varunbharadwaj opened this issue 1 year ago • 0 comments

Describe the bug

Currently, the pull based ingestion design decouples the poller and processor, where the poller reads batch of messages and writes to an in-memory queue. The processor reads and processes the updates from the queue. The poller's current batch start pointer is added along with every commit to act as the start point during shard recovery. In an extreme scenario, it is possible for the poller to move to the next batch before all messages from the previous batch are processed. If a commit is done at this time, the persisted batch start pointer will point to the next batch, skipping messages from the previous batch in case of shard failure.

This issue will be fixed by doing the following:

  1. The processor thread will provide the message pointer that is currently being processed.
  2. This pointer will be persisted in the commit information and used as the start point for recovery.

This will ensure shard recovery does not skip any messages even if the poller has moved on to a subsequent batch.

Related component

Indexing

To Reproduce

This is caught during the development and testing of the feature.

Expected behavior

No messages are skipped in any scenario during shard recovery

Additional Details

No response

varunbharadwaj avatar Apr 08 '25 23:04 varunbharadwaj