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 f39327c3c1a [HUDI-6433] Make the meta sync of streaming sink thread 
safe (#9046)
f39327c3c1a is described below

commit f39327c3c1aa668faaeded6e789cc74150d08923
Author: Danny Chan <[email protected]>
AuthorDate: Mon Jun 26 11:26:14 2023 +0800

    [HUDI-6433] Make the meta sync of streaming sink thread safe (#9046)
---
 .../main/java/org/apache/hudi/sync/common/util/SyncUtilHelpers.java  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/hudi-sync/hudi-sync-common/src/main/java/org/apache/hudi/sync/common/util/SyncUtilHelpers.java
 
b/hudi-sync/hudi-sync-common/src/main/java/org/apache/hudi/sync/common/util/SyncUtilHelpers.java
index 036ca3b47a9..466c0c71ffa 100644
--- 
a/hudi-sync/hudi-sync-common/src/main/java/org/apache/hudi/sync/common/util/SyncUtilHelpers.java
+++ 
b/hudi-sync/hudi-sync-common/src/main/java/org/apache/hudi/sync/common/util/SyncUtilHelpers.java
@@ -43,6 +43,9 @@ public class SyncUtilHelpers {
    * Create an instance of an implementation of {@link HoodieSyncTool} that 
will sync all the relevant meta information
    * with an external metastore such as Hive etc. to ensure Hoodie tables can 
be queried or read via external systems.
    *
+   * <p>IMPORTANT: make this method class level thread safe to avoid 
concurrent modification of the same underneath meta storage.
+   * Meta store such as Hive may encounter {@code 
ConcurrentModificationException} for #alter_table.
+   *
    * @param syncToolClassName   Class name of the {@link HoodieSyncTool} 
implementation.
    * @param props               property map.
    * @param hadoopConfig        Hadoop confs.
@@ -50,7 +53,7 @@ public class SyncUtilHelpers {
    * @param targetBasePath      The target base path that contains the hoodie 
table.
    * @param baseFileFormat      The file format used by the hoodie table 
(defaults to PARQUET).
    */
-  public static void runHoodieMetaSync(String syncToolClassName,
+  public static synchronized void runHoodieMetaSync(String syncToolClassName,
                                        TypedProperties props,
                                        Configuration hadoopConfig,
                                        FileSystem fs,

Reply via email to