Skip to content

Commit

Permalink
fix(meta): fix list changed log epoch retrun null epoch (#18273) (#18279
Browse files Browse the repository at this point in the history
)

Co-authored-by: Xinhao Xu <[email protected]>
  • Loading branch information
github-actions[bot] and xxhZs authored Aug 28, 2024
1 parent 07501ab commit d6bcb86
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
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

0 comments on commit d6bcb86

Please sign in to comment.