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: no need to expect mem table return Err #3071

Merged
merged 2 commits into from
Jun 10, 2022
Merged

Conversation

BowenXiao1999
Copy link
Contributor

@BowenXiao1999 BowenXiao1999 commented Jun 8, 2022

What's changed and what's your intention?

Ideas from:
#3068 (comment)

Memtable do not return Error, so no need to call .next()?.

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)

@BowenXiao1999 BowenXiao1999 changed the title fix: no need to anything for unreachable code fix: no need to expect mem table return Err Jun 8, 2022
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.

This would cause wrong result. We only peeked memtable without calling .next.

Better to rewrite this part with async_stream to make everything clear.

@BowenXiao1999 BowenXiao1999 enabled auto-merge (squash) June 8, 2022 09:32
@BowenXiao1999
Copy link
Contributor Author

BowenXiao1999 commented Jun 8, 2022

This would cause wrong result. We only peeked memtable without calling .next.

Better to rewrite this part with async_stream to make everything clear.

Actually it should return Error at (state_table.next()). If not(I cant imagine why), it will directly panic. So I guess It will not make the code malfunction.

@codecov
Copy link

codecov bot commented Jun 8, 2022

Codecov Report

Merging #3071 (6732f6b) into main (4ffe791) will decrease coverage by 0.09%.
The diff coverage is n/a.

❗ Current head 6732f6b differs from pull request most recent head ebe0086. Consider uploading reports for the commit ebe0086 to get more accurate results

@@            Coverage Diff             @@
##             main    #3071      +/-   ##
==========================================
- Coverage   73.62%   73.52%   -0.10%     
==========================================
  Files         736      732       -4     
  Lines      101467    99431    -2036     
==========================================
- Hits        74701    73106    -1595     
+ Misses      26766    26325     -441     
Flag Coverage Δ
rust 73.52% <ø> (-0.10%) ⬇️

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% <ø> (+1.18%) ⬆️
src/meta/src/hummock/compaction_group/mod.rs 55.55% <0.00%> (-38.89%) ⬇️
src/common/src/catalog/physical_table.rs 0.00% <0.00%> (-30.00%) ⬇️
src/frontend/src/planner/relation.rs 76.00% <0.00%> (-16.81%) ⬇️
src/expr/src/vector_op/bitwise_op.rs 91.93% <0.00%> (-8.07%) ⬇️
src/frontend/src/catalog/source_catalog.rs 60.86% <0.00%> (-7.56%) ⬇️
src/storage/src/hummock/state_store.rs 78.14% <0.00%> (-7.09%) ⬇️
src/expr/src/vector_op/cmp.rs 61.73% <0.00%> (-6.49%) ⬇️
src/expr/src/vector_op/cast.rs 59.88% <0.00%> (-6.15%) ⬇️
src/meta/src/stream/source_manager.rs 14.28% <0.00%> (-5.31%) ⬇️
... and 175 more

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

@BowenXiao1999
Copy link
Contributor Author

But indeed. This part logic looks strange

@BugenZhao
Copy link
Member

BugenZhao commented Jun 9, 2022

This would cause wrong result. We only peeked memtable without calling .next.

Better to rewrite this part with async_stream to make everything clear.

The match goes to this arm only if we peeked an error from cell_based_table_iter, so there should be no problem.

It may look strange because we cannot take the error out of the peeked reference. 😢

Signed-off-by: Bugen Zhao <i@bugenzhao.com>
@BugenZhao BugenZhao enabled auto-merge (squash) June 10, 2022 04:03
@BugenZhao BugenZhao merged commit 5eaf1b2 into main Jun 10, 2022
@BugenZhao BugenZhao deleted the bw/fix-unreachable branch June 10, 2022 04:18
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