-
Notifications
You must be signed in to change notification settings - Fork 110
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
(2/3) Commitlog: Add I/O based on regular files #920
Conversation
/// visible to the iterator. Upon encountering [`io::ErrorKind::UnexpectedEof`], | ||
/// however, a new iterator should be created using [`Self::commits_from`] | ||
/// with the last transaction offset yielded. | ||
pub fn commits(&self) -> impl Iterator<Item = Result<Commit, error::Traversal>> { |
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.
slash-slash-todo: We're skipping bad commits in case the next commit is good. It's not obvious what to do when the iterator is exhausted and the last commit is bad -- there could be more coming at a later point in time. So for now, we'll yield the error.
This is fine in tooling, but requires special-casing when replaying the log to fold it into a datastore. Maybe a named iterator which can be turned into one which just ignores the error if it's the last item could be handy.
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.
I settled on yielding the error in iterators, but ignore it in folds (because the consumer of a fold doesn't have access to the traversal itself).
802f385
to
c518f99
Compare
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.
Looks great! This does exactly what I expected it to do based on the previous PR and the proposal. I suggested a few minor comments in fs.rs
.
c518f99
to
67c1884
Compare
67c1884
to
f22752a
Compare
f22752a
to
f1cd904
Compare
f1cd904
to
9e13cd5
Compare
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.
Nice and straightforward.
In the future it might be nice to try to run the existing tests against the file system Repo implementation as well. I don't think we need to do that right now though.
use super::Repo; | ||
|
||
const SEGMENT_FILE_EXT: &str = ".stdb.log"; | ||
|
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.
.log
extension could be confused easily as being text-based, how about .log.stdb
or .stdb.wbl
(write behind log)
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.
This file extension was requested by @Centril. If we don’t like it, an amendment to the spec shall be proposed.
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.
.log is pretty standard. I think it's the same for kafka IIRC.
9e13cd5
to
d4e4dc5
Compare
d4e4dc5
to
a7f8dfd
Compare
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.
Seems fine given the previous PR.
ecdb130
to
03a645e
Compare
5f6b3e3
to
f2e3f7d
Compare
Provides a commitlog backing store based on files, and defines the exported `Commitlog` type which fixes the store to the file-based one.
Provides a commitlog backing store based on files, and defines the exported
Commitlog
type which fixes the store to the file-based one.NOTE: This PR is stacked on top of #919
Expected complexity level and risk
1