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

Never expect the replica iterators to be sorted #538

Merged
merged 1 commit into from
Dec 18, 2023

Conversation

hifi
Copy link
Collaborator

@hifi hifi commented Dec 15, 2023

We will never trust the order of anything anymore and always sort them on use when it matters. When it doesn't we can use the potentially unsorted iterator. Documentation for replica interface has been updated to match.

Some S3 implementations, like Storj, don't return objects in order unlike the real S3 API. It's against AWS documentation but they have their reasons not to pre-sort them.

Since there's only one place where the order matters and we're going to iterate all of them anyway and there's a sort implementation for a WAL segment slice we can do just that to add compatibility without any meaningful performance hit.

This also helps implementing new native replica implementations where sorting may not be available.

Fixes #535

@hifi hifi force-pushed the fix/unsorted-wal-segments branch from 73fbfc0 to 605dbab Compare December 15, 2023 08:59
@hifi hifi changed the title Always sort WAL segments on restore point calc Never expect the replica iterators to be sorted Dec 15, 2023
We will never trust the order of anything anymore and always sort
them on use when it matters. When it doesn't we can use the
potentially unsorted iterator. Documentation for replica interface
has been updated to match.

Some S3 implementations, like Storj, don't return objects in order
unlike the real S3 API. It's against AWS documentation but they
have their reasons not to pre-sort them.

Since there's only one place where the order matters and we're
going to iterate all of them anyway and there's a sort
implementation for a WAL segment slice we can do just that to
add compatibility without any meaningful performance hit.

This also helps implementing new native replica implementations
where sorting may not be available.

Fixes benbjohnson#535
@hifi hifi force-pushed the fix/unsorted-wal-segments branch from 605dbab to 9654c36 Compare December 18, 2023 11:25
@hifi hifi merged commit 0a7f6e9 into benbjohnson:main Dec 18, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Storj S3 restore Error: "cannot find max wal index for restore: missing initial wal segment:"
2 participants