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

ctlog: write pending tiles to protect against concurrent sequencers #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jellevandenhooff
Copy link
Owner

If two sequencers (somehow) end up running at the same time, they could scribble over each other's uploads to the backend storage.

Protect against that special case by writing the tiles in two steps. First, all tiles are staged in a unique pending directory (keyed by the hash of the new tree), and only copying them over to their final location after a successful lock update.

In the normal case, this will incur an extra copy and delete for every uploaded tile, doubling the number of write operations.

The copy code is simple but does introduce new requirements on the backend:

  • The backend must implement copy, list, and delete.
  • The copy must maintain the original headers.
  • The list must be read-after-write consistent. These properties should be true for S3.

To make sure that the (rare) recovery code path is well-tested, use the same code path in both the recovery and normal case.

A special IAM policy could allow deletes only of pending files.

If two sequencers (somehow) end up running at the same time, they
could scribble over each other's uploads to the backend storage.

Protect against that special case by writing the tiles in two steps. First, all
tiles are staged in a unique pending directory (keyed by the hash of the new
tree), and only copying them over to their final location after a successful
lock update.

In the normal case, this will incur an extra copy and delete for every uploaded
tile, doubling the number of write operations.

The copy code is simple but does introduce new requirements on the backend:
- The backend must implement copy, list, and delete.
- The copy must maintain the original headers.
- The list must be read-after-write consistent.
These properties should be true for S3.

To make sure that the (rare) recovery code path is well-tested, use the same
code path in both the recovery and normal case.

A special IAM policy could allow deletes only of pending files.
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.

1 participant