phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sama...@apache.org
Subject [52/52] [abbrv] phoenix git commit: Fix disabling of indexes on write failures
Date Mon, 25 Apr 2016 18:53:36 GMT
Fix disabling of indexes on write failures


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

Branch: refs/heads/encodecolumns
Commit: 227ba1d69bb0c0643a66c8c44a05a5e6497d2519
Parents: d8488ef
Author: Samarth <samarth.jain@salesforce.com>
Authored: Fri Apr 8 00:18:11 2016 -0700
Committer: Samarth <samarth.jain@salesforce.com>
Committed: Mon Apr 25 11:51:32 2016 -0700

----------------------------------------------------------------------
 .../phoenix/end2end/AlterTableWithViewsIT.java  |  8 ++--
 .../apache/phoenix/end2end/CreateTableIT.java   |  6 +--
 .../end2end/index/txn/MutableRollbackIT.java    |  2 +-
 .../coprocessor/MetaDataEndpointImpl.java       | 50 +++++++++-----------
 .../example/CoveredColumnIndexCodec.java        |  1 -
 .../phoenix/jdbc/PhoenixDatabaseMetaData.java   |  4 +-
 .../mapreduce/FormatToKeyValueReducer.java      |  8 +++-
 .../apache/phoenix/query/QueryConstants.java    |  4 +-
 .../apache/phoenix/schema/MetaDataClient.java   | 10 ++--
 9 files changed, 46 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/227ba1d6/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
