danny0405 commented on code in PR #13768:
URL: https://github.com/apache/hudi/pull/13768#discussion_r2374435752
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/LockManager.java:
##########
@@ -108,9 +108,20 @@ public synchronized LockProvider getLockProvider() {
// Perform lazy initialization of lock provider only if needed
if (lockProvider == null) {
LOG.info("LockProvider " + writeConfig.getLockProviderClass());
- lockProvider = (LockProvider)
ReflectionUtils.loadClass(writeConfig.getLockProviderClass(),
- new Class<?>[] {LockConfiguration.class, StorageConfiguration.class},
- lockConfiguration, storageConf);
+
+ // Try to load lock provider with HoodieLockMetrics constructor first
+ Class<?>[] metricsConstructorTypes = {LockConfiguration.class,
StorageConfiguration.class, HoodieLockMetrics.class};
+ if (ReflectionUtils.hasConstructor(writeConfig.getLockProviderClass(),
metricsConstructorTypes)) {
+ lockProvider = (LockProvider)
ReflectionUtils.loadClass(writeConfig.getLockProviderClass(),
+ metricsConstructorTypes, lockConfiguration, storageConf, metrics);
+ LOG.debug("Successfully loaded LockProvider with HoodieLockMetrics
support");
+ } else {
+ LOG.debug("LockProvider does not support HoodieLockMetrics
constructor, falling back to standard constructor");
+ // Fallback to original constructor without metrics
+ lockProvider = (LockProvider)
ReflectionUtils.loadClass(writeConfig.getLockProviderClass(),
+ new Class<?>[] {LockConfiguration.class,
StorageConfiguration.class},
+ lockConfiguration, storageConf);
Review Comment:
@alexr17 can we fix this as a 1.1 blocker.
--
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]