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(meta): fix list changed log epoch retrun null epoch (#18273) #18279

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/frontend/src/session/cursor_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ impl SubscriptionCursor {
&mut chunk_stream,
formats,
&from_snapshot,
&self.fields,
&fields,
handle_args.session.clone(),
);

Expand Down
2 changes: 1 addition & 1 deletion src/meta/src/hummock/manager/versioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ impl HummockManager {
.get(&TableId::new(table_id))
{
let table_change_log = table_change_log.clone();
table_change_log.get_epochs(min_epoch, max_count as usize)
table_change_log.get_non_empty_epochs(min_epoch, max_count as usize)
} else {
vec![]
}
Expand Down
9 changes: 8 additions & 1 deletion src/storage/hummock_sdk/src/change_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,16 @@ impl TableChangeLog {
&self.0[start..end]
}

pub fn get_epochs(&self, min_epoch: u64, max_count: usize) -> Vec<u64> {
/// Returns epochs where value is non-null and >= `min_epoch`.
pub fn get_non_empty_epochs(&self, min_epoch: u64, max_count: usize) -> Vec<u64> {
self.filter_epoch((min_epoch, u64::MAX))
.iter()
.filter(|epoch_change_log| {
// Filter out empty change logs
let new_value_empty = epoch_change_log.new_value.is_empty();
let old_value_empty = epoch_change_log.old_value.is_empty();
!new_value_empty || !old_value_empty
})
.flat_map(|epoch_change_log| epoch_change_log.epochs.iter().cloned())
.filter(|a| a >= &min_epoch)
.clone()
Expand Down
Loading