if (plan.earlyResultOnPreFlightError.isPresent()) { indexResult = plan.earlyResultOnPreFlightError.get(); assert indexResult.hasFailure(); } else if (plan.indexIntoLucene) { indexResult = indexIntoLucene(index, plan); indexResult = new IndexResult(plan.versionForIndexing, plan.currentNotFoundOrDeleted); if (indexResult.hasFailure() == false && index.origin() != Operation.Origin.LOCAL_TRANSLOG_RECOVERY) { Translog.Location location =
if (plan.earlyResultOnPreFlightError.isPresent()) { indexResult = plan.earlyResultOnPreFlightError.get(); assert indexResult.hasFailure(); } else if (plan.indexIntoLucene) { indexResult = indexIntoLucene(index, plan); indexResult = new IndexResult(plan.versionForIndexing, plan.currentNotFoundOrDeleted); if (indexResult.hasFailure() == false && index.origin() != Operation.Origin.LOCAL_TRANSLOG_RECOVERY) {
final IndexRequest indexRequest = (IndexRequest) itemRequest; Engine.IndexResult indexResult = executeIndexRequestOnPrimary(indexRequest, primary, mappingUpdatedAction, this.clusterService, this.indicesService, metaData); if (indexResult.hasFailure()) { response = null; } else {
@Override public void postIndex(ShardId shardId, Engine.Index indexOperation, Engine.IndexResult result) { if (result.hasFailure() == false) { final ParsedDocument doc = indexOperation.parsedDoc(); final long tookInNanos = result.getTook(); if (indexWarnThreshold >= 0 && tookInNanos > indexWarnThreshold) { indexLogger.warn("{}", new SlowLogParsedDocumentPrinter(index, doc, tookInNanos, reformat, maxSourceCharsToLog)); } else if (indexInfoThreshold >= 0 && tookInNanos > indexInfoThreshold) { indexLogger.info("{}", new SlowLogParsedDocumentPrinter(index, doc, tookInNanos, reformat, maxSourceCharsToLog)); } else if (indexDebugThreshold >= 0 && tookInNanos > indexDebugThreshold) { indexLogger.debug("{}", new SlowLogParsedDocumentPrinter(index, doc, tookInNanos, reformat, maxSourceCharsToLog)); } else if (indexTraceThreshold >= 0 && tookInNanos > indexTraceThreshold) { indexLogger.trace("{}", new SlowLogParsedDocumentPrinter(index, doc, tookInNanos, reformat, maxSourceCharsToLog)); } } }
@Override public void postIndex(ShardId shardId, Engine.Index index, Engine.IndexResult result) { if (result.hasFailure() == false) { if (!index.origin().isRecovery()) { long took = result.getTook(); totalStats.indexMetric.inc(took); totalStats.indexCurrent.dec(); StatsHolder typeStats = typeStats(index.type()); typeStats.indexMetric.inc(took); typeStats.indexCurrent.dec(); } } else { postIndex(shardId, index, result.getFailure()); } }