Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix row ordering flakiness when using clear APIs #3288

Merged
merged 3 commits into from
Sep 12, 2023

Conversation

teh-cmc
Copy link
Member

@teh-cmc teh-cmc commented Sep 12, 2023

The clear APIs insert multiple rows worth of data (1 per component) that all re-use the same RowId (the RowId that was used to do the log_clear() call itself).
This leads to a flaky ordering of these rows internally, as there is no way to tie-break between them.
It is also less performant than it should be as all of this data could and should live on the same row.

The problem is accentuated when doing recursive clears, since in that case the row ID is not only shared between multiple rows of the same entity, but also multiple rows across multiple entities: even more ordering flakiness.

This flaky ordering then leaks through the public APIs (e.g. range queries) and, importantly, through roundtrip tests.
This is how I first encoutered this issue: #3023 is blocked by this because the roundtrip tests for recursive clears are flaky. This PR fixes that.

Unfortunately we don't have a test suite in place for clear APIs (AFAIK), and I'm not even sure what the expected behavior is in all cases, so I cannot write that test suite for now. I've opened an issue for this:

In the meantime, the roundtrip tests introduced in #3023 will act as a regression test at the very least.

What

Checklist

@teh-cmc teh-cmc added 🪳 bug Something isn't working ⛃ re_datastore affects the datastore itself labels Sep 12, 2023
@teh-cmc teh-cmc force-pushed the cmc/clear_ordering_flakiness branch from 29537b4 to 7faa657 Compare September 12, 2023 10:05
@teh-cmc teh-cmc merged commit c2a4581 into main Sep 12, 2023
@teh-cmc teh-cmc deleted the cmc/clear_ordering_flakiness branch September 12, 2023 12:45
teh-cmc added a commit that referenced this pull request Sep 13, 2023
**Commit by commit**

This only adds unit tests and API examples: no need for dedicated
roundtrip tests since all possible cases are already covered by the API
example roundtrips.

I want a better constructor interface for Python, but this requires
#3268.

Requires #3288, otherwise the roundtrip tests are flaky.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪳 bug Something isn't working ⛃ re_datastore affects the datastore itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants