JingsongLi commented on code in PR #1525:
URL: https://github.com/apache/paimon-rust/pull/1525#discussion_r4690331244


##########
crates/paimon/src/table/table_commit.rs:
##########
@@ -1418,36 +1427,10 @@ impl TableCommit {
                 return Ok(CommitAttemptResult::Success(Box::new(snapshot)));
             }
             Ok(false) => {
-                if self.deletion_vectors_enabled && resolved.kind == 
CommitKind::COMPACT {
-                    // Only this attempt's generated DV files are definitely
-                    // unpublished. Prepared data/changelogs and old shared
-                    // containers still belong to the caller or prior 
snapshots.
-                    let created = created_files
-                        .iter()
-                        .map(String::as_str)
-                        .collect::<HashSet<_>>();
-                    for entry in resolved
-                        .new_index_manifest_entries
-                        .iter()
-                        .flatten()
-                        .filter(|entry| entry.index_file.index_type == 
DELETION_VECTORS_INDEX_TYPE)
-                    {
-                        let Ok(bucket) = self.bucket_path(&entry.partition, 
entry.bucket) else {
-                            continue;
-                        };
-                        let path = committed_index_file_path(
-                            self.table.location(),
-                            &bucket,
-                            self.table
-                                .schema()
-                                .core_options()
-                                .index_file_in_data_file_dir(),
-                            &entry.index_file,
-                        );
-                        if created.contains(path.as_str()) {
-                            let _ = 
self.table.file_io().delete_file(&path).await;
-                        }
-                    }
+                // Only payloads written for this attempt can be discarded.
+                // The retry still needs the caller's staged inputs.
+                for path in created_payloads {

Review Comment:
   **[P1] Verify the published snapshot before deleting replacement files**
   
   `Ok(false)` can come from a retry of our own successful conditional PUT. In 
a local OSS test, I made the first conditional PUT save the snapshot and return 
a retryable 503. The OpenDAL retry then received `409 FileAlreadyExists` for 
that same key. `overwrite_with_identifier` returned success after finding the 
published snapshot, but a scan failed with `NotFound` on its replacement 
Parquet file. This branch had already deleted the snapshot's data and index 
files. Before reclaiming the attempt's files, compare the published snapshot 
UUID with the attempt UUID. Preserve the files when they match or when 
publication remains uncertain.



-- 
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]

Reply via email to