Search in sources :

Example 1 with UNASSIGNED_PRIMARY_TERM

use of org.opensearch.index.seqno.SequenceNumbers.UNASSIGNED_PRIMARY_TERM in project OpenSearch by opensearch-project.

the class InternalEngineTests method testTreatDocumentFailureAsFatalError.

public void testTreatDocumentFailureAsFatalError() throws Exception {
    AtomicReference<IOException> addDocException = new AtomicReference<>();
    IndexWriterFactory indexWriterFactory = (dir, iwc) -> new IndexWriter(dir, iwc) {

        @Override
        public long addDocument(Iterable<? extends IndexableField> doc) throws IOException {
            final IOException ex = addDocException.getAndSet(null);
            if (ex != null) {
                throw ex;
            }
            return super.addDocument(doc);
        }
    };
    try (Store store = createStore();
        InternalEngine engine = createEngine(defaultSettings, store, createTempDir(), NoMergePolicy.INSTANCE, indexWriterFactory)) {
        final ParsedDocument doc = testParsedDocument("1", null, testDocumentWithTextField(), SOURCE, null);
        Engine.Operation.Origin origin = randomFrom(REPLICA, LOCAL_RESET, PEER_RECOVERY);
        Engine.Index index = new Engine.Index(newUid(doc), doc, randomNonNegativeLong(), primaryTerm.get(), randomNonNegativeLong(), null, origin, System.nanoTime(), -1, false, UNASSIGNED_SEQ_NO, UNASSIGNED_PRIMARY_TERM);
        addDocException.set(new IOException("simulated"));
        expectThrows(IOException.class, () -> engine.index(index));
        assertTrue(engine.isClosed.get());
        assertNotNull(engine.failedEngine.get());
    }
}
Also used : Term(org.apache.lucene.index.Term) AlreadyClosedException(org.apache.lucene.store.AlreadyClosedException) Version(org.opensearch.Version) PEER_RECOVERY(org.opensearch.index.engine.Engine.Operation.Origin.PEER_RECOVERY) MergePolicy(org.apache.lucene.index.MergePolicy) Map(java.util.Map) Mockito.doAnswer(org.mockito.Mockito.doAnswer) DefaultTranslogDeletionPolicy(org.opensearch.index.translog.DefaultTranslogDeletionPolicy) Path(java.nio.file.Path) TimeValue(org.opensearch.common.unit.TimeValue) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) SoftDeletesRetentionMergePolicy(org.apache.lucene.index.SoftDeletesRetentionMergePolicy) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) PointValues(org.apache.lucene.index.PointValues) CountDownLatch(java.util.concurrent.CountDownLatch) Logger(org.apache.logging.log4j.Logger) Randomness(org.opensearch.common.Randomness) BytesArray(org.opensearch.common.bytes.BytesArray) DocIdAndSeqNo(org.opensearch.common.lucene.uid.VersionsAndSeqNoResolver.DocIdAndSeqNo) XContentType(org.opensearch.common.xcontent.XContentType) CodecService(org.opensearch.index.codec.CodecService) ThreadPool(org.opensearch.threadpool.ThreadPool) LogDocMergePolicy(org.apache.lucene.index.LogDocMergePolicy) FixedBitSet(org.apache.lucene.util.FixedBitSet) RegexFilter(org.apache.logging.log4j.core.filter.RegexFilter) Mockito.spy(org.mockito.Mockito.spy) Supplier(java.util.function.Supplier) LinkedHashMap(java.util.LinkedHashMap) ToLongBiFunction(java.util.function.ToLongBiFunction) IndexWriterMaxDocsChanger(org.apache.lucene.index.IndexWriterMaxDocsChanger) Lock(org.apache.lucene.store.Lock) Mapping(org.opensearch.index.mapper.Mapping) VersionFieldMapper(org.opensearch.index.mapper.VersionFieldMapper) Matchers.hasSize(org.hamcrest.Matchers.hasSize) Bits(org.apache.lucene.util.Bits) TieredMergePolicy(org.apache.lucene.index.TieredMergePolicy) Versions(org.opensearch.common.lucene.uid.Versions) Matchers.greaterThanOrEqualTo(org.hamcrest.Matchers.greaterThanOrEqualTo) TestTranslog(org.opensearch.index.translog.TestTranslog) IOException(java.io.IOException) BrokenBarrierException(java.util.concurrent.BrokenBarrierException) UNASSIGNED_PRIMARY_TERM(org.opensearch.index.seqno.SequenceNumbers.UNASSIGNED_PRIMARY_TERM) SourceFieldMapper(org.opensearch.index.mapper.SourceFieldMapper) AtomicLong(java.util.concurrent.atomic.AtomicLong) Phaser(java.util.concurrent.Phaser) TextField(org.apache.lucene.document.TextField) SeqNoFieldMapper(org.opensearch.index.mapper.SeqNoFieldMapper) Matchers.emptyArray(org.hamcrest.Matchers.emptyArray) AbstractRunnable(org.opensearch.common.util.concurrent.AbstractRunnable) BiFunction(java.util.function.BiFunction) StoredField(org.apache.lucene.document.StoredField) Matchers.hasKey(org.hamcrest.Matchers.hasKey) Matchers.everyItem(org.hamcrest.Matchers.everyItem) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Terms(org.apache.lucene.index.Terms) Matchers.lessThanOrEqualTo(org.hamcrest.Matchers.lessThanOrEqualTo) Store(org.opensearch.index.store.Store) Collectors(java.util.stream.Collectors) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) Matchers.equalTo(org.hamcrest.Matchers.equalTo) LeafReader(org.apache.lucene.index.LeafReader) IndexSettings(org.opensearch.index.IndexSettings) MetadataFieldMapper(org.opensearch.index.mapper.MetadataFieldMapper) ShardUtils(org.opensearch.index.shard.ShardUtils) Queue(java.util.Queue) BigArrays(org.opensearch.common.util.BigArrays) IndexReader(org.apache.lucene.index.IndexReader) IndexSearcher(org.apache.lucene.search.IndexSearcher) IndexSettingsModule(org.opensearch.test.IndexSettingsModule) BytesReference(org.opensearch.common.bytes.BytesReference) IndexMetadata(org.opensearch.cluster.metadata.IndexMetadata) CheckedBiConsumer(org.opensearch.common.CheckedBiConsumer) LOCAL_RESET(org.opensearch.index.engine.Engine.Operation.Origin.LOCAL_RESET) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Function(java.util.function.Function) HashSet(java.util.HashSet) Charset(java.nio.charset.Charset) Translog(org.opensearch.index.translog.Translog) PRIMARY(org.opensearch.index.engine.Engine.Operation.Origin.PRIMARY) IntSupplier(java.util.function.IntSupplier) RetentionLease(org.opensearch.index.seqno.RetentionLease) CoreMatchers.sameInstance(org.hamcrest.CoreMatchers.sameInstance) OpenSearchDirectoryReader(org.opensearch.common.lucene.index.OpenSearchDirectoryReader) Collections.emptyMap(java.util.Collections.emptyMap) Matchers.empty(org.hamcrest.Matchers.empty) Semaphore(java.util.concurrent.Semaphore) Mockito.when(org.mockito.Mockito.when) ShardRouting(org.opensearch.cluster.routing.ShardRouting) IOUtils(org.opensearch.core.internal.io.IOUtils) ShardId(org.opensearch.index.shard.ShardId) TestShardRouting(org.opensearch.cluster.routing.TestShardRouting) VersionsAndSeqNoResolver(org.opensearch.common.lucene.uid.VersionsAndSeqNoResolver) Field(org.apache.lucene.document.Field) TransportActions(org.opensearch.action.support.TransportActions) Comparator(java.util.Comparator) LogManager(org.apache.logging.log4j.LogManager) NoMergePolicy(org.apache.lucene.index.NoMergePolicy) SeqNoStats(org.opensearch.index.seqno.SeqNoStats) SequenceNumbers(org.opensearch.index.seqno.SequenceNumbers) Arrays(java.util.Arrays) LongSupplier(java.util.function.LongSupplier) Matchers.not(org.hamcrest.Matchers.not) Level(org.apache.logging.log4j.Level) ContentPath(org.opensearch.index.mapper.ContentPath) LogEvent(org.apache.logging.log4j.core.LogEvent) ReferenceManager(org.apache.lucene.search.ReferenceManager) Document(org.opensearch.index.mapper.ParseContext.Document) Strings(org.opensearch.common.Strings) CoreMatchers.instanceOf(org.hamcrest.CoreMatchers.instanceOf) RandomNumbers(com.carrotsearch.randomizedtesting.generators.RandomNumbers) REPLICA(org.opensearch.index.engine.Engine.Operation.Origin.REPLICA) TermsEnum(org.apache.lucene.index.TermsEnum) Matchers.nullValue(org.hamcrest.Matchers.nullValue) Lucene(org.opensearch.common.lucene.Lucene) ActionListener(org.opensearch.action.ActionListener) SequentialStoredFieldsLeafReader(org.opensearch.common.lucene.index.SequentialStoredFieldsLeafReader) FieldsVisitor(org.opensearch.index.fieldvisitor.FieldsVisitor) NumericDocValuesField(org.apache.lucene.document.NumericDocValuesField) NO_OPS_PERFORMED(org.opensearch.index.seqno.SequenceNumbers.NO_OPS_PERFORMED) Mockito.atLeastOnce(org.mockito.Mockito.atLeastOnce) Set(java.util.Set) SortedSetSortField(org.apache.lucene.search.SortedSetSortField) Settings(org.opensearch.common.settings.Settings) ReplicationTracker(org.opensearch.index.seqno.ReplicationTracker) BuilderContext(org.opensearch.index.mapper.Mapper.BuilderContext) UncheckedIOException(java.io.UncheckedIOException) VersionType(org.opensearch.index.VersionType) Matchers.contains(org.hamcrest.Matchers.contains) CheckedRunnable(org.opensearch.common.CheckedRunnable) LocalCheckpointTracker(org.opensearch.index.seqno.LocalCheckpointTracker) Matchers.greaterThan(org.hamcrest.Matchers.greaterThan) Matchers.is(org.hamcrest.Matchers.is) Matchers.containsString(org.hamcrest.Matchers.containsString) Matchers.in(org.hamcrest.Matchers.in) TriFunction(org.opensearch.common.TriFunction) IndexCommit(org.apache.lucene.index.IndexCommit) LiveIndexWriterConfig(org.apache.lucene.index.LiveIndexWriterConfig) TranslogDeletionPolicies.createTranslogDeletionPolicy(org.opensearch.index.translog.TranslogDeletionPolicies.createTranslogDeletionPolicy) ArrayList(java.util.ArrayList) UNASSIGNED_SEQ_NO(org.opensearch.index.seqno.SequenceNumbers.UNASSIGNED_SEQ_NO) VersionUtils(org.opensearch.test.VersionUtils) ShardRoutingState(org.opensearch.cluster.routing.ShardRoutingState) ParsedDocument(org.opensearch.index.mapper.ParsedDocument) TopDocs(org.apache.lucene.search.TopDocs) ParseContext(org.opensearch.index.mapper.ParseContext) LongStream(java.util.stream.LongStream) SetOnce(org.apache.lucene.util.SetOnce) Files(java.nio.file.Files) AbstractAppender(org.apache.logging.log4j.core.appender.AbstractAppender) Matchers.hasItem(org.hamcrest.Matchers.hasItem) RetentionLeases(org.opensearch.index.seqno.RetentionLeases) SnapshotMatchers(org.opensearch.index.translog.SnapshotMatchers) LOCAL_TRANSLOG_RECOVERY(org.opensearch.index.engine.Engine.Operation.Origin.LOCAL_TRANSLOG_RECOVERY) Collections.shuffle(java.util.Collections.shuffle) IdFieldMapper(org.opensearch.index.mapper.IdFieldMapper) IndexableField(org.apache.lucene.index.IndexableField) NoneCircuitBreakerService(org.opensearch.indices.breaker.NoneCircuitBreakerService) OpenSearchException(org.opensearch.OpenSearchException) ConcurrentCollections(org.opensearch.common.util.concurrent.ConcurrentCollections) ObjectObjectCursor(com.carrotsearch.hppc.cursors.ObjectObjectCursor) MapperService(org.opensearch.index.mapper.MapperService) Directory(org.apache.lucene.store.Directory) LeafReaderContext(org.apache.lucene.index.LeafReaderContext) TotalHitCountCollector(org.apache.lucene.search.TotalHitCountCollector) IndexShardRoutingTable(org.opensearch.cluster.routing.IndexShardRoutingTable) CyclicBarrier(java.util.concurrent.CyclicBarrier) Sort(org.apache.lucene.search.Sort) BytesRef(org.apache.lucene.util.BytesRef) DirectoryReader(org.apache.lucene.index.DirectoryReader) TranslogConfig(org.opensearch.index.translog.TranslogConfig) TranslogDeletionPolicyFactory(org.opensearch.index.translog.TranslogDeletionPolicyFactory) SegmentInfos(org.apache.lucene.index.SegmentInfos) Tuple(org.opensearch.common.collect.Tuple) IndexWriter(org.apache.lucene.index.IndexWriter) List(java.util.List) MatcherAssert(org.hamcrest.MatcherAssert) IndexWriterConfig(org.apache.lucene.index.IndexWriterConfig) MockDirectoryWrapper(org.apache.lucene.store.MockDirectoryWrapper) Uid(org.opensearch.index.mapper.Uid) LongPoint(org.apache.lucene.document.LongPoint) NumericDocValues(org.apache.lucene.index.NumericDocValues) ByteSizeValue(org.opensearch.common.unit.ByteSizeValue) HashMap(java.util.HashMap) ReleasableLock(org.opensearch.common.util.concurrent.ReleasableLock) AtomicReference(java.util.concurrent.atomic.AtomicReference) Loggers(org.opensearch.common.logging.Loggers) UUIDs(org.opensearch.common.UUIDs) Iterator(java.util.Iterator) Matchers(org.hamcrest.Matchers) RootObjectMapper(org.opensearch.index.mapper.RootObjectMapper) Mockito.verify(org.mockito.Mockito.verify) TimeUnit(java.util.concurrent.TimeUnit) TermQuery(org.apache.lucene.search.TermQuery) Closeable(java.io.Closeable) IndexRequest(org.opensearch.action.index.IndexRequest) Collections(java.util.Collections) Store(org.opensearch.index.store.Store) AtomicReference(java.util.concurrent.atomic.AtomicReference) IOException(java.io.IOException) UncheckedIOException(java.io.UncheckedIOException) IndexableField(org.apache.lucene.index.IndexableField) ParsedDocument(org.opensearch.index.mapper.ParsedDocument) IndexWriter(org.apache.lucene.index.IndexWriter)

