Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 4159f6aec -> 601dae52c
http://git-wip-us.apache.org/repos/asf/phoenix/blob/601dae52/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index b086113..2e49122 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -82,7 +82,6 @@ import org.apache.hadoop.hbase.ipc.BlockingRpcCallback; import org.apache.hadoop.hbase.ipc.ServerRpcController; import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto; import org.apache.hadoop.hbase.regionserver.IndexHalfStoreFileReaderGenerator; -import org.apache.hadoop.hbase.regionserver.LocalIndexSplitter; import org.apache.hadoop.hbase.security.User; import org.apache.hadoop.hbase.util.ByteStringer; import org.apache.hadoop.hbase.util.Bytes; @@ -850,18 +849,14 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement null, priority, null); } - if (descriptor.getValue(MetaDataUtil.IS_LOCAL_INDEX_TABLE_PROP_BYTES) != null - && Boolean.TRUE.equals(PBoolean.INSTANCE.toObject(descriptor - .getValue(MetaDataUtil.IS_LOCAL_INDEX_TABLE_PROP_BYTES)))) { - if (!descriptor.hasCoprocessor(IndexHalfStoreFileReaderGenerator.class.getName())) { - descriptor.addCoprocessor(IndexHalfStoreFileReaderGenerator.class.getName(), - null, priority, null); - } - } else { - if (!descriptor.hasCoprocessor(LocalIndexSplitter.class.getName()) - && !SchemaUtil.isMetaTable(tableName) - && !SchemaUtil.isSequenceTable(tableName)) { - descriptor.addCoprocessor(LocalIndexSplitter.class.getName(), null, priority, null); + Set<byte[]> familiesKeys = descriptor.getFamiliesKeys(); + for(byte[] family: familiesKeys) { + if(Bytes.toString(family).startsWith(QueryConstants.LOCAL_INDEX_COLUMN_FAMILY_PREFIX)) { + if (!descriptor.hasCoprocessor(IndexHalfStoreFileReaderGenerator.class.getName())) { + descriptor.addCoprocessor(IndexHalfStoreFileReaderGenerator.class.getName(), + null, priority, null); + break; + } } } @@ -1071,8 +1066,19 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement } else { if (isMetaTable) { checkClientServerCompatibility(SchemaUtil.getPhysicalName(SYSTEM_CATALOG_NAME_BYTES, this.getProps()).getName()); + } else { + for(Pair<byte[],Map<String,Object>> family: families) { + if ((newDesc.getValue(HTableDescriptor.SPLIT_POLICY)==null || !newDesc.getValue(HTableDescriptor.SPLIT_POLICY).equals( + IndexRegionSplitPolicy.class.getName())) + && Bytes.toString(family.getFirst()).startsWith( + QueryConstants.LOCAL_INDEX_COLUMN_FAMILY_PREFIX)) { + newDesc.setValue(HTableDescriptor.SPLIT_POLICY, IndexRegionSplitPolicy.class.getName()); + break; + } + } } + if (!modifyExistingMetaData) { return existingDesc; // Caller already knows that no metadata was changed } @@ -1311,60 +1317,6 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement } } - private void ensureLocalIndexTableCreated(byte[] physicalTableName, Map<String, Object> tableProps, - List<Pair<byte[], Map<String, Object>>> families, byte[][] splits, long timestamp, - boolean isNamespaceMapped) throws SQLException { - PTable table; - String parentTableName = SchemaUtil - .getParentTableNameFromIndexTable(Bytes.toString(physicalTableName), - MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX) - .replace(QueryConstants.NAMESPACE_SEPARATOR, QueryConstants.NAME_SEPARATOR); - try { - synchronized (latestMetaDataLock) { - throwConnectionClosedIfNullMetaData(); - table = latestMetaData.getTableRef(new PTableKey(PName.EMPTY_NAME, parentTableName)).getTable(); - latestMetaDataLock.notifyAll(); - } - if (table.getTimeStamp() >= timestamp) { // Table in cache is newer than client timestamp which shouldn't be the case - throw new TableNotFoundException(table.getSchemaName().getString(), table.getTableName().getString()); - } - } catch (TableNotFoundException e) { - byte[] schemaName = Bytes.toBytes(SchemaUtil.getSchemaNameFromFullName(parentTableName)); - byte[] tableName = Bytes.toBytes(SchemaUtil.getTableNameFromFullName(parentTableName)); - MetaDataMutationResult result = this.getTable(null, schemaName, tableName, HConstants.LATEST_TIMESTAMP, timestamp); - table = result.getTable(); - if (table == null) { - throw e; - } - } - ensureLocalIndexTableCreated(physicalTableName, tableProps, families, splits, isNamespaceMapped); - } - - private void ensureLocalIndexTableCreated(byte[] physicalTableName, Map<String, Object> tableProps, - List<Pair<byte[], Map<String, Object>>> families, byte[][] splits, boolean isNamespaceMapped) - throws SQLException, TableAlreadyExistsException { - - // If we're not allowing local indexes or the hbase version is too low, - // don't create the local index table - if ( !this.getProps().getBoolean(QueryServices.ALLOW_LOCAL_INDEX_ATTRIB, QueryServicesOptions.DEFAULT_ALLOW_LOCAL_INDEX) - || !this.supportsFeature(Feature.LOCAL_INDEX)) { - return; - } - - tableProps.put(MetaDataUtil.IS_LOCAL_INDEX_TABLE_PROP_NAME, TRUE_BYTES_AS_STRING); - HTableDescriptor desc = ensureTableCreated(physicalTableName, PTableType.TABLE, tableProps, families, splits, - true, isNamespaceMapped); - if (desc != null) { - if (!Boolean.TRUE.equals(PBoolean.INSTANCE.toObject(desc.getValue(MetaDataUtil.IS_LOCAL_INDEX_TABLE_PROP_BYTES)))) { - String fullTableName = Bytes.toString(physicalTableName); - throw new TableAlreadyExistsException( - "Unable to create shared physical table for local indexes.", - SchemaUtil.getSchemaNameFromFullName(fullTableName), - SchemaUtil.getTableNameFromFullName(fullTableName)); - } - } - } - private boolean ensureViewIndexTableDropped(byte[] physicalTableName, long timestamp) throws SQLException { byte[] physicalIndexName = MetaDataUtil.getViewIndexPhysicalName(physicalTableName); HTableDescriptor desc = null; @@ -1393,22 +1345,26 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement } private boolean ensureLocalIndexTableDropped(byte[] physicalTableName, long timestamp) throws SQLException { - byte[] physicalIndexName = MetaDataUtil.getLocalIndexPhysicalName(physicalTableName); HTableDescriptor desc = null; boolean wasDeleted = false; try (HBaseAdmin admin = getAdmin()) { try { - desc = admin.getTableDescriptor(physicalIndexName); - if (Boolean.TRUE.equals(PBoolean.INSTANCE.toObject(desc.getValue(MetaDataUtil.IS_LOCAL_INDEX_TABLE_PROP_BYTES)))) { - this.tableStatsCache.invalidate(new ImmutableBytesPtr(physicalIndexName)); - final ReadOnlyProps props = this.getProps(); - final boolean dropMetadata = props.getBoolean(DROP_METADATA_ATTRIB, DEFAULT_DROP_METADATA); - if (dropMetadata) { - admin.disableTable(physicalIndexName); - admin.deleteTable(physicalIndexName); - clearTableRegionCache(physicalIndexName); - wasDeleted = true; + desc = admin.getTableDescriptor(physicalTableName); + this.tableStatsCache.invalidate(new ImmutableBytesPtr(physicalTableName)); + final ReadOnlyProps props = this.getProps(); + final boolean dropMetadata = props.getBoolean(DROP_METADATA_ATTRIB, DEFAULT_DROP_METADATA); + if (dropMetadata) { + List<String> columnFamiles = new ArrayList<String>(); + for(HColumnDescriptor cf : desc.getColumnFamilies()) { + if(cf.getNameAsString().startsWith(QueryConstants.LOCAL_INDEX_COLUMN_FAMILY_PREFIX)) { + columnFamiles.add(cf.getNameAsString()); + } } + for(String cf: columnFamiles) { + admin.deleteColumn(physicalTableName, cf); + } + clearTableRegionCache(physicalTableName); + wasDeleted = true; } } catch (org.apache.hadoop.hbase.TableNotFoundException ignore) { // Ignore, as we may never have created a view index table @@ -1432,9 +1388,14 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement byte[] schemaBytes = rowKeyMetadata[PhoenixDatabaseMetaData.SCHEMA_NAME_INDEX]; byte[] tableBytes = rowKeyMetadata[PhoenixDatabaseMetaData.TABLE_NAME_INDEX]; byte[] tableName = physicalTableName != null ? physicalTableName : SchemaUtil.getTableNameAsBytes(schemaBytes, tableBytes); - boolean localIndexTable = Boolean.TRUE.equals(tableProps.remove(MetaDataUtil.IS_LOCAL_INDEX_TABLE_PROP_NAME)); - - if ((tableType == PTableType.VIEW && physicalTableName != null) || (tableType != PTableType.VIEW && physicalTableName == null)) { + boolean localIndexTable = false; + for(Pair<byte[], Map<String, Object>> family: families) { + if(Bytes.toString(family.getFirst()).startsWith(QueryConstants.LOCAL_INDEX_COLUMN_FAMILY_PREFIX)) { + localIndexTable = true; + break; + } + } + if ((tableType == PTableType.VIEW && physicalTableName != null) || (tableType != PTableType.VIEW && (physicalTableName == null || localIndexTable))) { // For views this will ensure that metadata already exists // For tables and indexes, this will create the metadata if it doesn't already exist ensureTableCreated(tableName, tableType, tableProps, families, splits, true, isNamespaceMapped); @@ -1444,10 +1405,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement // Physical index table created up front for multi tenant // TODO: if viewIndexId is Short.MIN_VALUE, then we don't need to attempt to create it if (physicalTableName != null) { - if (localIndexTable) { - ensureLocalIndexTableCreated(tableName, tableProps, families, splits, - MetaDataUtil.getClientTimeStamp(m), isNamespaceMapped); - } else if (!MetaDataUtil.isMultiTenant(m, kvBuilder, ptr)) { + if (!localIndexTable && !MetaDataUtil.isMultiTenant(m, kvBuilder, ptr)) { ensureViewIndexTableCreated(tenantIdBytes.length == 0 ? null : PNameFactory.newName(tenantIdBytes), physicalTableName, MetaDataUtil.getClientTimeStamp(m), isNamespaceMapped); } @@ -2503,6 +2461,19 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement } if (currentServerSideTableTimeStamp < MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_8_0) { + Properties props = PropertiesUtil.deepCopy(metaConnection.getClientInfo()); + props.remove(PhoenixRuntime.CURRENT_SCN_ATTRIB); + props.remove(PhoenixRuntime.TENANT_ID_ATTRIB); + PhoenixConnection conn = + new PhoenixConnection(ConnectionQueryServicesImpl.this, + metaConnection.getURL(), props, metaConnection + .getMetaDataCache()); + try { + UpgradeUtil.upgradeLocalIndexes(conn, true); + } finally { + if (conn != null) conn.close(); + } + metaConnection = addColumnsIfNotExists(metaConnection, PhoenixDatabaseMetaData.SYSTEM_CATALOG, MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_8_0 - 2, @@ -3646,7 +3617,6 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement return supportsFeature(ConnectionQueryServices.Feature.RENEW_LEASE) && renewLeaseEnabled; } - @Override public HRegionLocation getTableRegionLocation(byte[] tableName, byte[] row) throws SQLException { /* http://git-wip-us.apache.org/repos/asf/phoenix/blob/601dae52/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 4efb708..91c84e0 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 @@ -166,6 +166,7 @@ public interface QueryConstants { public static final byte[] ARRAY_VALUE_COLUMN_QUALIFIER = ByteUtil.EMPTY_BYTE_ARRAY; public static final byte[] TRUE = new byte[] {1}; + /** * Separator used between variable length keys for a composite key. @@ -195,6 +196,16 @@ public interface QueryConstants { public static final ImmutableBytesPtr DEFAULT_COLUMN_FAMILY_BYTES_PTR = new ImmutableBytesPtr( DEFAULT_COLUMN_FAMILY_BYTES); + public static final String LOCAL_INDEX_COLUMN_FAMILY_PREFIX = "L#"; + public static final byte[] LOCAL_INDEX_COLUMN_FAMILY_PREFIX_BYTES = Bytes.toBytes(LOCAL_INDEX_COLUMN_FAMILY_PREFIX); + public static final ImmutableBytesPtr LOCAL_INDEX_COLUMN_FAMILY_PREFIX_PTR = new ImmutableBytesPtr( + LOCAL_INDEX_COLUMN_FAMILY_PREFIX_BYTES); + + public static final String DEFAULT_LOCAL_INDEX_COLUMN_FAMILY = LOCAL_INDEX_COLUMN_FAMILY_PREFIX + DEFAULT_COLUMN_FAMILY; + public static final byte[] DEFAULT_LOCAL_INDEX_COLUMN_FAMILY_BYTES = Bytes.toBytes(DEFAULT_LOCAL_INDEX_COLUMN_FAMILY); + public static final ImmutableBytesPtr DEFAULT_LOCAL_INDEX_COLUMN_FAMILY_BYTES_PTR = new ImmutableBytesPtr( + DEFAULT_LOCAL_INDEX_COLUMN_FAMILY_BYTES); + public static final String ALL_FAMILY_PROPERTIES_KEY = ""; public static final String SYSTEM_TABLE_PK_NAME = "pk"; http://git-wip-us.apache.org/repos/asf/phoenix/blob/601dae52/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 a1b7acc..cacf687 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 @@ -1113,7 +1113,7 @@ public class MetaDataClient { // connection so that our new index table is visible. Properties props = new Properties(connection.getClientInfo()); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(connection.getSCN()+1)); - PhoenixConnection conn = DriverManager.getConnection(connection.getURL(), props).unwrap(PhoenixConnection.class); + PhoenixConnection conn = new PhoenixConnection(connection, connection.getQueryServices(), props); MetaDataClient newClientAtNextTimeStamp = new MetaDataClient(conn); // Re-resolve the tableRef from the now newer connection @@ -1418,7 +1418,7 @@ public class MetaDataClient { } if (!SchemaUtil.isPKColumn(col) && col.getViewConstant() == null) { // Need to re-create ColumnName, since the above one won't have the column family name - colName = ColumnName.caseSensitiveColumnName(col.getFamilyName().getString(), IndexUtil.getIndexColumnName(col)); + colName = ColumnName.caseSensitiveColumnName(isLocalIndex?IndexUtil.getLocalIndexColumnFamily(col.getFamilyName().getString()):col.getFamilyName().getString(), IndexUtil.getIndexColumnName(col)); columnDefs.add(FACTORY.columnDef(colName, col.getDataType().getSqlTypeName(), col.isNullable(), col.getMaxLength(), col.getScale(), false, col.getSortOrder(), null, col.isRowTimestamp())); } } @@ -1686,6 +1686,7 @@ public class MetaDataClient { boolean isNamespaceMapped = parent == null ? SchemaUtil.isNamespaceMappingEnabled(tableType, connection.getQueryServices().getProps()) : parent.isNamespaceMapped(); + boolean isLocalIndex = indexType == IndexType.LOCAL; if (parent != null && tableType == PTableType.INDEX) { timestamp = TransactionUtil.getTableTimestamp(connection, transactional); storeNulls = parent.getStoreNulls(); @@ -1695,17 +1696,21 @@ public class MetaDataClient { // TODO: Can we support a multi-tenant index directly on a multi-tenant // table instead of only a view? We don't have anywhere to put the link // from the table to the index, though. - if (indexType == IndexType.LOCAL || (parent.getType() == PTableType.VIEW && parent.getViewType() != ViewType.MAPPED)) { + if (isLocalIndex || (parent.getType() == PTableType.VIEW && parent.getViewType() != ViewType.MAPPED)) { PName physicalName = parent.getPhysicalName(); saltBucketNum = parent.getBucketNum(); - addSaltColumn = (saltBucketNum != null && indexType != IndexType.LOCAL); + addSaltColumn = (saltBucketNum != null && !isLocalIndex); defaultFamilyName = parent.getDefaultFamilyName() == null ? null : parent.getDefaultFamilyName().getString(); - if (indexType == IndexType.LOCAL) { + if (isLocalIndex) { + defaultFamilyName = + parent.getDefaultFamilyName() == null ? QueryConstants.DEFAULT_LOCAL_INDEX_COLUMN_FAMILY + : IndexUtil.getLocalIndexColumnFamily(parent.getDefaultFamilyName().getString()); saltBucketNum = null; // Set physical name of local index table - physicalNames = Collections.singletonList(PNameFactory.newName(MetaDataUtil.getLocalIndexPhysicalName(physicalName.getBytes()))); + physicalNames = Collections.singletonList(PNameFactory.newName(physicalName.getBytes())); } else { + defaultFamilyName = parent.getDefaultFamilyName() == null ? QueryConstants.DEFAULT_COLUMN_FAMILY : parent.getDefaultFamilyName().getString(); // Set physical name of view index table physicalNames = Collections.singletonList(PNameFactory.newName(MetaDataUtil.getViewIndexPhysicalName(physicalName.getBytes()))); } @@ -2059,7 +2064,9 @@ public class MetaDataClient { .build().buildException(); } if (column.getFamilyName() != null) { - familyNames.put(column.getFamilyName().getString(),column.getFamilyName()); + familyNames.put( + IndexUtil.getActualColumnFamilyName(column.getFamilyName().getString()), + column.getFamilyName()); } } // We need a PK definition for a TABLE or mapped VIEW @@ -2109,7 +2116,9 @@ public class MetaDataClient { throwIfInsufficientColumns(schemaName, tableName, pkColumns, saltBucketNum!=null, multiTenant); for (PName familyName : familyNames.values()) { - Collection<Pair<String,Object>> props = statement.getProps().get(familyName.getString()); + String fam = familyName.getString(); + Collection<Pair<String, Object>> props = + statement.getProps().get(IndexUtil.getActualColumnFamilyName(fam)); if (props.isEmpty()) { familyPropList.add(new Pair<byte[],Map<String,Object>>(familyName.getBytes(),commonFamilyProps)); } else { @@ -2130,7 +2139,10 @@ public class MetaDataClient { if (familyNames.isEmpty()) { //if there are no family names, use the default column family name. This also takes care of the case when //the table ddl has only PK cols present (which means familyNames is empty). - byte[] cf = defaultFamilyName == null ? QueryConstants.DEFAULT_COLUMN_FAMILY_BYTES : Bytes.toBytes(defaultFamilyName); + byte[] cf = + defaultFamilyName == null ? (!isLocalIndex? QueryConstants.DEFAULT_COLUMN_FAMILY_BYTES + : QueryConstants.DEFAULT_LOCAL_INDEX_COLUMN_FAMILY_BYTES) + : Bytes.toBytes(defaultFamilyName); familyPropList.add(new Pair<byte[],Map<String,Object>>(cf, commonFamilyProps)); } @@ -2306,11 +2318,7 @@ public class MetaDataClient { */ Collections.reverse(tableMetaData); - if (parent != null && tableType == PTableType.INDEX && indexType == IndexType.LOCAL) { - tableProps.put(MetaDataUtil.PARENT_TABLE_KEY, parent.getPhysicalName().getString()); - tableProps.put(MetaDataUtil.IS_LOCAL_INDEX_TABLE_PROP_NAME, Boolean.TRUE); - splits = getSplitKeys(connection.getQueryServices().getAllTableRegions(parent.getPhysicalName().getBytes())); - } else { + if (indexType != IndexType.LOCAL) { splits = SchemaUtil.processSplits(splits, pkColumns, saltBucketNum, connection.getQueryServices().getProps().getBoolean( QueryServices.FORCE_ROW_KEY_ORDER_ATTRIB, QueryServicesOptions.DEFAULT_FORCE_ROW_KEY_ORDER)); } @@ -2575,7 +2583,7 @@ public class MetaDataClient { // All multi-tenant tables have a view index table, so no need to check in that case if (parentTableName == null) { for (PTable index : table.getIndexes()) { - if (MetaDataUtil.isLocalIndex(index.getPhysicalName().getString())) { + if (index.getIndexType() == IndexType.LOCAL) { hasLocalIndexTable = true; } } @@ -2599,19 +2607,6 @@ public class MetaDataClient { table.getColumnFamilies()); tableRefs.add(new TableRef(null, viewIndexTable, ts, false)); } - if (hasLocalIndexTable) { - String localIndexSchemaName = null; - String localIndexTableName = null; - if (schemaName != null) { - localIndexSchemaName = MetaDataUtil.getLocalIndexTableName(schemaName); - localIndexTableName = tableName; - } else { - localIndexTableName = MetaDataUtil.getLocalIndexTableName(tableName); - } - PTable localIndexTable = new PTableImpl(null, localIndexSchemaName, localIndexTableName, - ts, Collections.<PColumnFamily> emptyList()); - tableRefs.add(new TableRef(null, localIndexTable, ts, false)); - } } tableRefs.add(new TableRef(null, table, ts, false)); // TODO: Let the standard mutable secondary index maintenance handle this? @@ -2648,6 +2643,17 @@ public class MetaDataClient { buf.append("'" + ref.getTable().getPhysicalName().getString() + "',"); } buf.setCharAt(buf.length() - 1, ')'); + if(tableRefs.get(0).getTable().getIndexType()==IndexType.LOCAL) { + buf.append(" AND COLUMN_FAMILY IN("); + if (tableRefs.get(0).getTable().getColumnFamilies().isEmpty()) { + buf.append("'" + QueryConstants.DEFAULT_LOCAL_INDEX_COLUMN_FAMILY + "',"); + } else { + for(PColumnFamily cf : tableRefs.get(0).getTable().getColumnFamilies()) { + buf.append("'" + cf.getName().getString() + "',"); + } + } + buf.setCharAt(buf.length() - 1, ')'); + } conn.createStatement().execute(buf.toString()); success = true; } catch (SQLException e) { http://git-wip-us.apache.org/repos/asf/phoenix/blob/601dae52/phoenix-core/src/main/java/org/apache/phoenix/schema/TableRef.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/TableRef.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/TableRef.java index e231342..2ce5160 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/TableRef.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/TableRef.java @@ -21,6 +21,7 @@ import java.util.Objects; import org.apache.phoenix.compile.TupleProjectionCompiler; import org.apache.phoenix.query.QueryConstants; +import org.apache.phoenix.schema.PTable.IndexType; import org.apache.phoenix.util.IndexUtil; import org.apache.phoenix.util.SchemaUtil; @@ -101,7 +102,7 @@ public class TableRef { String defaultFamilyName = table.getDefaultFamilyName() == null ? QueryConstants.DEFAULT_COLUMN_FAMILY : table.getDefaultFamilyName().getString(); // Translate to the data table column name String dataFamilyName = isIndex ? IndexUtil.getDataColumnFamilyName(name) : column.getFamilyName().getString() ; - cf = defaultFamilyName.equals(dataFamilyName) ? null : dataFamilyName; + cf = (table.getIndexType()==IndexType.LOCAL? IndexUtil.getActualColumnFamilyName(defaultFamilyName):defaultFamilyName).equals(dataFamilyName) ? null : dataFamilyName; cq = isIndex ? IndexUtil.getDataColumnName(name) : name; } http://git-wip-us.apache.org/repos/asf/phoenix/blob/601dae52/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java index fdb36ee..a2df5c8 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java @@ -17,11 +17,13 @@ */ package org.apache.phoenix.util; +import static org.apache.phoenix.query.QueryConstants.LOCAL_INDEX_COLUMN_FAMILY_PREFIX; import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.IOException; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -38,10 +40,8 @@ import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.coprocessor.ObserverContext; import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment; -import org.apache.hadoop.hbase.coprocessor.RegionServerCoprocessorEnvironment; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.hadoop.hbase.regionserver.HRegion; -import org.apache.hadoop.hbase.regionserver.RegionServerServices; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.io.WritableUtils; import org.apache.phoenix.compile.ColumnResolver; @@ -139,24 +139,37 @@ public class IndexUtil { return name.substring(0,name.indexOf(INDEX_COLUMN_NAME_SEP)); } + public static String getActualColumnFamilyName(String name) { + if(name.startsWith(LOCAL_INDEX_COLUMN_FAMILY_PREFIX)) { + return name.substring(LOCAL_INDEX_COLUMN_FAMILY_PREFIX.length()); + } + return name; + } + public static String getCaseSensitiveDataColumnFullName(String name) { int index = name.indexOf(INDEX_COLUMN_NAME_SEP) ; - return SchemaUtil.getCaseSensitiveColumnDisplayName(name.substring(0, index), name.substring(index+1)); + return SchemaUtil.getCaseSensitiveColumnDisplayName(getDataColumnFamilyName(name), name.substring(index+1)); } public static String getIndexColumnName(String dataColumnFamilyName, String dataColumnName) { - return (dataColumnFamilyName == null ? "" : dataColumnFamilyName) + INDEX_COLUMN_NAME_SEP + dataColumnName; + return (dataColumnFamilyName == null ? "" : dataColumnFamilyName) + INDEX_COLUMN_NAME_SEP + + dataColumnName; } public static byte[] getIndexColumnName(byte[] dataColumnFamilyName, byte[] dataColumnName) { return ByteUtil.concat(dataColumnFamilyName == null ? ByteUtil.EMPTY_BYTE_ARRAY : dataColumnFamilyName, INDEX_COLUMN_NAME_SEP_BYTES, dataColumnName); } - + public static String getIndexColumnName(PColumn dataColumn) { String dataColumnFamilyName = SchemaUtil.isPKColumn(dataColumn) ? null : dataColumn.getFamilyName().getString(); return getIndexColumnName(dataColumnFamilyName, dataColumn.getName().getString()); } + public static String getLocalIndexColumnFamily(String dataColumnFamilyName) { + return dataColumnFamilyName == null ? null + : QueryConstants.LOCAL_INDEX_COLUMN_FAMILY_PREFIX + dataColumnFamilyName; + } + public static PColumn getDataColumn(PTable dataTable, String indexColumnName) { int pos = indexColumnName.indexOf(INDEX_COLUMN_NAME_SEP); if (pos < 0) { @@ -171,7 +184,7 @@ public class IndexUtil { } PColumnFamily family; try { - family = dataTable.getColumnFamily(indexColumnName.substring(0, pos)); + family = dataTable.getColumnFamily(getDataColumnFamilyName(indexColumnName)); } catch (ColumnFamilyNotFoundException e) { throw new IllegalArgumentException("Could not find column family \"" + indexColumnName.substring(0, pos) + "\" in index column name of \"" + indexColumnName + "\"", e); } @@ -220,7 +233,14 @@ public class IndexUtil { for (final Mutation dataMutation : dataMutations) { long ts = MetaDataUtil.getClientTimeStamp(dataMutation); ptr.set(dataMutation.getRow()); - Delete delete = maintainer.buildDeleteMutation(kvBuilder, ptr, ts); + byte[] regionStartKey = null; + byte[] regionEndkey = null; + if(maintainer.isLocalIndex()) { + HRegionLocation tableRegionLocation = connection.getQueryServices().getTableRegionLocation(table.getPhysicalName().getBytes(), dataMutation.getRow()); + regionStartKey = tableRegionLocation.getRegionInfo().getStartKey(); + regionEndkey = tableRegionLocation.getRegionInfo().getEndKey(); + } + Delete delete = maintainer.buildDeleteMutation(kvBuilder, null, ptr, Collections.<KeyValue>emptyList(), ts, regionStartKey, regionEndkey); delete.setAttribute(TxConstants.TX_ROLLBACK_ATTRIBUTE_KEY, dataMutation.getAttribute(TxConstants.TX_ROLLBACK_ATTRIBUTE_KEY)); indexMutations.add(delete); } @@ -334,53 +354,6 @@ public class IndexUtil { }); } - public static HRegion getIndexRegion(RegionCoprocessorEnvironment environment) - throws IOException { - HRegion dataRegion = environment.getRegion(); - return getIndexRegion(dataRegion, environment.getRegionServerServices()); - } - - public static HRegion - getIndexRegion(HRegion dataRegion, RegionServerCoprocessorEnvironment env) - throws IOException { - return getIndexRegion(dataRegion, env.getRegionServerServices()); - } - - public static HRegion getDataRegion(RegionCoprocessorEnvironment env) throws IOException { - HRegion indexRegion = env.getRegion(); - return getDataRegion(indexRegion, env.getRegionServerServices()); - } - - public static HRegion - getDataRegion(HRegion indexRegion, RegionServerCoprocessorEnvironment env) - throws IOException { - return getDataRegion(indexRegion, env.getRegionServerServices()); - } - - public static HRegion getIndexRegion(HRegion dataRegion, RegionServerServices rss) throws IOException { - TableName indexTableName = - TableName.valueOf(MetaDataUtil.getLocalIndexPhysicalName(dataRegion.getTableDesc() - .getName())); - List<HRegion> onlineRegions = rss.getOnlineRegions(indexTableName); - for(HRegion indexRegion : onlineRegions) { - if (Bytes.compareTo(dataRegion.getStartKey(), indexRegion.getStartKey()) == 0) { - return indexRegion; - } - } - return null; - } - - public static HRegion getDataRegion(HRegion indexRegion, RegionServerServices rss) throws IOException { - TableName dataTableName = TableName.valueOf(MetaDataUtil.getUserTableName(indexRegion.getTableDesc().getNameAsString())); - List<HRegion> onlineRegions = rss.getOnlineRegions(dataTableName); - for(HRegion region : onlineRegions) { - if (Bytes.compareTo(indexRegion.getStartKey(), region.getStartKey()) == 0) { - return region; - } - } - return null; - } - public static ColumnReference[] deserializeDataTableColumnsToJoin(Scan scan) { byte[] columnsBytes = scan.getAttribute(BaseScannerRegionObserver.DATA_TABLE_COLUMNS_TO_JOIN); if (columnsBytes == null) return null; http://git-wip-us.apache.org/repos/asf/phoenix/blob/601dae52/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java index f040bfe..c80b2fe 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java @@ -29,6 +29,7 @@ import java.io.IOException; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; @@ -438,15 +439,34 @@ public class MetaDataUtil { } public static boolean hasLocalIndexTable(PhoenixConnection connection, byte[] physicalTableName) throws SQLException { - byte[] physicalIndexName = MetaDataUtil.getLocalIndexPhysicalName(physicalTableName); try { - HTableDescriptor desc = connection.getQueryServices().getTableDescriptor(physicalIndexName); - return desc != null && Boolean.TRUE.equals(PBoolean.INSTANCE.toObject(desc.getValue(IS_LOCAL_INDEX_TABLE_PROP_BYTES))); + HTableDescriptor desc = connection.getQueryServices().getTableDescriptor(physicalTableName); + if(desc == null ) return false; + return hasLocalIndexColumnFamily(desc); } catch (TableNotFoundException e) { return false; } } + public static boolean hasLocalIndexColumnFamily(HTableDescriptor desc) { + for (HColumnDescriptor cf : desc.getColumnFamilies()) { + if (cf.getNameAsString().startsWith(QueryConstants.LOCAL_INDEX_COLUMN_FAMILY_PREFIX)) { + return true; + } + } + return false; + } + + public static List<byte[]> getNonLocalIndexColumnFamilies(HTableDescriptor desc) { + List<byte[]> families = new ArrayList<byte[]>(desc.getColumnFamilies().length); + for (HColumnDescriptor cf : desc.getColumnFamilies()) { + if (!cf.getNameAsString().startsWith(QueryConstants.LOCAL_INDEX_COLUMN_FAMILY_PREFIX)) { + families.add(cf.getName()); + } + } + return families; + } + public static void deleteViewIndexSequences(PhoenixConnection connection, PName name, boolean isNamespaceMapped) throws SQLException { String schemaName = getViewIndexSequenceSchemaName(name, isNamespaceMapped); http://git-wip-us.apache.org/repos/asf/phoenix/blob/601dae52/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java b/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java index 5754298..45815bd 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java @@ -520,6 +520,7 @@ public class PhoenixRuntime { private boolean isBypassUpgrade; private boolean mapNamespace; private String srcTable; + private boolean localIndexUpgrade; /** * Factory method to build up an {@code ExecutionCommand} based on supplied parameters. @@ -561,6 +562,9 @@ public class PhoenixRuntime { Option mapNamespaceOption = new Option("m", "map-namespace", true, "Used to map table to a namespace matching with schema, require "+ QueryServices.IS_NAMESPACE_MAPPING_ENABLED + " to be enabled"); + Option localIndexUpgradeOption = new Option("l", "local-index-upgrade", false, + "Used to upgrade local index data by moving index data from separate table to " + + "separate column families in the same table."); Options options = new Options(); options.addOption(tableOption); options.addOption(headerOption); @@ -572,6 +576,7 @@ public class PhoenixRuntime { options.addOption(upgradeOption); options.addOption(bypassUpgradeOption); options.addOption(mapNamespaceOption); + options.addOption(localIndexUpgradeOption); CommandLineParser parser = new PosixParser(); CommandLine cmdLine = null; @@ -625,7 +630,7 @@ public class PhoenixRuntime { } execCmd.isBypassUpgrade = true; } - + execCmd.localIndexUpgrade = cmdLine.hasOption(localIndexUpgradeOption.getOpt()); List<String> argList = Lists.newArrayList(cmdLine.getArgList()); if (argList.isEmpty()) { @@ -740,6 +745,10 @@ public class PhoenixRuntime { public String getSrcTable() { return srcTable; } + + public boolean isLocalIndexUpgrade() { + return localIndexUpgrade; + } } /** http://git-wip-us.apache.org/repos/asf/phoenix/blob/601dae52/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java index 679c7a1..ea0ebea 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java @@ -67,7 +67,7 @@ public class ServerUtil { } else if (t instanceof IOException) { // If the IOException does not wrap any exception, then bubble it up. Throwable cause = t.getCause(); - if (cause instanceof RetriesExhaustedWithDetailsException) + if (cause instanceof RetriesExhaustedWithDetailsException || cause instanceof DoNotRetryIOException) return new DoNotRetryIOException(t.getMessage(), cause); else if (cause == null || cause instanceof IOException) { return (IOException) t; http://git-wip-us.apache.org/repos/asf/phoenix/blob/601dae52/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java index d635acd..f13334d 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java @@ -78,6 +78,8 @@ import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.ResultScanner; import org.apache.hadoop.hbase.client.Scan; +import org.apache.hadoop.hbase.io.ImmutableBytesWritable; +import org.apache.hadoop.hbase.regionserver.LocalIndexSplitter; import org.apache.hadoop.hbase.snapshot.SnapshotCreationException; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.coprocessor.MetaDataEndpointImpl; @@ -300,6 +302,119 @@ public class UpgradeUtil { } } } + + public static void upgradeLocalIndexes(PhoenixConnection metaConnection, boolean createAsyncIndex) throws SQLException, + IOException, org.apache.hadoop.hbase.TableNotFoundException { + HBaseAdmin admin = null; + try { + admin = metaConnection.getQueryServices().getAdmin(); + ResultSet rs = metaConnection.createStatement().executeQuery("SELECT TABLE_SCHEM, TABLE_NAME, DATA_TABLE_NAME FROM SYSTEM.CATALOG " + + " WHERE COLUMN_NAME IS NULL" + + " AND COLUMN_FAMILY IS NULL" + + " AND INDEX_TYPE=2"); + boolean droppedLocalIndexes = false; + while (rs.next()) { + if(!droppedLocalIndexes) { + HTableDescriptor[] localIndexTables = admin.listTables(MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX+".*"); + String localIndexSplitter = LocalIndexSplitter.class.getName(); + for (HTableDescriptor table : localIndexTables) { + HTableDescriptor dataTableDesc = admin.getTableDescriptor(TableName.valueOf(MetaDataUtil.getUserTableName(table.getNameAsString()))); + HColumnDescriptor[] columnFamilies = dataTableDesc.getColumnFamilies(); + boolean modifyTable = false; + for(HColumnDescriptor cf : columnFamilies) { + String localIndexCf = QueryConstants.LOCAL_INDEX_COLUMN_FAMILY_PREFIX+cf.getNameAsString(); + if(dataTableDesc.getFamily(Bytes.toBytes(localIndexCf))==null){ + HColumnDescriptor colDef = + new HColumnDescriptor(localIndexCf); + for(Entry<ImmutableBytesWritable, ImmutableBytesWritable>keyValue: cf.getValues().entrySet()){ + colDef.setValue(keyValue.getKey().copyBytes(), keyValue.getValue().copyBytes()); + } + dataTableDesc.addFamily(colDef); + modifyTable = true; + } + } + List<String> coprocessors = dataTableDesc.getCoprocessors(); + for(String coprocessor: coprocessors) { + if(coprocessor.equals(localIndexSplitter)) { + dataTableDesc.removeCoprocessor(localIndexSplitter); + modifyTable = true; + } + } + if(modifyTable) { + admin.modifyTable(dataTableDesc.getName(), dataTableDesc); + } + } + admin.disableTables(MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX+".*"); + admin.deleteTables(MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX+".*"); + droppedLocalIndexes = true; + } + String getColumns = + "SELECT COLUMN_NAME, COLUMN_FAMILY FROM SYSTEM.CATALOG WHERE TABLE_SCHEM " + + (rs.getString(1) == null ? "IS NULL " : "='" + rs.getString(1) + + "'") + " and TABLE_NAME='" + rs.getString(2) + + "' AND COLUMN_NAME IS NOT NULL"; + ResultSet getColumnsRs = metaConnection.createStatement().executeQuery(getColumns); + List<String> indexedColumns = new ArrayList<String>(1); + List<String> coveredColumns = new ArrayList<String>(1); + + while (getColumnsRs.next()) { + String column = getColumnsRs.getString(1); + String columnName = IndexUtil.getDataColumnName(column); + if (columnName.equals(MetaDataUtil.getViewIndexIdColumnName())) { + continue; + } + String columnFamily = IndexUtil.getDataColumnFamilyName(column); + if (getColumnsRs.getString(2) == null) { + if (columnFamily != null && !columnFamily.isEmpty()) { + if (columnFamily.equals(QueryConstants.DEFAULT_COLUMN_FAMILY)) { + indexedColumns.add(columnName); + } else { + indexedColumns.add(SchemaUtil.getColumnName(columnFamily, + columnName)); + } + } + } else { + coveredColumns.add(SchemaUtil.getColumnName(columnFamily, columnName)); + } + } + StringBuilder createIndex = new StringBuilder("CREATE LOCAL INDEX "); + createIndex.append(rs.getString(2)); + createIndex.append(" ON "); + createIndex.append(SchemaUtil.getTableName(rs.getString(1), rs.getString(3))); + createIndex.append("("); + for (int i = 0; i < indexedColumns.size(); i++) { + createIndex.append(indexedColumns.get(i)); + if (i < indexedColumns.size() - 1) { + createIndex.append(","); + } + } + createIndex.append(")"); + + if (!coveredColumns.isEmpty()) { + createIndex.append(" INCLUDE("); + for (int i = 0; i < coveredColumns.size(); i++) { + createIndex.append(coveredColumns.get(i)); + if (i < coveredColumns.size() - 1) { + createIndex.append(","); + } + } + createIndex.append(") ASYNC"); + } + logger.info("Index creation query is : " + createIndex.toString()); + logger.info("Dropping the index " + rs.getString(2) + + " to clean up the index details from SYSTEM.CATALOG."); + metaConnection.createStatement().execute( + "DROP INDEX IF EXISTS " + rs.getString(2) + " ON " + + SchemaUtil.getTableName(rs.getString(1), rs.getString(3))); + logger.info("Recreating the index " + rs.getString(2)); + metaConnection.createStatement().execute(createIndex.toString()); + logger.info("Created the index " + rs.getString(2)); + } + metaConnection.createStatement().execute("DELETE FROM SYSTEM.CATALOG WHERE SUBSTR(TABLE_NAME,0,11)='"+MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX+"'"); + } finally { + if (admin != null) admin.close(); + } + } @SuppressWarnings("deprecation") public static boolean upgradeSequenceTable(PhoenixConnection conn, int nSaltBuckets, PTable oldTable) throws SQLException { http://git-wip-us.apache.org/repos/asf/phoenix/blob/601dae52/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleIndexWriter.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleIndexWriter.java b/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleIndexWriter.java index 88bf7fc..1f1e37e 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleIndexWriter.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleIndexWriter.java @@ -108,7 +108,7 @@ public class TestParalleIndexWriter { // setup the writer and failure policy ParallelWriterIndexCommitter writer = new ParallelWriterIndexCommitter(VersionInfo.getVersion()); writer.setup(factory, exec, abort, stop, 1); - writer.write(indexUpdates); + writer.write(indexUpdates, true); assertTrue("Writer returned before the table batch completed! Likely a race condition tripped", completed[0]); writer.stop(this.test.getTableNameString() + " finished"); http://git-wip-us.apache.org/repos/asf/phoenix/blob/601dae52/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleWriterIndexCommitter.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleWriterIndexCommitter.java b/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleWriterIndexCommitter.java index ee5e1d5..8eece3b 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleWriterIndexCommitter.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/write/TestParalleWriterIndexCommitter.java @@ -108,7 +108,7 @@ public class TestParalleWriterIndexCommitter { // setup the writer and failure policy ParallelWriterIndexCommitter writer = new ParallelWriterIndexCommitter(VersionInfo.getVersion()); writer.setup(factory, exec, abort, stop, 1); - writer.write(indexUpdates); + writer.write(indexUpdates, true); assertTrue("Writer returned before the table batch completed! Likely a race condition tripped", completed[0]); writer.stop(this.test.getTableNameString() + " finished"); http://git-wip-us.apache.org/repos/asf/phoenix/blob/601dae52/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java index be3f6d1..cd16f61 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java @@ -128,22 +128,16 @@ import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.IntegrationTestingUtility; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.HBaseAdmin; -import org.apache.hadoop.hbase.coprocessor.CoprocessorHost; -import org.apache.hadoop.hbase.coprocessor.RegionServerObserver; import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding; import org.apache.hadoop.hbase.ipc.PhoenixRpcSchedulerFactory; import org.apache.hadoop.hbase.ipc.RpcControllerFactory; import org.apache.hadoop.hbase.ipc.controller.ServerRpcControllerFactory; -import org.apache.hadoop.hbase.master.LoadBalancer; import org.apache.hadoop.hbase.regionserver.HRegionServer; -import org.apache.hadoop.hbase.regionserver.LocalIndexMerger; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.end2end.BaseClientManagedTimeIT; import org.apache.phoenix.end2end.BaseHBaseManagedTimeIT; import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.exception.SQLExceptionInfo; -import org.apache.phoenix.hbase.index.balancer.IndexLoadBalancer; -import org.apache.phoenix.hbase.index.master.IndexMasterObserver; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; import org.apache.phoenix.jdbc.PhoenixDriver; @@ -748,11 +742,6 @@ public abstract class BaseTest { conf.setInt(HConstants.REGION_SERVER_HANDLER_COUNT, 5); conf.setInt("hbase.regionserver.metahandler.count", 2); conf.setInt(HConstants.MASTER_HANDLER_COUNT, 2); - conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, IndexMasterObserver.class.getName()); - conf.setClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS, IndexLoadBalancer.class, - LoadBalancer.class); - conf.setClass("hbase.coprocessor.regionserver.classes", LocalIndexMerger.class, - RegionServerObserver.class) ; conf.setInt("dfs.namenode.handler.count", 2); conf.setInt("dfs.namenode.service.handler.count", 2); conf.setInt("dfs.datanode.handler.count", 2);
