You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "vinoyang (Jira)" <ji...@apache.org> on 2022/07/18 14:50:00 UTC

[jira] [Assigned] (HUDI-4409) Improve LockManager wait logic when catch exception

     [ https://issues.apache.org/jira/browse/HUDI-4409?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

vinoyang reassigned HUDI-4409:
------------------------------

    Assignee: liujinhui

> Improve LockManager wait logic when catch exception
> ---------------------------------------------------
>
>                 Key: HUDI-4409
>                 URL: https://issues.apache.org/jira/browse/HUDI-4409
>             Project: Apache Hudi
>          Issue Type: Improvement
>            Reporter: liujinhui
>            Assignee: 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)