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:58:18 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/1a6a689b
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/1a6a689b
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/1a6a689b

Branch: refs/heads/master
Commit: 1a6a689b87de9c58e784276d542ed0bdb555962b
Parents: 724cc46
Author: Samarth <samarth.jain@salesforce.com>
Authored: Mon Dec 12 11:58:07 2016 -0800
Committer: Samarth <samarth.jain@salesforce.com>
Committed: Mon Dec 12 11:58:07 2016 -0800

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1a6a689b/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 8128fb0..0c67af6 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
@@ -2999,8 +2999,20 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices
implement
             Put put = new Put(rowToLock);
             put.addColumn(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