hubgeter opened a new pull request, #61112:
URL: https://github.com/apache/doris/pull/61112

   ### What problem does this PR solve?
   Related PR: #56413
   Problem Summary:
   fix iceberg `rewrite_data_file` fail when table had been updated.
   
   Reproduction steps:
   spark-sql:
   ```
   create table if not exists test_rewrite_data_with_update (
     id INT,name STRING )
   USING iceberg
   TBLPROPERTIES (
     'format-version' = '2','write.delete.mode' = 'merge-on-read',
     'write.update.mode' = 'merge-on-read','write.merge.mode' = 'merge-on-read'
   );
   INSERT INTO test_rewrite_data_with_update VALUES
   (1, 'a'),(2, 'b'),(3, 'c');
   update test_rewrite_data_with_update set name = "bb"  where id = 1;
   ```
   then  doris:
   ```
   mysql>         ALTER TABLE test_rewrite_data_with_update
       ->         EXECUTE rewrite_data_files(
       ->             "target-file-size-bytes" = "10485760",
       ->             "min-input-files" = "1"
       ->         );
   ```
   Error: 
   ```
   2026-03-06 16:59:08,524 WARN (mysql-nio-pool-0|204) 
[IcebergRewriteDataFilesAction.executeAction():199] Failed to rewrite data 
files for table: test_rewrite_data_with_update
   java.lang.RuntimeException: 
org.apache.iceberg.exceptions.ValidationException: Cannot commit, found new 
delete for replaced data file: GenericDataFile{content=data, 
file_path=s3a://warehouse/wh/test_db/test_rewrite_data_with_update/data/d3b4489712ef4f52-aa754e4142723ff8_fddbaa4c-d5cd-4443-ab84-e2041608ad36-0.zstd.parquet,
 file_format=PARQUET, spec_id=0, partition=PartitionData{}, record_count=1, 
file_size_in_bytes=1451, column_sizes=null, value_counts=null, 
null_value_counts=null, nan_value_counts=null, lower_bounds=null, 
upper_bounds=null, key_metadata=null, split_offsets=null, equality_ids=null, 
sort_order_id=0, data_sequence_number=3, file_sequence_number=3, 
first_row_id=null, referenced_data_file=null, content_offset=null, 
content_size_in_bytes=null}
           at 
org.apache.doris.datasource.iceberg.IcebergTransaction.finishRewrite(IcebergTransaction.java:163)
           at 
org.apache.doris.datasource.iceberg.rewrite.RewriteDataFileExecutor.executeGroupsConcurrently(RewriteDataFileExecutor.java:107)
           at 
org.apache.doris.datasource.iceberg.action.IcebergRewriteDataFilesAction.executeAction(IcebergRewriteDataFilesAction.java:196)
           at 
org.apache.doris.nereids.trees.plans.commands.execute.BaseExecuteAction.execute(BaseExecuteAction.java:102)
           at 
org.apache.doris.nereids.trees.plans.commands.ExecuteActionCommand.run(ExecuteActionCommand.java:107)
           at 
org.apache.doris.qe.StmtExecutor.executeByNereids(StmtExecutor.java:678)
           at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:541)
           at org.apache.doris.qe.StmtExecutor.queryRetry(StmtExecutor.java:500)
           at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:485)
           at 
org.apache.doris.qe.ConnectProcessor.executeQuery(ConnectProcessor.java:311)
           at 
org.apache.doris.qe.ConnectProcessor.handleQuery(ConnectProcessor.java:198)
           at 
org.apache.doris.qe.MysqlConnectProcessor.handleQuery(MysqlConnectProcessor.java:231)
           at 
org.apache.doris.qe.MysqlConnectProcessor.dispatch(MysqlConnectProcessor.java:259)
           at 
org.apache.doris.qe.MysqlConnectProcessor.processOnce(MysqlConnectProcessor.java:403)
           at 
org.apache.doris.mysql.ReadListener.lambda$handleEvent$0(ReadListener.java:52)
           at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
           at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
           at java.base/java.lang.Thread.run(Thread.java:840)
   Caused by: org.apache.iceberg.exceptions.ValidationException: Cannot commit, 
found new delete for replaced data file: GenericDataFile{content=data, 
file_path=s3a://warehouse/wh/test_db/test_rewrite_data_with_update/data/d3b4489712ef4f52-aa754e4142723ff8_fddbaa4c-d5cd-4443-ab84-e2041608ad36-0.zstd.parquet,
 file_format=PARQUET, spec_id=0, partition=PartitionData{}, record_count=1, 
file_size_in_bytes=1451, column_sizes=null, value_counts=null, 
null_value_counts=null, nan_value_counts=null, lower_bounds=null, 
upper_bounds=null, key_metadata=null, split_offsets=null, equality_ids=null, 
sort_order_id=0, data_sequence_number=3, file_sequence_number=3, 
first_row_id=null, referenced_data_file=null, content_offset=null, 
content_size_in_bytes=null}
           at 
org.apache.iceberg.exceptions.ValidationException.check(ValidationException.java:49)
           at 
org.apache.iceberg.MergingSnapshotProducer.validateNoNewDeletesForDataFiles(MergingSnapshotProducer.java:530)
           at 
org.apache.iceberg.MergingSnapshotProducer.validateNoNewDeletesForDataFiles(MergingSnapshotProducer.java:462)
           at 
org.apache.iceberg.BaseRewriteFiles.validate(BaseRewriteFiles.java:140)
           at 
org.apache.iceberg.SnapshotProducer.apply(SnapshotProducer.java:260)
           at 
org.apache.iceberg.SnapshotProducer.lambda$commit$2(SnapshotProducer.java:439)
           at 
org.apache.iceberg.util.Tasks$Builder.runTaskWithRetry(Tasks.java:413)
           at 
org.apache.iceberg.util.Tasks$Builder.runSingleThreaded(Tasks.java:219)
           at org.apache.iceberg.util.Tasks$Builder.run(Tasks.java:203)
           at org.apache.iceberg.util.Tasks$Builder.run(Tasks.java:196)
           at 
org.apache.iceberg.SnapshotProducer.commit(SnapshotProducer.java:437)
           at 
org.apache.doris.datasource.iceberg.IcebergTransaction.updateManifestAfterRewrite(IcebergTransaction.java:213)
           at 
org.apache.doris.datasource.iceberg.IcebergTransaction.lambda$finishRewrite$3(IcebergTransaction.java:158)
           at 
org.apache.doris.common.security.authentication.ExecutionAuthenticator.execute(ExecutionAuthenticator.java:44)
           at 
org.apache.doris.datasource.iceberg.IcebergTransaction.finishRewrite(IcebergTransaction.java:157)
           ... 17 more
   ```
   
   
   ### Release note
   fix iceberg rewrite_data_file fail when table had been updated.
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [x] Regression test
       - [ ] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason <!-- Add your reason?  -->
   
   - Behavior changed:
       - [x] No.
       - [ ] Yes. <!-- Explain the behavior change -->
   
   - Does this need documentation?
       - [x] No.
       - [ ] Yes. <!-- Add document PR link here. eg: 
https://github.com/apache/doris-website/pull/1214 -->
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label <!-- Add branch pick label that this PR should 
merge into -->
   
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to