index 6deab29..9295f51 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
@@ -21,7 +21,7 @@ import static org.apache.phoenix.exception.SQLExceptionCode.CANNOT_MUTATE_TABLE;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_FAMILY;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_NAME;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ENCODED_COLUMN_QUALIFIER;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ENCODED_COLUMN_QUALIFIER_COUNTER;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_QUALIFIER_COUNTER;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_NAME;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_SCHEM;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_SEQ_NUM;
@@ -860,8 +860,8 @@ public class AlterTableWithViewsIT extends BaseHBaseManagedTimeIT {
     }
     
     private void assertEncodedCQCounter(String columnFamily, String schemaName, String tableName,
int expectedValue) throws Exception {
-        String query = "SELECT " + ENCODED_COLUMN_QUALIFIER_COUNTER + " FROM SYSTEM.CATALOG
WHERE " + TABLE_SCHEM + " = ? AND " + TABLE_NAME
-                + " = ? " + " AND " + COLUMN_FAMILY + " = ? AND " + ENCODED_COLUMN_QUALIFIER_COUNTER
+ " IS NOT NULL";
+        String query = "SELECT " + COLUMN_QUALIFIER_COUNTER + " FROM SYSTEM.CATALOG WHERE
" + TABLE_SCHEM + " = ? AND " + TABLE_NAME
+                + " = ? " + " AND " + COLUMN_FAMILY + " = ? AND " + COLUMN_QUALIFIER_COUNTER
+ " IS NOT NULL";
         try (Connection conn = DriverManager.getConnection(getUrl())) {
             PreparedStatement stmt = conn.prepareStatement(query);
             stmt.setString(1, schemaName);
@@ -889,4 +889,4 @@ public class AlterTableWithViewsIT extends BaseHBaseManagedTimeIT {
         }
     }
     
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/phoenix/blob/227ba1d6/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java
index 0ab47f0..6055b1c 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java
@@ -21,7 +21,7 @@ import static org.apache.hadoop.hbase.HColumnDescriptor.DEFAULT_REPLICATION_SCOP
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_FAMILY;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_NAME;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ENCODED_COLUMN_QUALIFIER;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ENCODED_COLUMN_QUALIFIER_COUNTER;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_QUALIFIER_COUNTER;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_NAME;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_SCHEM;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_SEQ_NUM;
@@ -582,8 +582,8 @@ public class CreateTableIT extends BaseClientManagedTimeIT {
     }
     
     private void assertColumnFamilyCounter(String columnFamily, String schemaName, String
tableName, int expectedValue) throws Exception {
-        String query = "SELECT " + ENCODED_COLUMN_QUALIFIER_COUNTER + " FROM SYSTEM.CATALOG
WHERE " + TABLE_SCHEM + " = ? AND " + TABLE_NAME
-                + " = ? " + " AND " + COLUMN_FAMILY + " = ? AND " + ENCODED_COLUMN_QUALIFIER_COUNTER
+ " IS NOT NULL";
+        String query = "SELECT " + COLUMN_QUALIFIER_COUNTER + " FROM SYSTEM.CATALOG WHERE
" + TABLE_SCHEM + " = ? AND " + TABLE_NAME
+                + " = ? " + " AND " + COLUMN_FAMILY + " = ? AND " + COLUMN_QUALIFIER_COUNTER
+ " IS NOT NULL";
         try (Connection conn = DriverManager.getConnection(getUrl())) {
             PreparedStatement stmt = conn.prepareStatement(query);
             stmt.setString(1, schemaName);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/227ba1d6/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/MutableRollbackIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/MutableRollbackIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/MutableRollbackIT.java
index 767c4e0..e675dda 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/MutableRollbackIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/MutableRollbackIT.java
@@ -278,7 +278,7 @@ public class MutableRollbackIT extends BaseHBaseManagedTimeIT {
             assertFalse(rs.next());
             
             //assert no rows exists in indexName2
-            rs = stmt.executeQuery("select * from " + fullTableName2);
+            rs = stmt.executeQuery("select /*+ INDEX(" + indexName1 + ")*/ k, v1 from " +
fullTableName2);
             assertFalse(rs.next());
             
             stmt.executeUpdate("upsert into " + fullTableName1 + " values('x', 'z', 'a')");

http://git-wip-us.apache.org/repos/asf/phoenix/blob/227ba1d6/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index 1d2c0d3..36e04b5 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@ -33,6 +33,7 @@ import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DEFAULT_COLUMN_FAM
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DEFAULT_VALUE_BYTES;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DISABLE_WAL_BYTES;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ENCODED_COLUMN_QUALIFIER_BYTES;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_QUALIFIER_COUNTER_BYTES;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.FAMILY_NAME_INDEX;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IMMUTABLE_ROWS_BYTES;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.INDEX_DISABLE_TIMESTAMP_BYTES;
@@ -274,6 +275,7 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements
Coprocesso
     private static final KeyValue IS_NAMESPACE_MAPPED_KV = createFirstOnRow(ByteUtil.EMPTY_BYTE_ARRAY,
             TABLE_FAMILY_BYTES, IS_NAMESPACE_MAPPED_BYTES);
     private static final KeyValue STORAGE_SCHEME_KV = createFirstOnRow(ByteUtil.EMPTY_BYTE_ARRAY,
TABLE_FAMILY_BYTES, STORAGE_SCHEME_BYTES);
+    private static final KeyValue QUALIIFIER_COUNTER_KV = createFirstOnRow(ByteUtil.EMPTY_BYTE_ARRAY,
TABLE_FAMILY_BYTES, COLUMN_QUALIFIER_COUNTER_BYTES);
     
     private static final List<KeyValue> TABLE_KV_COLUMNS = Arrays.<KeyValue>asList(
             EMPTY_KEYVALUE_KV,
@@ -930,37 +932,28 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements
Coprocesso
               break;
           }
           Cell colKv = results.get(LINK_TYPE_INDEX);
-          Cell qualifierCounterKv = null;
-          if (storageScheme == StorageScheme.ENCODED_COLUMN_NAMES) {
-              int index = tableType == PTableType.VIEW ? 1 : 0;
-              qualifierCounterKv = results.get(index);
-          }
           if (colKv != null) {
               int colKeyLength = colKv.getRowLength();
               PName colName = newPName(colKv.getRowArray(), colKv.getRowOffset() + offset,
colKeyLength-offset);
               int colKeyOffset = offset + colName.getBytes().length + 1;
               PName famName = newPName(colKv.getRowArray(), colKv.getRowOffset() + colKeyOffset,
colKeyLength-colKeyOffset);
-              if (colName.getString().isEmpty() && famName != null) {
-                  LinkType linkType = LinkType.fromSerializedValue(colKv.getValueArray()[colKv.getValueOffset()]);
-                  if (linkType == LinkType.INDEX_TABLE) {
-                      addIndexToTable(tenantId, schemaName, famName, tableName, clientTimeStamp,
indexes);
-                  } else if (linkType == LinkType.PHYSICAL_TABLE) {
-                      physicalTables.add(famName);
-                  }
-              } else {
+                if (colName.getString().isEmpty() && famName != null) {
+                    if (isQualifierCounterKv(colKv)) {
+                        Integer counter = (Integer)PInteger.INSTANCE.toObject(colKv.getValueArray(),
+                                colKv.getValueOffset(), colKv.getValueLength());
+                        encodedColumnQualifierCounters.put(famName.getString(), counter);
+                    } else {
+                        LinkType linkType = LinkType.fromSerializedValue(colKv.getValueArray()[colKv.getValueOffset()]);
+                        if (linkType == LinkType.INDEX_TABLE) {
+                            addIndexToTable(tenantId, schemaName, famName, tableName, clientTimeStamp,
indexes);
+                        } else if (linkType == LinkType.PHYSICAL_TABLE) {
+                            physicalTables.add(famName);
+                        }
+                    }
+                } else {
                   addColumnToTable(results, colName, famName, colKeyValues, columns, saltBucketNum
!= null);
               }
           } 
-          if (qualifierCounterKv != null) {
-              int length = qualifierCounterKv.getRowLength();
-              PName colName = newPName(qualifierCounterKv.getRowArray(), qualifierCounterKv.getRowOffset()
+ offset, length - offset);
-              int colKeyOffset = offset + colName.getBytes().length + 1;
-              PName famName = newPName(qualifierCounterKv.getRowArray(), qualifierCounterKv.getRowOffset()
+ colKeyOffset, length - colKeyOffset);
-              if (colName.getString().isEmpty() && famName != null) {
-                  Integer counter = (Integer)PInteger.INSTANCE.toObject(qualifierCounterKv.getValueArray(),
qualifierCounterKv.getValueOffset(), qualifierCounterKv.getValueLength());
-                  encodedColumnQualifierCounters.put(famName.getString(), counter);
-              }
-          }
         }
         PName physicalTableName = physicalTables.isEmpty() ? PNameFactory.newName(SchemaUtil.getPhysicalTableName(
                 Bytes.toBytes(SchemaUtil.getTableName(schemaName.getBytes(), tableName.getBytes())),
isNamespaceMapped)
@@ -1008,6 +1001,12 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements
Coprocesso
         return new PSchema(schemaName.getString(), timeStamp);
     }
 
+    private static boolean isQualifierCounterKv(Cell colKv) {
+        return Bytes.compareTo(colKv.getQualifierArray(), colKv.getQualifierOffset(),
+                colKv.getQualifierLength(), QUALIIFIER_COUNTER_KV.getQualifierArray(),
+                QUALIIFIER_COUNTER_KV.getQualifierOffset(), QUALIIFIER_COUNTER_KV.getQualifierLength())
== 0;
+    }
+
     private PFunction getFunction(RegionScanner scanner, final boolean isReplace, long clientTimeStamp,
List<Mutation> deleteMutationsForReplace)
             throws IOException, SQLException {
         List<Cell> results = Lists.newArrayList();
@@ -3244,10 +3243,7 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements
Coprocesso
                         tableMetadata = new ArrayList<Mutation>(tableMetadata);
                         // insert an empty KV to trigger time stamp update on data table
row
                         Put p = new Put(dataTableKey);
-                        // Decide on what column qualifier to use for empty key value.
-                        PTable currentTable = doGetTable(key, HConstants.LATEST_TIMESTAMP,
rowLock);
-                        Pair<byte[], byte[]> emptyKeyValuePair = EncodedColumnsUtil.getEmptyKeyValueInfo(currentTable);
-                        p.add(TABLE_FAMILY_BYTES, emptyKeyValuePair.getFirst(), timeStamp,
emptyKeyValuePair.getSecond());
+                        p.add(TABLE_FAMILY_BYTES, QueryConstants.EMPTY_COLUMN_BYTES, timeStamp,
QueryConstants.EMPTY_COLUMN_VALUE_BYTES);
                         tableMetadata.add(p);
                     }
                     boolean setRowKeyOrderOptimizableCell = newState == PIndexState.BUILDING
&& !rowKeyOrderOptimizable;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/227ba1d6/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/example/CoveredColumnIndexCodec.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/example/CoveredColumnIndexCodec.java
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/example/CoveredColumnIndexCodec.java
index 6f9caa6..0f960e4 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/example/CoveredColumnIndexCodec.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/example/CoveredColumnIndexCodec.java
@@ -32,7 +32,6 @@ import org.apache.phoenix.hbase.index.covered.TableState;
 import org.apache.phoenix.hbase.index.scanner.Scanner;
 
 import com.google.common.collect.Lists;
-import com.google.common.collect.Lists;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/phoenix/blob/227ba1d6/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
index b528f0b..1c9bc51 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
@@ -297,8 +297,8 @@ public class PhoenixDatabaseMetaData implements DatabaseMetaData {
     public static final byte[] STORAGE_SCHEME_BYTES = Bytes.toBytes(STORAGE_SCHEME);
     public static final String ENCODED_COLUMN_QUALIFIER = "COLUMN_QUALIFIER";
     public static final byte[] ENCODED_COLUMN_QUALIFIER_BYTES = Bytes.toBytes(ENCODED_COLUMN_QUALIFIER);
-    public static final String ENCODED_COLUMN_QUALIFIER_COUNTER = "QUALIFIER_COUNTER";
-    public static final byte[] ENCODED_COLUMN_QUALIFIER_COUNTER_BYTES = Bytes.toBytes(ENCODED_COLUMN_QUALIFIER_COUNTER);
+    public static final String COLUMN_QUALIFIER_COUNTER = "QUALIFIER_COUNTER";
+    public static final byte[] COLUMN_QUALIFIER_COUNTER_BYTES = Bytes.toBytes(COLUMN_QUALIFIER_COUNTER);
     
     private final PhoenixConnection connection;
     private final ResultSet emptyResultSet;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/227ba1d6/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToKeyValueReducer.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToKeyValueReducer.java
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToKeyValueReducer.java
index ddf6120..89d59a4 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToKeyValueReducer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToKeyValueReducer.java
@@ -66,6 +66,7 @@ public class FormatToKeyValueReducer
     protected KeyValueBuilder builder;
     List<List<Pair<byte[], byte[]>>> columnIndexes;
     List<ImmutableBytesPtr> emptyFamilyName;
+    List<Pair<byte[], byte[]>> emptyKeyValueQualifier;
 
 
     @Override
@@ -87,7 +88,8 @@ public class FormatToKeyValueReducer
             logicalNames = TargetTableRefFunctions.NAMES_FROM_JSON.apply(logicalNamesConf);
 
             columnIndexes = new ArrayList<>(tableNames.size());
-            emptyFamilyName = new ArrayList<>();
+            emptyFamilyName = new ArrayList<>(logicalNames.size());
+            emptyKeyValueQualifier = new ArrayList<>(logicalNames.size()); 
             initColumnsMap(conn);
         } catch (SQLException | ClassNotFoundException e) {
             throw new RuntimeException(e);
@@ -98,6 +100,7 @@ public class FormatToKeyValueReducer
         for (String tableName : logicalNames) {
             PTable table = PhoenixRuntime.getTable(conn, tableName);
             emptyFamilyName.add(SchemaUtil.getEmptyColumnFamilyPtr(table));
+            emptyKeyValueQualifier.add(EncodedColumnsUtil.getEmptyKeyValueInfo(table));
             List<PColumn> cls = table.getColumns();
             List<Pair<byte[], byte[]>> list = new ArrayList<>(cls.size());
             for (int i = 0; i < cls.size(); i++) {
@@ -153,10 +156,11 @@ public class FormatToKeyValueReducer
                 }
                 map.add(kv);
             }
+            Pair<byte[], byte[]> emptyKeyValue = emptyKeyValueQualifier.get(tableIndex);
             //FIXME: samarth need to supply the right empty column qualifier here.
             KeyValue empty = builder.buildPut(key.getRowkey(),
                     emptyFamilyName.get(tableIndex),
-                    QueryConstants.EMPTY_COLUMN_BYTES_PTR, ByteUtil.EMPTY_BYTE_ARRAY_PTR);
+                    new ImmutableBytesPtr(emptyKeyValue.getFirst()), new ImmutableBytesPtr(emptyKeyValue.getSecond()));
             map.add(empty);
             Closeables.closeQuietly(input);
         }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/227ba1d6/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 3733c5b..f57043b 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
@@ -39,7 +39,7 @@ import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DECIMAL_DIGITS;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DEFAULT_COLUMN_FAMILY_NAME;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DEFAULT_VALUE;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DISABLE_WAL;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ENCODED_COLUMN_QUALIFIER_COUNTER;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_QUALIFIER_COUNTER;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.FUNCTION_NAME;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.GUIDE_POSTS_ROW_COUNT;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.GUIDE_POSTS_WIDTH;
@@ -280,7 +280,7 @@ public interface QueryConstants {
             IS_NAMESPACE_MAPPED + " BOOLEAN," +
             ENCODED_COLUMN_QUALIFIER + " INTEGER," +
             STORAGE_SCHEME + " TINYINT, " + 
-            ENCODED_COLUMN_QUALIFIER_COUNTER + " INTEGER, " +
+            COLUMN_QUALIFIER_COUNTER + " INTEGER, " +
             "CONSTRAINT " + SYSTEM_TABLE_PK_NAME + " PRIMARY KEY (" + TENANT_ID + ","
             + TABLE_SCHEM + "," + TABLE_NAME + "," + COLUMN_NAME + "," + COLUMN_FAMILY +
"))\n" +
             HConstants.VERSIONS + "=" + MetaDataProtocol.DEFAULT_MAX_META_DATA_VERSIONS +
",\n" +

http://git-wip-us.apache.org/repos/asf/phoenix/blob/227ba1d6/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index a612e42..70a1d6e 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -41,7 +41,7 @@ import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DECIMAL_DIGITS;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DEFAULT_COLUMN_FAMILY_NAME;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DEFAULT_VALUE;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DISABLE_WAL;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ENCODED_COLUMN_QUALIFIER_COUNTER;
+import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_QUALIFIER_COUNTER;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.FUNCTION_NAME;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IMMUTABLE_ROWS;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.INDEX_DISABLE_TIMESTAMP;
@@ -294,7 +294,7 @@ public class MetaDataClient {
             TABLE_SCHEM + "," +
             TABLE_NAME + "," +
             COLUMN_FAMILY + "," +
-            ENCODED_COLUMN_QUALIFIER_COUNTER + 
+            COLUMN_QUALIFIER_COUNTER + 
             ") VALUES (?, ?, ?, ?)";
     private static final String INCREMENT_SEQ_NUM =
             "UPSERT INTO " + SYSTEM_CATALOG_SCHEMA + ".\"" + SYSTEM_CATALOG_TABLE + "\"(
" +
@@ -1966,12 +1966,12 @@ public class MetaDataClient {
                  * the column qualifiers that were used when populating the hbase table.
                  */
                 byte[] tableNameBytes = SchemaUtil.getTableNameAsBytes(schemaName, tableName);
-                boolean hbaseTableAlreadyExists = true;
+                boolean tableExists = true;
                 try (HBaseAdmin admin = connection.getQueryServices().getAdmin()) {
                     try {
                         admin.getTableDescriptor(tableNameBytes);
                     } catch (org.apache.hadoop.hbase.TableNotFoundException e) {
-                        hbaseTableAlreadyExists = false;
+                        tableExists = false;
                     }
                 } catch (IOException e) {
                     throw new RuntimeException(e);
@@ -1980,7 +1980,7 @@ public class MetaDataClient {
                 }
                 if (parent != null) {
                     storageScheme = parent.getStorageScheme();
-                } else if (hbaseTableAlreadyExists) {
+                } else if (tableExists) {
                     storageScheme = StorageScheme.NON_ENCODED_COLUMN_NAMES;
                 } else {
                     storageScheme = StorageScheme.ENCODED_COLUMN_NAMES;


Mime
View raw message