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-3781 Backward compatibility issue with old client and 4.10 server
Date Wed, 12 Apr 2017 17:47:41 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.10-HBase-1.1 e5c016577 -> 86043c7cf


PHOENIX-3781 Backward compatibility issue with old client and 4.10 server


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

Branch: refs/heads/4.10-HBase-1.1
Commit: 86043c7cfedb9ae58dd0ca0f97f98fcac884c251
Parents: e5c0165
Author: Samarth <samarth.jain@salesforce.com>
Authored: Wed Apr 12 10:47:31 2017 -0700
Committer: Samarth <samarth.jain@salesforce.com>
Committed: Wed Apr 12 10:47:31 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/phoenix/schema/PTableImpl.java   | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/86043c7c/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
index d91ebcb..51f5b0b 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
@@ -480,8 +480,9 @@ public class PTableImpl implements PTable {
         this.isNamespaceMapped = isNamespaceMapped;
         this.autoPartitionSeqName = autoPartitionSeqName;
         this.isAppendOnlySchema = isAppendOnlySchema;
-        this.immutableStorageScheme = storageScheme;
-        this.qualifierEncodingScheme = qualifierEncodingScheme;
+        // null check for backward compatibility and sanity. If any of the two below is null,
then it means the table is a non-encoded table.
+        this.immutableStorageScheme = storageScheme == null ? ImmutableStorageScheme.ONE_CELL_PER_COLUMN
: storageScheme;
+        this.qualifierEncodingScheme = qualifierEncodingScheme == null ? QualifierEncodingScheme.NON_ENCODED_QUALIFIERS
: qualifierEncodingScheme;
         List<PColumn> pkColumns;
         PColumn[] allColumns;
         
@@ -586,7 +587,7 @@ public class PTableImpl implements PTable {
                 .orderedBy(Bytes.BYTES_COMPARATOR);
         for (int i = 0; i < families.length; i++) {
             Map.Entry<PName,List<PColumn>> entry = iterator.next();
-            PColumnFamily family = new PColumnFamilyImpl(entry.getKey(), entry.getValue());//,
qualifierEncodingScheme);
+            PColumnFamily family = new PColumnFamilyImpl(entry.getKey(), entry.getValue());
             families[i] = family;
             familyByString.put(family.getName().getString(), family);
             familyByBytes.put(family.getName().getBytes(), family);
@@ -896,7 +897,7 @@ public class PTableImpl implements PTable {
                 mutations.add(deleteRow);
             } else {
                 // store all columns for a given column family in a single cell instead of
one column per cell in order to improve write performance
-                if (immutableStorageScheme != ImmutableStorageScheme.ONE_CELL_PER_COLUMN)
{
+                if (immutableStorageScheme != null && immutableStorageScheme != ImmutableStorageScheme.ONE_CELL_PER_COLUMN)
{
                     Put put = new Put(this.key);
                     if (isWALDisabled()) {
                         put.setDurability(Durability.SKIP_WAL);
@@ -1300,11 +1301,13 @@ public class PTableImpl implements PTable {
         if (table.hasIsAppendOnlySchema()) {
             isAppendOnlySchema = table.getIsAppendOnlySchema();
         }
-        ImmutableStorageScheme storageScheme = null;
+        // For backward compatibility. Clients older than 4.10 will always have non-encoded
immutable tables.
+        ImmutableStorageScheme storageScheme = ImmutableStorageScheme.ONE_CELL_PER_COLUMN;
         if (table.hasStorageScheme()) {
             storageScheme = ImmutableStorageScheme.fromSerializedValue(table.getStorageScheme().toByteArray()[0]);
         }
-        QualifierEncodingScheme qualifierEncodingScheme = null;
+        // For backward compatibility. Clients older than 4.10 will always have non-encoded
qualifiers.
+        QualifierEncodingScheme qualifierEncodingScheme = QualifierEncodingScheme.NON_ENCODED_QUALIFIERS;
         if (table.hasEncodingScheme()) {
             qualifierEncodingScheme = QualifierEncodingScheme.fromSerializedValue(table.getEncodingScheme().toByteArray()[0]);
         }


Mime
View raw message