Skip to content
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

Merged
merged 7 commits into from
Mar 22, 2023
Merged

Force value-only iteration in the public API #192

merged 7 commits into from
Mar 22, 2023

Conversation

arkpar
Copy link
Member

@arkpar arkpar commented Mar 20, 2023

  • Introduced iter_values which only iterates value tables sequentially
  • Tweaked check tool output to include more details for corruptions.

Copy link
Collaborator

@cheme cheme left a 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.

src/table.rs Outdated Show resolved Hide resolved
@@ -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.
Copy link
Collaborator

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?

Copy link
Member Author

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()] {
Copy link
Contributor

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},
Copy link
Contributor

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?

Copy link
Member Author

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.

@arkpar arkpar merged commit 443dff5 into master Mar 22, 2023
@arkpar arkpar deleted the arkpar/iter branch March 22, 2023 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants