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: the signature unmatch in async trait function #3068

Merged
merged 1 commit into from
Jun 8, 2022

Conversation

BowenXiao1999
Copy link
Contributor

@BowenXiao1999 BowenXiao1999 commented Jun 8, 2022

What's changed and what's your intention?

When we use state_table.iter() in a async trait function, it shows a confusing compiler error about signature mismatch. I think it's compiler's problem but I do not get too many evidence. I just removed the unnecessary closure mentioned in the error and it seems work.

@wcy-fdu can you please check that it fixs your problem? I have tested it on my version.

The compiler error looks like:
image

Because the .map looks unnecessary, so I just removed it.

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)

@github-actions github-actions bot added the type/fix Bug fix label Jun 8, 2022
@BowenXiao1999 BowenXiao1999 force-pushed the bw/fix-lifetime-iter branch 3 times, most recently from 79243aa to a78a9cc Compare June 8, 2022 08:56
@BowenXiao1999 BowenXiao1999 force-pushed the bw/fix-lifetime-iter branch from a78a9cc to ad9ec87 Compare June 8, 2022 08:58
@BowenXiao1999 BowenXiao1999 requested review from wcy-fdu, BugenZhao and skyzh and removed request for wcy-fdu June 8, 2022 09:04
Copy link
Contributor

@skyzh skyzh left a comment

Choose a reason for hiding this comment

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

let mut mem_table_iter = mem_table_iter
             .map(|(k, v)| Ok::<_, StorageError>((k, v)))
             .peekable();

Using the original impl can help implement this with async_stream. As we are not using async_stream for now, I'd be okay with this change.

Copy link
Member

@BugenZhao BugenZhao left a comment

Choose a reason for hiding this comment

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

Should wait for #3057 to be merged first?

@BowenXiao1999
Copy link
Contributor Author

I also provide a PR if you want to test locally #2999 : 2a7e515

@@ -422,7 +418,7 @@ impl<S: StateStore> StateTableRowIter<S> {
(Some(_), Some(_)) => {
// Throw the error.
cell_based_table_iter.next().await.unwrap()?;
mem_table_iter.next().unwrap()?;
mem_table_iter.next().unwrap();
Copy link
Member

Choose a reason for hiding this comment

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

We may remove this line since there's no error to throw for memtable iterator now. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's seperate problem so I submit another PR. #3071

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Emmm think for twice and I think you are right.. It should be done in this PR. anyway..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually previous it also can not be Error. It's always map with Ok.

Copy link
Member

Choose a reason for hiding this comment

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

Previously there’re some decoding stuff in the map body so it can be error. Seems this has changed.😁

Copy link
Contributor

@wcy-fdu wcy-fdu left a comment

Choose a reason for hiding this comment

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

This PR also works in my case!
Good Job!

@codecov
Copy link

codecov bot commented Jun 8, 2022

Codecov Report

Merging #3068 (ad9ec87) into main (f6da1a8) will decrease coverage by 0.00%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #3068      +/-   ##
==========================================
- Coverage   73.52%   73.52%   -0.01%     
==========================================
  Files         732      732              
  Lines       99433    99431       -2     
==========================================
- Hits        73106    73103       -3     
- Misses      26327    26328       +1     
Flag Coverage Δ
rust 73.52% <ø> (-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 87.97% <ø> (-0.16%) ⬇️
src/meta/src/model/barrier.rs 78.57% <0.00%> (-3.58%) ⬇️

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

@BowenXiao1999 BowenXiao1999 enabled auto-merge (squash) June 8, 2022 09:13
@BowenXiao1999 BowenXiao1999 merged commit 6706598 into main Jun 8, 2022
@BowenXiao1999 BowenXiao1999 deleted the bw/fix-lifetime-iter branch June 8, 2022 09:14
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.

4 participants