final T entry ) {
final ByteArrayId adapterIdObj = writableAdapter.getAdapterId();
final byte[] adapterId = writableAdapter.getAdapterId().getBytes();
IngestEntryInfo entryInfo;
synchronized (this) {
dataStore.store(writableAdapter);
dataStore.store(index);
try {
if (writableAdapter instanceof AttachedIteratorDataAdapter) {
if (!DataAdapterAndIndexCache.getInstance(
AttachedIteratorDataAdapter.ATTACHED_ITERATOR_CACHE_ID).add(
adapterIdObj,
indexName)) {
accumuloOperations.attachIterators(
indexName,
accumuloOptions.isCreateTable(),
((AttachedIteratorDataAdapter) writableAdapter).getAttachedIteratorConfig());
}
}
if (accumuloOptions.isUseLocalityGroups() && !accumuloOperations.localityGroupExists(
indexName,
adapterId)) {
accumuloOperations.addLocalityGroup(
indexName,
adapterId);
}
}
catch (AccumuloException | TableNotFoundException | AccumuloSecurityException e) {
LOGGER.error(
"Unable to determine existence of locality group [" + writableAdapter.getAdapterId().getString() + "]",
e);
}
ensureOpen();
entryInfo = AccumuloUtils.write(
writableAdapter,
index,
entry,
writer
);
if (useAltIndex) {
AccumuloUtils.writeAltIndex(
writableAdapter,
entryInfo,
entry,
altIdxWriter);
}
if (persistStats) {
List<DataStatisticsBuilder> stats;
if (statsMap.containsKey(adapterIdObj)) {
stats = statsMap.get(adapterIdObj);
}
else {
if (writableAdapter instanceof StatisticalDataAdapter) {
final ByteArrayId[] statisticsIds = ((StatisticalDataAdapter<T>) writableAdapter).getSupportedStatisticsIds();
stats = new ArrayList<DataStatisticsBuilder>(
statisticsIds.length);
for (final ByteArrayId id : statisticsIds) {
stats.add(new DataStatisticsBuilder<T>(
(StatisticalDataAdapter) writableAdapter,
id));
}
if ((stats != null) && stats.isEmpty()) {
// if its an empty list, for simplicity just set it
// to null
stats = null;
}
}
else {
stats = null;
}
statsMap.put(
adapterIdObj,
stats);
}
if (stats != null) {
for (final DataStatisticsBuilder<T> s : stats) {
s.entryIngested(
entryInfo,
entry);
}
}
}
}
return entryInfo.getRowIds();
}