Example 2 with UNASSIGNED_PRIMARY_TERM

use of org.opensearch.index.seqno.SequenceNumbers.UNASSIGNED_PRIMARY_TERM in project OpenSearch by opensearch-project.

the class InternalEngineTests method assertOpsOnPrimary.

private int assertOpsOnPrimary(List<Engine.Operation> ops, long currentOpVersion, boolean docDeleted, InternalEngine engine) throws IOException {
    String lastFieldValue = null;
    int opsPerformed = 0;
    long lastOpVersion = currentOpVersion;
    long lastOpSeqNo = UNASSIGNED_SEQ_NO;
    long lastOpTerm = UNASSIGNED_PRIMARY_TERM;
    PrimaryTermSupplier currentTerm = (PrimaryTermSupplier) engine.engineConfig.getPrimaryTermSupplier();
    BiFunction<Long, Engine.Index, Engine.Index> indexWithVersion = (version, index) -> new Engine.Index(index.uid(), index.parsedDoc(), UNASSIGNED_SEQ_NO, currentTerm.get(), version, index.versionType(), index.origin(), index.startTime(), index.getAutoGeneratedIdTimestamp(), index.isRetry(), UNASSIGNED_SEQ_NO, 0);
    BiFunction<Long, Engine.Delete, Engine.Delete> delWithVersion = (version, delete) -> new Engine.Delete(delete.type(), delete.id(), delete.uid(), UNASSIGNED_SEQ_NO, currentTerm.get(), version, delete.versionType(), delete.origin(), delete.startTime(), UNASSIGNED_SEQ_NO, 0);
    TriFunction<Long, Long, Engine.Index, Engine.Index> indexWithSeq = (seqNo, term, index) -> new Engine.Index(index.uid(), index.parsedDoc(), UNASSIGNED_SEQ_NO, currentTerm.get(), index.version(), index.versionType(), index.origin(), index.startTime(), index.getAutoGeneratedIdTimestamp(), index.isRetry(), seqNo, term);
    TriFunction<Long, Long, Engine.Delete, Engine.Delete> delWithSeq = (seqNo, term, delete) -> new Engine.Delete(delete.type(), delete.id(), delete.uid(), UNASSIGNED_SEQ_NO, currentTerm.get(), delete.version(), delete.versionType(), delete.origin(), delete.startTime(), seqNo, term);
    Function<Engine.Index, Engine.Index> indexWithCurrentTerm = index -> new Engine.Index(index.uid(), index.parsedDoc(), UNASSIGNED_SEQ_NO, currentTerm.get(), index.version(), index.versionType(), index.origin(), index.startTime(), index.getAutoGeneratedIdTimestamp(), index.isRetry(), index.getIfSeqNo(), index.getIfPrimaryTerm());
    Function<Engine.Delete, Engine.Delete> deleteWithCurrentTerm = delete -> new Engine.Delete(delete.type(), delete.id(), delete.uid(), UNASSIGNED_SEQ_NO, currentTerm.get(), delete.version(), delete.versionType(), delete.origin(), delete.startTime(), delete.getIfSeqNo(), delete.getIfPrimaryTerm());
    for (Engine.Operation op : ops) {
        final boolean versionConflict = rarely();
        final boolean versionedOp = versionConflict || randomBoolean();
        final long conflictingVersion = docDeleted || randomBoolean() ? lastOpVersion + (randomBoolean() ? 1 : -1) : Versions.MATCH_DELETED;
        final long conflictingSeqNo = // use 5 to go above 0 for
        lastOpSeqNo == UNASSIGNED_SEQ_NO || randomBoolean() ? // use 5 to go above 0 for
        lastOpSeqNo + 5 : // magic numbers
        lastOpSeqNo;
        final long conflictingTerm = conflictingSeqNo == lastOpSeqNo || randomBoolean() ? lastOpTerm + 1 : lastOpTerm;
        if (rarely()) {
            currentTerm.set(currentTerm.get() + 1L);
            engine.rollTranslogGeneration();
        }
        final long correctVersion = docDeleted ? Versions.MATCH_DELETED : lastOpVersion;
        logger.info("performing [{}]{}{}", op.operationType().name().charAt(0), versionConflict ? " (conflict " + conflictingVersion + ")" : "", versionedOp ? " (versioned " + correctVersion + ", seqNo " + lastOpSeqNo + ", term " + lastOpTerm + " )" : "");
        if (op instanceof Engine.Index) {
            final Engine.Index index = (Engine.Index) op;
            if (versionConflict) {
                // generate a conflict
                final Engine.IndexResult result;
                if (randomBoolean()) {
                    result = engine.index(indexWithSeq.apply(conflictingSeqNo, conflictingTerm, index));
                } else {
                    result = engine.index(indexWithVersion.apply(conflictingVersion, index));
                }
                assertThat(result.isCreated(), equalTo(false));
                assertThat(result.getVersion(), equalTo(lastOpVersion));
                assertThat(result.getResultType(), equalTo(Engine.Result.Type.FAILURE));
                assertThat(result.getFailure(), instanceOf(VersionConflictEngineException.class));
                assertThat(result.getFailure().getStackTrace(), emptyArray());
            } else {
                final Engine.IndexResult result;
                if (versionedOp) {
                    // TODO: add support for non-existing docs
                    if (randomBoolean() && lastOpSeqNo != SequenceNumbers.UNASSIGNED_SEQ_NO && docDeleted == false) {
                        result = engine.index(indexWithSeq.apply(lastOpSeqNo, lastOpTerm, index));
                    } else {
                        result = engine.index(indexWithVersion.apply(correctVersion, index));
                    }
                } else {
                    result = engine.index(indexWithCurrentTerm.apply(index));
                }
                assertThat(result.isCreated(), equalTo(docDeleted));
                assertThat(result.getVersion(), equalTo(Math.max(lastOpVersion + 1, 1)));
                assertThat(result.getResultType(), equalTo(Engine.Result.Type.SUCCESS));
                assertThat(result.getFailure(), nullValue());
                lastFieldValue = index.docs().get(0).get("value");
                docDeleted = false;
                lastOpVersion = result.getVersion();
                lastOpSeqNo = result.getSeqNo();
                lastOpTerm = result.getTerm();
                opsPerformed++;
            }
        } else {
            final Engine.Delete delete = (Engine.Delete) op;
            if (versionConflict) {
                // generate a conflict
                Engine.DeleteResult result;
                if (randomBoolean()) {
                    result = engine.delete(delWithSeq.apply(conflictingSeqNo, conflictingTerm, delete));
                } else {
                    result = engine.delete(delWithVersion.apply(conflictingVersion, delete));
                }
                assertThat(result.isFound(), equalTo(docDeleted == false));
                assertThat(result.getVersion(), equalTo(lastOpVersion));
                assertThat(result.getResultType(), equalTo(Engine.Result.Type.FAILURE));
                assertThat(result.getFailure(), instanceOf(VersionConflictEngineException.class));
                assertThat(result.getFailure().getStackTrace(), emptyArray());
            } else {
                final Engine.DeleteResult result;
                long correctSeqNo = docDeleted ? UNASSIGNED_SEQ_NO : lastOpSeqNo;
                if (versionedOp && lastOpSeqNo != UNASSIGNED_SEQ_NO && randomBoolean()) {
                    result = engine.delete(delWithSeq.apply(correctSeqNo, lastOpTerm, delete));
                } else if (versionedOp) {
                    result = engine.delete(delWithVersion.apply(correctVersion, delete));
                } else {
                    result = engine.delete(deleteWithCurrentTerm.apply(delete));
                }
                assertThat(result.isFound(), equalTo(docDeleted == false));
                assertThat(result.getVersion(), equalTo(Math.max(lastOpVersion + 1, 1)));
                assertThat(result.getResultType(), equalTo(Engine.Result.Type.SUCCESS));
                assertThat(result.getFailure(), nullValue());
                docDeleted = true;
                lastOpVersion = result.getVersion();
                lastOpSeqNo = result.getSeqNo();
                lastOpTerm = result.getTerm();
                opsPerformed++;
            }
        }
        if (randomBoolean()) {
            // refresh and take the chance to check everything is ok so far
            assertVisibleCount(engine, docDeleted ? 0 : 1);
            // first op and it failed.
            if (docDeleted == false && lastFieldValue != null) {
                try (Engine.Searcher searcher = engine.acquireSearcher("test")) {
                    final TotalHitCountCollector collector = new TotalHitCountCollector();
                    searcher.search(new TermQuery(new Term("value", lastFieldValue)), collector);
                    assertThat(collector.getTotalHits(), equalTo(1));
                }
            }
        }
        if (randomBoolean()) {
            engine.flush();
            engine.refresh("test");
        }
        if (rarely()) {
            // simulate GC deletes
            engine.refresh("gc_simulation", Engine.SearcherScope.INTERNAL, true);
            engine.clearDeletedTombstones();
            if (docDeleted) {
                lastOpVersion = Versions.NOT_FOUND;
                lastOpSeqNo = UNASSIGNED_SEQ_NO;
                lastOpTerm = UNASSIGNED_PRIMARY_TERM;
            }
        }
    }
    assertVisibleCount(engine, docDeleted ? 0 : 1);
    if (docDeleted == false) {
        try (Engine.Searcher searcher = engine.acquireSearcher("test")) {
            final TotalHitCountCollector collector = new TotalHitCountCollector();
            searcher.search(new TermQuery(new Term("value", lastFieldValue)), collector);
            assertThat(collector.getTotalHits(), equalTo(1));
        }
    }
    return opsPerformed;
}
Also used : Term(org.apache.lucene.index.Term) AlreadyClosedException(org.apache.lucene.store.AlreadyClosedException) Version(org.opensearch.Version) PEER_RECOVERY(org.opensearch.index.engine.Engine.Operation.Origin.PEER_RECOVERY) MergePolicy(org.apache.lucene.index.MergePolicy) Map(java.util.Map) Mockito.doAnswer(org.mockito.Mockito.doAnswer) DefaultTranslogDeletionPolicy(org.opensearch.index.translog.DefaultTranslogDeletionPolicy) Path(java.nio.file.Path) TimeValue(org.opensearch.common.unit.TimeValue) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) SoftDeletesRetentionMergePolicy(org.apache.lucene.index.SoftDeletesRetentionMergePolicy) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) PointValues(org.apache.lucene.index.PointValues) CountDownLatch(java.util.concurrent.CountDownLatch) Logger(org.apache.logging.log4j.Logger) Randomness(org.opensearch.common.Randomness) BytesArray(org.opensearch.common.bytes.BytesArray) DocIdAndSeqNo(org.opensearch.common.lucene.uid.VersionsAndSeqNoResolver.DocIdAndSeqNo) XContentType(org.opensearch.common.xcontent.XContentType) CodecService(org.opensearch.index.codec.CodecService) ThreadPool(org.opensearch.threadpool.ThreadPool) LogDocMergePolicy(org.apache.lucene.index.LogDocMergePolicy) FixedBitSet(org.apache.lucene.util.FixedBitSet) RegexFilter(org.apache.logging.log4j.core.filter.RegexFilter) Mockito.spy(org.mockito.Mockito.spy) Supplier(java.util.function.Supplier) LinkedHashMap(java.util.LinkedHashMap) ToLongBiFunction(java.util.function.ToLongBiFunction) IndexWriterMaxDocsChanger(org.apache.lucene.index.IndexWriterMaxDocsChanger) Lock(org.apache.lucene.store.Lock) Mapping(org.opensearch.index.mapper.Mapping) VersionFieldMapper(org.opensearch.index.mapper.VersionFieldMapper) Matchers.hasSize(org.hamcrest.Matchers.hasSize) Bits(org.apache.lucene.util.Bits) TieredMergePolicy(org.apache.lucene.index.TieredMergePolicy) Versions(org.opensearch.common.lucene.uid.Versions) Matchers.greaterThanOrEqualTo(org.hamcrest.Matchers.greaterThanOrEqualTo) TestTranslog(org.opensearch.index.translog.TestTranslog) IOException(java.io.IOException) BrokenBarrierException(java.util.concurrent.BrokenBarrierException) UNASSIGNED_PRIMARY_TERM(org.opensearch.index.seqno.SequenceNumbers.UNASSIGNED_PRIMARY_TERM) SourceFieldMapper(org.opensearch.index.mapper.SourceFieldMapper) AtomicLong(java.util.concurrent.atomic.AtomicLong) Phaser(java.util.concurrent.Phaser) TextField(org.apache.lucene.document.TextField) SeqNoFieldMapper(org.opensearch.index.mapper.SeqNoFieldMapper) Matchers.emptyArray(org.hamcrest.Matchers.emptyArray) AbstractRunnable(org.opensearch.common.util.concurrent.AbstractRunnable) BiFunction(java.util.function.BiFunction) StoredField(org.apache.lucene.document.StoredField) Matchers.hasKey(org.hamcrest.Matchers.hasKey) Matchers.everyItem(org.hamcrest.Matchers.everyItem) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Terms(org.apache.lucene.index.Terms) Matchers.lessThanOrEqualTo(org.hamcrest.Matchers.lessThanOrEqualTo) Store(org.opensearch.index.store.Store) Collectors(java.util.stream.Collectors) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) Matchers.equalTo(org.hamcrest.Matchers.equalTo) LeafReader(org.apache.lucene.index.LeafReader) IndexSettings(org.opensearch.index.IndexSettings) MetadataFieldMapper(org.opensearch.index.mapper.MetadataFieldMapper) ShardUtils(org.opensearch.index.shard.ShardUtils) Queue(java.util.Queue) BigArrays(org.opensearch.common.util.BigArrays) IndexReader(org.apache.lucene.index.IndexReader) IndexSearcher(org.apache.lucene.search.IndexSearcher) IndexSettingsModule(org.opensearch.test.IndexSettingsModule) BytesReference(org.opensearch.common.bytes.BytesReference) IndexMetadata(org.opensearch.cluster.metadata.IndexMetadata) CheckedBiConsumer(org.opensearch.common.CheckedBiConsumer) LOCAL_RESET(org.opensearch.index.engine.Engine.Operation.Origin.LOCAL_RESET) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Function(java.util.function.Function) HashSet(java.util.HashSet) Charset(java.nio.charset.Charset) Translog(org.opensearch.index.translog.Translog) PRIMARY(org.opensearch.index.engine.Engine.Operation.Origin.PRIMARY) IntSupplier(java.util.function.IntSupplier) RetentionLease(org.opensearch.index.seqno.RetentionLease) CoreMatchers.sameInstance(org.hamcrest.CoreMatchers.sameInstance) OpenSearchDirectoryReader(org.opensearch.common.lucene.index.OpenSearchDirectoryReader) Collections.emptyMap(java.util.Collections.emptyMap) Matchers.empty(org.hamcrest.Matchers.empty) Semaphore(java.util.concurrent.Semaphore) Mockito.when(org.mockito.Mockito.when) ShardRouting(org.opensearch.cluster.routing.ShardRouting) IOUtils(org.opensearch.core.internal.io.IOUtils) ShardId(org.opensearch.index.shard.ShardId) TestShardRouting(org.opensearch.cluster.routing.TestShardRouting) VersionsAndSeqNoResolver(org.opensearch.common.lucene.uid.VersionsAndSeqNoResolver) Field(org.apache.lucene.document.Field) TransportActions(org.opensearch.action.support.TransportActions) Comparator(java.util.Comparator) LogManager(org.apache.logging.log4j.LogManager) NoMergePolicy(org.apache.lucene.index.NoMergePolicy) SeqNoStats(org.opensearch.index.seqno.SeqNoStats) SequenceNumbers(org.opensearch.index.seqno.SequenceNumbers) Arrays(java.util.Arrays) LongSupplier(java.util.function.LongSupplier) Matchers.not(org.hamcrest.Matchers.not) Level(org.apache.logging.log4j.Level) ContentPath(org.opensearch.index.mapper.ContentPath) LogEvent(org.apache.logging.log4j.core.LogEvent) ReferenceManager(org.apache.lucene.search.ReferenceManager) Document(org.opensearch.index.mapper.ParseContext.Document) Strings(org.opensearch.common.Strings) CoreMatchers.instanceOf(org.hamcrest.CoreMatchers.instanceOf) RandomNumbers(com.carrotsearch.randomizedtesting.generators.RandomNumbers) REPLICA(org.opensearch.index.engine.Engine.Operation.Origin.REPLICA) TermsEnum(org.apache.lucene.index.TermsEnum) Matchers.nullValue(org.hamcrest.Matchers.nullValue) Lucene(org.opensearch.common.lucene.Lucene) ActionListener(org.opensearch.action.ActionListener) SequentialStoredFieldsLeafReader(org.opensearch.common.lucene.index.SequentialStoredFieldsLeafReader) FieldsVisitor(org.opensearch.index.fieldvisitor.FieldsVisitor) NumericDocValuesField(org.apache.lucene.document.NumericDocValuesField) NO_OPS_PERFORMED(org.opensearch.index.seqno.SequenceNumbers.NO_OPS_PERFORMED) Mockito.atLeastOnce(org.mockito.Mockito.atLeastOnce) Set(java.util.Set) SortedSetSortField(org.apache.lucene.search.SortedSetSortField) Settings(org.opensearch.common.settings.Settings) ReplicationTracker(org.opensearch.index.seqno.ReplicationTracker) BuilderContext(org.opensearch.index.mapper.Mapper.BuilderContext) UncheckedIOException(java.io.UncheckedIOException) VersionType(org.opensearch.index.VersionType) Matchers.contains(org.hamcrest.Matchers.contains) CheckedRunnable(org.opensearch.common.CheckedRunnable) LocalCheckpointTracker(org.opensearch.index.seqno.LocalCheckpointTracker) Matchers.greaterThan(org.hamcrest.Matchers.greaterThan) Matchers.is(org.hamcrest.Matchers.is) Matchers.containsString(org.hamcrest.Matchers.containsString) Matchers.in(org.hamcrest.Matchers.in) TriFunction(org.opensearch.common.TriFunction) IndexCommit(org.apache.lucene.index.IndexCommit) LiveIndexWriterConfig(org.apache.lucene.index.LiveIndexWriterConfig) TranslogDeletionPolicies.createTranslogDeletionPolicy(org.opensearch.index.translog.TranslogDeletionPolicies.createTranslogDeletionPolicy) ArrayList(java.util.ArrayList) UNASSIGNED_SEQ_NO(org.opensearch.index.seqno.SequenceNumbers.UNASSIGNED_SEQ_NO) VersionUtils(org.opensearch.test.VersionUtils) ShardRoutingState(org.opensearch.cluster.routing.ShardRoutingState) ParsedDocument(org.opensearch.index.mapper.ParsedDocument) TopDocs(org.apache.lucene.search.TopDocs) ParseContext(org.opensearch.index.mapper.ParseContext) LongStream(java.util.stream.LongStream) SetOnce(org.apache.lucene.util.SetOnce) Files(java.nio.file.Files) AbstractAppender(org.apache.logging.log4j.core.appender.AbstractAppender) Matchers.hasItem(org.hamcrest.Matchers.hasItem) RetentionLeases(org.opensearch.index.seqno.RetentionLeases) SnapshotMatchers(org.opensearch.index.translog.SnapshotMatchers) LOCAL_TRANSLOG_RECOVERY(org.opensearch.index.engine.Engine.Operation.Origin.LOCAL_TRANSLOG_RECOVERY) Collections.shuffle(java.util.Collections.shuffle) IdFieldMapper(org.opensearch.index.mapper.IdFieldMapper) IndexableField(org.apache.lucene.index.IndexableField) NoneCircuitBreakerService(org.opensearch.indices.breaker.NoneCircuitBreakerService) OpenSearchException(org.opensearch.OpenSearchException) ConcurrentCollections(org.opensearch.common.util.concurrent.ConcurrentCollections) ObjectObjectCursor(com.carrotsearch.hppc.cursors.ObjectObjectCursor) MapperService(org.opensearch.index.mapper.MapperService) Directory(org.apache.lucene.store.Directory) LeafReaderContext(org.apache.lucene.index.LeafReaderContext) TotalHitCountCollector(org.apache.lucene.search.TotalHitCountCollector) IndexShardRoutingTable(org.opensearch.cluster.routing.IndexShardRoutingTable) CyclicBarrier(java.util.concurrent.CyclicBarrier) Sort(org.apache.lucene.search.Sort) BytesRef(org.apache.lucene.util.BytesRef) DirectoryReader(org.apache.lucene.index.DirectoryReader) TranslogConfig(org.opensearch.index.translog.TranslogConfig) TranslogDeletionPolicyFactory(org.opensearch.index.translog.TranslogDeletionPolicyFactory) SegmentInfos(org.apache.lucene.index.SegmentInfos) Tuple(org.opensearch.common.collect.Tuple) IndexWriter(org.apache.lucene.index.IndexWriter) List(java.util.List) MatcherAssert(org.hamcrest.MatcherAssert) IndexWriterConfig(org.apache.lucene.index.IndexWriterConfig) MockDirectoryWrapper(org.apache.lucene.store.MockDirectoryWrapper) Uid(org.opensearch.index.mapper.Uid) LongPoint(org.apache.lucene.document.LongPoint) NumericDocValues(org.apache.lucene.index.NumericDocValues) ByteSizeValue(org.opensearch.common.unit.ByteSizeValue) HashMap(java.util.HashMap) ReleasableLock(org.opensearch.common.util.concurrent.ReleasableLock) AtomicReference(java.util.concurrent.atomic.AtomicReference) Loggers(org.opensearch.common.logging.Loggers) UUIDs(org.opensearch.common.UUIDs) Iterator(java.util.Iterator) Matchers(org.hamcrest.Matchers) RootObjectMapper(org.opensearch.index.mapper.RootObjectMapper) Mockito.verify(org.mockito.Mockito.verify) TimeUnit(java.util.concurrent.TimeUnit) TermQuery(org.apache.lucene.search.TermQuery) Closeable(java.io.Closeable) IndexRequest(org.opensearch.action.index.IndexRequest) Collections(java.util.Collections) Matchers.containsString(org.hamcrest.Matchers.containsString) TotalHitCountCollector(org.apache.lucene.search.TotalHitCountCollector) TermQuery(org.apache.lucene.search.TermQuery) Term(org.apache.lucene.index.Term) LongPoint(org.apache.lucene.document.LongPoint) AtomicLong(java.util.concurrent.atomic.AtomicLong)

Aggregations

ObjectObjectCursor (com.carrotsearch.hppc.cursors.ObjectObjectCursor)2 RandomNumbers (com.carrotsearch.randomizedtesting.generators.RandomNumbers)2 Closeable (java.io.Closeable)2 IOException (java.io.IOException)2 UncheckedIOException (java.io.UncheckedIOException)2 Charset (java.nio.charset.Charset)2 Files (java.nio.file.Files)2 Path (java.nio.file.Path)2 ArrayList (java.util.ArrayList)2 Arrays (java.util.Arrays)2 Collections (java.util.Collections)2 Collections.emptyMap (java.util.Collections.emptyMap)2 Collections.shuffle (java.util.Collections.shuffle)2 Comparator (java.util.Comparator)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Iterator (java.util.Iterator)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 Map (java.util.Map)2