-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce initial snapshot chunking (#2119)
This PR changes the way we write snapshots to disk, the storage API to request them, and some logic around offsets. 1. The `Storage.get_snapshot/1` method is gone. It's now unified under `Storage.get_log_stream/3`, with some caveats. 2. The offsets within the snapshot rows are not updated, so now latest item on the sent log may have mismatching `offset` field to the `electric-offset` header of the same response. All our clients respect the header, and that's the only correct behaviour going forward. There is a decision to remove `offset` from our items entirely, but that's a separate PR. 3. While we're making the snapshot, we cannot know how many chunks are going to be there until we make them. Thus we allow clients to request any chunks up to `LogOffset.new(0, :infinity)`, and consider all offsets at txn 0 to be virtual pointers. 4. The `get_log_stream/3` for the snapshot section ignores the contract a little bit - you cannot request the stream to be up to an arbitrary point, it's always up to the chunk boundary, even when specified otherwise. Since we've moved to "pure" chunking behaviour, it should be enshrined in the `Storage` interface so that reading functions can act optimally and honestly. I'm hoping to address that in a separate PR 5. If the instance is started with the old snapshot already created, we update the naming and metadata to avoid recreating shapes if we can avoid it.
- Loading branch information
1 parent
4b1680a
commit 6ca47df
Showing
27 changed files
with
720 additions
and
443 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@core/sync-service": patch | ||
--- | ||
|
||
feat: introduce chunked snapshot generation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.