-
Notifications
You must be signed in to change notification settings - Fork 598
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(hummock): fix gc delete keys incorrectly #14751
Changes from 2 commits
8ac1f6c
1e76956
df590b5
5da8144
976eaef
d365ea2
a0ba181
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ use risingwave_common::util::sort_util::OrderType; | |
use risingwave_expr::window_function::{ | ||
create_window_state, StateKey, WindowFuncCall, WindowStates, | ||
}; | ||
use risingwave_storage::row_serde::row_serde_util::serialize_pk_with_vnode; | ||
use risingwave_storage::StateStore; | ||
|
||
use super::over_partition::{ | ||
|
@@ -324,7 +325,8 @@ impl<S: StateStore> OverWindowExecutor<S> { | |
} | ||
|
||
// `input pk` => `Record` | ||
let mut key_change_update_buffer = BTreeMap::new(); | ||
let mut key_change_update_buffer: BTreeMap<DefaultOrdered<OwnedRow>, Record<OwnedRow>> = | ||
BTreeMap::new(); | ||
let mut chunk_builder = | ||
StreamChunkBuilder::new(this.chunk_size, this.info.schema.data_types()); | ||
|
||
|
@@ -372,6 +374,9 @@ impl<S: StateStore> OverWindowExecutor<S> { | |
let pk = key.pk.clone(); | ||
let record = record.clone(); | ||
if let Some(existed) = key_change_update_buffer.remove(&key.pk) { | ||
let tp1 = existed.to_record_type(); | ||
let tp2 = record.to_record_type(); | ||
|
||
match (existed, record) { | ||
(Record::Insert { new_row }, Record::Delete { old_row }) | ||
| (Record::Delete { old_row }, Record::Insert { new_row }) => { | ||
|
@@ -382,7 +387,15 @@ impl<S: StateStore> OverWindowExecutor<S> { | |
yield chunk; | ||
} | ||
} | ||
_ => panic!("other cases should not exist"), | ||
_ => { | ||
let vnode = this.state_table.compute_vnode_by_pk(&key.pk); | ||
let raw_key = serialize_pk_with_vnode( | ||
&key.pk, | ||
this.state_table.pk_serde(), | ||
vnode, | ||
); | ||
panic!("other cases should not exist. raw_key: {:?}, existed: {:?}, new: {:?}", raw_key, tp1, tp2); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feeling a little bit weird to print raw table key in executor. But it looks acceptable for error avoidance. I would prefer to move the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix |
||
} | ||
} | ||
} else { | ||
key_change_update_buffer.insert(pk, record); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it expected ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is necessary to output content of wrong key in panic