You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "lengkristy (via GitHub)" <gi...@apache.org> on 2023/09/25 10:02:21 UTC

[GitHub] [iceberg] lengkristy opened a new issue, #8636: Update table failed due to concurrent modifications

lengkristy opened a new issue, #8636:
URL: https://github.com/apache/iceberg/issues/8636

   ### Query engine
   
   java SDK API
   
   code:
   
   package com.harman.iceberg;
   
   import com.amazonaws.services.lambda.runtime.LambdaLogger;
   import com.harman.ProcessKinesisRecords;
   import com.harman.conf.LambdaConfig;
   import com.harman.model.PipelineData;
   import com.harman.util.ExceptionUtil;
   import org.apache.iceberg.AppendFiles;
   import org.apache.iceberg.FileFormat;
   import org.apache.iceberg.PartitionKey;
   import org.apache.iceberg.Table;
   import org.apache.iceberg.aws.glue.GlueCatalog;
   import org.apache.iceberg.catalog.Catalog;
   import org.apache.iceberg.catalog.TableIdentifier;
   import org.apache.iceberg.data.GenericAppenderFactory;
   import org.apache.iceberg.data.InternalRecordWrapper;
   import org.apache.iceberg.data.Record;
   import org.apache.iceberg.io.OutputFileFactory;
   import org.apache.iceberg.io.PartitionedFanoutWriter;
   
   import java.util.*;
   
   public class IcebergWriter {
   
       //lambda config
       private LambdaConfig lambdaConfig;
   
       private LambdaLogger logger = null;
   
       private Random random = new Random();
   
       private final static Long TARGET_FILE_SIZE_IN_BYTES = 1000000L;
   
       private final static String CATALOG = "glue_catalog";
   
       private Table table = null;
   
       public IcebergWriter(LambdaConfig lambdaConfig, LambdaLogger logger) {
           this.lambdaConfig = lambdaConfig;
           this.logger = logger;
       }
   
       //save to iceberg
       public void save(List<PipelineData> records) throws Exception {
           if (records == null || records.size() == 0) {
               return;
           }
           //init table
           Table table = null;
           GenericAppenderFactory appenderFactory = null;
           OutputFileFactory outputFileFactory = null;
           try {
               table = loadTable();
               appenderFactory = new GenericAppenderFactory(table.schema());
               int partitionId = 1 + random.nextInt(1000);
               long taskId = System.currentTimeMillis();
               outputFileFactory = OutputFileFactory.builderFor(table, partitionId, taskId).format(FileFormat.PARQUET).build();
           } catch (Exception e) {
               System.out.println("get table error:" + e.getMessage() + ExceptionUtil.convertStackToString(e));
               if (logger != null) {
                   logger.log("can not init iceberg table :");
                   logger.log(ExceptionUtil.convertStackToString(e));
               }
               throw e;
           }
   
           //write data
           PartitionedFanoutWriter<Record> partitionedFanoutWriter = null;
           try {
               PartitionKey partitionKey = new PartitionKey(table.spec(), table.spec().schema());
               InternalRecordWrapper recordWrapper = new InternalRecordWrapper(table.schema().asStruct());
               // partitionedFanoutWriter will auto partitioned record and create the partitioned writer
               partitionedFanoutWriter = new PartitionedFanoutWriter<Record>(table.spec(), FileFormat.PARQUET, appenderFactory, outputFileFactory, table.io(), TARGET_FILE_SIZE_IN_BYTES) {
                   @Override
                   protected PartitionKey partition(Record record) {
                       try {
                           partitionKey.partition(recordWrapper.wrap(record));
                       }catch (Exception e){
                           System.out.println("write partition data error:" + e.getMessage() + ExceptionUtil.convertStackToString(e));
                       }
                       return partitionKey;
                   }
               };
               for (PipelineData data : records) {
                   try {
                       if (data.getRecord() != null)
                           partitionedFanoutWriter.write(data.getRecord());
                   } catch (Exception e) {
                       System.out.println("write data error:" + e.getMessage() + ExceptionUtil.convertStackToString(e));
                       if (logger != null) {
                           logger.log("can not write iceberg table :" + data.getRecord().toString());
                           logger.log(ExceptionUtil.convertStackToString(e));
                           //record the data
                           logger.log(records.toString());
                       }
                       ProcessKinesisRecords.errRecords.add(data);
                   }
               }
           } catch (Exception e) {
               //
               System.out.println("write data error:" + e.getMessage() + ExceptionUtil.convertStackToString(e));
               if (logger != null) {
                   logger.log("can not write data to iceberg table:");
                   logger.log(ExceptionUtil.convertStackToString(e));
               }
               throw e;
           }finally {
               if (partitionedFanoutWriter != null){
                   partitionedFanoutWriter.close();
               }
           }
   
           //commit data
           try {
               System.out.println("start commit file,file size:" + partitionedFanoutWriter.dataFiles()[0].recordCount());
               AppendFiles appendFiles = table.newAppend();
               // submit datafiles to the table
               Arrays.stream(partitionedFanoutWriter.dataFiles()).forEach(appendFiles::appendFile);
               // submit snapshot
               appendFiles.apply();
               appendFiles.commit();
               table.rewriteManifests();
               System.out.println("committed file");
           } catch (Throwable e) {
               if (logger != null) {
                   logger.log("ERROR: can not commit data to iceberg table:" + e.getMessage());
               }
               System.out.println("can not commit");
               ProcessKinesisRecords.errRecords.addAll(records);
               e.printStackTrace();
               throw e;
           }
       }
   
       public synchronized Table loadTable() {
           if (this.table == null) {
               Catalog catalog = null;
               //init table
               Table table = null;
               try {
                   if (CATALOG.equalsIgnoreCase(this.lambdaConfig.getCatalogName()))
                       catalog = new GlueCatalog();
                   if (catalog == null)
                       return null;
                   Map<String, String> properties = new HashMap<String, String>();
                   properties.put("warehouse", this.lambdaConfig.getWarehouseLocation());
                   properties.put("lock-impl","org.apache.iceberg.aws.dynamodb.DynamoDbLockManager");
                   properties.put("lock.table","ota_fact");
                   catalog.initialize(this.lambdaConfig.getCatalogName(), properties);
                   TableIdentifier name = TableIdentifier.of(this.lambdaConfig.getDbName(), this.lambdaConfig.getFactTableName());
                   table = catalog.loadTable(name);
               } catch (Exception e) {
                   throw e;
               }
               this.table = table;
           }
           return this.table;
       }
   }
   
   
   ### Question
   
   I use aws lambda concurrent write iceberg by java SDK, the data is from kinesis, and total 4 concurrent, and I used the dynamodb lock.
   but I get some error:
   1. Caused by: software.amazon.awssdk.services.glue.model.ConcurrentModificationException: Update table failed due to concurrent modifications. (Service: Glue, Status Code: 400, Request ID: 2de439bb-065b-4fb0-84f7-0079e1073f3b)
   ![image](https://github.com/apache/iceberg/assets/37865070/c2b4fcf2-2220-45e0-ac6f-1989865a0ab5)
   
   2.org.apache.iceberg.exceptions.CommitFailedException: Cannot commit glue_catalog.gu_iot_dev_eu_one_platform_result_9b02b87.fact_ota_data because base metadata location 's3://s3-iot-dev-eu-analytics-result-eu-west-1-7c87510/fact_ota_data/metadata/01974-48d83c2d-5e87-493f-a738-e38d4b2e0f3c.metadata.json' is not same as the current Glue location 's3://s3-iot-dev-eu-analytics-result-eu-west-1-7c87510/fact_ota_data/metadata/01975-f7e5d86f-a1e4-4316-9705-02ec4bb7145d.metadata.json
   ![image](https://github.com/apache/iceberg/assets/37865070/951031ba-486d-4c6a-ac59-0166fe012263)
   
   


-- 
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: issues-unsubscribe@iceberg.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] lengkristy commented on issue #8636: Update table failed due to concurrent modifications

Posted by "lengkristy (via GitHub)" <gi...@apache.org>.
lengkristy commented on issue #8636:
URL: https://github.com/apache/iceberg/issues/8636#issuecomment-1734696190

   @nastra Sure, this is gradle dependencies:
   
   implementation 'org.apache.iceberg:iceberg-core:1.3.1'
       implementation 'org.apache.iceberg:iceberg-parquet:1.3.1'
       implementation 'org.apache.iceberg:iceberg-data:1.3.1'
       implementation 'org.apache.iceberg:iceberg-hive-runtime:1.3.1'
       implementation ('org.apache.hadoop:hadoop-aws:3.3.0'){
           exclude(group:'com.amazonaws',module: 'aws-java-sdk-bundle')
       }
       implementation 'org.apache.hadoop:hadoop-common:3.3.0'
       implementation 'software.amazon.awssdk:s3:2.20.131'
       implementation 'software.amazon.awssdk:glue:2.17.122'
       implementation 'software.amazon.awssdk:sts:2.17.122'
       implementation 'software.amazon.awssdk:dynamodb:2.17.122'
   
   and write iceberg table data with 4 concurrent:
   
   below code:
   //write data
           PartitionedFanoutWriter<Record> partitionedFanoutWriter = null;
           try {
               PartitionKey partitionKey = new PartitionKey(table.spec(), table.spec().schema());
               InternalRecordWrapper recordWrapper = new InternalRecordWrapper(table.schema().asStruct());
               // partitionedFanoutWriter will auto partitioned record and create the partitioned writer
               partitionedFanoutWriter = new PartitionedFanoutWriter<Record>(table.spec(), FileFormat.PARQUET, appenderFactory, outputFileFactory, table.io(), TARGET_FILE_SIZE_IN_BYTES) {
                   @Override
                   protected PartitionKey partition(Record record) {
                       try {
                           partitionKey.partition(recordWrapper.wrap(record));
                       }catch (Exception e){
                           System.out.println("write partition data error:" + e.getMessage() + ExceptionUtil.convertStackToString(e));
                       }
                       return partitionKey;
                   }
               };
               for (PipelineData data : records) {
                   try {
                       if (data.getRecord() != null)
                           partitionedFanoutWriter.write(data.getRecord());
                   } catch (Exception e) {
                       System.out.println("write data error:" + e.getMessage() + ExceptionUtil.convertStackToString(e));
                       if (logger != null) {
                           logger.log("can not write iceberg table :" + data.getRecord().toString());
                           logger.log(ExceptionUtil.convertStackToString(e));
                           //record the data
                           logger.log(records.toString());
                       }
                       ProcessKinesisRecords.errRecords.add(data);
                   }
               }
           } catch (Exception e) {
               //
               System.out.println("write data error:" + e.getMessage() + ExceptionUtil.convertStackToString(e));
               if (logger != null) {
                   logger.log("can not write data to iceberg table:");
                   logger.log(ExceptionUtil.convertStackToString(e));
               }
               throw e;
           }finally {
               if (partitionedFanoutWriter != null){
                   partitionedFanoutWriter.close();
               }
           }
   
           //commit data
           try {
               System.out.println("start commit file,file size:" + partitionedFanoutWriter.dataFiles()[0].recordCount());
               AppendFiles appendFiles = table.newAppend();
               // submit datafiles to the table
               Arrays.stream(partitionedFanoutWriter.dataFiles()).forEach(appendFiles::appendFile);
               // submit snapshot
               appendFiles.apply();
               appendFiles.commit();
               System.out.println("committed file");
           } catch (Throwable e) {
               if (logger != null) {
                   logger.log("ERROR: can not commit data to iceberg table:" + e.getMessage());
               }
               System.out.println("can not commit");
               ProcessKinesisRecords.errRecords.addAll(records);
               e.printStackTrace();
               throw e;
           }


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] lengkristy commented on issue #8636: Update table failed due to concurrent modifications

