JingsongLi commented on code in PR #1454:
URL: https://github.com/apache/paimon-rust/pull/1454#discussion_r4665405779
##########
crates/paimon/src/table/table_commit/auto_maintenance.rs:
##########
@@ -312,7 +319,79 @@ impl TableCommit {
{
return Ok(());
}
- let executor = builder.new_auto_executor()?;
+ let overwrite_l0 = if let Some(latest) = dv_snapshot {
+ let active =
crate::table::snapshot_manifest::read_snapshot_entries(
+ &compact.snapshot_manager,
+ latest,
+ None,
+ )
+ .await?;
+ let active = active
+ .iter()
+ .map(|entry| {
+ let partition = if
compact.table.schema().partition_keys().is_empty() {
+ EMPTY_SERIALIZED_ROW.as_slice()
+ } else {
+ entry.partition()
+ };
+ (
+ (
+ partition,
+ entry.bucket(),
+ entry.total_buckets(),
+ entry.file().file_name.as_str(),
+ ),
+ entry.file(),
+ )
+ })
+ .collect::<HashMap<_, _>>();
+ // Refresh DV masks and retained runs, suppressing changelogs
only
+ // for original L0 inputs whose complete metadata is still
active.
+ let mut files = OverwriteL0Files::new();
+ let mut buckets = CompactBuckets::new();
+ for task in plan.tasks() {
+ for file in task.files().iter().filter(|file| file.level
== 0) {
+ if active
+ .get(&(
+ task.partition(),
+ task.bucket(),
+ task.total_buckets(),
+ file.file_name.as_str(),
+ ))
+ .is_some_and(|current| *current == file)
+ {
+ files.insert((
+ task.partition().to_vec(),
+ task.bucket(),
+ file.file_name.clone(),
+ ));
+ buckets.insert((
+ task.partition().to_vec(),
+ task.bucket(),
+ task.total_buckets(),
+ ));
+ }
+ }
+ }
+ if files.is_empty() {
Review Comment:
[P1] Preserve lookup suppression when a normal append compacts first. I
published an OVERWRITE containing key 1 on a PK DV table with merge-on-read
enabled, then interrupted it before auto compaction. A reader bootstrapping at
that durable snapshot could already see key 1. A subsequent normal APPEND of
key 2 compacted both L0 inputs. Retrying the overwrite recovered successfully,
but a changelog scan from the overwrite snapshot returned +I for both keys,
replaying the already-visible key 1. The existing recovery tests leave the
later append pending with write-only=true. Please cover the ordinary writer too
and preserve the overwrite input's suppression through the competing compaction.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]