Repository: phoenix Updated Branches: refs/heads/5.x-HBase-2.0 475798219 -> 0ca498ea1
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/0ca498ea Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/0ca498ea Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/0ca498ea Branch: refs/heads/5.x-HBase-2.0 Commit: 0ca498ea11b732edddefa95521497eb045fda54f Parents: 4757982 Author: James Taylor <[email protected]> Authored: Tue Feb 13 14:29:02 2018 -0800 Committer: James Taylor <[email protected]> Committed: Tue Feb 13 14:39:12 2018 -0800 ---------------------------------------------------------------------- .../apache/phoenix/end2end/DynamicColumnIT.java | 2 +- .../phoenix/end2end/MappingTableDataTypeIT.java | 2 +- .../end2end/NamespaceSchemaMappingIT.java | 19 ++++++++---------- .../apache/phoenix/schema/MetaDataClient.java | 21 +------------------- 4 files changed, 11 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/0ca498ea/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 747107a..a93a3bb 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/0ca498ea/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 f064730..ad91126 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 @@ -116,7 +116,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/0ca498ea/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 7d24cdd..ff2d30a 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.TableDescriptorBuilder; 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; @@ -54,7 +54,7 @@ public class NamespaceSchemaMappingIT extends ParallelStatsDisabledIT { @Test public void testBackWardCompatibility() throws Exception { - String namespace = "TEST_SCHEMA"; + String namespace = generateUniqueName(); String schemaName = namespace; String tableName = generateUniqueName(); @@ -72,24 +72,24 @@ public class NamespaceSchemaMappingIT extends ParallelStatsDisabledIT { QueryConstants.EMPTY_COLUMN_VALUE_BYTES); Table phoenixSchematable = admin.getConnection().getTable(TableName.valueOf(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(); Table namespaceMappedtable = admin.getConnection().getTable(TableName.valueOf(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(); Table metatable = admin.getConnection().getTable( SchemaUtil.getPhysicalName(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME_BYTES, @@ -105,9 +105,6 @@ public class NamespaceSchemaMappingIT extends ParallelStatsDisabledIT { rs = conn.createStatement().executeQuery(query); assertTrue(rs.next()); assertEquals(hbaseFullTableName, rs.getString(1)); - admin.disableTable(TableName.valueOf(phoenixFullTableName)); - admin.deleteTable(TableName.valueOf(phoenixFullTableName)); - conn.createStatement().execute("DROP TABLE " + phoenixFullTableName); admin.close(); conn.close(); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/0ca498ea/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 46998c4..114af37 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 @@ -2215,27 +2215,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 { - TableDescriptor 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 {