Posted by "lengkristy (via GitHub)" <gi...@apache.org>.
lengkristy commented on issue #8636:
URL: https://github.com/apache/iceberg/issues/8636#issuecomment-1733406188

   <html>
   <body>
   <!--StartFragment-->
   
   2023-09-25T17:44:21.178+08:00 | org.apache.iceberg.exceptions.CommitFailedException: Cannot commit glue_catalog.gu_iot_dev_eu_one_platform_result_9b02b87.fact_ota_data because Glue detected concurrent update
   -- | --
     | 2023-09-25T17:44:21.178+08:00 | at org.apache.iceberg.aws.glue.GlueTableOperations.handleAWSExceptions(GlueTableOperations.java:355)
     | 2023-09-25T17:44:21.178+08:00 | at org.apache.iceberg.aws.glue.GlueTableOperations.doCommit(GlueTableOperations.java:180)
     | 2023-09-25T17:44:21.178+08:00 | at org.apache.iceberg.BaseMetastoreTableOperations.commit(BaseMetastoreTableOperations.java:135)
     | 2023-09-25T17:44:21.178+08:00 | at org.apache.iceberg.SnapshotProducer.lambda$commit$2(SnapshotProducer.java:390)
     | 2023-09-25T17:44:21.178+08:00Copyat org.apache.iceberg.util.Tasks$Builder.runTaskWithRetry(Tasks.java:413) | at org.apache.iceberg.util.Tasks$Builder.runTaskWithRetry(Tasks.java:413)
     | 2023-09-25T17:44:21.178+08:00 | at org.apache.iceberg.util.Tasks$Builder.runSingleThreaded(Tasks.java:219)
     | 2023-09-25T17:44:21.178+08:00 | at org.apache.iceberg.util.Tasks$Builder.run(Tasks.java:203)
     | 2023-09-25T17:44:21.178+08:00 | at org.apache.iceberg.util.Tasks$Builder.run(Tasks.java:196)
     | 2023-09-25T17:44:21.178+08:00 | at org.apache.iceberg.SnapshotProducer.commit(SnapshotProducer.java:364)
     | 2023-09-25T17:44:21.178+08:00 | at com.harman.iceberg.IcebergWriter.save(IcebergWriter.java:121)
     | 2023-09-25T17:44:21.178+08:00 | at com.harman.ProcessKinesisRecords.handleRequest(ProcessKinesisRecords.java:65)
     | 2023-09-25T17:44:21.178+08:00 | at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
     | 2023-09-25T17:44:21.178+08:00 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     | 2023-09-25T17:44:21.178+08:00 | at java.lang.reflect.Method.invoke(Method.java:498)
     | 2023-09-25T17:44:21.178+08:00 | at lambdainternal.EventHandlerLoader$PojoMethodRequestHandler.handleRequest(EventHandlerLoader.java:263)
     | 2023-09-25T17:44:21.178+08:00 | at lambdainternal.EventHandlerLoader$PojoHandlerAsStreamHandler.handleRequest(EventHandlerLoader.java:180)
     | 2023-09-25T17:44:21.178+08:00 | at lambdainternal.EventHandlerLoader$2.call(EventHandlerLoader.java:903)
     | 2023-09-25T17:44:21.178+08:00 | at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:355)
     | 2023-09-25T17:44:21.178+08:00 | at lambdainternal.AWSLambda.<clinit>(AWSLambda.java:72)
     | 2023-09-25T17:44:21.178+08:00 | at java.lang.Class.forName0(Native Method)
     | 2023-09-25T17:44:21.178+08:00 | at java.lang.Class.forName(Class.java:348)
     | 2023-09-25T17:44:21.178+08:00 | at lambdainternal.LambdaRTEntry.main(LambdaRTEntry.java:150)
     | 2023-09-25T17:44:21.179+08:00CopyCaused by: software.amazon.awssdk.services.glue.model.ConcurrentModificationException: Update table failed due to concurrent modifications. (Service: Glue, Status Code: 400, Request ID: 2de439bb-065b-4fb0-84f7-0079e1073f3b) | Caused by: software.amazon.awssdk.services.glue.model.ConcurrentModificationException: Update table failed due to concurrent modifications. (Service: Glue, Status Code: 400, Request ID: 2de439bb-065b-4fb0-84f7-0079e1073f3b)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.CombinedResponseHandler.handleErrorResponse(CombinedResponseHandler.java:125)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.CombinedResponseHandler.handleResponse(CombinedResponseHandler.java:82)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.CombinedResponseHandler.handle(CombinedResponseHandler.java:60)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.CombinedResponseHandler.handle(CombinedResponseHandler.java:41)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.stages.HandleResponseStage.execute(HandleResponseStage.java:40)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.stages.HandleResponseStage.execute(HandleResponseStage.java:30)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptTimeoutTrackingStage.execute(ApiCallAttemptTimeoutTrackingStage.java:72)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptTimeoutTrackingStage.execute(ApiCallAttemptTimeoutTrackingStage.java:42)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.stages.TimeoutExceptionHandlingStage.execute(TimeoutExceptionHandlingStage.java:78)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.stages.TimeoutExceptionHandlingStage.execute(TimeoutExceptionHandlingStage.java:40)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptMetricCollectionStage.execute(ApiCallAttemptMetricCollectionStage.java:52)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptMetricCollectionStage.execute(ApiCallAttemptMetricCollectionStage.java:37)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage.execute(RetryableStage.java:81)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage.execute(RetryableStage.java:36)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.StreamManagingStage.execute(StreamManagingStage.java:56)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.StreamManagingStage.execute(StreamManagingStage.java:36)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.executeWithTimer(ApiCallTimeoutTrackingStage.java:80)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.execute(ApiCallTimeoutTrackingStage.java:60)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.execute(ApiCallTimeoutTrackingStage.java:42)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallMetricCollectionStage.execute(ApiCallMetricCollectionStage.java:50)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallMetricCollectionStage.execute(ApiCallMetricCollectionStage.java:32)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.stages.ExecutionFailureExceptionReportingStage.execute(ExecutionFailureExceptionReportingStage.java:37)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.pipeline.stages.ExecutionFailureExceptionReportingStage.execute(ExecutionFailureExceptionReportingStage.java:26)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.http.AmazonSyncHttpClient$RequestExecutionBuilderImpl.execute(AmazonSyncHttpClient.java:196)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.invoke(BaseSyncClientHandler.java:103)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.doExecute(BaseSyncClientHandler.java:171)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.lambda$execute$1(BaseSyncClientHandler.java:82)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.measureApiCallSuccess(BaseSyncClientHandler.java:179)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.execute(BaseSyncClientHandler.java:76)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.core.client.handler.SdkSyncClientHandler.execute(SdkSyncClientHandler.java:45)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler.execute(AwsSyncClientHandler.java:56)
     | 2023-09-25T17:44:21.179+08:00 | at software.amazon.awssdk.services.glue.DefaultGlueClient.updateTable(DefaultGlueClient.java:13214)
     | 2023-09-25T17:44:21.179+08:00 | at org.apache.iceberg.aws.glue.GlueTableOperations.persistGlueTable(GlueTableOperations.java:331)
     | 2023-09-25T17:44:21.179+08:00 | at org.apache.iceberg.aws.glue.GlueTableOperations.doCommit(GlueTableOperations.java:160)
   
   <!--EndFragment-->
   </body>
   </html>
   @nastra Hi this is full stack trace, thank you


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] lengkristy commented on issue #8636: Update table failed due to concurrent modifications

