@Override public void configure(TableOperations tops) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { switch (this.tableType) { case SHARD: configureShardTable(tops); break; case GIDX: configureGidxTable(tops); break; case GRIDX: configureGridxTable(tops); break; case DINDX: configureDictionaryTable(tops); break; default: // Technically, this is dead code. If 'Configure' is called prior to 'Setup' // tableType is null and throws a NullPointerException in the switch statement. // If 'Setup' successfully runs to completion then tableType is assigned one // of the three other values. throw new TableNotFoundException(null, tableName, "Table is not a Shard Type Table"); } }
protected void configureShardTable(TableOperations tops) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { // Set a text index aggregator on the "tf" (Term Frequency) column family CombinerConfiguration tfConf = new CombinerConfiguration(new Column("tf"), new IteratorSetting(10, "TF", datawave.ingest.table.aggregator.TextIndexAggregator.class.getName())); setAggregatorConfigurationIfNecessary(tableName, Collections.singletonList(tfConf), tops, log); if (markingsSetupIteratorEnabled) { for (IteratorScope scope : IteratorScope.values()) { // we want the markings setup iterator init method to be called up front String stem = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scope.name(), "MarkingsLoader"); setPropertyIfNecessary(tableName, stem, markingsSetupIteratorConfig, tops, log); } } // Set the locality group for the full content column family setLocalityGroupConfigurationIfNecessary(tableName, localityGroups, tops, log); // Set up the bloom filters for faster queries on the index portion if (enableBloomFilters) { setPropertyIfNecessary(tableName, Property.TABLE_BLOOM_KEY_FUNCTOR.getKey(), SHARD_KEY_FUNCTOR_CLASS, tops, log); } setPropertyIfNecessary(tableName, Property.TABLE_BLOOM_ENABLED.getKey(), Boolean.toString(enableBloomFilters), tops, log); // Set up the table balancer for shards setPropertyIfNecessary(tableName, Property.TABLE_LOAD_BALANCER.getKey(), shardTableBalancerClass, tops, log); }
TableOperations tops = mockUpTableOperations(); ShardTableConfigHelper uut = new ShardTableConfigHelper(); this.localityGroups.clear(); uut.setup(ShardTableConfigHelperTest.TABLE_NAME, config, log); uut.tableType); uut.configure(tops); this.localityGroups.isEmpty()); uut = new ShardTableConfigHelper(); this.localityGroups.clear(); uut.setup(ShardTableConfigHelperTest.TABLE_NAME, config, log); uut.tableType); uut.configure(tops);
@Test public void testSetupNothingDefinedInConfiguration() { ShardTableConfigHelperTest.logger.info("ShardTableConfigHelperTest.testSetupNothingDefinedInConfiguration called."); try { ShardTableConfigHelper uut = new ShardTableConfigHelper(); Configuration config = this.createMockConfiguration(); Logger log = this.createMockLogger(); uut.setup(ShardTableConfigHelperTest.TABLE_NAME, config, log); } catch (IllegalArgumentException iae) { String msg = iae.getMessage(); Assert.assertEquals("ShardTableConfigHelper .setup threw the expected exception, but the message was not the expected message.", "No Shard Tables Defined", msg); } finally { ShardTableConfigHelperTest.logger.info("ShardTableConfigHelperTest.testSetupNothingDefinedInConfiguration completed."); } }
@Test(expected = NullPointerException.class) public void testConfigureCalledBeforeSetup() throws AccumuloSecurityException, AccumuloException, TableNotFoundException { ShardTableConfigHelperTest.logger.info("ShardTableConfigHelperTest.testConfigureCalledBeforeSetup called."); try { ShardTableConfigHelper uut = new ShardTableConfigHelper(); TableOperations tops = mockUpTableOperations(); uut.configure(tops); Assert.fail("ShardTableConfigHelper.configure failed to throw expected exception."); } finally { ShardTableConfigHelperTest.logger.info("ShardTableConfigHelperTest.testConfigureCalledBeforeSetup completed."); } }
/** * Configures all of the default tables and associates a {@link BatchWriterConfig} object for ach table. * * @param writer * @throws AccumuloSecurityException * @throws AccumuloException * @throws TableNotFoundException */ public void configureTables(MockAccumuloRecordWriter writer) throws AccumuloSecurityException, AccumuloException, TableNotFoundException { configureAShardRelatedTable(writer, new MetadataTableConfigHelper(), ShardedDataTypeHandler.METADATA_TABLE_NAME, METADATA_TABLE_NAME); configureAShardRelatedTable(writer, new ShardTableConfigHelper(), ShardedDataTypeHandler.SHARD_TNAME, SHARD_TABLE_NAME); configureAShardRelatedTable(writer, new ShardTableConfigHelper(), ShardedDataTypeHandler.SHARD_GIDX_TNAME, SHARD_INDEX_TABLE_NAME); configureAShardRelatedTable(writer, new ShardTableConfigHelper(), ShardedDataTypeHandler.SHARD_GRIDX_TNAME, SHARD_RINDEX_TABLE_NAME); writer.addWriter(new Text(SHARD_DICT_INDEX_NAME), connector.createBatchWriter(SHARD_DICT_INDEX_NAME, bwCfg)); // todo - configure the other tables... }
protected void configureGidxTable(TableOperations tops) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { // Add the UID aggregator for (IteratorScope scope : IteratorScope.values()) { String stem = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scope.name(), "UIDAggregator"); setPropertyIfNecessary(tableName, stem, "19,datawave.iterators.TotalAggregatingIterator", tops, log); stem += ".opt."; setPropertyIfNecessary(tableName, stem + "*", "datawave.ingest.table.aggregator.GlobalIndexUidAggregator", tops, log); if (markingsSetupIteratorEnabled) { // we want the markings setup iterator init method to be called up front stem = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scope.name(), "MarkingsLoader"); setPropertyIfNecessary(tableName, stem, markingsSetupIteratorConfig, tops, log); } } // Set up the bloom filters for faster queries on the index portion if (enableBloomFilters) { setPropertyIfNecessary(tableName, Property.TABLE_BLOOM_KEY_FUNCTOR.getKey(), ShardIndexKeyFunctor.class.getName(), tops, log); } setPropertyIfNecessary(tableName, Property.TABLE_BLOOM_ENABLED.getKey(), Boolean.toString(enableBloomFilters), tops, log); }
protected void configureDictionaryTable(TableOperations tops) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { setLocalityGroupConfigurationIfNecessary(tableName, localityGroups, tops, log); } }
TableOperations tops = mockUpTableOperations(); ShardTableConfigHelper uut = new ShardTableConfigHelper(); this.localityGroups.clear(); uut.setup(ShardTableConfigHelperTest.TABLE_NAME, config, log); uut.tableType); uut.configure(tops); uut = new ShardTableConfigHelper(); this.localityGroups.clear(); uut.setup(ShardTableConfigHelperTest.TABLE_NAME, config, log); uut.tableType); uut.configure(tops);
ShardTableConfigHelper uut = new ShardTableConfigHelper(); uut.setup(ShardTableConfigHelperTest.TABLE_NAME, config, log); uut.setup(ShardTableConfigHelperTest.TABLE_NAME, config, log); uut.setup(ShardTableConfigHelperTest.TABLE_NAME, config, log);
protected void configureGridxTable(TableOperations tops) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { // Add the UID aggregator for (IteratorScope scope : IteratorScope.values()) { String stem = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scope.name(), "UIDAggregator"); setPropertyIfNecessary(tableName, stem, "19,datawave.iterators.TotalAggregatingIterator", tops, log); stem += ".opt."; setPropertyIfNecessary(tableName, stem + "*", "datawave.ingest.table.aggregator.GlobalIndexUidAggregator", tops, log); if (markingsSetupIteratorEnabled) { // we want the markings setup iterator init method to be called up front stem = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scope.name(), "MarkingsLoader"); setPropertyIfNecessary(tableName, stem, markingsSetupIteratorConfig, tops, log); } } // Set up the bloom filters for faster queries on the index portion if (enableBloomFilters) { setPropertyIfNecessary(tableName, Property.TABLE_BLOOM_KEY_FUNCTOR.getKey(), ShardIndexKeyFunctor.class.getName(), tops, log); } setPropertyIfNecessary(tableName, Property.TABLE_BLOOM_ENABLED.getKey(), Boolean.toString(enableBloomFilters), tops, log); }
TableOperations tops = mockUpTableOperations(); ShardTableConfigHelper uut = new ShardTableConfigHelper(); this.localityGroups.clear(); uut.setup(ShardTableConfigHelperTest.TABLE_NAME, config, log); uut.tableType); uut.configure(tops); this.localityGroups.isEmpty()); uut = new ShardTableConfigHelper(); this.localityGroups.clear(); uut.setup(ShardTableConfigHelperTest.TABLE_NAME, config, log); uut.tableType); uut.configure(tops);
ShardTableConfigHelper uut = new ShardTableConfigHelper(); try { uut.setup(ShardTableConfigHelperTest.BAD_TABLE_NAME, config, log); try { uut.setup(ShardTableConfigHelperTest.BAD_TABLE_NAME, config, log); try { uut.setup(ShardTableConfigHelperTest.BAD_TABLE_NAME, config, log);