Repository: phoenix
Updated Branches:
  refs/heads/encodecolumns c7a425df4 -> ff15ee8c7


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

Branch: refs/heads/encodecolumns
Commit: ff15ee8c7f19a7b8eac3025a7b7d8e69d8b8d39d
Parents: c7a425d
Author: Samarth <[email protected]>
Authored: Fri Apr 8 00:18:11 2016 -0700
Committer: Samarth <[email protected]>
Committed: Fri Apr 8 00:18:11 2016 -0700

----------------------------------------------------------------------
 .../phoenix/end2end/AlterTableWithViewsIT.java  |  6 +--
 .../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, 45 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ff15ee8c/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 8633fbe..682779f 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;
@@ -1344,8 +1344,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);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/ff15ee8c/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 b28935e..f180e34 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;
@@ -515,8 +515,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/ff15ee8c/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/ff15ee8c/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 71c3d7f..902012d 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;
@@ -254,6 +255,7 @@ public class MetaDataEndpointImpl extends MetaDataProtocol 
implements Coprocesso
     private static final KeyValue TRANSACTIONAL_KV = 
createFirstOnRow(ByteUtil.EMPTY_BYTE_ARRAY, TABLE_FAMILY_BYTES, 
TRANSACTIONAL_BYTES);
     private static final KeyValue UPDATE_CACHE_FREQUENCY_KV = 
createFirstOnRow(ByteUtil.EMPTY_BYTE_ARRAY, TABLE_FAMILY_BYTES, 
UPDATE_CACHE_FREQUENCY_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,
@@ -871,37 +873,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.getTableName(
                 schemaName.getString(), tableName.getString())) : 
physicalTables.get(0);
@@ -925,6 +918,12 @@ public class MetaDataEndpointImpl extends MetaDataProtocol 
implements Coprocesso
             stats, baseColumnCount, indexDisableTimestamp, storageScheme, 
encodedColumnQualifierCounters);
     }
 
+    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();
@@ -2899,10 +2898,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/ff15ee8c/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/ff15ee8c/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 0a756c2..15da871 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
@@ -294,8 +294,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/ff15ee8c/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/ff15ee8c/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 11f52b5..d2df1c4 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;
@@ -272,7 +272,7 @@ public interface QueryConstants {
             UPDATE_CACHE_FREQUENCY + " BIGINT," +
             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/ff15ee8c/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 54e2861..7943478 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;
@@ -283,7 +283,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 + "\"( " +
@@ -1922,19 +1922,19 @@ 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);
                 }
                 if (parent != null) {
                     storageScheme = parent.getStorageScheme();
-                } else if (hbaseTableAlreadyExists) {
+                } else if (tableExists) {
                     storageScheme = StorageScheme.NON_ENCODED_COLUMN_NAMES;
                 } else {
                     storageScheme = StorageScheme.ENCODED_COLUMN_NAMES;

Reply via email to