You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by sa...@apache.org on 2016/11/02 20:21:24 UTC

phoenix git commit: PHOENIX-3435 Upgrade will fail for future releases because of use of timestamp as value for upgrade mutex

Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 c1c78b2e4 -> 83b0ebee1


PHOENIX-3435 Upgrade will fail for future releases because of use of timestamp as value for upgrade mutex


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 83b0ebee10577129aa06d0335e7b37d7c48ddc26
Parents: c1c78b2
Author: Samarth <sa...@salesforce.com>
Authored: Wed Nov 2 13:20:39 2016 -0700
Committer: Samarth <sa...@salesforce.com>
Committed: Wed Nov 2 13:21:01 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/83b0ebee/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 b1b7bab..356f0b8 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
@@ -20,7 +20,6 @@ package org.apache.phoenix.query;
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static org.apache.hadoop.hbase.HColumnDescriptor.TTL;
 import static org.apache.phoenix.coprocessor.MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP;
-import static org.apache.phoenix.coprocessor.MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_9_0;
 import static org.apache.phoenix.coprocessor.MetaDataProtocol.PHOENIX_MAJOR_VERSION;
 import static org.apache.phoenix.coprocessor.MetaDataProtocol.PHOENIX_MINOR_VERSION;
 import static org.apache.phoenix.coprocessor.MetaDataProtocol.PHOENIX_PATCH_NUMBER;
@@ -281,6 +280,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
     private final boolean isAutoUpgradeEnabled;
     private final AtomicBoolean upgradeRequired = new AtomicBoolean(false);
     private static final byte[] UPGRADE_MUTEX = "UPGRADE_MUTEX".getBytes();
+    private static final byte[] UPGRADE_MUTEX_VALUE = UPGRADE_MUTEX; 
 
     private static interface FeatureSupported {
         boolean isSupported(ConnectionQueryServices services);
@@ -2971,13 +2971,6 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
     /**
      * Acquire distributed mutex of sorts to make sure only one JVM is able to run the upgrade code by
      * making use of HBase's checkAndPut api.
-     * <p>
-     * This method was added as part of 4.9.0 release. For clients upgrading to 4.9.0, the old value in the
-     * cell will be null i.e. the {@value #UPGRADE_MUTEX} column will be non-existent. For client's
-     * upgrading to a release newer than 4.9.0 the existing cell value will be non-null. The client which
-     * wins the race will end up setting the cell value to the {@value MetaDataProtocol#MIN_SYSTEM_TABLE_TIMESTAMP}
-     * for the release.
-     * </p>
      * 
      * @return true if client won the race, false otherwise
      * @throws IOException
@@ -3003,9 +2996,8 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
         try (HTableInterface sysMutexTable = getTable(PhoenixDatabaseMetaData.SYSTEM_MUTEX_NAME_BYTES)) {
             byte[] family = PhoenixDatabaseMetaData.SYSTEM_MUTEX_FAMILY_NAME_BYTES;
             byte[] qualifier = UPGRADE_MUTEX;
-            byte[] oldValue = currentServerSideTableTimestamp < MIN_SYSTEM_TABLE_TIMESTAMP_4_9_0 ? null
-                    : PLong.INSTANCE.toBytes(currentServerSideTableTimestamp);
-            byte[] newValue = PLong.INSTANCE.toBytes(MIN_SYSTEM_TABLE_TIMESTAMP);
+            byte[] oldValue = null;
+            byte[] newValue = UPGRADE_MUTEX_VALUE;
             Put put = new Put(rowToLock);
             put.add(family, qualifier, newValue);
             boolean acquired = sysMutexTable.checkAndPut(rowToLock, family, qualifier, oldValue, put);
@@ -3021,7 +3013,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
         try (HTableInterface sysMutexTable = getTable(PhoenixDatabaseMetaData.SYSTEM_MUTEX_NAME_BYTES)) {
             byte[] family = PhoenixDatabaseMetaData.SYSTEM_MUTEX_FAMILY_NAME_BYTES;
             byte[] qualifier = UPGRADE_MUTEX;
-            byte[] expectedValue = PLong.INSTANCE.toBytes(MIN_SYSTEM_TABLE_TIMESTAMP);
+            byte[] expectedValue = UPGRADE_MUTEX_VALUE;
             Delete delete = new Delete(mutexRowKey);
             RowMutations mutations = new RowMutations(mutexRowKey);
             mutations.add(delete);