[
https://issues.apache.org/jira/browse/HUDI-4409?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated HUDI-4409:
---------------------------------
Labels: pull-request-available (was: )
> LockManager improve wait time logic
> -----------------------------------
>
> Key: HUDI-4409
> URL: https://issues.apache.org/jira/browse/HUDI-4409
> Project: Apache Hudi
> Issue Type: Improvement
> Reporter: liujinhui
> Priority: Major
> Labels: pull-request-available
>
> {code:java}
> //public void lock() {
> if
> (writeConfig.getWriteConcurrencyMode().supportsOptimisticConcurrencyControl())
> {
> LockProvider lockProvider = getLockProvider();
> int retryCount = 0;
> boolean acquired = false;
> while (retryCount <= maxRetries) {
> try {
> acquired =
> lockProvider.tryLock(writeConfig.getLockAcquireWaitTimeoutInMs(),
> TimeUnit.MILLISECONDS);
> if (acquired) {
> break;
> }
> LOG.info("Retrying to acquire lock...");
> Thread.sleep(maxWaitTimeInMs);
> } catch (HoodieLockException | InterruptedException e) {
> if (retryCount >= maxRetries) {
> throw new HoodieLockException("Unable to acquire lock, lock object
> ", e);
> }
> } finally {
> retryCount++;
> }
> }
> if (!acquired) {
> throw new HoodieLockException("Unable to acquire lock, lock object " +
> lockProvider.getLock());
> }
> }
> } {code}
> We should put sleep in catch
--
This message was sent by Atlassian Jira
(v8.20.10#820010)