phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sama...@apache.org
Subject phoenix git commit: PHOENIX-3230 Addendum to use the physical name of system catalog and other tweaks/cleanup
Date Fri, 09 Sep 2016 21:34:15 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.8-HBase-1.1 9a9ac302f -> bd1e7d06b


PHOENIX-3230 Addendum to use the physical name of system catalog and other tweaks/cleanup


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

Branch: refs/heads/4.8-HBase-1.1
Commit: bd1e7d06b09496809d3515efe86d9863b8155ffc
Parents: 9a9ac30
Author: Samarth <samarth.jain@salesforce.com>
Authored: Fri Sep 9 14:34:08 2016 -0700
Committer: Samarth <samarth.jain@salesforce.com>
Committed: Fri Sep 9 14:34:08 2016 -0700

----------------------------------------------------------------------
 .../phoenix/coprocessor/MetaDataProtocol.java   |  3 +-
 .../query/ConnectionQueryServicesImpl.java      | 29 ++++++++++----------
 .../apache/phoenix/query/QueryConstants.java    |  2 +-
 3 files changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/bd1e7d06/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
index 20922e5..3b57981 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
@@ -83,8 +83,9 @@ public abstract class MetaDataProtocol extends MetaDataService {
     public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_6_0 = MIN_TABLE_TIMESTAMP + 9;
     public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 = MIN_TABLE_TIMESTAMP + 15;
     public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_8_0 = MIN_TABLE_TIMESTAMP + 18;
+    public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_8_1 = MIN_TABLE_TIMESTAMP + 18;
     // MIN_SYSTEM_TABLE_TIMESTAMP needs to be set to the max of all the MIN_SYSTEM_TABLE_TIMESTAMP_*
constants
-    public static final long MIN_SYSTEM_TABLE_TIMESTAMP = MIN_SYSTEM_TABLE_TIMESTAMP_4_8_0;
+    public static final long MIN_SYSTEM_TABLE_TIMESTAMP = MIN_SYSTEM_TABLE_TIMESTAMP_4_8_1;
     
     // ALWAYS update this map whenever rolling out a new release (major, minor or patch release).

     // Key is the SYSTEM.CATALOG timestamp for the version and value is the version string.

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bd1e7d06/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 7058889..4a3e92a 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
@@ -18,9 +18,8 @@
 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.CURRENT_CLIENT_VERSION;
 import static org.apache.phoenix.coprocessor.MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP;
-import static org.apache.phoenix.coprocessor.MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_8_0;
+import static org.apache.phoenix.coprocessor.MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_8_1;
 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;
@@ -77,7 +76,6 @@ import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Append;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HConnection;
-import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.HTableInterface;
 import org.apache.hadoop.hbase.client.Increment;
 import org.apache.hadoop.hbase.client.Mutation;
@@ -2331,7 +2329,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices
implement
                                 if (upgradeSystemTables) {
                                     long currentServerSideTableTimeStamp = e.getTable().getTimeStamp();
                                     sysCatalogTableName = e.getTable().getPhysicalName().getString();
-                                    if (currentServerSideTableTimeStamp < MIN_SYSTEM_TABLE_TIMESTAMP
&& acquireUpgradeMutex(currentServerSideTableTimeStamp)) {
+                                    if (currentServerSideTableTimeStamp < MIN_SYSTEM_TABLE_TIMESTAMP
&& acquireUpgradeMutex(currentServerSideTableTimeStamp, e.getTable().getPhysicalName().getBytes()))
{
                                         snapshotName = getUpgradeSnapshotName(sysCatalogTableName,
currentServerSideTableTimeStamp);
                                         createSnapshot(snapshotName, sysCatalogTableName);
                                     }
@@ -2729,9 +2727,9 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices
implement
                  * making use of HBase's checkAndPut api.
                  * <p>
                  * This method was added as part of 4.8.1 release. For clients upgrading
to 4.8.1, the old value in the
-                 * version cell will be null i.e. the QueryConstants#VERSION column will
be non-existent. For client's
+                 * version cell will be null i.e. the {@value QueryConstants#UPGRADE_MUTEX}
column will be non-existent. For client's
                  * upgrading to a release newer than 4.8.1 the existing version cell will
be non-null. The client which
-                 * wins the race will end up setting the version cell to the MetadataProtocol#MIN_SYSTEM_TABLE_TIMESTAMP
+                 * wins the race will end up setting the version cell to the {@value MetaDataProtocol#MIN_SYSTEM_TABLE_TIMESTAMP}
                  * for the release.
                  * </p>
                  * 
@@ -2739,19 +2737,20 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices
implement
                  * @throws IOException
                  * @throws SQLException
                  */
-                private boolean acquireUpgradeMutex(long currentServerSideTableTimestamp)
throws IOException,
+                private boolean acquireUpgradeMutex(long currentServerSideTableTimestamp,
byte[] sysCatalogTableName) throws IOException,
                         SQLException {
                     Preconditions.checkArgument(currentServerSideTableTimestamp < MIN_SYSTEM_TABLE_TIMESTAMP);
-                    try (HTableInterface sysCatalogTable = getTable(SYSTEM_CATALOG_NAME_BYTES))
{
+                    try (HTableInterface sysCatalogTable = getTable(sysCatalogTableName))
{
                         byte[] row = SchemaUtil.getTableKey(null, PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA,
-                                PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME);
+                                PhoenixDatabaseMetaData.SYSTEM_CATALOG_TABLE);
                         byte[] family = PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES;
-                        byte[] qualifier = QueryConstants.VERSION;
-                        byte[] oldValue = currentServerSideTableTimestamp < MIN_SYSTEM_TABLE_TIMESTAMP_4_8_0
? null
-                                : Bytes.toBytes(currentServerSideTableTimestamp);
-                        byte[] newValue = Bytes.toBytes(MIN_SYSTEM_TABLE_TIMESTAMP);
-                        long ts = MIN_SYSTEM_TABLE_TIMESTAMP;
-                        Put put = new Put(row, ts);
+                        byte[] qualifier = QueryConstants.UPGRADE_MUTEX;
+                        byte[] oldValue = currentServerSideTableTimestamp < MIN_SYSTEM_TABLE_TIMESTAMP_4_8_1
? null
+                                : PLong.INSTANCE.toBytes(currentServerSideTableTimestamp);
+                        byte[] newValue = PLong.INSTANCE.toBytes(MIN_SYSTEM_TABLE_TIMESTAMP);
+                        // Note that the timestamp for this put doesn't really matter since
UPGRADE_MUTEX column isn't used
+                        // to calculate SYSTEM.CATALOG's server side timestamp.
+                        Put put = new Put(row);
                         put.add(family, qualifier, newValue);
                         boolean acquired = sysCatalogTable.checkAndPut(row, family, qualifier,
oldValue, put);
                         if (!acquired) { throw new UpgradeInProgressException(

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bd1e7d06/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
index 3077943..7e5f7a2 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
@@ -356,6 +356,6 @@ public interface QueryConstants {
     public static final byte[] OFFSET_FAMILY = "f_offset".getBytes();
     public static final byte[] OFFSET_COLUMN = "c_offset".getBytes();
     public static final String LAST_SCAN = "LAST_SCAN";
-    public static final byte[] VERSION = "VERSION".getBytes();
+    public static final byte[] UPGRADE_MUTEX = "UPGRADE_MUTEX".getBytes();
 
 }


Mime
View raw message