Posted by "lengkristy (via GitHub)" <gi...@apache.org>.
lengkristy commented on issue #8636:
URL: https://github.com/apache/iceberg/issues/8636#issuecomment-1734698500

   and also get this error:
   org.apache.iceberg.exceptions.CommitFailedException: Cannot commit  because base metadata location 's3://xxxx/00426-a7b003ff-2e45-4591-9561-10b9cded215e.metadata.json' is not same as the current Glue location 's3://xxxxx/00427-74a9323a-ffdd-47e8-a54f-278ce87425a0.metadata.json'
   	at org.apache.iceberg.aws.glue.GlueTableOperations.checkMetadataLocation(GlueTableOperations.java:272)
   	at org.apache.iceberg.aws.glue.GlueTableOperations.doCommit(GlueTableOperations.java:158)
   	at org.apache.iceberg.BaseMetastoreTableOperations.commit(BaseMetastoreTableOperations.java:135)
   	at org.apache.iceberg.SnapshotProducer.lambda$commit$2(SnapshotProducer.java:390)
   	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:364)
   


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] nastra closed issue #8636: Update table failed due to concurrent modifications

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra closed issue #8636: Update table failed due to concurrent modifications
URL: https://github.com/apache/iceberg/issues/8636


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] lengkristy commented on issue #8636: Update table failed due to concurrent modifications

