diff options
author | Martin Polden <mpolden@mpolden.no> | 2020-04-29 13:14:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-29 13:14:22 +0200 |
commit | 62e03497277f21288afade57ea156d558180a97a (patch) | |
tree | f8977a7b799d9abc97e4e15ed6844c0a2b3ed194 /node-repository | |
parent | a8fc679943ae9bdc6d6d58d82a2b9f43dac54ad4 (diff) |
Revert "Take both legacy lock and application lock"
Diffstat (limited to 'node-repository')
-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(); - } - }; } /** |