danny0405 commented on code in PR #13077:
URL: https://github.com/apache/hudi/pull/13077#discussion_r2026548368


##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/TimeGeneratorBase.java:
##########
@@ -85,20 +85,26 @@ public TimeGeneratorBase(HoodieTimeGeneratorConfig config, 
StorageConfiguration<
 
   protected LockProvider<?> getLockProvider() {
     // Perform lazy initialization of lock provider only if needed
-    if (lockProvider == null) {
+    String lockProviderClass = 
lockConfiguration.getConfig().getString("hoodie.write.lock.provider");
+    LOG.info("LockProvider for TimeGenerator: {}", lockProviderClass);
+    if (!LockProvider.isThreadSafe(lockProviderClass)) {
+      return createLockProvider(lockProviderClass);

Review Comment:
   Can we just make `TimeGenerator#generateTime` synchronized to fix the issue? 
   
   And even if we store the lock as member variable of the lock provider, the 
try-lock would trigger a lock acquisition exception then a retry until the lock 
is fetched successfully? So it is still thread-safe without any fix?



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

Reply via email to