rabbitmq / osiris

Log based streaming subsystem for RabbitMQ
Other
45 stars 10 forks source link

last_epochs_offsets could potentially return offsets pointing to missing data #145

Open kjnilsson opened 1 year ago

kjnilsson commented 1 year ago

Describe the bug

This function does not check that an entry in the index is also valid in the segment and thus can return values that are not valid. For normal operation this is fine as the index is always written to after the segment. However if there is an unclean node shutdown where the page cache is lost it is/appears possible that the index will contain data not also present in the segment (due to data re-ordering at the storage layer or file system).

Reproduction steps

  1. Truncating some data from the segment file then running the function should be sufficient to show it returning offsets not present in the segment.

Expected behavior

It should include only valid epoch offsets.

Additional context

No response