Package org.elasticsearch.index.engine
Class EngineTestCase
java.lang.Object
org.junit.Assert
org.apache.lucene.tests.util.LuceneTestCase
org.elasticsearch.test.ESTestCase
org.elasticsearch.index.engine.EngineTestCase
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic final classstatic final classNested classes/interfaces inherited from class org.elasticsearch.test.ESTestCase
ESTestCase.DeprecationWarning, ESTestCase.EntitledTestPackages, ESTestCase.GeohashGenerator, ESTestCase.TestAnalysis, ESTestCase.WithEntitlementsOnTestCode, ESTestCase.WithoutEntitlementsNested classes/interfaces inherited from class org.apache.lucene.tests.util.LuceneTestCase
org.apache.lucene.tests.util.LuceneTestCase.AwaitsFix, org.apache.lucene.tests.util.LuceneTestCase.BadApple, org.apache.lucene.tests.util.LuceneTestCase.Monster, org.apache.lucene.tests.util.LuceneTestCase.Nightly, org.apache.lucene.tests.util.LuceneTestCase.SuppressCodecs, org.apache.lucene.tests.util.LuceneTestCase.SuppressFileSystems, org.apache.lucene.tests.util.LuceneTestCase.SuppressFsync, org.apache.lucene.tests.util.LuceneTestCase.SuppressReproduceLine, org.apache.lucene.tests.util.LuceneTestCase.SuppressSysoutChecks, org.apache.lucene.tests.util.LuceneTestCase.SuppressTempFileChecks, org.apache.lucene.tests.util.LuceneTestCase.ThrowingConsumer<T>, org.apache.lucene.tests.util.LuceneTestCase.ThrowingRunnable, org.apache.lucene.tests.util.LuceneTestCase.Weekly -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AllocationIdprotected static final BytesReferenceprotected static final BytesReferenceprotected static final BytesReferenceprotected Stringprotected IndexSettingsprotected InternalEngineprotected static final IndexSettingsprotected MapperServiceprotected NodeEnvironmentprotected final EngineTestCase.PrimaryTermSupplierprotected Pathprotected InternalEngineprotected Pathprotected final ShardIdprotected static final BytesArrayprotected Storeprotected Storeprotected ThreadPoolprotected ThreadPoolMergeExecutorServiceprotected TranslogHandlerFields inherited from class org.elasticsearch.test.ESTestCase
checkIndexFailures, DEFAULT_TEST_WORKER_ID, failureAndSuccessEvents, FIPS_SYSPROP, JAVA_TIMEZONE_IDS, JAVA_ZONE_IDS, logger, MIN_PRIVATE_PORT, SAFE_AWAIT_TIMEOUT, TEST_ENTITLEMENTS, TEST_REQUEST_TIMEOUT, TEST_WORKER_SYS_PROPERTY, TEST_WORKER_VM_ID, UNSIGNED_LONG_MAXFields inherited from class org.apache.lucene.tests.util.LuceneTestCase
assertsAreEnabled, classRules, DEFAULT_LINE_DOCS_FILE, INFOSTREAM, JENKINS_LARGE_LINE_DOCS_FILE, LEAVE_TEMPORARY, MAYBE_CACHE_POLICY, RANDOM_MULTIPLIER, ruleChain, suiteFailureMarker, SYSPROP_AWAITSFIX, SYSPROP_BADAPPLES, SYSPROP_FAILFAST, SYSPROP_MAXFAILURES, SYSPROP_MONSTER, SYSPROP_NIGHTLY, SYSPROP_WEEKLY, TEST_ASSERTS_ENABLED, TEST_AWAITSFIX, TEST_BADAPPLES, TEST_CODEC, TEST_DIRECTORY, TEST_DOCVALUESFORMAT, TEST_LINE_DOCS_FILE, TEST_MONSTER, TEST_NIGHTLY, TEST_POSTINGSFORMAT, TEST_THROTTLING, TEST_WEEKLY, VERBOSE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Engine.ResultapplyOperation(Engine engine, Engine.Operation operation) static voidapplyOperations(Engine engine, List<Engine.Operation> operations) static voidstatic voidassertAtMostOneLuceneDocumentPerSequenceNumber(IndexSettings indexSettings, org.apache.lucene.index.DirectoryReader reader) static voidAsserts the provided engine has a consistent document history between translog and Lucene index.static voidassertMaxSeqNoInCommitUserData(Engine engine) Asserts that the max_seq_no stored in the commit's user_data is never smaller than seq_no of any document in the commit.static voidassertNoInFlightDocuments(Engine engine) static voidassertOpsOnReplica(List<Engine.Operation> ops, InternalEngine replicaEngine, boolean shuffleOps, org.apache.logging.log4j.Logger logger) protected static voidassertVisibleCount(Engine engine, int numDocs) protected static voidassertVisibleCount(Engine engine, int numDocs, boolean refresh) protected static voidassertVisibleCount(InternalEngine engine, int numDocs) protected static voidassertVisibleCount(InternalEngine engine, int numDocs, boolean refresh) protected static BytesArraybytesArray(String string) static voidcheckNoSoftDeletesLoaded(ReadOnlyEngine readOnlyEngine) static voidconcurrentlyApplyOps(List<Engine.Operation> ops, InternalEngine engine) protected EngineConfigconfig(EngineConfig config, Store store, Path translogPath) config(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, org.apache.lucene.search.ReferenceManager.RefreshListener refreshListener) config(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, org.apache.lucene.search.ReferenceManager.RefreshListener externalRefreshListener, org.apache.lucene.search.ReferenceManager.RefreshListener internalRefreshListener, org.apache.lucene.search.Sort indexSort, LongSupplier maybeGlobalCheckpointSupplier, Supplier<RetentionLeases> maybeRetentionLeasesSupplier, CircuitBreakerService breakerService, Engine.IndexCommitListener indexCommitListener) config(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, org.apache.lucene.search.ReferenceManager.RefreshListener externalRefreshListener, org.apache.lucene.search.ReferenceManager.RefreshListener internalRefreshListener, org.apache.lucene.search.Sort indexSort, LongSupplier maybeGlobalCheckpointSupplier, CircuitBreakerService breakerService) config(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, org.apache.lucene.search.ReferenceManager.RefreshListener refreshListener, org.apache.lucene.search.Sort indexSort, LongSupplier globalCheckpointSupplier) config(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, org.apache.lucene.search.ReferenceManager.RefreshListener refreshListener, org.apache.lucene.search.Sort indexSort, LongSupplier globalCheckpointSupplier, Supplier<RetentionLeases> retentionLeasesSupplier) static EngineConfigcopy(EngineConfig config, LongSupplier globalCheckpointSupplier) copy(EngineConfig config, org.apache.lucene.analysis.Analyzer analyzer) copy(EngineConfig config, org.apache.lucene.index.MergePolicy mergePolicy) protected InternalEnginecreateEngine(EngineConfig config) static InternalEnginecreateEngine(EngineConfig engineConfig, int maxDocs) protected InternalEnginecreateEngine(EngineTestCase.IndexWriterFactory indexWriterFactory, BiFunction<Long, Long, LocalCheckpointTracker> localCheckpointTrackerSupplier, ToLongBiFunction<Engine, Engine.Operation> seqNoForOperation, EngineConfig config) protected InternalEnginecreateEngine(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy) protected InternalEnginecreateEngine(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, EngineTestCase.IndexWriterFactory indexWriterFactory) protected InternalEnginecreateEngine(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, EngineTestCase.IndexWriterFactory indexWriterFactory, BiFunction<Long, Long, LocalCheckpointTracker> localCheckpointTrackerSupplier, LongSupplier globalCheckpointSupplier) protected InternalEnginecreateEngine(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, EngineTestCase.IndexWriterFactory indexWriterFactory, BiFunction<Long, Long, LocalCheckpointTracker> localCheckpointTrackerSupplier, LongSupplier globalCheckpointSupplier, ToLongBiFunction<Engine, Engine.Operation> seqNoForOperation) protected InternalEnginecreateEngine(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, EngineTestCase.IndexWriterFactory indexWriterFactory, BiFunction<Long, Long, LocalCheckpointTracker> localCheckpointTrackerSupplier, ToLongBiFunction<Engine, Engine.Operation> seqNoForOperation, org.apache.lucene.search.Sort indexSort, LongSupplier globalCheckpointSupplier) protected InternalEnginecreateEngine(Store store, Path translogPath) protected InternalEnginecreateEngine(Store store, Path translogPath, BiFunction<Long, Long, LocalCheckpointTracker> localCheckpointTrackerSupplier) protected InternalEnginecreateEngine(Store store, Path translogPath, BiFunction<Long, Long, LocalCheckpointTracker> localCheckpointTrackerSupplier, ToLongBiFunction<Engine, Engine.Operation> seqNoForOperation) protected InternalEnginecreateEngine(Store store, Path translogPath, LongSupplier globalCheckpointSupplier) static InternalEnginecreateInternalEngine(EngineTestCase.IndexWriterFactory indexWriterFactory, BiFunction<Long, Long, LocalCheckpointTracker> localCheckpointTrackerSupplier, ToLongBiFunction<Engine, Engine.Operation> seqNoForOperation, EngineConfig config) static MapperServicestatic MapperServicecreateMapperService(Settings settings, String mappings) static MapperServicecreateMapperService(Settings settings, String mappings, List<MapperPlugin> extraMappers) static ParsedDocumentcreateParsedDoc(String id, String routing) static ParsedDocumentcreateParsedDoc(String id, String routing, boolean recoverySource) protected Storeprotected StorecreateStore(org.apache.lucene.store.Directory directory) protected StorecreateStore(IndexSettings indexSettings, org.apache.lucene.store.Directory directory) protected TranslogcreateTranslog(Path translogPath, LongSupplier primaryTermSupplier) protected TranslogcreateTranslog(LongSupplier primaryTermSupplier) protected TranslogHandlercreateTranslogHandler(MapperService mapperService) protected Stringstatic voidensureOpen(Engine engine) protected List<MapperPlugin> generateHistoryOnReplica(int numOps, boolean allowGapInSeqNo, boolean allowDuplicate, boolean includeNestedDocs) generateHistoryOnReplica(int numOps, long startingSeqNo, boolean allowGapInSeqNo, boolean allowDuplicate, boolean includeNestedDocs) static longgenerateNewSeqNo(Engine engine) Generate a new sequence number and return it.static List<Engine.Operation> generateSingleDocHistory(boolean forReplica, VersionType versionType, long primaryTerm, int minOpCount, int maxOpCount, String docId) static List<DocIdSeqNoAndSource> Gets a collection of tuples of docId, sequence number, and primary term of all live documents in the provided engine.static longgetInFlightDocCount(Engine engine) static longgetNumVersionLookups(Engine engine) Returns the number of times a version was looked up either from version map or from the index.static TransloggetTranslog(Engine engine) Exposes a translog associated with the given engine for testing purpose.static booleanprotected Engine.Indexprotected Settingsstatic MappingLookupprotected static CodecServiceprotected Engine.GetnewGet(boolean realtime, ParsedDocument doc) static org.apache.lucene.util.BytesRefnewUid(ParsedDocument doc) protected EngineConfignoOpConfig(IndexSettings indexSettings, Store store, Path translogPath) protected EngineConfignoOpConfig(IndexSettings indexSettings, Store store, Path translogPath, LongSupplier globalCheckpointSupplier) static ParsedDocumentparseDocument(MapperService mapperService, String id, String routing) static org.elasticsearch.core.CheckedFunction<org.apache.lucene.index.DirectoryReader, org.apache.lucene.index.DirectoryReader, IOException> static Function<Engine.Searcher, Engine.Searcher> static List<Translog.Operation> readAllOperationsInLucene(Engine engine) Reads all engine operations that have been processed by the engine from Lucene index.static voidrecoverFromTranslog(Engine engine, Engine.TranslogRecoveryRunner translogRecoveryRunner, long recoverUpToSeqNo) CallEngine.recoverFromTranslog(org.elasticsearch.index.engine.Engine.TranslogRecoveryRunner, long)and block until it succeeds.protected longSupplier of relative timestamps for the engine.protected Engine.DeletereplicaDeleteForDoc(String id, long version, long seqNo, long startTime) protected Engine.IndexreplicaIndexForDoc(ParsedDocument doc, long version, long seqNo, boolean isRetry) voidsetUp()voidtearDown()protected static LuceneDocumentprotected static LuceneDocumentprotected static LuceneDocumenttestDocumentWithTextField(String value) protected ParsedDocumenttestParsedDocument(String id, String routing, LuceneDocument document, BytesReference source, Mapping mappingUpdate) protected static ParsedDocumenttestParsedDocument(String id, String routing, LuceneDocument document, BytesReference source, Mapping mappingUpdate, boolean recoverySource) static voidwaitForOpsToComplete(InternalEngine engine, long seqNo) Waits for all operations up to the provided sequence number to complete in the given internal engine.Methods inherited from class org.elasticsearch.test.ESTestCase
after, afterIfFailed, afterIfSuccessful, allBreakersMemoryReleased, asInstanceOf, assertArrayEquals, assertBusy, assertBusy, assertCriticalWarnings, assertEquals, assertLeakDetected, assertSettingDeprecationsAndWarnings, assertThat, assertThat, assertWarnings, assertWarnings, before, between, buildEnvSettings, buildNewFakeTransportAddress, captureLoggingLevel, checkStaticState, compatibleMediaType, copyInstance, copyNamedWriteable, copyNamedWriteable, copyWriteable, copyWriteable, createDefaultIndexAnalyzers, createParser, createParser, createParser, createParser, createParser, createParser, createParserWithCompatibilityFor, createTestAnalysis, createTestAnalysis, createTestAnalysis, createThreadPool, enableBigArraysReleasedCheck, enableWarningsCheck, ensureAllContextsReleased, ensureAllSearchContextsReleased, ensureCheckIndexPassed, ensureNoWarnings, ensureSupportedLocale, expectThrows, expectThrows, expectThrows, fail, fail, filteredWarnings, flushThreadPoolExecutor, frequently, generateRandomStringArray, generateRandomStringArray, getDataPath, getPortRange, getResourceDataPath, getSuiteFailureMarker, getTestTransportPlugin, getTestTransportType, getWorkerBasePort, indexSettings, indexSettings, inFipsJvm, initTestSeed, isTurkishLocale, iterations, maybeSet, mockScript, newEnvironment, newEnvironment, newLimitedBreaker, newNodeEnvironment, newNodeEnvironment, parserConfig, randomAlphanumericOfLength, randomAlphaOfLength, randomAlphaOfLengthBetween, randomAlphaOfLengthOrNull, randomArray, randomArray, randomBigInteger, randomBoolean, randomByte, randomByteArrayOfLength, randomByteBetween, randomBytesBetween, randomByteSizeValue, randomBytesReference, randomCompatibleMediaType, randomDateFormatterPattern, randomDouble, randomDoubleBetween, randomDoubles, randomDoubles, randomExecutor, randomFloat, randomFloatBetween, randomFloatOrNull, randomFrom, randomFrom, randomFrom, randomFrom, randomFrom, randomFrom, randomGeohash, randomIdentifier, randomInstantBetween, randomInt, randomInt, randomIntBetween, randomIntOrNull, randomInts, randomInts, randomIp, randomList, randomList, randomLong, randomLongBetween, randomLongOrNull, randomLongs, randomLongs, randomMap, randomMillisUpToYear9999, randomNegativeInt, randomNonEmptySubsetOf, randomNonNegativeByte, randomNonNegativeInt, randomNonNegativeIntOrNull, randomNonNegativeLong, randomNonNegativeLongOrNull, randomOptionalBoolean, randomPositiveTimeValue, randomRealisticUnicodeOfCodepointLength, randomRealisticUnicodeOfCodepointLengthBetween, randomRealisticUnicodeOfLength, randomRealisticUnicodeOfLengthBetween, randomSecretKey, randomSecureStringOfLength, randomSet, randomShort, randomSubsetOf, randomSubsetOf, randomSubsetOf, randomTimeValue, randomTimeValue, randomTimeValue, randomTimeZone, randomUnicodeOfCodepointLength, randomUnicodeOfCodepointLengthBetween, randomUnicodeOfLength, randomUnicodeOfLengthBetween, randomUnique, randomUnsignedLongBetween, randomUUID, randomValueOtherThan, randomValueOtherThanMany, randomVendorType, randomZone, removeHeaderWarningAppender, resetCheckIndexStatus, resetPortCounter, restoreContentType, restoreFileSystem, restoreLoggingLevel, runInParallel, safeAcquire, safeAcquire, safeAwait, safeAwait, safeAwait, safeAwait, safeAwait, safeAwait, safeAwaitAndUnwrapFailure, safeAwaitFailure, safeAwaitFailure, safeAwaitFailure, safeAwaitFailure, safeExecute, safeGet, safeGet, safeSleep, safeSleep, scaledRandomIntBetween, secureRandom, secureRandom, secureRandomFips, secureRandomFips, secureRandomNonFips, secureRandomNonFips, setContentType, setFileSystem, setHeaderWarningAppender, settings, shuffledList, shuffleMap, shuffleXContent, shuffleXContent, skipTestWaitingForLuceneFix, spinForAtLeastNMilliseconds, spinForAtLeastOneMillisecond, startInParallel, terminate, terminate, tmpPaths, toShuffledXContent, waitUntil, waitUntil, writableRegistry, xContentRegistryMethods inherited from class org.apache.lucene.tests.util.LuceneTestCase
addVirusChecker, assertDeletedDocsEquals, assertDocsAndPositionsEnumEquals, assertDocsEnumEquals, assertDocsSkippingEquals, assertDocValuesEquals, assertDocValuesEquals, assertDoubleUlpEquals, assertFieldInfosEquals, assertFloatUlpEquals, assertNormsEquals, assertPointsEquals, assertPositionsSkippingEquals, assertReaderEquals, assertReaderStatisticsEquals, assertStoredFieldEquals, assertStoredFieldsEquals, assertTermsEnumEquals, assertTermsEquals, assertTermsEquals, assertTermsStatisticsEquals, assertTermStatsEquals, assertTermVectorsEquals, asSet, assumeFalse, assumeNoException, assumeTrue, assumeWorkingMMapOnWindows, atLeast, atLeast, callStackContains, callStackContains, callStackContainsAnyOf, closeAfterSuite, closeAfterTest, collate, createTempDir, createTempDir, createTempFile, createTempFile, dumpArray, dumpIterator, ensureSaneIWCOnNightly, expectThrows, expectThrows, expectThrows, expectThrowsAnyOf, expectThrowsAnyOf, getDataInputStream, getJvmForkArguments, getOnlyLeafReader, getTestClass, getTestName, hasWorkingMMapOnWindows, isTestThread, localeForLanguageTag, maybeChangeLiveIndexWriterConfig, maybeWrapReader, newAlcoholicMergePolicy, newAlcoholicMergePolicy, newBytesRef, newBytesRef, newBytesRef, newBytesRef, newBytesRef, newBytesRef, newDirectory, newDirectory, newDirectory, newDirectory, newDirectory, newField, newField, newFSDirectory, newFSDirectory, newIndexWriterConfig, newIndexWriterConfig, newIndexWriterConfig, newIOContext, newIOContext, newLogMergePolicy, newLogMergePolicy, newLogMergePolicy, newLogMergePolicy, newLogMergePolicy, newMaybeVirusCheckingDirectory, newMaybeVirusCheckingFSDirectory, newMergePolicy, newMergePolicy, newMergePolicy, newMockDirectory, newMockDirectory, newMockDirectory, newMockFSDirectory, newMockFSDirectory, newSearcher, newSearcher, newSearcher, newSearcher, newSnapshotIndexWriterConfig, newStringField, newStringField, newStringField, newStringField, newTextField, newTextField, newTieredMergePolicy, newTieredMergePolicy, overrideDefaultQueryCache, overrideTestDefaultQueryCache, random, randomLocale, randomTimeZone, randomVectorFormat, rarely, rarely, replaceMaxFailureRule, resetDefaultQueryCache, restoreCPUCoreCount, restoreIndexWriterMaxDocs, runWithRestrictedPermissions, setIndexWriterMaxDocs, setupCPUCoreCount, setUpExecutorService, shutdownExecutorService, slowFileExists, usually, usually, wrapReaderMethods inherited from class org.junit.Assert
assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThrows, assertThrows, assertTrue, assertTrue, fail, fail
-
Field Details
-
shardId
-
allocationId
-
INDEX_SETTINGS
-
threadPool
-
nodeEnvironment
-
threadPoolMergeExecutorService
-
translogHandler
-
store
-
storeReplica
-
mapperService
-
engine
-
replicaEngine
-
defaultSettings
-
codecName
-
-
replicaTranslogDir
-
primaryTerm
-
B_1
-
B_2
-
B_3
-
SOURCE
-
-
Constructor Details
-
EngineTestCase
public EngineTestCase()
-
-
Method Details
-
assertVisibleCount
- Throws:
IOException
-
assertVisibleCount
protected static void assertVisibleCount(Engine engine, int numDocs, boolean refresh) throws IOException - Throws:
IOException
-
indexSettings
-
defaultMapping
-
extraMappers
-
setUp
- Overrides:
setUpin classorg.apache.lucene.tests.util.LuceneTestCase- Throws:
Exception
-
copy
-
copy
-
copy
-
tearDown
- Overrides:
tearDownin classorg.apache.lucene.tests.util.LuceneTestCase- Throws:
Exception
-
testDocumentWithTextField
-
testDocumentWithTextField
-
testDocument
-
createParsedDoc
-
createParsedDoc
-
testParsedDocument
protected ParsedDocument testParsedDocument(String id, String routing, LuceneDocument document, BytesReference source, Mapping mappingUpdate) -
testParsedDocument
protected static ParsedDocument testParsedDocument(String id, String routing, LuceneDocument document, BytesReference source, Mapping mappingUpdate, boolean recoverySource) -
parseDocument
-
createStore
- Throws:
IOException
-
createStore
- Throws:
IOException
-
createStore
protected Store createStore(IndexSettings indexSettings, org.apache.lucene.store.Directory directory) throws IOException - Throws:
IOException
-
createTranslog
- Throws:
IOException
-
createTranslog
protected Translog createTranslog(Path translogPath, LongSupplier primaryTermSupplier) throws IOException - Throws:
IOException
-
createTranslogHandler
-
createEngine
- Throws:
IOException
-
createEngine
protected InternalEngine createEngine(Store store, Path translogPath, LongSupplier globalCheckpointSupplier) throws IOException - Throws:
IOException
-
createEngine
protected InternalEngine createEngine(Store store, Path translogPath, BiFunction<Long, Long, throws IOExceptionLocalCheckpointTracker> localCheckpointTrackerSupplier) - Throws:
IOException
-
createEngine
protected InternalEngine createEngine(Store store, Path translogPath, BiFunction<Long, Long, throws IOExceptionLocalCheckpointTracker> localCheckpointTrackerSupplier, ToLongBiFunction<Engine, Engine.Operation> seqNoForOperation) - Throws:
IOException
-
createEngine
protected InternalEngine createEngine(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy) throws IOException - Throws:
IOException
-
createEngine
protected InternalEngine createEngine(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, @Nullable EngineTestCase.IndexWriterFactory indexWriterFactory) throws IOException - Throws:
IOException
-
createEngine
protected InternalEngine createEngine(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, @Nullable EngineTestCase.IndexWriterFactory indexWriterFactory, @Nullable BiFunction<Long, Long, throws IOExceptionLocalCheckpointTracker> localCheckpointTrackerSupplier, @Nullable LongSupplier globalCheckpointSupplier) - Throws:
IOException
-
createEngine
protected InternalEngine createEngine(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, @Nullable EngineTestCase.IndexWriterFactory indexWriterFactory, @Nullable BiFunction<Long, Long, throws IOExceptionLocalCheckpointTracker> localCheckpointTrackerSupplier, @Nullable LongSupplier globalCheckpointSupplier, @Nullable ToLongBiFunction<Engine, Engine.Operation> seqNoForOperation) - Throws:
IOException
-
createEngine
protected InternalEngine createEngine(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, @Nullable EngineTestCase.IndexWriterFactory indexWriterFactory, @Nullable BiFunction<Long, Long, throws IOExceptionLocalCheckpointTracker> localCheckpointTrackerSupplier, @Nullable ToLongBiFunction<Engine, Engine.Operation> seqNoForOperation, @Nullable org.apache.lucene.search.Sort indexSort, @Nullable LongSupplier globalCheckpointSupplier) - Throws:
IOException
-
createEngine
- Throws:
IOException
-
createEngine
protected InternalEngine createEngine(@Nullable EngineTestCase.IndexWriterFactory indexWriterFactory, @Nullable BiFunction<Long, Long, throws IOExceptionLocalCheckpointTracker> localCheckpointTrackerSupplier, @Nullable ToLongBiFunction<Engine, Engine.Operation> seqNoForOperation, EngineConfig config) - Throws:
IOException
-
createEngine
-
generateNewSeqNo
Generate a new sequence number and return it. Only works on InternalEngines -
createInternalEngine
public static InternalEngine createInternalEngine(@Nullable EngineTestCase.IndexWriterFactory indexWriterFactory, @Nullable BiFunction<Long, Long, LocalCheckpointTracker> localCheckpointTrackerSupplier, @Nullable ToLongBiFunction<Engine, Engine.Operation> seqNoForOperation, EngineConfig config) -
config
public EngineConfig config(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, org.apache.lucene.search.ReferenceManager.RefreshListener refreshListener) -
config
public EngineConfig config(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, org.apache.lucene.search.ReferenceManager.RefreshListener refreshListener, org.apache.lucene.search.Sort indexSort, LongSupplier globalCheckpointSupplier) -
config
public EngineConfig config(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, org.apache.lucene.search.ReferenceManager.RefreshListener refreshListener, org.apache.lucene.search.Sort indexSort, LongSupplier globalCheckpointSupplier, Supplier<RetentionLeases> retentionLeasesSupplier) -
config
public EngineConfig config(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, org.apache.lucene.search.ReferenceManager.RefreshListener externalRefreshListener, org.apache.lucene.search.ReferenceManager.RefreshListener internalRefreshListener, org.apache.lucene.search.Sort indexSort, @Nullable LongSupplier maybeGlobalCheckpointSupplier, CircuitBreakerService breakerService) -
config
public EngineConfig config(IndexSettings indexSettings, Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, org.apache.lucene.search.ReferenceManager.RefreshListener externalRefreshListener, org.apache.lucene.search.ReferenceManager.RefreshListener internalRefreshListener, org.apache.lucene.search.Sort indexSort, @Nullable LongSupplier maybeGlobalCheckpointSupplier, @Nullable Supplier<RetentionLeases> maybeRetentionLeasesSupplier, CircuitBreakerService breakerService, @Nullable Engine.IndexCommitListener indexCommitListener) -
config
-
noOpConfig
-
noOpConfig
protected EngineConfig noOpConfig(IndexSettings indexSettings, Store store, Path translogPath, LongSupplier globalCheckpointSupplier) -
bytesArray
-
newUid
-
newGet
-
indexForDoc
-
replicaIndexForDoc
protected Engine.Index replicaIndexForDoc(ParsedDocument doc, long version, long seqNo, boolean isRetry) -
replicaDeleteForDoc
-
assertVisibleCount
- Throws:
IOException
-
assertVisibleCount
protected static void assertVisibleCount(InternalEngine engine, int numDocs, boolean refresh) throws IOException - Throws:
IOException
-
generateSingleDocHistory
public static List<Engine.Operation> generateSingleDocHistory(boolean forReplica, VersionType versionType, long primaryTerm, int minOpCount, int maxOpCount, String docId) -
generateHistoryOnReplica
public List<Engine.Operation> generateHistoryOnReplica(int numOps, boolean allowGapInSeqNo, boolean allowDuplicate, boolean includeNestedDocs) throws Exception - Throws:
Exception
-
generateHistoryOnReplica
public List<Engine.Operation> generateHistoryOnReplica(int numOps, long startingSeqNo, boolean allowGapInSeqNo, boolean allowDuplicate, boolean includeNestedDocs) throws Exception - Throws:
Exception
-
assertOpsOnReplica
public static void assertOpsOnReplica(List<Engine.Operation> ops, InternalEngine replicaEngine, boolean shuffleOps, org.apache.logging.log4j.Logger logger) throws IOException - Throws:
IOException
-
concurrentlyApplyOps
public static void concurrentlyApplyOps(List<Engine.Operation> ops, InternalEngine engine) throws InterruptedException - Throws:
InterruptedException
-
applyOperations
public static void applyOperations(Engine engine, List<Engine.Operation> operations) throws IOException - Throws:
IOException
-
applyOperation
public static Engine.Result applyOperation(Engine engine, Engine.Operation operation) throws IOException - Throws:
IOException
-
getDocIds
public static List<DocIdSeqNoAndSource> getDocIds(Engine engine, boolean refresh) throws IOException Gets a collection of tuples of docId, sequence number, and primary term of all live documents in the provided engine.- Throws:
IOException
-
readAllOperationsInLucene
Reads all engine operations that have been processed by the engine from Lucene index. The returned operations are sorted and de-duplicated, thus each sequence number will be have at most one operation.- Throws:
IOException
-
assertConsistentHistoryBetweenTranslogAndLuceneIndex
public static void assertConsistentHistoryBetweenTranslogAndLuceneIndex(Engine engine) throws IOException Asserts the provided engine has a consistent document history between translog and Lucene index.- Throws:
IOException
-
assertMaxSeqNoInCommitUserData
Asserts that the max_seq_no stored in the commit's user_data is never smaller than seq_no of any document in the commit.- Throws:
Exception
-
assertAtMostOneLuceneDocumentPerSequenceNumber
- Throws:
IOException
-
assertAtMostOneLuceneDocumentPerSequenceNumber
public static void assertAtMostOneLuceneDocumentPerSequenceNumber(IndexSettings indexSettings, org.apache.lucene.index.DirectoryReader reader) throws IOException - Throws:
IOException
-
createMapperService
- Throws:
IOException
-
createMapperService
public static MapperService createMapperService(Settings settings, String mappings) throws IOException - Throws:
IOException
-
createMapperService
public static MapperService createMapperService(Settings settings, String mappings, List<MapperPlugin> extraMappers) throws IOException - Throws:
IOException
-
mappingLookup
-
getTranslog
Exposes a translog associated with the given engine for testing purpose. -
waitForOpsToComplete
Waits for all operations up to the provided sequence number to complete in the given internal engine.- Parameters:
seqNo- the sequence number that the checkpoint must advance to before this method returns- Throws:
InterruptedException- if the thread was interrupted while blocking on the conditionException
-
hasAcquiredIndexCommitsForTesting
-
getNumVersionLookups
Returns the number of times a version was looked up either from version map or from the index. -
getInFlightDocCount
-
assertNoInFlightDocuments
- Throws:
Exception
-
randomReaderWrapper
public static org.elasticsearch.core.CheckedFunction<org.apache.lucene.index.DirectoryReader,org.apache.lucene.index.DirectoryReader, randomReaderWrapper()IOException> -
randomSearcherWrapper
-
checkNoSoftDeletesLoaded
-
newCodecService
-
relativeTimeInNanos
protected long relativeTimeInNanos()Supplier of relative timestamps for the engine. Override this method to control how time passes as seen by the engine. The default implementation returnsSystem.nanoTime(). -
recoverFromTranslog
public static void recoverFromTranslog(Engine engine, Engine.TranslogRecoveryRunner translogRecoveryRunner, long recoverUpToSeqNo) throws IOException CallEngine.recoverFromTranslog(org.elasticsearch.index.engine.Engine.TranslogRecoveryRunner, long)and block until it succeeds.- Throws:
IOException
-
ensureOpen
-