phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sama...@apache.org
Subject [2/2] phoenix git commit: TTL on UPGRADE_LOCK cell causes upgrade to fail
Date Mon, 12 Dec 2016 19:50:26 GMT
TTL on UPGRADE_LOCK cell causes upgrade to fail


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/534b100e
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/534b100e
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/534b100e

Branch: refs/heads/4.9-HBase-0.98
Commit: 534b100e08ca595dc705688d5e1a79f6daf836e9
Parents: 040dd29
Author: Samarth <samarth.jain@salesforce.com>
Authored: Mon Dec 12 11:50:13 2016 -0800
Committer: Samarth <samarth.jain@salesforce.com>
Committed: Mon Dec 12 11:50:13 2016 -0800

----------------------------------------------------------------------
 .../phoenix/query/ConnectionQueryServicesImpl.java  | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/534b100e/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index 9bc088d..c8d42d9 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -2997,8 +2997,20 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices
implement
             Put put = new Put(rowToLock);
             put.add(family, qualifier, newValue);
             boolean acquired =  sysMutexTable.checkAndPut(rowToLock, family, qualifier, oldValue,
put);
-            if (!acquired) { throw new UpgradeInProgressException(getVersion(currentServerSideTableTimestamp),
-                    getVersion(MIN_SYSTEM_TABLE_TIMESTAMP)); }
+            if (!acquired) {
+                /*
+                 * Because of TTL on the SYSTEM_MUTEX_FAMILY, it is very much possible that
the cell
+                 * has gone away. So we need to retry with an old value of null. Note there
is a small
+                 * race condition here that between the two checkAndPut calls, it is possible
that another
+                 * request would have set the value back to UPGRADE_MUTEX_UNLOCKED. In that
scenario this
+                 * following checkAndPut would still return false even though the lock was
available.
+                 */
+                acquired =  sysMutexTable.checkAndPut(rowToLock, family, qualifier, null,
put);
+                if (!acquired) {
+                    throw new UpgradeInProgressException(getVersion(currentServerSideTableTimestamp),
+                        getVersion(MIN_SYSTEM_TABLE_TIMESTAMP));
+                }
+            }
             return true;
         }
     }


Mime
View raw message