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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 12 additions & 16 deletions src/storage/src/table/state_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,7 @@ impl<S: StateStore> StateTableRowIter<S> {
.peekable();
pin_mut!(cell_based_table_iter);

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

loop {
match (
Expand All @@ -273,7 +271,7 @@ impl<S: StateStore> StateTableRowIter<S> {
yield Cow::Owned(row);
}
(None, Some(_)) => {
let row_op = mem_table_iter.next().unwrap()?.1;
let row_op = mem_table_iter.next().unwrap().1;
match row_op {
RowOp::Insert(row) | RowOp::Update((_, row)) => {
yield Cow::Borrowed(row);
Expand All @@ -284,7 +282,7 @@ impl<S: StateStore> StateTableRowIter<S> {

(
Some(Ok((cell_based_pk, cell_based_row))),
Some(Ok((mem_table_pk, _mem_table_row_op))),
Some((mem_table_pk, _mem_table_row_op)),
) => {
match cell_based_pk.cmp(mem_table_pk) {
Ordering::Less => {
Expand All @@ -296,7 +294,7 @@ impl<S: StateStore> StateTableRowIter<S> {
// mem_table_item will be return, while both cell_based_streaming_iter
// and mem_table_iter need to execute next()
// once.
let row_op = mem_table_iter.next().unwrap()?.1;
let row_op = mem_table_iter.next().unwrap().1;
match row_op {
RowOp::Insert(row) => yield Cow::Borrowed(row),
RowOp::Delete(_) => {}
Expand All @@ -309,7 +307,7 @@ impl<S: StateStore> StateTableRowIter<S> {
}
Ordering::Greater => {
// mem_table_item will be return
let row_op = mem_table_iter.next().unwrap()?.1;
let row_op = mem_table_iter.next().unwrap().1;
match row_op {
RowOp::Insert(row) => yield Cow::Borrowed(row),
RowOp::Delete(_) => {}
Expand All @@ -321,7 +319,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();

unreachable!()
}
Expand Down Expand Up @@ -353,9 +351,7 @@ impl<S: StateStore> StateTableRowIter<S> {
.peekable();
pin_mut!(cell_based_table_iter);

let mut mem_table_iter = mem_table_iter
.map(|(k, v)| Ok::<_, StorageError>((k, v)))
.peekable();
let mut mem_table_iter = mem_table_iter.peekable();
loop {
match (
cell_based_table_iter.as_mut().peek().await,
Expand All @@ -367,7 +363,7 @@ impl<S: StateStore> StateTableRowIter<S> {
yield Cow::Owned(row);
}
(None, Some(_)) => {
let (mem_table_pk, row_op) = mem_table_iter.next().unwrap()?;
let (mem_table_pk, row_op) = mem_table_iter.next().unwrap();

if mem_table_bounds.contains(mem_table_pk) {
match row_op {
Expand All @@ -381,7 +377,7 @@ impl<S: StateStore> StateTableRowIter<S> {

(
Some(Ok((cell_based_pk, cell_based_row))),
Some(Ok((mem_table_pk, _mem_table_row_op))),
Some((mem_table_pk, _mem_table_row_op)),
) => {
match cell_based_pk.cmp(mem_table_pk) {
Ordering::Less => {
Expand All @@ -393,7 +389,7 @@ impl<S: StateStore> StateTableRowIter<S> {
// mem_table_item will be return, while both
// and mem_table_iter need to execute
// once.
let (mem_table_pk, row_op) = mem_table_iter.next().unwrap()?;
let (mem_table_pk, row_op) = mem_table_iter.next().unwrap();
if mem_table_bounds.contains(mem_table_pk) {
match row_op {
RowOp::Insert(row) => yield Cow::Borrowed(row),
Expand All @@ -408,7 +404,7 @@ impl<S: StateStore> StateTableRowIter<S> {
}
Ordering::Greater => {
// mem_table_item will be return
let (mem_table_pk, row_op) = mem_table_iter.next().unwrap()?;
let (mem_table_pk, row_op) = mem_table_iter.next().unwrap();
if mem_table_bounds.contains(mem_table_pk) {
match row_op {
RowOp::Insert(row) => yield Cow::Borrowed(row),
Expand All @@ -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.😁


unreachable!()
}
Expand Down