Package org.elasticsearch.index.engine
Class EngineTestCase
java.lang.Object
org.junit.Assert
org.apache.lucene.util.LuceneTestCase
org.elasticsearch.test.ESTestCase
org.elasticsearch.index.engine.EngineTestCase
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static final class
static final class
Nested classes/interfaces inherited from class org.elasticsearch.test.ESTestCase
ESTestCase.DeprecationWarning, ESTestCase.GeohashGenerator, ESTestCase.TestAnalysis
Nested classes/interfaces inherited from class org.apache.lucene.util.LuceneTestCase
org.apache.lucene.util.LuceneTestCase.AwaitsFix, org.apache.lucene.util.LuceneTestCase.BadApple, org.apache.lucene.util.LuceneTestCase.Monster, org.apache.lucene.util.LuceneTestCase.Nightly, org.apache.lucene.util.LuceneTestCase.Slow, org.apache.lucene.util.LuceneTestCase.SuppressCodecs, org.apache.lucene.util.LuceneTestCase.SuppressFileSystems, org.apache.lucene.util.LuceneTestCase.SuppressFsync, org.apache.lucene.util.LuceneTestCase.SuppressReproduceLine, org.apache.lucene.util.LuceneTestCase.SuppressSysoutChecks, org.apache.lucene.util.LuceneTestCase.SuppressTempFileChecks, org.apache.lucene.util.LuceneTestCase.ThrowingRunnable, org.apache.lucene.util.LuceneTestCase.Weekly
-
Field Summary
Modifier and TypeFieldDescriptionprotected final org.elasticsearch.cluster.routing.AllocationId
protected static final org.elasticsearch.common.bytes.BytesReference
protected static final org.elasticsearch.common.bytes.BytesReference
protected static final org.elasticsearch.common.bytes.BytesReference
protected String
protected org.elasticsearch.index.IndexSettings
protected org.elasticsearch.index.engine.InternalEngine
protected static final org.elasticsearch.index.IndexSettings
protected final EngineTestCase.PrimaryTermSupplier
protected Path
protected org.elasticsearch.index.engine.InternalEngine
protected Path
protected final org.elasticsearch.index.shard.ShardId
protected static final org.elasticsearch.common.bytes.BytesArray
protected org.elasticsearch.index.store.Store
protected org.elasticsearch.index.store.Store
protected org.elasticsearch.threadpool.ThreadPool
protected TranslogHandler
Fields 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, TEST_WORKER_SYS_PROPERTY, TEST_WORKER_VM_ID
Fields inherited from class org.apache.lucene.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_SLOW, 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_SLOW, TEST_THROTTLING, TEST_WEEKLY, VERBOSE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.elasticsearch.index.engine.Engine.Result
applyOperation
(org.elasticsearch.index.engine.Engine engine, org.elasticsearch.index.engine.Engine.Operation operation) static void
applyOperations
(org.elasticsearch.index.engine.Engine engine, List<org.elasticsearch.index.engine.Engine.Operation> operations) static void
assertAtMostOneLuceneDocumentPerSequenceNumber
(org.elasticsearch.index.engine.Engine engine) static void
assertAtMostOneLuceneDocumentPerSequenceNumber
(org.elasticsearch.index.IndexSettings indexSettings, org.apache.lucene.index.DirectoryReader reader) static void
assertConsistentHistoryBetweenTranslogAndLuceneIndex
(org.elasticsearch.index.engine.Engine engine) Asserts the provided engine has a consistent document history between translog and Lucene index.static void
assertMaxSeqNoInCommitUserData
(org.elasticsearch.index.engine.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 void
assertNoInFlightDocuments
(org.elasticsearch.index.engine.Engine engine) static void
assertOpsOnReplica
(List<org.elasticsearch.index.engine.Engine.Operation> ops, org.elasticsearch.index.engine.InternalEngine replicaEngine, boolean shuffleOps, org.apache.logging.log4j.Logger logger) protected static void
assertVisibleCount
(org.elasticsearch.index.engine.Engine engine, int numDocs) protected static void
assertVisibleCount
(org.elasticsearch.index.engine.Engine engine, int numDocs, boolean refresh) protected static void
assertVisibleCount
(org.elasticsearch.index.engine.InternalEngine engine, int numDocs) protected static void
assertVisibleCount
(org.elasticsearch.index.engine.InternalEngine engine, int numDocs, boolean refresh) protected static org.elasticsearch.common.bytes.BytesArray
bytesArray
(String string) static void
checkNoSoftDeletesLoaded
(org.elasticsearch.index.engine.ReadOnlyEngine readOnlyEngine) static void
concurrentlyApplyOps
(List<org.elasticsearch.index.engine.Engine.Operation> ops, org.elasticsearch.index.engine.InternalEngine engine) protected org.elasticsearch.index.engine.EngineConfig
config
(org.elasticsearch.index.engine.EngineConfig config, org.elasticsearch.index.store.Store store, Path translogPath) org.elasticsearch.index.engine.EngineConfig
config
(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, org.apache.lucene.search.ReferenceManager.RefreshListener refreshListener) org.elasticsearch.index.engine.EngineConfig
config
(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.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<org.elasticsearch.index.seqno.RetentionLeases> maybeRetentionLeasesSupplier, org.elasticsearch.indices.breaker.CircuitBreakerService breakerService) org.elasticsearch.index.engine.EngineConfig
config
(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.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, org.elasticsearch.indices.breaker.CircuitBreakerService breakerService) org.elasticsearch.index.engine.EngineConfig
config
(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.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) org.elasticsearch.index.engine.EngineConfig
config
(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.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<org.elasticsearch.index.seqno.RetentionLeases> retentionLeasesSupplier) org.elasticsearch.index.engine.EngineConfig
copy
(org.elasticsearch.index.engine.EngineConfig config, LongSupplier globalCheckpointSupplier) org.elasticsearch.index.engine.EngineConfig
copy
(org.elasticsearch.index.engine.EngineConfig config, org.apache.lucene.analysis.Analyzer analyzer) org.elasticsearch.index.engine.EngineConfig
copy
(org.elasticsearch.index.engine.EngineConfig config, org.apache.lucene.index.MergePolicy mergePolicy) protected org.elasticsearch.index.engine.InternalEngine
createEngine
(org.elasticsearch.index.engine.EngineConfig config) static org.elasticsearch.index.engine.InternalEngine
createEngine
(org.elasticsearch.index.engine.EngineConfig engineConfig, int maxDocs) protected org.elasticsearch.index.engine.InternalEngine
createEngine
(EngineTestCase.IndexWriterFactory indexWriterFactory, BiFunction<Long, Long, org.elasticsearch.index.seqno.LocalCheckpointTracker> localCheckpointTrackerSupplier, ToLongBiFunction<org.elasticsearch.index.engine.Engine, org.elasticsearch.index.engine.Engine.Operation> seqNoForOperation, org.elasticsearch.index.engine.EngineConfig config) protected org.elasticsearch.index.engine.InternalEngine
createEngine
(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy) protected org.elasticsearch.index.engine.InternalEngine
createEngine
(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, EngineTestCase.IndexWriterFactory indexWriterFactory) protected org.elasticsearch.index.engine.InternalEngine
createEngine
(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, EngineTestCase.IndexWriterFactory indexWriterFactory, BiFunction<Long, Long, org.elasticsearch.index.seqno.LocalCheckpointTracker> localCheckpointTrackerSupplier, LongSupplier globalCheckpointSupplier) protected org.elasticsearch.index.engine.InternalEngine
createEngine
(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, EngineTestCase.IndexWriterFactory indexWriterFactory, BiFunction<Long, Long, org.elasticsearch.index.seqno.LocalCheckpointTracker> localCheckpointTrackerSupplier, LongSupplier globalCheckpointSupplier, ToLongBiFunction<org.elasticsearch.index.engine.Engine, org.elasticsearch.index.engine.Engine.Operation> seqNoForOperation) protected org.elasticsearch.index.engine.InternalEngine
createEngine
(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, EngineTestCase.IndexWriterFactory indexWriterFactory, BiFunction<Long, Long, org.elasticsearch.index.seqno.LocalCheckpointTracker> localCheckpointTrackerSupplier, ToLongBiFunction<org.elasticsearch.index.engine.Engine, org.elasticsearch.index.engine.Engine.Operation> seqNoForOperation, org.apache.lucene.search.Sort indexSort, LongSupplier globalCheckpointSupplier) protected org.elasticsearch.index.engine.InternalEngine
createEngine
(org.elasticsearch.index.store.Store store, Path translogPath) protected org.elasticsearch.index.engine.InternalEngine
createEngine
(org.elasticsearch.index.store.Store store, Path translogPath, BiFunction<Long, Long, org.elasticsearch.index.seqno.LocalCheckpointTracker> localCheckpointTrackerSupplier) protected org.elasticsearch.index.engine.InternalEngine
createEngine
(org.elasticsearch.index.store.Store store, Path translogPath, BiFunction<Long, Long, org.elasticsearch.index.seqno.LocalCheckpointTracker> localCheckpointTrackerSupplier, ToLongBiFunction<org.elasticsearch.index.engine.Engine, org.elasticsearch.index.engine.Engine.Operation> seqNoForOperation) protected org.elasticsearch.index.engine.InternalEngine
createEngine
(org.elasticsearch.index.store.Store store, Path translogPath, LongSupplier globalCheckpointSupplier) static org.elasticsearch.index.engine.InternalEngine
createInternalEngine
(EngineTestCase.IndexWriterFactory indexWriterFactory, BiFunction<Long, Long, org.elasticsearch.index.seqno.LocalCheckpointTracker> localCheckpointTrackerSupplier, ToLongBiFunction<org.elasticsearch.index.engine.Engine, org.elasticsearch.index.engine.Engine.Operation> seqNoForOperation, org.elasticsearch.index.engine.EngineConfig config) static org.elasticsearch.index.mapper.MapperService
static org.elasticsearch.index.mapper.ParsedDocument
createParsedDoc
(String id, String routing) static org.elasticsearch.index.mapper.ParsedDocument
createParsedDoc
(String id, String routing, boolean recoverySource) protected org.elasticsearch.index.store.Store
protected org.elasticsearch.index.store.Store
createStore
(org.apache.lucene.store.Directory directory) protected org.elasticsearch.index.store.Store
createStore
(org.elasticsearch.index.IndexSettings indexSettings, org.apache.lucene.store.Directory directory) protected org.elasticsearch.index.translog.Translog
createTranslog
(Path translogPath, LongSupplier primaryTermSupplier) protected org.elasticsearch.index.translog.Translog
createTranslog
(LongSupplier primaryTermSupplier) protected TranslogHandler
createTranslogHandler
(org.elasticsearch.index.IndexSettings indexSettings) List<org.elasticsearch.index.engine.Engine.Operation>
generateHistoryOnReplica
(int numOps, boolean allowGapInSeqNo, boolean allowDuplicate, boolean includeNestedDocs) List<org.elasticsearch.index.engine.Engine.Operation>
generateHistoryOnReplica
(int numOps, long startingSeqNo, boolean allowGapInSeqNo, boolean allowDuplicate, boolean includeNestedDocs) static long
generateNewSeqNo
(org.elasticsearch.index.engine.Engine engine) Generate a new sequence number and return it.static List<org.elasticsearch.index.engine.Engine.Operation>
generateSingleDocHistory
(boolean forReplica, org.elasticsearch.index.VersionType versionType, long primaryTerm, int minOpCount, int maxOpCount, String docId) static List<DocIdSeqNoAndSource>
getDocIds
(org.elasticsearch.index.engine.Engine engine, boolean refresh) Gets a collection of tuples of docId, sequence number, and primary term of all live documents in the provided engine.static long
getInFlightDocCount
(org.elasticsearch.index.engine.Engine engine) static long
getNumVersionLookups
(org.elasticsearch.index.engine.Engine engine) Returns the number of times a version was looked up either from version map or from the index.static org.elasticsearch.index.translog.Translog
getTranslog
(org.elasticsearch.index.engine.Engine engine) Exposes a translog associated with the given engine for testing purpose.static boolean
hasSnapshottedCommits
(org.elasticsearch.index.engine.Engine engine) protected org.elasticsearch.index.engine.Engine.Index
indexForDoc
(org.elasticsearch.index.mapper.ParsedDocument doc) protected org.elasticsearch.common.settings.Settings
static org.elasticsearch.index.mapper.MappingLookup
static org.elasticsearch.common.CheckedBiFunction<String,
Integer, org.elasticsearch.index.mapper.ParsedDocument, IOException> protected org.elasticsearch.index.engine.Engine.Get
newGet
(boolean realtime, org.elasticsearch.index.mapper.ParsedDocument doc) static org.apache.lucene.index.Term
static org.apache.lucene.index.Term
newUid
(org.elasticsearch.index.mapper.ParsedDocument doc) protected org.elasticsearch.index.engine.EngineConfig
noOpConfig
(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.Store store, Path translogPath) protected org.elasticsearch.index.engine.EngineConfig
noOpConfig
(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.Store store, Path translogPath, LongSupplier globalCheckpointSupplier) static org.elasticsearch.core.CheckedFunction<org.apache.lucene.index.DirectoryReader,
org.apache.lucene.index.DirectoryReader, IOException> static Function<org.elasticsearch.index.engine.Engine.Searcher,
org.elasticsearch.index.engine.Engine.Searcher> static List<org.elasticsearch.index.translog.Translog.Operation>
readAllOperationsInLucene
(org.elasticsearch.index.engine.Engine engine) Reads all engine operations that have been processed by the engine from Lucene index.protected org.elasticsearch.index.engine.Engine.Delete
replicaDeleteForDoc
(String id, long version, long seqNo, long startTime) protected org.elasticsearch.index.engine.Engine.Index
replicaIndexForDoc
(org.elasticsearch.index.mapper.ParsedDocument doc, long version, long seqNo, boolean isRetry) void
setUp()
void
tearDown()
protected static org.elasticsearch.index.mapper.LuceneDocument
protected static org.elasticsearch.index.mapper.LuceneDocument
protected static org.elasticsearch.index.mapper.LuceneDocument
testDocumentWithTextField
(String value) protected static org.elasticsearch.index.mapper.ParsedDocument
testParsedDocument
(String id, String routing, org.elasticsearch.index.mapper.LuceneDocument document, org.elasticsearch.common.bytes.BytesReference source, org.elasticsearch.index.mapper.Mapping mappingUpdate) protected static org.elasticsearch.index.mapper.ParsedDocument
testParsedDocument
(String id, String routing, org.elasticsearch.index.mapper.LuceneDocument document, org.elasticsearch.common.bytes.BytesReference source, org.elasticsearch.index.mapper.Mapping mappingUpdate, boolean recoverySource) static void
waitForOpsToComplete
(org.elasticsearch.index.engine.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, assertArrayEquals, assertBusy, assertBusy, assertCriticalWarnings, assertEquals, assertSettingDeprecationsAndWarnings, assertWarnings, assertWarnings, before, between, buildEnvSettings, buildNewFakeTransportAddress, checkStaticState, compatibleMediaType, copyInstance, copyNamedWriteable, copyNamedWriteable, copyWriteable, copyWriteable, createDefaultIndexAnalyzers, createParser, createParser, createParser, createParser, createParser, createParser, createParserWithCompatibilityFor, createTestAnalysis, createTestAnalysis, createTestAnalysis, enableWarningsCheck, ensureAllSearchContextsReleased, ensureCheckIndexPassed, ensureNoWarnings, ensureSupportedLocale, filteredWarnings, frequently, generateRandomStringArray, generateRandomStringArray, getBasePort, getDataPath, getPortRange, getSuiteFailureMarker, getTestTransportPlugin, getTestTransportType, inFipsJvm, iterations, maybeSet, mockScript, newEnvironment, newEnvironment, newNodeEnvironment, newNodeEnvironment, parserConfig, randomAlphaOfLength, randomAlphaOfLengthBetween, randomArray, randomArray, randomBigInteger, randomBoolean, randomByte, randomByteArrayOfLength, randomCompatibleMediaType, randomDateFormatterPattern, randomDouble, randomDoubleBetween, randomFloat, randomFrom, randomFrom, randomFrom, randomFrom, randomFrom, randomFrom, randomGeohash, randomInt, randomInt, randomIntBetween, randomIp, randomList, randomList, randomLong, randomLongBetween, randomMap, randomMillisUpToYear9999, randomNonNegativeByte, randomNonNegativeLong, randomPositiveTimeValue, randomRealisticUnicodeOfCodepointLength, randomRealisticUnicodeOfCodepointLengthBetween, randomRealisticUnicodeOfLength, randomRealisticUnicodeOfLengthBetween, randomShort, randomSubsetOf, randomSubsetOf, randomSubsetOf, randomTimeValue, randomTimeValue, randomTimeValue, randomTimeZone, randomUnicodeOfCodepointLength, randomUnicodeOfCodepointLengthBetween, randomUnicodeOfLength, randomUnicodeOfLengthBetween, randomUnique, randomValueOtherThan, randomValueOtherThanMany, randomVendorType, randomZone, removeHeaderWarningAppender, resetCheckIndexStatus, resetPortCounter, restoreContentType, restoreFileSystem, scaledRandomIntBetween, setContentType, setFileSystem, setHeaderWarningAppender, settings, shuffleMap, shuffleXContent, shuffleXContent, skipTestWaitingForLuceneFix, spinForAtLeastNMilliseconds, spinForAtLeastOneMillisecond, terminate, terminate, tmpPaths, toShuffledXContent, waitUntil, waitUntil, writableRegistry, xContentRegistry
Methods inherited from class org.apache.lucene.util.LuceneTestCase
addVirusChecker, assertDeletedDocsEquals, assertDocsAndPositionsEnumEquals, assertDocsEnumEquals, assertDocsSkippingEquals, assertDocValuesEquals, assertDocValuesEquals, assertFieldInfosEquals, 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, 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, newStringField, newStringField, newStringField, newStringField, newTextField, newTextField, newTieredMergePolicy, newTieredMergePolicy, overrideDefaultQueryCache, overrideTestDefaultQueryCache, random, randomLocale, randomTimeZone, rarely, rarely, replaceMaxFailureRule, resetDefaultQueryCache, restoreCPUCoreCount, restoreIndexWriterMaxDocs, runWithRestrictedPermissions, setIndexWriterMaxDocs, setupCPUCoreCount, slowFileExists, usually, usually, wrapReader
Methods 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, assertThat, assertThat, assertTrue, assertTrue, fail, fail
-
Field Details
-
shardId
protected final org.elasticsearch.index.shard.ShardId shardId -
allocationId
protected final org.elasticsearch.cluster.routing.AllocationId allocationId -
INDEX_SETTINGS
protected static final org.elasticsearch.index.IndexSettings INDEX_SETTINGS -
threadPool
protected org.elasticsearch.threadpool.ThreadPool threadPool -
translogHandler
-
store
protected org.elasticsearch.index.store.Store store -
storeReplica
protected org.elasticsearch.index.store.Store storeReplica -
engine
protected org.elasticsearch.index.engine.InternalEngine engine -
replicaEngine
protected org.elasticsearch.index.engine.InternalEngine replicaEngine -
defaultSettings
protected org.elasticsearch.index.IndexSettings defaultSettings -
codecName
-
-
replicaTranslogDir
-
primaryTerm
-
B_1
protected static final org.elasticsearch.common.bytes.BytesReference B_1 -
B_2
protected static final org.elasticsearch.common.bytes.BytesReference B_2 -
B_3
protected static final org.elasticsearch.common.bytes.BytesReference B_3 -
SOURCE
protected static final org.elasticsearch.common.bytes.BytesArray SOURCE
-
-
Constructor Details
-
EngineTestCase
public EngineTestCase()
-
-
Method Details
-
assertVisibleCount
protected static void assertVisibleCount(org.elasticsearch.index.engine.Engine engine, int numDocs) throws IOException - Throws:
IOException
-
assertVisibleCount
protected static void assertVisibleCount(org.elasticsearch.index.engine.Engine engine, int numDocs, boolean refresh) throws IOException - Throws:
IOException
-
indexSettings
protected org.elasticsearch.common.settings.Settings indexSettings() -
setUp
- Overrides:
setUp
in classorg.apache.lucene.util.LuceneTestCase
- Throws:
Exception
-
copy
public org.elasticsearch.index.engine.EngineConfig copy(org.elasticsearch.index.engine.EngineConfig config, LongSupplier globalCheckpointSupplier) -
copy
public org.elasticsearch.index.engine.EngineConfig copy(org.elasticsearch.index.engine.EngineConfig config, org.apache.lucene.analysis.Analyzer analyzer) -
copy
public org.elasticsearch.index.engine.EngineConfig copy(org.elasticsearch.index.engine.EngineConfig config, org.apache.lucene.index.MergePolicy mergePolicy) -
tearDown
- Overrides:
tearDown
in classorg.apache.lucene.util.LuceneTestCase
- Throws:
Exception
-
testDocumentWithTextField
protected static org.elasticsearch.index.mapper.LuceneDocument testDocumentWithTextField() -
testDocumentWithTextField
protected static org.elasticsearch.index.mapper.LuceneDocument testDocumentWithTextField(String value) -
testDocument
protected static org.elasticsearch.index.mapper.LuceneDocument testDocument() -
createParsedDoc
-
createParsedDoc
-
testParsedDocument
-
testParsedDocument
-
nestedParsedDocFactory
public static org.elasticsearch.common.CheckedBiFunction<String,Integer, nestedParsedDocFactory() throws Exceptionorg.elasticsearch.index.mapper.ParsedDocument, IOException> - Throws:
Exception
-
createStore
- Throws:
IOException
-
createStore
protected org.elasticsearch.index.store.Store createStore(org.apache.lucene.store.Directory directory) throws IOException - Throws:
IOException
-
createStore
protected org.elasticsearch.index.store.Store createStore(org.elasticsearch.index.IndexSettings indexSettings, org.apache.lucene.store.Directory directory) throws IOException - Throws:
IOException
-
createTranslog
protected org.elasticsearch.index.translog.Translog createTranslog(LongSupplier primaryTermSupplier) throws IOException - Throws:
IOException
-
createTranslog
protected org.elasticsearch.index.translog.Translog createTranslog(Path translogPath, LongSupplier primaryTermSupplier) throws IOException - Throws:
IOException
-
createTranslogHandler
protected TranslogHandler createTranslogHandler(org.elasticsearch.index.IndexSettings indexSettings) -
createEngine
protected org.elasticsearch.index.engine.InternalEngine createEngine(org.elasticsearch.index.store.Store store, Path translogPath) throws IOException - Throws:
IOException
-
createEngine
protected org.elasticsearch.index.engine.InternalEngine createEngine(org.elasticsearch.index.store.Store store, Path translogPath, LongSupplier globalCheckpointSupplier) throws IOException - Throws:
IOException
-
createEngine
protected org.elasticsearch.index.engine.InternalEngine createEngine(org.elasticsearch.index.store.Store store, Path translogPath, BiFunction<Long, Long, throws IOExceptionorg.elasticsearch.index.seqno.LocalCheckpointTracker> localCheckpointTrackerSupplier) - Throws:
IOException
-
createEngine
protected org.elasticsearch.index.engine.InternalEngine createEngine(org.elasticsearch.index.store.Store store, Path translogPath, BiFunction<Long, Long, throws IOExceptionorg.elasticsearch.index.seqno.LocalCheckpointTracker> localCheckpointTrackerSupplier, ToLongBiFunction<org.elasticsearch.index.engine.Engine, org.elasticsearch.index.engine.Engine.Operation> seqNoForOperation) - Throws:
IOException
-
createEngine
protected org.elasticsearch.index.engine.InternalEngine createEngine(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy) throws IOException - Throws:
IOException
-
createEngine
protected org.elasticsearch.index.engine.InternalEngine createEngine(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, @Nullable EngineTestCase.IndexWriterFactory indexWriterFactory) throws IOException - Throws:
IOException
-
createEngine
protected org.elasticsearch.index.engine.InternalEngine createEngine(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, @Nullable EngineTestCase.IndexWriterFactory indexWriterFactory, @Nullable BiFunction<Long, Long, throws IOExceptionorg.elasticsearch.index.seqno.LocalCheckpointTracker> localCheckpointTrackerSupplier, @Nullable LongSupplier globalCheckpointSupplier) - Throws:
IOException
-
createEngine
protected org.elasticsearch.index.engine.InternalEngine createEngine(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, @Nullable EngineTestCase.IndexWriterFactory indexWriterFactory, @Nullable BiFunction<Long, Long, throws IOExceptionorg.elasticsearch.index.seqno.LocalCheckpointTracker> localCheckpointTrackerSupplier, @Nullable LongSupplier globalCheckpointSupplier, @Nullable ToLongBiFunction<org.elasticsearch.index.engine.Engine, org.elasticsearch.index.engine.Engine.Operation> seqNoForOperation) - Throws:
IOException
-
createEngine
protected org.elasticsearch.index.engine.InternalEngine createEngine(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, @Nullable EngineTestCase.IndexWriterFactory indexWriterFactory, @Nullable BiFunction<Long, Long, throws IOExceptionorg.elasticsearch.index.seqno.LocalCheckpointTracker> localCheckpointTrackerSupplier, @Nullable ToLongBiFunction<org.elasticsearch.index.engine.Engine, org.elasticsearch.index.engine.Engine.Operation> seqNoForOperation, @Nullable org.apache.lucene.search.Sort indexSort, @Nullable LongSupplier globalCheckpointSupplier) - Throws:
IOException
-
createEngine
protected org.elasticsearch.index.engine.InternalEngine createEngine(org.elasticsearch.index.engine.EngineConfig config) throws IOException - Throws:
IOException
-
createEngine
protected org.elasticsearch.index.engine.InternalEngine createEngine(@Nullable EngineTestCase.IndexWriterFactory indexWriterFactory, @Nullable BiFunction<Long, Long, throws IOExceptionorg.elasticsearch.index.seqno.LocalCheckpointTracker> localCheckpointTrackerSupplier, @Nullable ToLongBiFunction<org.elasticsearch.index.engine.Engine, org.elasticsearch.index.engine.Engine.Operation> seqNoForOperation, org.elasticsearch.index.engine.EngineConfig config) - Throws:
IOException
-
createEngine
public static org.elasticsearch.index.engine.InternalEngine createEngine(org.elasticsearch.index.engine.EngineConfig engineConfig, int maxDocs) -
generateNewSeqNo
public static long generateNewSeqNo(org.elasticsearch.index.engine.Engine engine) Generate a new sequence number and return it. Only works on InternalEngines -
createInternalEngine
public static org.elasticsearch.index.engine.InternalEngine createInternalEngine(@Nullable EngineTestCase.IndexWriterFactory indexWriterFactory, @Nullable BiFunction<Long, Long, org.elasticsearch.index.seqno.LocalCheckpointTracker> localCheckpointTrackerSupplier, @Nullable ToLongBiFunction<org.elasticsearch.index.engine.Engine, org.elasticsearch.index.engine.Engine.Operation> seqNoForOperation, org.elasticsearch.index.engine.EngineConfig config) -
config
public org.elasticsearch.index.engine.EngineConfig config(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.Store store, Path translogPath, org.apache.lucene.index.MergePolicy mergePolicy, org.apache.lucene.search.ReferenceManager.RefreshListener refreshListener) -
config
public org.elasticsearch.index.engine.EngineConfig config(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.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 org.elasticsearch.index.engine.EngineConfig config(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.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<org.elasticsearch.index.seqno.RetentionLeases> retentionLeasesSupplier) -
config
public org.elasticsearch.index.engine.EngineConfig config(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.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, org.elasticsearch.indices.breaker.CircuitBreakerService breakerService) -
config
public org.elasticsearch.index.engine.EngineConfig config(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.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<org.elasticsearch.index.seqno.RetentionLeases> maybeRetentionLeasesSupplier, org.elasticsearch.indices.breaker.CircuitBreakerService breakerService) -
config
protected org.elasticsearch.index.engine.EngineConfig config(org.elasticsearch.index.engine.EngineConfig config, org.elasticsearch.index.store.Store store, Path translogPath) -
noOpConfig
protected org.elasticsearch.index.engine.EngineConfig noOpConfig(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.Store store, Path translogPath) -
noOpConfig
protected org.elasticsearch.index.engine.EngineConfig noOpConfig(org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.store.Store store, Path translogPath, LongSupplier globalCheckpointSupplier) -
bytesArray
-
newUid
-
newUid
public static org.apache.lucene.index.Term newUid(org.elasticsearch.index.mapper.ParsedDocument doc) -
newGet
protected org.elasticsearch.index.engine.Engine.Get newGet(boolean realtime, org.elasticsearch.index.mapper.ParsedDocument doc) -
indexForDoc
protected org.elasticsearch.index.engine.Engine.Index indexForDoc(org.elasticsearch.index.mapper.ParsedDocument doc) -
replicaIndexForDoc
protected org.elasticsearch.index.engine.Engine.Index replicaIndexForDoc(org.elasticsearch.index.mapper.ParsedDocument doc, long version, long seqNo, boolean isRetry) -
replicaDeleteForDoc
protected org.elasticsearch.index.engine.Engine.Delete replicaDeleteForDoc(String id, long version, long seqNo, long startTime) -
assertVisibleCount
protected static void assertVisibleCount(org.elasticsearch.index.engine.InternalEngine engine, int numDocs) throws IOException - Throws:
IOException
-
assertVisibleCount
protected static void assertVisibleCount(org.elasticsearch.index.engine.InternalEngine engine, int numDocs, boolean refresh) throws IOException - Throws:
IOException
-
generateSingleDocHistory
-
generateHistoryOnReplica
public List<org.elasticsearch.index.engine.Engine.Operation> generateHistoryOnReplica(int numOps, boolean allowGapInSeqNo, boolean allowDuplicate, boolean includeNestedDocs) throws Exception - Throws:
Exception
-
generateHistoryOnReplica
public List<org.elasticsearch.index.engine.Engine.Operation> generateHistoryOnReplica(int numOps, long startingSeqNo, boolean allowGapInSeqNo, boolean allowDuplicate, boolean includeNestedDocs) throws Exception - Throws:
Exception
-
assertOpsOnReplica
public static void assertOpsOnReplica(List<org.elasticsearch.index.engine.Engine.Operation> ops, org.elasticsearch.index.engine.InternalEngine replicaEngine, boolean shuffleOps, org.apache.logging.log4j.Logger logger) throws IOException - Throws:
IOException
-
concurrentlyApplyOps
public static void concurrentlyApplyOps(List<org.elasticsearch.index.engine.Engine.Operation> ops, org.elasticsearch.index.engine.InternalEngine engine) throws InterruptedException - Throws:
InterruptedException
-
applyOperations
public static void applyOperations(org.elasticsearch.index.engine.Engine engine, List<org.elasticsearch.index.engine.Engine.Operation> operations) throws IOException - Throws:
IOException
-
applyOperation
public static org.elasticsearch.index.engine.Engine.Result applyOperation(org.elasticsearch.index.engine.Engine engine, org.elasticsearch.index.engine.Engine.Operation operation) throws IOException - Throws:
IOException
-
getDocIds
public static List<DocIdSeqNoAndSource> getDocIds(org.elasticsearch.index.engine.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
public static List<org.elasticsearch.index.translog.Translog.Operation> readAllOperationsInLucene(org.elasticsearch.index.engine.Engine engine) throws IOException 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(org.elasticsearch.index.engine.Engine engine) throws IOException Asserts the provided engine has a consistent document history between translog and Lucene index.- Throws:
IOException
-
assertMaxSeqNoInCommitUserData
public static void assertMaxSeqNoInCommitUserData(org.elasticsearch.index.engine.Engine engine) throws Exception 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
public static void assertAtMostOneLuceneDocumentPerSequenceNumber(org.elasticsearch.index.engine.Engine engine) throws IOException - Throws:
IOException
-
assertAtMostOneLuceneDocumentPerSequenceNumber
public static void assertAtMostOneLuceneDocumentPerSequenceNumber(org.elasticsearch.index.IndexSettings indexSettings, org.apache.lucene.index.DirectoryReader reader) throws IOException - Throws:
IOException
-
createMapperService
- Throws:
IOException
-
mappingLookup
public static org.elasticsearch.index.mapper.MappingLookup mappingLookup() -
getTranslog
public static org.elasticsearch.index.translog.Translog getTranslog(org.elasticsearch.index.engine.Engine engine) Exposes a translog associated with the given engine for testing purpose. -
waitForOpsToComplete
public static void waitForOpsToComplete(org.elasticsearch.index.engine.InternalEngine engine, long seqNo) throws Exception 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
-
hasSnapshottedCommits
public static boolean hasSnapshottedCommits(org.elasticsearch.index.engine.Engine engine) -
getNumVersionLookups
public static long getNumVersionLookups(org.elasticsearch.index.engine.Engine engine) Returns the number of times a version was looked up either from version map or from the index. -
getInFlightDocCount
public static long getInFlightDocCount(org.elasticsearch.index.engine.Engine engine) -
assertNoInFlightDocuments
public static void assertNoInFlightDocuments(org.elasticsearch.index.engine.Engine engine) throws Exception - Throws:
Exception
-
randomReaderWrapper
public static org.elasticsearch.core.CheckedFunction<org.apache.lucene.index.DirectoryReader,org.apache.lucene.index.DirectoryReader, randomReaderWrapper()IOException> -
randomSearcherWrapper
public static Function<org.elasticsearch.index.engine.Engine.Searcher,org.elasticsearch.index.engine.Engine.Searcher> randomSearcherWrapper() -
checkNoSoftDeletesLoaded
public static void checkNoSoftDeletesLoaded(org.elasticsearch.index.engine.ReadOnlyEngine readOnlyEngine)
-