-
Notifications
You must be signed in to change notification settings - Fork 68
Switch to using byte offsets as LSNs #2541
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
Merged
Merged
Changes from 28 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
4e4d3ef
Add redo and is_shutdown to log_checkpoint
fabubaker d89cb57
Add ControlFileOps and NoControlFile
fabubaker 0b1ecbb
Remove new and load from WalOps
fabubaker 257ee27
Attach control_file to strategy structs
fabubaker 97d77b8
Expose control_file in PersistenceStrategy
fabubaker d84b5e2
Expose control_file in DurabilityOps
fabubaker 50fc86c
Move DurabilityOps out of mutation
fabubaker 166e895
Write to control file on drop
fabubaker 337023a
Add sketch of recovery
fabubaker 7569cac
Add read to WalOps
fabubaker 05faeb8
Add read_checkpoint
fabubaker 7eab0fc
Return DBState
fabubaker 8830b10
Remove wal rotate
fabubaker 7b8b949
Modify replay to take a start LSN
fabubaker f26bca2
Fix crash recovery with byte offsets
fabubaker 0fd0764
Remove replay_iter
fabubaker 3bece44
Run fmt
fabubaker 1082672
Rename next_lsn to position
fabubaker 875c688
Replace raw_bytes with next_lsn
fabubaker 0f15401
Remove stray print
fabubaker 5c6c6e8
Merge branch 'db_v4' of github.com:Pometry/Raphtory into db_v4_/lsn-b…
fabubaker 5372d75
Fix stray merge conflicts
fabubaker 1d8fdf2
Create graph folder in path.init()
fabubaker 83dea34
Run fmt
fabubaker 85b04fa
chore: apply tidy-public auto-fixes
github-actions[bot] 181b05b
Merge branch 'db_v4' of github.com:Pometry/Raphtory into db_v4_/lsn-b…
fabubaker 124389f
Simplify shutdown
fabubaker eeddacb
Merge branch 'db_v4' into db_v4_/lsn-byte-offsets
fabubaker f751224
Merge branch 'db_v4' of github.com:Pometry/Raphtory into db_v4_/lsn-b…
fabubaker beb02ae
Remove panic on Drop
fabubaker 051f80e
Update clam-core and optd
fabubaker d8ed166
Merge branch 'db_v4' into db_v4_/lsn-byte-offsets
fabubaker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,53 @@ | ||
| use crate::{error::StorageError, wal::LSN}; | ||
| use serde::{Deserialize, Serialize}; | ||
| use std::path::Path; | ||
|
|
||
| #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] | ||
| pub enum DBState { | ||
| Running, | ||
| Shutdown, | ||
| CrashRecovery, | ||
| NotSupported, | ||
| } | ||
|
|
||
| // Starting value for `last_checkpoint` in the control file. | ||
| pub const LAST_CHECKPOINT_INIT: LSN = 0; | ||
|
|
||
| pub trait ControlFileOps: Sized { | ||
| fn load(dir: &Path) -> Result<Self, StorageError>; | ||
|
|
||
| fn save(&self) -> Result<(), StorageError>; | ||
|
|
||
| fn db_state(&self) -> DBState; | ||
|
|
||
| fn last_checkpoint(&self) -> LSN; | ||
|
|
||
| fn set_db_state(&self, state: DBState); | ||
|
|
||
| fn set_checkpoint(&self, lsn: LSN); | ||
| } | ||
|
|
||
| #[derive(Debug, Clone)] | ||
| pub struct NoControlFile; | ||
|
|
||
| impl ControlFileOps for NoControlFile { | ||
| fn load(_dir: &Path) -> Result<Self, StorageError> { | ||
| Ok(NoControlFile) | ||
| } | ||
|
|
||
| fn save(&self) -> Result<(), StorageError> { | ||
| Ok(()) | ||
| } | ||
|
|
||
| fn db_state(&self) -> DBState { | ||
| DBState::NotSupported | ||
| } | ||
|
|
||
| fn last_checkpoint(&self) -> LSN { | ||
| 0 | ||
| } | ||
|
|
||
| fn set_db_state(&self, state: DBState) {} | ||
|
|
||
| fn set_checkpoint(&self, lsn: LSN) {} | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| pub mod config; | ||
| pub mod control_file; | ||
| pub mod strategy; |
This file contains hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no panics in drop, this should just be logged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the
expectcalls; errors are logged and the Drop returns immediately .