Repository: phoenix
Updated Branches:
  refs/heads/4.x-cdh5.11.2 e1566570a -> b36ad75a2


PHOENIX-4603 Remove check for table existence in 
MetaDataClient.createTableInternal()


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

Branch: refs/heads/4.x-cdh5.11.2
Commit: b36ad75a2d0146a62274179f68a029a4b0c602e3
Parents: e156657
Author: James Taylor <jtay...@salesforce.com>
Authored: Tue Feb 13 14:29:02 2018 -0800
Committer: James Taylor <jtay...@salesforce.com>
Committed: Tue Feb 13 14:34:18 2018 -0800

----------------------------------------------------------------------
 .../apache/phoenix/end2end/DynamicColumnIT.java |  2 +-
 .../phoenix/end2end/MappingTableDataTypeIT.java |  2 +-
 .../end2end/NamespaceSchemaMappingIT.java       | 19 +++++++---------
 .../apache/phoenix/schema/MetaDataClient.java   | 23 +-------------------
 4 files changed, 11 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b36ad75a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicColumnIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicColumnIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicColumnIT.java
index 3f02113..f55d01a 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicColumnIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicColumnIT.java
@@ -106,7 +106,7 @@ public class DynamicColumnIT extends 
ParallelStatsDisabledIT {
                 "    A.F1v1 varchar," +
                 "    A.F1v2 varchar," +
                 "    B.F2v1 varchar" +
-                "    CONSTRAINT pk PRIMARY KEY (entry))");
+                "    CONSTRAINT pk PRIMARY KEY (entry)) 
COLUMN_ENCODED_BYTES=NONE");
             }
 
         }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b36ad75a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MappingTableDataTypeIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MappingTableDataTypeIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MappingTableDataTypeIT.java
