This is an automated email from the ASF dual-hosted git repository.
yihua 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 ab28ee6b978 [MINOR] Code clean for time generator (#10842)
ab28ee6b978 is described below
commit ab28ee6b978851ab1ac9860a218f0c3eb5c3dad7
Author: Danny Chan <[email protected]>
AuthorDate: Sat Mar 9 13:21:20 2024 +0800
[MINOR] Code clean for time generator (#10842)
---
.../common/table/timeline/TimeGeneratorBase.java | 20 +++++++-------------
.../hudi/common/table/timeline/TimeGenerators.java | 2 +-
2 files changed, 8 insertions(+), 14 deletions(-)
diff --git
a/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/TimeGeneratorBase.java
b/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/TimeGeneratorBase.java
index 4acb8d2af54..c8e56c6b6d8 100644
---
a/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/TimeGeneratorBase.java
+++
b/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/TimeGeneratorBase.java
@@ -50,15 +50,7 @@ public abstract class TimeGeneratorBase implements
TimeGenerator, Serializable {
/**
* The lock provider.
*/
- private volatile LockProvider lockProvider;
- /**
- * The maximum times to retry in case there are failures.
- */
- private final int maxRetries;
- /**
- * The maximum time to wait for each time generation to resolve the clock
skew issue on distributed hosts.
- */
- private final long maxWaitTimeInMs;
+ private volatile LockProvider<?> lockProvider;
/**
* The maximum time to block for acquiring a lock.
*/
@@ -79,24 +71,26 @@ public abstract class TimeGeneratorBase implements
TimeGenerator, Serializable {
this.lockConfiguration = config.getLockConfiguration();
this.hadoopConf = hadoopConf;
- maxRetries =
lockConfiguration.getConfig().getInteger(LOCK_ACQUIRE_CLIENT_NUM_RETRIES_PROP_KEY,
+ // The maximum times to retry in case there are failures.
+ int maxRetries =
lockConfiguration.getConfig().getInteger(LOCK_ACQUIRE_CLIENT_NUM_RETRIES_PROP_KEY,
Integer.parseInt(DEFAULT_LOCK_ACQUIRE_NUM_RETRIES));
lockAcquireWaitTimeInMs =
lockConfiguration.getConfig().getInteger(LOCK_ACQUIRE_WAIT_TIMEOUT_MS_PROP_KEY,
DEFAULT_LOCK_ACQUIRE_WAIT_TIMEOUT_MS);
- maxWaitTimeInMs =
lockConfiguration.getConfig().getLong(LOCK_ACQUIRE_CLIENT_RETRY_WAIT_TIME_IN_MILLIS_PROP_KEY,
+ // The maximum time to wait for each time generation to resolve the clock
skew issue on distributed hosts.
+ long maxWaitTimeInMs =
lockConfiguration.getConfig().getLong(LOCK_ACQUIRE_CLIENT_RETRY_WAIT_TIME_IN_MILLIS_PROP_KEY,
Long.parseLong(DEFAULT_LOCK_ACQUIRE_CLIENT_RETRY_WAIT_TIME_IN_MILLIS));
lockRetryHelper = new RetryHelper<>(maxWaitTimeInMs, maxRetries,
maxWaitTimeInMs,
Arrays.asList(HoodieLockException.class, InterruptedException.class),
"acquire timeGenerator lock");
}
- protected LockProvider getLockProvider() {
+ protected LockProvider<?> getLockProvider() {
// Perform lazy initialization of lock provider only if needed
if (lockProvider == null) {
synchronized (this) {
if (lockProvider == null) {
String lockProviderClass =
lockConfiguration.getConfig().getString("hoodie.write.lock.provider");
LOG.info("LockProvider for TimeGenerator: " + lockProviderClass);
- lockProvider = (LockProvider)
ReflectionUtils.loadClass(lockProviderClass,
+ lockProvider = (LockProvider<?>)
ReflectionUtils.loadClass(lockProviderClass,
lockConfiguration, hadoopConf.get());
}
}
diff --git
a/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/TimeGenerators.java
b/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/TimeGenerators.java
index 3f394a47a6d..4ae2f1054a0 100644
---
a/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/TimeGenerators.java
+++
b/hudi-common/src/main/java/org/apache/hudi/common/table/timeline/TimeGenerators.java
@@ -29,7 +29,7 @@ import org.apache.hadoop.conf.Configuration;
import static org.apache.hudi.common.config.HoodieCommonConfig.BASE_PATH;
/**
- * Holds all different {@link TimeGenerator} implementations, use {@link
HoodieCommonConfig.BASE_PATH}
+ * Holds all different {@link TimeGenerator} implementations, use {@link
org.apache.hudi.common.config.HoodieCommonConfig#BASE_PATH}
* to cache the existing instances.
*/
public class TimeGenerators {