-
Notifications
You must be signed in to change notification settings - Fork 61
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
Force value-only iteration in the public API #192
Conversation
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 good to me, IIRC the value only iterator is not exposed, maybe could be part of check command.
@@ -440,6 +442,11 @@ impl ValueTable { | |||
return Ok((0, false)) | |||
} | |||
|
|||
if self.multipart && part == 0 && !buf.is_multihead() { | |||
// This may only happen during value iteration. |
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.
Maybe a warning here? or returning Corrupted?
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.
It is not exacly a corruption. Previsouly the table did not care if multipart
entry is a single entry. The way it is used in column.rs however would not allow that. Perhaps there needs to be a check that disallows inserting small values in multipart tables. I'll leave for another PR though.
src/column.rs
Outdated
pub fn iter_while(&self, log: &Log, mut f: impl FnMut(IterState) -> bool) -> Result<()> { | ||
pub fn iter_values(&self, log: &Log, mut f: impl FnMut(ValueIterState) -> bool) -> Result<()> { | ||
let tables = self.tables.read(); | ||
for table in &tables.value[..tables.value.len()] { |
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.
Nit: Might be just for table in &tables.value
. I believe tables.value
is a vec
@@ -20,7 +20,7 @@ | |||
|
|||
use crate::{ | |||
btree::{commit_overlay::BTreeChangeSet, BTreeIterator, BTreeTable}, | |||
column::{hash_key, ColId, Column, IterState, ReindexBatch}, | |||
column::{hash_key, ColId, Column, IterState, ReindexBatch, ValueIterState}, |
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.
Shoudn't we make ValueIterState
pub
in src/lib.rs
to allow its usage from other crates?
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.
Good point, even though public types from private modules are allowed to be leaked. They can be used but can't be named. I've aded it to public exports anyway.
iter_values
which only iterates value tables sequentiallycheck
tool output to include more details for corruptions.