index 768b005..52e22bf 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MappingTableDataTypeIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MappingTableDataTypeIT.java
@@ -119,7 +119,7 @@ public class MappingTableDataTypeIT extends 
ParallelStatsDisabledIT {
      */
     private void createPhoenixTable(String tableName) throws SQLException {
         String ddl = "create table IF NOT EXISTS " + tableName+ " (" + " id 
varchar NOT NULL primary key,"
-                + " \"cf1\".\"q1\" varchar" + " ) ";
+                + " \"cf1\".\"q1\" varchar" + " ) COLUMN_ENCODED_BYTES=NONE";
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
         conn.createStatement().execute(ddl);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b36ad75a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NamespaceSchemaMappingIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NamespaceSchemaMappingIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NamespaceSchemaMappingIT.java
index 31647bf..961c0a0 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NamespaceSchemaMappingIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NamespaceSchemaMappingIT.java
@@ -35,9 +35,9 @@ import org.apache.hadoop.hbase.client.Put;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
 import org.apache.phoenix.query.QueryConstants;
-import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.schema.types.PBoolean;
 import org.apache.phoenix.schema.types.PVarchar;
+import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.SchemaUtil;
 import org.apache.phoenix.util.TestUtil;
 import org.junit.Test;
@@ -55,7 +55,7 @@ public class NamespaceSchemaMappingIT extends 
ParallelStatsDisabledIT {
     @SuppressWarnings("deprecation")
     public void testBackWardCompatibility() throws Exception {
 
-        String namespace = "TEST_SCHEMA";
+        String namespace = generateUniqueName();
         String schemaName = namespace;
         String tableName = generateUniqueName();
 
@@ -74,24 +74,24 @@ public class NamespaceSchemaMappingIT extends 
ParallelStatsDisabledIT {
                 QueryConstants.EMPTY_COLUMN_VALUE_BYTES);
         HTable phoenixSchematable = new HTable(admin.getConfiguration(), 
phoenixFullTableName);
         phoenixSchematable.put(put);
-        phoenixSchematable.close();
         put = new Put(PVarchar.INSTANCE.toBytes(hbaseFullTableName));
         put.addColumn(QueryConstants.DEFAULT_COLUMN_FAMILY_BYTES, 
QueryConstants.EMPTY_COLUMN_BYTES,
                 QueryConstants.EMPTY_COLUMN_VALUE_BYTES);
-        phoenixSchematable.close();
         HTable namespaceMappedtable = new HTable(admin.getConfiguration(), 
hbaseFullTableName);
         namespaceMappedtable.put(put);
-        namespaceMappedtable.close();
-        Properties props = new Properties();
-        props.setProperty(QueryServices.DROP_METADATA_ATTRIB, 
Boolean.TRUE.toString());
+        Properties props = PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
-        String ddl = "create table " + phoenixFullTableName + "(tableName 
varchar primary key)";
+        String ddl = "create table " + phoenixFullTableName + "(tableName 
varchar primary key) COLUMN_ENCODED_BYTES=NONE";
         conn.createStatement().execute(ddl);
         String query = "select tableName from " + phoenixFullTableName;
 
         ResultSet rs = conn.createStatement().executeQuery(query);
+        TestUtil.dumpTable(namespaceMappedtable);
+        TestUtil.dumpTable(phoenixSchematable);
         assertTrue(rs.next());
         assertEquals(phoenixFullTableName, rs.getString(1));
+        namespaceMappedtable.close();
+        phoenixSchematable.close();
 
         HTable metatable = new HTable(admin.getConfiguration(),
                 
SchemaUtil.getPhysicalName(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME_BYTES,
@@ -107,9 +107,6 @@ public class NamespaceSchemaMappingIT extends 
ParallelStatsDisabledIT {
         rs = conn.createStatement().executeQuery(query);
         assertTrue(rs.next());
         assertEquals(hbaseFullTableName, rs.getString(1));
-        admin.disableTable(phoenixFullTableName);
-        admin.deleteTable(phoenixFullTableName);
-        conn.createStatement().execute("DROP TABLE " + phoenixFullTableName);
         admin.close();
         conn.close();
     }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/b36ad75a/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 403cbfe..9bf6dc9 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
@@ -113,7 +113,6 @@ import java.sql.SQLException;
 import java.sql.SQLFeatureNotSupportedException;
 import java.sql.Types;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.BitSet;
 import java.util.Collection;
 import java.util.Collections;
@@ -134,7 +133,6 @@ import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.client.ClusterConnection;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.client.HConnection;
 import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Scan;
@@ -2223,27 +2221,8 @@ public class MetaDataClient {
                  * partitioned by the virtue of indexId present in the row 
key. As such, different shared indexes can use
                  * potentially overlapping column qualifiers.
                  * 
-                 * If the hbase table already exists, then possibly encoded or 
non-encoded column qualifiers were used. 
-                 * In this case we pursue ahead with non-encoded column 
qualifier scheme. If the phoenix metadata for this table already exists 
-                 * then we rely on the PTable, with appropriate storage 
scheme, returned in the MetadataMutationResult to be updated 
-                 * in the client cache. If the phoenix table metadata already 
doesn't exist then the non-encoded column qualifier scheme works
-                 * because we cannot control the column qualifiers that were 
used when populating the hbase table.
                  */
-                
-                byte[] tableNameBytes = 
SchemaUtil.getTableNameAsBytes(schemaName, tableName);
-                boolean tableExists = true;
-                try {
-                    HTableDescriptor tableDescriptor = 
connection.getQueryServices().getTableDescriptor(tableNameBytes);
-                    if (tableDescriptor == null) { // for connectionless
-                        tableExists = false;
-                    }
-                } catch (org.apache.phoenix.schema.TableNotFoundException e) {
-                    tableExists = false;
-                }
-                if (tableExists) {
-                    encodingScheme = NON_ENCODED_QUALIFIERS;
-                    immutableStorageScheme = ONE_CELL_PER_COLUMN;
-                } else if (parent != null) {
+                if (parent != null) {
                     encodingScheme = parent.getEncodingScheme();
                     immutableStorageScheme = 
parent.getImmutableStorageScheme();
                 } else {

Reply via email to