Posted by "lengkristy (via GitHub)" <gi...@apache.org>.
lengkristy commented on issue #8636:
URL: https://github.com/apache/iceberg/issues/8636#issuecomment-1733387467

   Caused by: software.amazon.awssdk.services.glue.model.ConcurrentModificationException: Update table failed due to concurrent modifications. (Service: Glue, Status Code: 400, Request ID: 710a23c5-718f-4b56-989b-55ad9afd9c52)


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] nastra commented on issue #8636: Update table failed due to concurrent modifications

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on issue #8636:
URL: https://github.com/apache/iceberg/issues/8636#issuecomment-1735198983

   Catching all exceptions might be the reason for the discrepancy. In any case, I'll go ahead and close this issue, since throwing a CFE on conflict is expected.


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] lengkristy commented on issue #8636: Update table failed due to concurrent modifications

Posted by "lengkristy (via GitHub)" <gi...@apache.org>.
lengkristy commented on issue #8636:
URL: https://github.com/apache/iceberg/issues/8636#issuecomment-1735149266

   I tested 100000 data, there is no error info, but iceberg just only received 98964 data:
   ![image](https://github.com/apache/iceberg/assets/37865070/34aed59b-5602-4d6a-8f86-a7b5c8bfc6e9)
   


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] nastra commented on issue #8636: Update table failed due to concurrent modifications

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on issue #8636:
URL: https://github.com/apache/iceberg/issues/8636#issuecomment-1733389582

   @lengkristy I think it would be helpful if you could attach the full stack trace, the Iceberg version you're using and which actions you're running


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] lengkristy commented on issue #8636: Update table failed due to concurrent modifications

