[BUG] Fix corner case in pull-based ingestion where messages can be skipped on shard recovery
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:
- The processor thread will provide the message pointer that is currently being processed.
- 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