-
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
Fixes the restart problem (i.e. rebuilding the datastore from the message log) #34
Conversation
pub fn rebuild_state_after_replay(&self) -> Result<(), DBError> { | ||
let mut inner = self.inner.lock(); | ||
|
||
// `build_missing_tables` must be called before indexes. |
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'd be fine with that if the very deep for loop bodies inside got factored out.
.unwrap() | ||
.insert_tables | ||
.get(table_id) | ||
.and_then(|tx_state| tx_state.insert_tables.get(table_id)) |
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 have mixed feelings about this pattern. I don't think the ability to reason about the state (tx_state is None or not, corresponding to being currently in a transaction or not) was great, but I think this also muddles it a little further. I don't think it's actionable now, but something that we could want to make clearer in the future.
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.
Yeah I hate this whole thing tbh, but I'm just trying to get it to build in time. :/
Some(RowOp::Absent) => { | ||
return Some(DataRef::new(row.clone())); | ||
} | ||
None => { |
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 is an example of my comment about what state we are in, now there's this extra None case in which you are supposed to do the same thing as when you see Some(Absent).
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.
Agreed.
…sage log) (#34) * Fixes the restart problem (i.e. rebuilding the datastore from the message log) * Remove logging
…sage log) (#34) * Fixes the restart problem (i.e. rebuilding the datastore from the message log) * Remove logging
Description of Changes
This makes it so that we appropriate rebuild in memory data structures from the message log after restarting the database.
I don't love the solution, but a general solution is really tricky and we're on a bit of a deadline.
API
If the API is breaking, please state below what will break