@Test public void testLoadSecondaryIndexesForTable() throws IOException { Map<IndexColumn, String> columnIndexes = new HashMap<IndexColumn, String>(); DefaultIndexer indexer = new DefaultIndexer(conf); indexer.loadSecondaryIndexesForTable(admin.getTableDescriptor(MAIN_TABLE), columnIndexes); Assert.assertEquals(1, columnIndexes.size()); IndexColumn indexColumn = new IndexColumn(MAIN_TABLE, INDEX_FAMILY, INDEX_QUALIFIER); Assert.assertTrue(columnIndexes.containsKey(indexColumn)); Assert.assertEquals(Bytes.toString(INDEX_TABLE), columnIndexes.get(indexColumn)); }
protected void loadSecondaryIndexesForTable(HTableDescriptor desc, Map<IndexColumn, String> columnIndexes) throws IOException { for (HColumnDescriptor family : desc.getFamilies()) { if (IndexMasterObserver.isSecondaryIndexEnableFamily(family)) { List<Pair<String, String>> indexNameAndColumns = IndexMasterObserver .getIndexNameAndColumns(desc.getNameAsString(), family); for (Pair<String, String> indexNameAndColumn : indexNameAndColumns) { String indexName = indexNameAndColumn.getFirst(); String column = indexNameAndColumn.getSecond(); IndexColumn indexColumn = new IndexColumn(desc.getName(), family.getName(), Bytes.toBytes(column)); String indexTableName = IndexMasterObserver.constructSecondaryIndexTableName( desc.getNameAsString(), family.getNameAsString(), column, indexName); if (!columnIndexes.containsKey(indexColumn)) { columnIndexes.put(indexColumn, indexTableName); } else { throw new IOException("duplicated index definition found, indexColumn=" + indexColumn); } } } } }
DefaultIndexer extends Indexer { protected void loadSecondaryIndexesForTable(HTableDescriptor desc, Map<IndexColumn, String> columnIndexes) throws IOException { for (HColumnDescriptor family : desc.getFamilies()) { if (IndexMasterObserver.isSecondaryIndexEnableFamily(family)) { List<Pair<String, String>> indexNameAndColumns = IndexMasterObserver .getIndexNameAndColumns(desc.getNameAsString(), family); for (Pair<String, String> indexNameAndColumn : indexNameAndColumns) { String indexName = indexNameAndColumn.getFirst(); String column = indexNameAndColumn.getSecond(); IndexColumn indexColumn = new IndexColumn(desc.getName(), family.getName(), Bytes.toBytes(column)); String indexTableName = IndexMasterObserver.constructSecondaryIndexTableName( desc.getNameAsString(), family.getNameAsString(), column, indexName); if (!columnIndexes.containsKey(indexColumn)) { columnIndexes.put(indexColumn, indexTableName); } else { throw new IOException("duplicated index definition found, indexColumn=" + indexColumn); } } } } } }
DefaultIndexer extends Indexer { protected void loadSecondaryIndexesForTable(HTableDescriptor desc, Map<IndexColumn, String> columnIndexes) throws IOException { for (HColumnDescriptor family : desc.getFamilies()) { if (IndexMasterObserver.isSecondaryIndexEnableFamily(family)) { List<Pair<String, String>> indexNameAndColumns = IndexMasterObserver .getIndexNameAndColumns(desc.getNameAsString(), family); for (Pair<String, String> indexNameAndColumn : indexNameAndColumns) { String indexName = indexNameAndColumn.getFirst(); String column = indexNameAndColumn.getSecond(); IndexColumn indexColumn = new IndexColumn(desc.getName(), family.getName(), Bytes.toBytes(column)); String indexTableName = IndexMasterObserver.constructSecondaryIndexTableName( desc.getNameAsString(), family.getNameAsString(), column, indexName); if (!columnIndexes.containsKey(indexColumn)) { columnIndexes.put(indexColumn, indexTableName); } else { throw new IOException("duplicated index definition found, indexColumn=" + indexColumn); } } } } } DefaultIndexer(Configuration conf); }
DefaultIndexer extends Indexer { protected void loadSecondaryIndexesForTable(HTableDescriptor desc, Map<IndexColumn, String> columnIndexes) throws IOException { for (HColumnDescriptor family : desc.getFamilies()) { if (IndexMasterObserver.isSecondaryIndexEnableFamily(family)) { List<Pair<String, String>> indexNameAndColumns = IndexMasterObserver .getIndexNameAndColumns(desc.getNameAsString(), family); for (Pair<String, String> indexNameAndColumn : indexNameAndColumns) { String indexName = indexNameAndColumn.getFirst(); String column = indexNameAndColumn.getSecond(); IndexColumn indexColumn = new IndexColumn(desc.getName(), family.getName(), Bytes.toBytes(column)); String indexTableName = IndexMasterObserver.constructSecondaryIndexTableName( desc.getNameAsString(), family.getNameAsString(), column, indexName); if (!columnIndexes.containsKey(indexColumn)) { columnIndexes.put(indexColumn, indexTableName); } else { throw new IOException("duplicated index definition found, indexColumn=" + indexColumn); } } } } } DefaultIndexer(Configuration conf); Map<IndexColumn, String> getColumnIndexes(); @Override IndexScanner getScanner(byte[] tableName, ThemisScan scan, Transaction transaction); @Override void addIndexMutations(ColumnMutationCache mutationCache); }
DefaultIndexer extends Indexer { protected void loadSecondaryIndexesForTable(HTableDescriptor desc, Map<IndexColumn, String> columnIndexes) throws IOException { for (HColumnDescriptor family : desc.getFamilies()) { if (IndexMasterObserver.isSecondaryIndexEnableFamily(family)) { List<Pair<String, String>> indexNameAndColumns = IndexMasterObserver .getIndexNameAndColumns(desc.getNameAsString(), family); for (Pair<String, String> indexNameAndColumn : indexNameAndColumns) { String indexName = indexNameAndColumn.getFirst(); String column = indexNameAndColumn.getSecond(); IndexColumn indexColumn = new IndexColumn(desc.getName(), family.getName(), Bytes.toBytes(column)); String indexTableName = IndexMasterObserver.constructSecondaryIndexTableName( desc.getNameAsString(), family.getNameAsString(), column, indexName); if (!columnIndexes.containsKey(indexColumn)) { columnIndexes.put(indexColumn, indexTableName); } else { throw new IOException("duplicated index definition found, indexColumn=" + indexColumn); } } } } } DefaultIndexer(Configuration conf); Map<IndexColumn, String> getColumnIndexes(); @Override IndexScanner getScanner(byte[] tableName, ThemisScan scan, Transaction transaction); @Override void addIndexMutations(ColumnMutationCache mutationCache);  }