This is an automated email from the ASF dual-hosted git repository.
danny0405 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git
The following commit(s) were added to refs/heads/master by this push:
new a0bae464592 [HUDI-8006] Fix glue sync async call to update table
(#11659)
a0bae464592 is described below
commit a0bae464592f44cfa7463d9d09aa7235fd63b5fe
Author: Nicolas Paris <[email protected]>
AuthorDate: Tue Jul 23 02:56:16 2024 +0200
[HUDI-8006] Fix glue sync async call to update table (#11659)
---
.../org/apache/hudi/aws/sync/AWSGlueCatalogSyncClient.java | 14 +++++++++-----
.../org/apache/hudi/aws/sync/TestAWSGlueSyncClient.java | 1 +
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git
a/hudi-aws/src/main/java/org/apache/hudi/aws/sync/AWSGlueCatalogSyncClient.java
b/hudi-aws/src/main/java/org/apache/hudi/aws/sync/AWSGlueCatalogSyncClient.java
index 520f4364837..733ed3c7d40 100644
---
a/hudi-aws/src/main/java/org/apache/hudi/aws/sync/AWSGlueCatalogSyncClient.java
+++
b/hudi-aws/src/main/java/org/apache/hudi/aws/sync/AWSGlueCatalogSyncClient.java
@@ -499,7 +499,11 @@ public class AWSGlueCatalogSyncClient extends
HoodieSyncClient {
.tableInput(updatedTableInput)
.build();
- awsGlue.updateTable(request);
+ try {
+ awsGlue.updateTable(request).get();
+ } catch (Exception e) {
+ throw new HoodieGlueSyncException("Fail to update table comments " +
tableId(databaseName, table.name()), e);
+ }
return true;
}
}
@@ -531,7 +535,7 @@ public class AWSGlueCatalogSyncClient extends
HoodieSyncClient {
.tableInput(updatedTableInput)
.build();
- awsGlue.updateTable(request);
+ awsGlue.updateTable(request).get();
} catch (Exception e) {
throw new HoodieGlueSyncException("Fail to update definition for table "
+ tableId(databaseName, tableName), e);
}
@@ -574,7 +578,7 @@ public class AWSGlueCatalogSyncClient extends
HoodieSyncClient {
.skipArchive(skipTableArchive)
.tableInput(updatedTableInput)
.build();
- awsGlue.updateTable(request);
+ awsGlue.updateTable(request).get();
dropTable(tempTableName);
} catch (Exception e) {
throw new HoodieGlueSyncException("Fail to recreate the table" +
tableId(databaseName, tableName), e);
@@ -1011,7 +1015,7 @@ public class AWSGlueCatalogSyncClient extends
HoodieSyncClient {
.tableInput(updatedTableInput)
.build();
- awsGlue.updateTable(updateTableRequest);
+ awsGlue.updateTable(updateTableRequest).get();
return true;
} catch (Exception e) {
throw new HoodieGlueSyncException("Failed to update table serde info for
table: "
@@ -1094,7 +1098,7 @@ public class AWSGlueCatalogSyncClient extends
HoodieSyncClient {
.tableInput(updatedTableInput)
.skipArchive(skipTableArchive)
.build();
- awsGlue.updateTable(request);
+ awsGlue.updateTable(request).get();
return true;
} catch (Exception e) {
throw new HoodieGlueSyncException("Fail to update params for table " +
tableId(databaseName, tableName) + ": " + updatingParams, e);
diff --git
a/hudi-aws/src/test/java/org/apache/hudi/aws/sync/TestAWSGlueSyncClient.java
b/hudi-aws/src/test/java/org/apache/hudi/aws/sync/TestAWSGlueSyncClient.java
index 540b1d75141..8723db418c0 100644
--- a/hudi-aws/src/test/java/org/apache/hudi/aws/sync/TestAWSGlueSyncClient.java
+++ b/hudi-aws/src/test/java/org/apache/hudi/aws/sync/TestAWSGlueSyncClient.java
@@ -115,6 +115,7 @@ class TestAWSGlueSyncClient {
CompletableFuture<DeleteTableResponse> deleteTableResponse =
CompletableFuture.completedFuture(DeleteTableResponse.builder().build());
Mockito.when(mockAwsGlue.deleteTable(any(DeleteTableRequest.class))).thenReturn(deleteTableResponse);
+
Mockito.when(mockAwsGlue.updateTable(any(UpdateTableRequest.class))).thenReturn(CompletableFuture.completedFuture(null));
awsGlueSyncClient.createOrReplaceTable(tableName, storageSchema,
inputFormatClass, outputFormatClass, serdeClass, serdeProperties,
tableProperties);
// Verify that awsGlue.updateTable() is called exactly once