Noemi Pap-Takacs has posted comments on this change. ( 
https://gerrit.cloudera.org/25276 )

Change subject: IMPALA-15730: Fix DROP PARTITION truncating Iceberg tables
......................................................................


Patch Set 1:

(3 comments)

Thanks for working on this. I also found some related issues, already opened 
IMPALA-15483, but during the review, I was considering some others, some 
possible concurrency problems. I would appreciate your thoughts on them. Which 
ones do you think we should address here or open a separate Jira?

Not introduced in this change, but a concurrency problem in case of the 
TRUNCATE path: We decide to truncate based on the current snapshot but in 
IcebergCatalogOpExecutor (L339), the snapshot is not checked. A concurrent 
write could have already landed and this TRUNCATE does not take the new 
snapshot into consideration, removing everything from the latest snapshot (even 
the newly written files), which can lead to data loss.

We should either consider checking for concurrent updates/conflicts or let go 
of this truncate shortcut.


Also worth considering a concurrent (partial or total) compaction with the 
general, selective DROP PARTITION case:
As far as I understand, we do not check for missing files at commit time in the 
catalog. So it is possible that DROP PARTITION wants to remove the old file, 
but it is already rewritten by the other job and the new file keeps the rows 
that were intended to be removed. To be safe, we should delete files by path 
with validateFilesExist() in the catalog, so that it throws an exception that 
there is a conflict if the file is missing.

https://gerrit.cloudera.org/#/c/25276/1/fe/src/main/java/org/apache/impala/analysis/AlterTableDropPartitionStmt.java
File 
fe/src/main/java/org/apache/impala/analysis/AlterTableDropPartitionStmt.java:

https://gerrit.cloudera.org/#/c/25276/1/fe/src/main/java/org/apache/impala/analysis/AlterTableDropPartitionStmt.java@151
PS1, Line 151: if (icebergFilePaths_.size() == 
FeIcebergTable.Utils.getTotalNumberOfFiles(table,
             :           null)) {
nit: Currently because of IMPALA-15483, it is possible that the total will be 
higher than icebergFilePaths_.size() even if all partitions are selected 
because total counts the leftover delete files. In that case we lose the 
truncate shortcut. Fixing that first or comparing only the number of data files 
would avoid this problem.


https://gerrit.cloudera.org/#/c/25276/1/testdata/workloads/functional-query/queries/QueryTest/iceberg-drop-partition.test
File 
testdata/workloads/functional-query/queries/QueryTest/iceberg-drop-partition.test:

https://gerrit.cloudera.org/#/c/25276/1/testdata/workloads/functional-query/queries/QueryTest/iceberg-drop-partition.test@581
PS1, Line 581: The same for a table upgraded to format version 3
If we want to test DVs, you could delete from the table after it is upgraded to 
v3.


https://gerrit.cloudera.org/#/c/25276/1/testdata/workloads/functional-query/queries/QueryTest/iceberg-drop-partition.test@603
PS1, Line 603: with shared delete files
This test does not match the comment because there are no delete files in this 
table.



--
To view, visit https://gerrit.cloudera.org/25276
To unsubscribe, visit https://gerrit.cloudera.org/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I47dd166a468f1ae038c36e052cfe24fbb9932a3c
Gerrit-Change-Number: 25276
Gerrit-PatchSet: 1
Gerrit-Owner: Nandor Kollar <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Nandor Kollar <[email protected]>
Gerrit-Reviewer: Noemi Pap-Takacs <[email protected]>
Gerrit-Reviewer: Peter Rozsa <[email protected]>
Gerrit-Comment-Date: Mon, 09 Nov 2026 17:50:33 +0000
Gerrit-HasComments: Yes

Reply via email to