Posted by "lengkristy (via GitHub)" <gi...@apache.org>.
lengkristy commented on issue #8636:
URL: https://github.com/apache/iceberg/issues/8636#issuecomment-1735187285

   > @lengkristy it's difficult to say what might have gone wrong without having full visibility into your application code that handles those updates
   
   thanks @nastra, yeah, I catch all exception ,I think if not success, maybe there is error info, but the code running well and no error info , so it's very strange.


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] lengkristy commented on issue #8636: Update table failed due to concurrent modifications

Posted by "lengkristy (via GitHub)" <gi...@apache.org>.
lengkristy commented on issue #8636:
URL: https://github.com/apache/iceberg/issues/8636#issuecomment-1735201088

   OK, thank you


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] lengkristy commented on issue #8636: Update table failed due to concurrent modifications

Posted by "lengkristy (via GitHub)" <gi...@apache.org>.
lengkristy commented on issue #8636:
URL: https://github.com/apache/iceberg/issues/8636#issuecomment-1735062236

   > If you are writing data concurrently, then `CommitFailedException` is an expected (and retryable) exception. In your case, the `CommitFailedException` indicates that the table metadata was modified concurrently by another process, which means that the respective changes can't be applied without first refreshing the table you're doing the changes against. What you could do is add some retry handling:
   > 
   > ```
   > Tasks.foreach(ops)
   >           .retry(COMMIT_NUM_RETRIES_DEFAULT)
   >           .exponentialBackoff(
   >               COMMIT_MIN_RETRY_WAIT_MS_DEFAULT,
   >               COMMIT_MAX_RETRY_WAIT_MS_DEFAULT,
   >               COMMIT_TOTAL_RETRY_TIME_MS_DEFAULT,
   >               2.0 /* exponential */)
   >           .onlyRetryOn(CommitFailedException.class)
   >           .run(
   >               taskOps -> { 
   >                  // refresh table + perfom the commit
   >              });
   > ```
   
   @nastra Thanks, I will try it


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] nastra commented on issue #8636: Update table failed due to concurrent modifications

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on issue #8636:
URL: https://github.com/apache/iceberg/issues/8636#issuecomment-1735175086

   @lengkristy it's difficult to say what might have gone wrong without having full visibility into your application code that handles those updates


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] nastra commented on issue #8636: Update table failed due to concurrent modifications

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on issue #8636:
URL: https://github.com/apache/iceberg/issues/8636#issuecomment-1733415952

   @lengkristy thanks. Can you please also provide the other information I mentioned?


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] nastra commented on issue #8636: Update table failed due to concurrent modifications

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on issue #8636:
URL: https://github.com/apache/iceberg/issues/8636#issuecomment-1735035827

   If you are writing data concurrently, then `CommitFailedException` is an expected (and retryable) exception. What you could do is add some retry handling:
   
   ```
   Tasks.foreach(ops)
             .retry(COMMIT_NUM_RETRIES_DEFAULT)
             .exponentialBackoff(
                 COMMIT_MIN_RETRY_WAIT_MS_DEFAULT,
                 COMMIT_MAX_RETRY_WAIT_MS_DEFAULT,
                 COMMIT_TOTAL_RETRY_TIME_MS_DEFAULT,
                 2.0 /* exponential */)
             .onlyRetryOn(CommitFailedException.class)
             .run(
                 taskOps -> { 
                    // refresh table + perfom the commit
                });
   ```
   


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org