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

fix: iter only need the pk prefix reference instead of ownership #3126

Merged
merged 3 commits into from
Jun 10, 2022

Conversation

BowenXiao1999
Copy link
Contributor

@BowenXiao1999 BowenXiao1999 commented Jun 10, 2022

What's changed and what's your intention?

As title

Checklist

  • I have written necessary docs and comments
  • I have added necessary unit tests and integration tests
  • All checks passed in ./risedev check (or alias, ./risedev c)

Refer to a related PR or issue link (optional)

@codecov
Copy link

codecov bot commented Jun 10, 2022

Codecov Report

Merging #3126 (f6e9d8e) into main (b23ce00) will decrease coverage by 0.00%.
The diff coverage is 67.74%.

@@            Coverage Diff             @@
##             main    #3126      +/-   ##
==========================================
- Coverage   73.64%   73.64%   -0.01%     
==========================================
  Files         736      736              
  Lines      101570   101581      +11     
==========================================
+ Hits        74805    74809       +4     
- Misses      26765    26772       +7     
Flag Coverage Δ
rust 73.64% <67.74%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/storage/src/table/state_table.rs 81.76% <66.66%> (-5.03%) ⬇️
src/storage/src/table/test_relational_table.rs 98.22% <100.00%> (ø)
src/storage/src/hummock/local_version_manager.rs 84.28% <0.00%> (+0.15%) ⬆️
src/meta/src/barrier/mod.rs 69.45% <0.00%> (+0.32%) ⬆️
src/meta/src/hummock/mock_hummock_meta_client.rs 43.47% <0.00%> (+1.08%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

Comment on lines +231 to +240
let cell_based_bounds = (Unbounded, Unbounded);
let mem_table_bounds: (Bound<Vec<u8>>, Bound<Vec<u8>>) = (Unbounded, Unbounded);
let mem_table_iter = self.mem_table.buffer.range(mem_table_bounds);
Ok(StateTableRowIter::into_stream(
&self.keyspace,
self.column_descs.clone(),
mem_table_iter,
cell_based_bounds,
epoch,
))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I can not reuse self.iter(epoch). may be a bug of compiler

@BowenXiao1999 BowenXiao1999 merged commit 77f0339 into main Jun 10, 2022
@BowenXiao1999 BowenXiao1999 deleted the bw/fix-state-table-iter-API branch June 10, 2022 07:47
@@ -203,33 +203,46 @@ impl<S: StateStore> StateTable<S> {
/// This function scans rows from the relational table with specific `pk_prefix`.
pub async fn iter_with_pk_prefix(
&self,
pk_prefix: Row,
pk_prefix: Option<&Row>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When will the pk_prefix be None? Can we just reuse iter? 😁

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it's exactly self.iter(), I just copy the code. But seems like we can not simply write self.iter() due to some compiler problems (Checked this with @skyzh before).

BTW StateTableRowIter seems needs some refactor, it may need to expose lifetime. Or we should just simply remove it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants