org.apache.accumulo.core.client.AccumuloException Java Examples

The following examples show how to use org.apache.accumulo.core.client.AccumuloException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AccumuloClient.java    From presto with Apache License 2.0 6 votes vote down vote up
@Inject
public AccumuloClient(
        Connector connector,
        AccumuloConfig config,
        ZooKeeperMetadataManager metaManager,
        AccumuloTableManager tableManager,
        IndexLookup indexLookup)
        throws AccumuloException, AccumuloSecurityException
{
    this.connector = requireNonNull(connector, "connector is null");
    this.username = requireNonNull(config, "config is null").getUsername();
    this.metaManager = requireNonNull(metaManager, "metaManager is null");
    this.tableManager = requireNonNull(tableManager, "tableManager is null");
    this.indexLookup = requireNonNull(indexLookup, "indexLookup is null");

    this.auths = connector.securityOperations().getUserAuthorizations(username);
}
 
Example #2
Source File: MetadataTableSplits.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * updates the splits file if the splits in the new file have not decreased beyond the maximum deviation allowed
 */
public void update() {
    try {
        FileSystem fs = FileSystem.get(this.splitsPath.toUri(), conf);
        initAccumuloHelper();
        Path tmpSplitsFile = createTempFile(fs);
        Map<String,Integer> tmpSplitsPerTable = writeSplits(fs, tmpSplitsFile);
        if (null == getFileStatus() || !exceedsMaxSplitsDeviation(tmpSplitsPerTable)) {
            log.info("updating splits file");
            createCacheFile(fs, tmpSplitsFile);
        } else {
            log.info("Deleting " + tmpSplitsFile);
            fs.delete(tmpSplitsFile, false);
        }
    } catch (IOException | AccumuloException | AccumuloSecurityException | TableNotFoundException ex) {
        log.error("Unable to update the splits file", ex);
    }
    
}
 
Example #3
Source File: DefaultQueryPlanner.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * Load the metadata information.
 *
 * @param fieldToDatatypeMap
 * @param indexedFields
 * @param reverseIndexedFields
 * @param normalizedFields
 * @param reload
 * @throws AccumuloException
 * @throws AccumuloSecurityException
 * @throws TableNotFoundException
 * @throws ExecutionException
 * @throws InstantiationException
 * @throws IllegalAccessException
 */
private void loadDataTypeMetadata(Multimap<String,Type<?>> fieldToDatatypeMap, Set<String> indexedFields, Set<String> reverseIndexedFields,
                Set<String> normalizedFields, boolean reload) throws AccumuloException, AccumuloSecurityException, TableNotFoundException,
                ExecutionException, InstantiationException, IllegalAccessException {
    synchronized (dataTypeMap) {
        if (!reload && (null != cachedIndexedFields && null != indexedFields) && (null != cachedNormalizedFields && null != normalizedFields)
                        && (null != cachedReverseIndexedFields && null != reverseIndexedFields)) {
            indexedFields.addAll(cachedIndexedFields);
            reverseIndexedFields.addAll(cachedReverseIndexedFields);
            normalizedFields.addAll(cachedNormalizedFields);
            
            return;
        }
        
        cachedIndexedFields = metadataHelper.getIndexedFields(null);
        cachedReverseIndexedFields = metadataHelper.getReverseIndexedFields(null);
        cachedNormalizedFields = metadataHelper.getAllNormalized();
        
        if ((null != cachedIndexedFields && null != indexedFields) && (null != cachedNormalizedFields && null != normalizedFields)
                        && (null != cachedReverseIndexedFields && null != reverseIndexedFields)) {
            indexedFields.addAll(cachedIndexedFields);
            reverseIndexedFields.addAll(cachedReverseIndexedFields);
            normalizedFields.addAll(cachedNormalizedFields);
        }
    }
}
 
Example #4
Source File: ShardTableConfigHelper.java    From datawave with Apache License 2.0 6 votes vote down vote up
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);
    
}
 
Example #5
Source File: MetricsTableConfigHelper.java    From datawave with Apache License 2.0 6 votes vote down vote up
@Override
public void configure(TableOperations tops) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
    if (MetricsConfiguration.isEnabled(conf)) {
        try {
            String table = MetricsConfiguration.getTable(conf);
            
            if (!table.equals(this.tableName)) {
                throw new IllegalArgumentException("Table names did not match. Configuration = " + table + ", Configuration Helper = " + this.tableName);
            }
            
            Collection<MetricsReceiver> receivers = MetricsConfiguration.getReceivers(conf);
            for (MetricsReceiver receiver : receivers) {
                logger.info("Configuring metrics receiver " + receiver);
                receiver.configureTable(table, tops, conf);
            }
        } catch (Exception e) {
            logger.error("An error occurred while configuring ingest metrics, disabling", e);
            MetricsConfiguration.disable(conf);
        }
    }
}
 
Example #6
Source File: AccumuloCounterSource.java    From datawave with Apache License 2.0 6 votes vote down vote up
@Override
public boolean hasNext() {
    
    if (null == iterator) {
        try {
            BatchScanner scanner = connector.createBatchScanner(queryTable, connector.securityOperations().getUserAuthorizations(username), 100);
            
            scanner.setRanges(ranges);
            for (String cf : cfs) {
                
                scanner.fetchColumnFamily(new Text(cf));
                
            }
            
            iterator = scanner.iterator();
            
        } catch (TableNotFoundException | AccumuloException | AccumuloSecurityException e) {
            throw new RuntimeException(e);
        }
    }
    nextIterator();
    return null != topKey;
}
 
Example #7
Source File: ShardTableConfigHelper.java    From datawave with Apache License 2.0 6 votes vote down vote up
@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");
    }
}
 
Example #8
Source File: IngestMetricsSummaryLoader.java    From datawave with Apache License 2.0 6 votes vote down vote up
@Override
protected void setup(Context context) throws IOException, InterruptedException {
    super.setup(context);
    
    Configuration conf = context.getConfiguration();
    String user = conf.get(MetricsConfig.USER);
    String password = conf.get(MetricsConfig.PASS);
    String instance = conf.get(MetricsConfig.INSTANCE);
    String zookeepers = conf.get(MetricsConfig.ZOOKEEPERS);
    
    useHourlyPrecision = HourlyPrecisionHelper.checkForHourlyPrecisionOption(context.getConfiguration(), log);
    
    try {
        ZooKeeperInstance inst = new ZooKeeperInstance(ClientConfiguration.loadDefault().withInstance(instance).withZkHosts(zookeepers));
        Connector con = inst.getConnector(user, new PasswordToken(password));
        ingestScanner = con.createScanner(conf.get(MetricsConfig.INGEST_TABLE, MetricsConfig.DEFAULT_INGEST_TABLE), Authorizations.EMPTY);
    } catch (TableNotFoundException | AccumuloException | AccumuloSecurityException e) {
        throw new IOException(e);
    }
}
 
Example #9
Source File: AtomTableConfigHelper.java    From datawave with Apache License 2.0 6 votes vote down vote up
@Override
public void configure(TableOperations tops) {
    if (null != this.ageoff) {
        EnumSet<IteratorScope> scopes = EnumSet.of(IteratorScope.scan, IteratorScope.minc, IteratorScope.majc);
        HashMap<String,String> properties = new HashMap<>();
        properties.put("ttl", ageoff);
        IteratorSetting settings = new IteratorSetting(19, AgeOffFilter.class, properties);
        
        try {
            tops.attachIterator(tableName, settings, scopes);
        } catch (IllegalArgumentException | AccumuloException iaEx) {
            String msg = iaEx.getMessage();
            if (msg.contains("name conflict"))
                log.info("Iterator, 'age-off' already exists for table: " + tableName + "\n" + iaEx.getMessage());
            else
                log.error("Error setting up age-off iterator on table: " + tableName, iaEx);
        } catch (Exception e) {
            log.error("Error setting up age-off iterator on table: " + tableName, e);
        }
    }
}
 
Example #10
Source File: MultiRFileOutputFormatter.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * Close the current writer for the specified key, and create the next writer. The index encoded in the filename will be appropriately updated.
 * 
 * @param key
 * @throws IOException
 * @throws AccumuloException
 */
protected void closeAndUpdateWriter(String key) throws IOException, AccumuloException {
    SizeTrackingWriter writer = writers.get(key);
    // don't bother if we have not created a writer for this key yet
    if (writer != null) {
        String table = writerTableNames.get(key);
        Path filename = usedWriterPaths.get(key);
        // don't bother if this writer has not been used yet
        if (filename != null) {
            writer.close();
            // pull the index off the filename
            filename = removeFileCount(filename);
            createAndRegisterWriter(key, table, filename, tableConfigs.get(table));
        }
    }
}
 
Example #11
Source File: ShardTableQueryMetricHandler.java    From datawave with Apache License 2.0 6 votes vote down vote up
protected void createAndConfigureTablesIfNecessary(String[] tableNames, TableOperations tops, Configuration conf) throws AccumuloSecurityException,
                AccumuloException, TableNotFoundException {
    for (String table : tableNames) {
        // If the tables don't exist, then create them.
        try {
            if (!tops.exists(table)) {
                tops.create(table);
                Map<String,TableConfigHelper> tableConfigs = getTableConfigs(log, conf, tableNames);
                
                TableConfigHelper tableHelper = tableConfigs.get(table);
                
                if (tableHelper != null) {
                    tableHelper.configure(tops);
                } else {
                    log.info("No configuration supplied for table: " + table);
                }
            }
        } catch (TableExistsException te) {
            // in this case, somebody else must have created the table after our existence check
            log.debug("Tried to create " + table + " but somebody beat us to the punch");
        }
    }
}
 
Example #12
Source File: MultiRFileOutputFormatter.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * Get a writer that was previously registered. This will mark the writer as being used.
 * 
 * @param key
 * @return the writer
 * @throws AccumuloException
 * @throws IOException
 */
protected SizeTrackingWriter getRegisteredWriter(String key) throws IOException, AccumuloException {
    SizeTrackingWriter writer = writers.get(key);
    if (writer != null) {
        if ((maxRFileEntries > 0 && writer.getNumEntries() >= maxRFileEntries) || (maxRFileSize > 0 && writer.getSize() >= maxRFileSize)) {
            if (log.isInfoEnabled()) {
                if (maxRFileEntries > 0 && writer.getNumEntries() >= maxRFileEntries) {
                    log.info("Breached the max RFile entries, creating a new file for " + key + ": " + writer.getNumEntries() + " >= " + maxRFileEntries);
                } else {
                    log.info("Breached the max RFile size, creating a new file for " + key + ": " + writer.getSize() + " >= " + maxRFileSize);
                }
            }
            closeAndUpdateWriter(key);
            writer = writers.get(key);
        }
        Path path = unusedWriterPaths.remove(key);
        if (path != null) {
            usedWriterPaths.put(key, path);
        }
    }
    return writer;
}
 
Example #13
Source File: AccumuloQueryRunner.java    From presto with Apache License 2.0 6 votes vote down vote up
/**
 * Gets the AccumuloConnector singleton, starting the MiniAccumuloCluster on initialization.
 * This singleton instance is required so all test cases access the same MiniAccumuloCluster.
 *
 * @return Accumulo connector
 */
public static Connector getAccumuloConnector()
{
    if (connector != null) {
        return connector;
    }

    try {
        MiniAccumuloCluster accumulo = createMiniAccumuloCluster();
        Instance instance = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers());
        connector = instance.getConnector(MAC_USER, new PasswordToken(MAC_PASSWORD));
        LOG.info("Connection to MAC instance %s at %s established, user %s password %s", accumulo.getInstanceName(), accumulo.getZooKeepers(), MAC_USER, MAC_PASSWORD);
        return connector;
    }
    catch (AccumuloException | AccumuloSecurityException | InterruptedException | IOException e) {
        throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to get connector to Accumulo", e);
    }
}
 
Example #14
Source File: AbstractTableConfigHelper.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * Set the locality group configuration for a table if necessary. If the specified configuration is not already included in the current group configuration,
 * then the new locality groups are merged with the current set and the locality groups are reset for the table.
 * 
 * @param tableName
 * @param newLocalityGroups
 * @param tops
 * @param log
 * @throws AccumuloException
 * @throws TableNotFoundException
 * @throws AccumuloSecurityException
 */
protected void setLocalityGroupConfigurationIfNecessary(String tableName, Map<String,Set<Text>> newLocalityGroups, TableOperations tops, Logger log)
                throws AccumuloException, TableNotFoundException, AccumuloSecurityException {
    if (areLocalityGroupsConfigured(tableName, newLocalityGroups, tops)) {
        log.debug("Verified the following locality groups are configured for " + tableName + ": " + newLocalityGroups);
        return;
    }
    
    log.info("Creating the locality groups for " + tableName + ": " + newLocalityGroups);
    Map<String,Set<Text>> localityGroups = tops.getLocalityGroups(tableName);
    for (Map.Entry<String,Set<Text>> entry : newLocalityGroups.entrySet()) {
        Set<Text> families = localityGroups.get(entry.getKey());
        if (families == null) {
            families = new HashSet<>();
            localityGroups.put(entry.getKey(), families);
        }
        families.addAll(entry.getValue());
    }
    tops.setLocalityGroups(tableName, localityGroups);
    log.info("Reset the locality groups for " + tableName + " to " + localityGroups);
}
 
Example #15
Source File: LoadDateTableConfigHelper.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Override
public void configure(TableOperations tops) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
    for (IteratorScope scope : IteratorScope.values()) {
        setCombinerForLoadDateCounts(tops, scope.name());
        configureToDropBadData(tops, scope.name());
    }
    setLocalityGroupConfigurationIfNecessary(getLoadDatesTableName(conf), localityGroups, tops, log);
}
 
Example #16
Source File: QueryTestTableHelper.java    From datawave with Apache License 2.0 5 votes vote down vote up
public void overrideUidAggregator() throws AccumuloSecurityException, AccumuloException {
    for (IteratorUtil.IteratorScope scope : IteratorUtil.IteratorScope.values()) {
        String stem = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scope.name(), "UIDAggregator");
        // Override the UidAggregator with a mock aggregator to lower the UID.List MAX uid limit.
        connector.tableOperations().setProperty(SHARD_INDEX_TABLE_NAME, stem + ".opt.*", "datawave.query.util.InMemoryGlobalIndexUidAggregator");
        connector.tableOperations().setProperty(SHARD_RINDEX_TABLE_NAME, stem + ".opt.*", "datawave.query.util.InMemoryGlobalIndexUidAggregator");
    }
}
 
Example #17
Source File: MetadataTableConfigHelper.java    From datawave with Apache License 2.0 5 votes vote down vote up
private String setCombinerForCountMetadata(TableOperations tops, String scopeName) throws AccumuloException, AccumuloSecurityException,
                TableNotFoundException {
    String stem = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scopeName, "CountMetadataCombiner");
    setPropertyIfNecessary(tableName, stem, "15,datawave.iterators.CountMetadataCombiner", tops, log);
    setPropertyIfNecessary(tableName, stem + ".opt.columns", ColumnFamilyConstants.COLF_COUNT.toString(), tops, log);
    return stem;
}
 
Example #18
Source File: MetadataTableConfigHelper.java    From datawave with Apache License 2.0 5 votes vote down vote up
private String setCombinerForEdgeMetadata(TableOperations tops, String scopeName) throws AccumuloException, AccumuloSecurityException,
                TableNotFoundException {
    String stem = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scopeName, "EdgeMetadataCombiner");
    setPropertyIfNecessary(tableName, stem, "19,datawave.iterators.EdgeMetadataCombiner", tops, log);
    setPropertyIfNecessary(tableName, stem + ".opt.columns", ColumnFamilyConstants.COLF_EDGE.toString(), tops, log);
    return stem;
}
 
Example #19
Source File: MetadataTableConfigHelper.java    From datawave with Apache License 2.0 5 votes vote down vote up
private String setFrequencyCombiner(TableOperations tops, String scopeName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
    String stem = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scopeName, "FrequencyCombiner");
    setPropertyIfNecessary(tableName, stem, "10," + SummingCombiner.class.getName(), tops, log);
    setPropertyIfNecessary(tableName, stem + ".opt.columns", ColumnFamilyConstants.COLF_F.toString(), tops, log);
    setPropertyIfNecessary(tableName, stem + ".opt.type", "VARLEN", tops, log);
    return stem;
}
 
Example #20
Source File: GenerateMultipleNumShardsCacheFile.java    From datawave with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("static-access")
public static void main(String[] args) throws ParseException, AccumuloException, AccumuloSecurityException, TableNotFoundException, IOException {
    AccumuloCliOptions accumuloOptions = new AccumuloCliOptions();
    Options options = accumuloOptions.getOptions();
    options.addOption(OptionBuilder.isRequired(true).hasArg().withDescription("Config directory path").create(CONFIG_DIRECTORY_LOCATION_OVERRIDE));
    options.addOption(OptionBuilder.isRequired(false).hasArg().withDescription("Config file suffix").create(CONFIG_SUFFIEX_OVERRIDE));
    options.addOption(OptionBuilder.isRequired(false).hasArg().withDescription("Multiple numShards cache file path")
                    .create(MULTIPLE_NUMSHARD_CACHE_FILE_LOCATION_OVERRIDE));
    Configuration conf = accumuloOptions.getConf(args, true);
    CommandLine cl;
    String configDirectory = null;
    String configSuffix;
    try {
        cl = new BasicParser().parse(options, args);
        if (cl.hasOption(CONFIG_DIRECTORY_LOCATION_OVERRIDE)) {
            configDirectory = cl.getOptionValue(CONFIG_DIRECTORY_LOCATION_OVERRIDE);
        } else {
            HelpFormatter helpFormatter = new HelpFormatter();
            helpFormatter.printHelp("Generate Multiple NumShards Cache", options);
            System.exit(1);
        }
        if (cl.hasOption(MULTIPLE_NUMSHARD_CACHE_FILE_LOCATION_OVERRIDE)) {
            conf.set(NumShards.MULTIPLE_NUMSHARDS_CACHE_PATH, cl.getOptionValue(MULTIPLE_NUMSHARD_CACHE_FILE_LOCATION_OVERRIDE));
        }
        if (cl.hasOption(CONFIG_SUFFIEX_OVERRIDE)) {
            configSuffix = cl.getOptionValue(CONFIG_SUFFIEX_OVERRIDE);
        } else {
            configSuffix = "config.xml";
        }
        ConfigurationFileHelper.setConfigurationFromFiles(conf, configDirectory, configSuffix);
        NumShards numShards = new NumShards(conf);
        numShards.updateCache();
    } catch (ParseException ex) {
        log.error(GenerateMultipleNumShardsCacheFile.class.getName(), ex);
    }
}
 
Example #21
Source File: MetricsTableConfigHelperTest.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldDisableMetricsWhenConfigFails() throws Exception {
    String table = MetricsConfiguration.getTable(conf);
    
    // Using mocks to force error during tops.getIteratorSetting()
    TableOperations tops = EasyMock.createMock(TableOperations.class);
    EasyMock.expect(tops.getIteratorSetting(EasyMock.anyString(), EasyMock.anyString(), EasyMock.anyObject(IteratorScope.class))).andThrow(
                    new AccumuloException(""));
    EasyMock.replay(tops);
    
    // run test
    configHelper.configure(tops);
    
    assertFalse(MetricsConfiguration.isEnabled(conf));
}
 
Example #22
Source File: QueryTestTableHelper.java    From datawave with Apache License 2.0 5 votes vote down vote up
public QueryTestTableHelper(Connector connector, Logger log) throws AccumuloSecurityException, AccumuloException, TableExistsException,
                TableNotFoundException {
    // create mock instance and connector
    this.connector = connector;
    this.log = log;
    createTables();
}
 
Example #23
Source File: AbstractTableConfigHelperTest.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Override
protected void setLocalityGroupConfigurationIfNecessary(String tableName, Map<String,Set<Text>> newLocalityGroups, TableOperations tops, Logger log)
                throws AccumuloException, TableNotFoundException, AccumuloSecurityException {
    
    setLocalityGroupConfigurationCalled = true;
    
    if (!overrideSetLocalityGroupConfigured) {
        
        super.setLocalityGroupConfigurationIfNecessary(tableName, newLocalityGroups, tops, log);
    }
}
 
Example #24
Source File: QueryTestTableHelper.java    From datawave with Apache License 2.0 5 votes vote down vote up
/**
 * 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...
}
 
Example #25
Source File: ErrorMetadataTableConfigHelper.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Override
public void configure(TableOperations tops) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
    super.configure(tops);
    for (IteratorUtil.IteratorScope scope : IteratorUtil.IteratorScope.values()) {
        configureToDropBadData(tops, scope.name());
    }
}
 
Example #26
Source File: ShardTableQueryMetricHandler.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Override
public void reload() {
    try {
        if (this.recordWriter != null) {
            // don't try to flush the mtbw (close). If recordWriter != null then this method is being called
            // because of an Exception and the metrics have been saved off to be added to the new recordWriter.
            this.recordWriter.returnConnector();
        }
        recordWriter = new AccumuloRecordWriter(this.connectionFactory, conf);
    } catch (AccumuloException | AccumuloSecurityException | IOException e) {
        log.error(e.getMessage(), e);
    }
}
 
Example #27
Source File: LoadDateTableConfigHelper.java    From datawave with Apache License 2.0 5 votes vote down vote up
private void setCombinerForLoadDateCounts(TableOperations tops, String scopeName) throws AccumuloException, AccumuloSecurityException,
                TableNotFoundException {
    String stem = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scopeName, "LoadDateMetadataCombiner");
    String tableName = LoadDateTableConfigHelper.getLoadDatesTableName(conf);
    setPropertyIfNecessary(tableName, stem, "18,org.apache.accumulo.core.iterators.user.SummingCombiner", tops, log);
    setPropertyIfNecessary(tableName, stem + ".opt.all", "true", tops, log);
    setPropertyIfNecessary(tableName, stem + ".opt.type", LongCombiner.Type.VARLEN.name(), tops, log);
}
 
Example #28
Source File: DateIndexTableConfigHelper.java    From datawave with Apache License 2.0 5 votes vote down vote up
protected void configureDateIndexTable(TableOperations tops) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
    // Add the DATE aggregator
    for (IteratorScope scope : IteratorScope.values()) {
        String stem = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scope.name(), "DATEAggregator");
        setPropertyIfNecessary(tableName, stem, "19,datawave.iterators.TotalAggregatingIterator", tops, log);
        stem += ".opt.";
        setPropertyIfNecessary(tableName, stem + "*", "datawave.ingest.table.aggregator.DateIndexDateAggregator", tops, log);
    }
    
    setPropertyIfNecessary(tableName, Property.TABLE_BLOOM_ENABLED.getKey(), Boolean.toString(false), tops, log);
    
    // Set the locality group for the full content column family
    setLocalityGroupConfigurationIfNecessary(tableName, localityGroups, tops, log);
}
 
Example #29
Source File: AccumuloRecordWriter.java    From datawave with Apache License 2.0 5 votes vote down vote up
public AccumuloRecordWriter(AccumuloConnectionFactory connectionFactory, Configuration conf) throws AccumuloException, AccumuloSecurityException,
                IOException {
    Level l = getLogLevel(conf);
    if (l != null) {
        log.setLevel(getLogLevel(conf));
    }
    this.simulate = getSimulationMode(conf);
    this.createTables = canCreateTables(conf);
    
    if (simulate) {
        log.info("Simulating output only. No writes to tables will occur");
    }
    
    this.bws = new HashMap<>();
    
    String tname = getDefaultTableName(conf);
    this.defaultTableName = (tname == null) ? null : new Text(tname);
    
    if (!simulate) {
        try {
            if (connectionFactory == null) {
                this.conn = getInstance(conf).getConnector(getUsername(conf), new PasswordToken(getPassword(conf)));
            } else {
                this.connFactory = connectionFactory;
                Map<String,String> trackingMap = connectionFactory.getTrackingMap(Thread.currentThread().getStackTrace());
                this.conn = connectionFactory.getConnection(Priority.ADMIN, trackingMap);
            }
            mtbw = conn.createMultiTableBatchWriter(getMaxMutationBufferSize(conf), getMaxLatency(conf), getMaxWriteThreads(conf));
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
    }
}
 
Example #30
Source File: LoadDateTableConfigHelper.java    From datawave with Apache License 2.0 5 votes vote down vote up
private void configureToDropBadData(TableOperations tops, String scopeName) throws AccumuloSecurityException, AccumuloException, TableNotFoundException {
    String stem = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scopeName, "dropBadData");
    String tableName = LoadDateTableConfigHelper.getLoadDatesTableName(conf);
    setPropertyIfNecessary(tableName, stem, "30,org.apache.accumulo.core.iterators.user.RegExFilter", tops, log);
    setPropertyIfNecessary(tableName, stem + ".opt.negate", "true", tops, log);
    setPropertyIfNecessary(tableName, stem + ".opt.rowRegex", ".*\\..*", tops, log);
    setPropertyIfNecessary(tableName, stem + ".opt.encoding", "UTF-8", tops, log);
}