Skip to content

Commit 7242904

Browse files
make ICT only work if it is the first row in a commit
1 parent cb6afe1 commit 7242904

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

kernel/src/table_changes/log_replay.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl LogReplayScanner {
164164
let mut add_paths = HashSet::default();
165165
let mut has_cdc_action = false;
166166
let mut timestamp = commit_file.location.last_modified;
167-
for actions in action_iter {
167+
for (i, actions) in action_iter.enumerate() {
168168
let actions = actions?;
169169

170170
let mut visitor = PreparePhaseVisitor {
@@ -174,6 +174,7 @@ impl LogReplayScanner {
174174
commit_timestamp: &mut timestamp,
175175
protocol: None,
176176
metadata_info: None,
177+
is_first_batch: i == 0,
177178
};
178179
visitor.visit_rows_of(actions.as_ref())?;
179180

@@ -276,6 +277,7 @@ struct PreparePhaseVisitor<'a> {
276277
add_paths: &'a mut HashSet<String>,
277278
remove_dvs: &'a mut HashMap<String, DvInfo>,
278279
commit_timestamp: &'a mut i64,
280+
is_first_batch: bool,
279281
}
280282
impl PreparePhaseVisitor<'_> {
281283
fn schema() -> Arc<StructType> {
@@ -362,7 +364,9 @@ impl RowVisitor for PreparePhaseVisitor<'_> {
362364
} else if let Some(timestamp) =
363365
getters[16].get_long(i, "commitInfo.inCommitTimestamp")?
364366
{
365-
*self.commit_timestamp = timestamp;
367+
if self.is_first_batch && i == 0 {
368+
*self.commit_timestamp = timestamp;
369+
}
366370
}
367371
}
368372
Ok(())

kernel/src/table_changes/scan_file.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,8 @@ mod tests {
327327
.await;
328328
mock_table
329329
.commit([
330-
Action::Cdc(cdc.clone()),
331330
Action::CommitInfo(commit_info.clone()),
331+
Action::Cdc(cdc.clone()),
332332
])
333333
.await;
334334
mock_table

0 commit comments

Comments
 (0)