clockworklabs / SpacetimeDB

Multiplayer at the speed of light
https://spacetimedb.com
Other
4.41k stars 110 forks source link

commitlog: Improve skipping behavior of traversals #1902

Closed kim closed 3 weeks ago

kim commented 4 weeks ago

The *_from style traversals have historically yielded commits or transactions before the given from-offset, leaving it to downstream consumers to handle skipping.

While folding handles it internally, this behavior is not great for transaction iterators, due to the statefulness of decoding -- it is usually necessary to call Decoder::skip_record until the desired offset is found.

We would also yield all commits from the start of the nearest segment boundary, which can be quite confusing when using the commit iterators directly.

This patch fixes the situation by:

Expected complexity level and risk

2.5 -- makes head spin

NOTE: On top of #1901, because tooling work depends on the whole series