diff options
author | Martin Polden <mpolden@mpolden.no> | 2020-04-29 13:31:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-29 13:31:30 +0200 |
commit | f1ce8fa10014190166d3231066d07a8a2c5f37b9 (patch) | |
tree | b7e57881faa43378e4355918db50d3bc92fb79bf | |
parent | e316f0c522cf1753b0f98442777852dbfc255df2 (diff) | |
parent | 62e03497277f21288afade57ea156d558180a97a (diff) |
Merge pull request #13104 from vespa-engine/revert-13089-mpolden/take-application-lock
Revert "Take both legacy lock and application lock"
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabaseClient.java | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabaseClient.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabaseClient.java index 4475014172e..4defbb55485 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabaseClient.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabaseClient.java @@ -12,8 +12,8 @@ import com.yahoo.config.provision.HostName; import com.yahoo.config.provision.NodeFlavors; import com.yahoo.config.provision.NodeType; import com.yahoo.config.provision.Zone; +import java.util.logging.Level; import com.yahoo.path.Path; -import com.yahoo.transaction.Mutex; import com.yahoo.transaction.NestedTransaction; import com.yahoo.transaction.Transaction; import com.yahoo.vespa.curator.Curator; @@ -366,36 +366,19 @@ public class CuratorDatabaseClient implements JobControl.Db { /** Acquires the single cluster-global, reentrant lock for active nodes of this application */ // TODO(mpolden): Remove when all config servers take the new lock - public Mutex legacyLock(ApplicationId application) { + public Lock legacyLock(ApplicationId application) { return legacyLock(application, defaultLockTimeout); } /** Acquires the single cluster-global, reentrant lock with the specified timeout for active nodes of this application */ // TODO(mpolden): Remove when all config servers take the new lock - public Mutex legacyLock(ApplicationId application, Duration timeout) { - Mutex legacyLock; - Mutex lock; - // Take the legacy node-repository lock + public Lock legacyLock(ApplicationId application, Duration timeout) { try { - legacyLock = db.lock(legacyLockPath(application), timeout); - } catch (UncheckedTimeoutException e) { - throw new ApplicationLockException(e); + return db.lock(legacyLockPath(application), timeout); } - // Take the application lock (same as config server). This is likey already held at this point, but is - // re-entrant. - try { - lock = db.lock(lockPath(application), timeout); - } catch (UncheckedTimeoutException e) { - legacyLock.close(); + catch (UncheckedTimeoutException e) { throw new ApplicationLockException(e); } - return () -> { - try { - lock.close(); - } finally { - legacyLock.close(); - } - }; } /** |