-
Notifications
You must be signed in to change notification settings - Fork 643
feat(hash agg): do state cleaning by watermarks in hash agg #6330
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
Changes from all commits
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 |
---|---|---|
|
@@ -396,13 +396,17 @@ impl<K: HashKey, S: StateStore> HashAggExecutor<K, S> { | |
ref total_lookup_count, | ||
ref metrics, | ||
ref chunk_size, | ||
buffered_watermarks: ref _buffered_watermarks, | ||
ref buffered_watermarks, | ||
.. | ||
}: &'a mut HashAggExecutorExtra<K, S>, | ||
agg_groups: &'a mut AggGroupMap<K, S>, | ||
epoch: EpochPair, | ||
) { | ||
// TODO("https://github.com/risingwavelabs/risingwave/issues/6112"): use buffered_watermarks[0] do some state cleaning | ||
let state_clean_watermark = buffered_watermarks | ||
.first() | ||
.and_then(|opt_watermark| opt_watermark.as_ref()) | ||
.map(|watermark| watermark.val.clone()); | ||
|
||
let actor_id_str = ctx.id.to_string(); | ||
metrics | ||
.agg_lookup_miss_count | ||
|
@@ -483,10 +487,16 @@ impl<K: HashKey, S: StateStore> HashAggExecutor<K, S> { | |
} | ||
|
||
// Commit all state tables. | ||
futures::future::try_join_all( | ||
iter_table_storage(storages).map(|state_table| state_table.commit(epoch)), | ||
) | ||
futures::future::try_join_all(iter_table_storage(storages).map(|state_table| async { | ||
if let Some(watermark) = state_clean_watermark.as_ref() { | ||
state_table.update_watermark(watermark.clone()) | ||
}; | ||
state_table.commit(epoch).await | ||
})) | ||
.await?; | ||
if let Some(watermark) = state_clean_watermark.as_ref() { | ||
result_table.update_watermark(watermark.clone()); | ||
}; | ||
result_table.commit(epoch).await?; | ||
|
||
// Evict cache to target capacity. | ||
|
@@ -495,8 +505,14 @@ impl<K: HashKey, S: StateStore> HashAggExecutor<K, S> { | |
// Nothing to flush. | ||
// Call commit on state table to increment the epoch. | ||
iter_table_storage(storages).for_each(|state_table| { | ||
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. I think this can only apply on 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.
why? register state table also starts with group key |
||
if let Some(watermark) = state_clean_watermark.as_ref() { | ||
state_table.update_watermark(watermark.clone()) | ||
}; | ||
state_table.commit_no_data_expected(epoch); | ||
}); | ||
if let Some(watermark) = state_clean_watermark.as_ref() { | ||
result_table.update_watermark(watermark.clone()); | ||
}; | ||
result_table.commit_no_data_expected(epoch); | ||
return Ok(()); | ||
} | ||
|
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.
ditto