public class InternalEngine extends Engine
Engine.CommitId, Engine.Delete, Engine.EventListener, Engine.Get, Engine.GetResult, Engine.Index, Engine.IndexThrottle, Engine.NoOpLock, Engine.Operation, Engine.Searcher, Engine.SyncedFlushResult, Engine.WarmerdeletionPolicy, engineConfig, eventListener, failedEngine, failEngineLock, isClosed, lastWriteNanos, logger, readLock, rwl, shardId, store, SYNC_COMMIT_ID, writeLock| Constructor and Description |
|---|
InternalEngine(EngineConfig engineConfig) |
| Modifier and Type | Method and Description |
|---|---|
org.apache.lucene.index.IndexCommit |
acquireIndexCommit(boolean flushFirst)
Snapshots the index and returns a handle to it.
|
void |
activateThrottling()
Request that this engine throttle incoming indexing requests to one thread.
|
protected void |
closeNoLock(java.lang.String reason)
Closes the engine without acquiring the write lock.
|
void |
deactivateThrottling()
Reverses a previous
Engine.activateThrottling() call. |
void |
delete(Engine.Delete delete) |
Engine.CommitId |
flush()
Flushes the state of the engine including the transaction log, clearing memory and persisting
documents in the lucene index to disk including a potentially heavy and durable fsync operation.
|
Engine.CommitId |
flush(boolean force,
boolean waitIfOngoing)
Flushes the state of the engine including the transaction log, clearing memory.
|
void |
forceMerge(boolean flush,
int maxNumSegments,
boolean onlyExpungeDeletes,
boolean upgrade,
boolean upgradeOnlyAncientSegments)
Triggers a forced merge on this engine
|
Engine.GetResult |
get(Engine.Get get,
java.util.function.Function<java.lang.String,Engine.Searcher> searcherFactory) |
DocsStats |
getDocStats()
Returns the engines current document statistics
|
long |
getIndexBufferRAMBytesUsed()
How much heap is used that would be freed by a refresh.
|
long |
getIndexThrottleTimeInMillis()
Returns the number of milliseconds this engine was under index throttling.
|
protected org.apache.lucene.index.SegmentInfos |
getLastCommittedSegmentInfos() |
MergeStats |
getMergeStats() |
protected org.apache.lucene.search.SearcherManager |
getSearcherManager() |
Translog |
getTranslog()
returns the translog for this engine
|
void |
index(Engine.Index index) |
boolean |
isRecovering()
Returns
true iff this engine is currently recovering from translog. |
boolean |
isThrottled()
Returns the
true iff this engine is currently under index throttling. |
protected boolean |
maybeFailEngine(java.lang.String source,
java.lang.Exception e)
Check whether the engine should be failed
|
void |
onSettingsChanged() |
InternalEngine |
recoverFromTranslog()
Performs recovery from the transaction log.
|
void |
refresh(java.lang.String source)
Synchronously refreshes the engine for new search operations to reflect the latest
changes.
|
java.util.List<Segment> |
segments(boolean verbose)
The list of segments in the engine.
|
Engine.SyncedFlushResult |
syncFlush(java.lang.String syncId,
Engine.CommitId expectedCommitId)
Attempts to do a special commit where the given syncID is put into the commit data.
|
void |
writeIndexingBuffer()
Called when our engine is using too much heap and should move buffered indexed/deleted documents to disk.
|
protected void |
writerSegmentStats(SegmentsStats stats) |
acquireSearcher, close, commitStats, config, ensureOpen, failEngine, flushAndClose, forceMerge, get, getFromSearcher, getLastWriteNanos, getSegmentInfo, guardedRamBytesUsed, isMergedSegment, newSearcher, readLastCommittedSegmentInfos, refreshNeeded, segmentReader, segmentsStatspublic InternalEngine(EngineConfig engineConfig) throws EngineException
EngineExceptionpublic InternalEngine recoverFromTranslog() throws java.io.IOException
EnginerecoverFromTranslog in class Enginejava.io.IOExceptionpublic Translog getTranslog()
EnginegetTranslog in class Enginepublic Engine.GetResult get(Engine.Get get, java.util.function.Function<java.lang.String,Engine.Searcher> searcherFactory) throws EngineException
get in class EngineEngineExceptionpublic void index(Engine.Index index)
public void delete(Engine.Delete delete) throws EngineException
delete in class EngineEngineExceptionpublic void refresh(java.lang.String source)
throws EngineException
Enginerefresh in class EngineEngineExceptionpublic void writeIndexingBuffer()
throws EngineException
EnginewriteIndexingBuffer in class EngineEngineExceptionpublic Engine.SyncedFlushResult syncFlush(java.lang.String syncId, Engine.CommitId expectedCommitId) throws EngineException
EnginesyncFlush in class EnginesyncId - id of this syncexpectedCommitId - the expected value ofEngineExceptionpublic Engine.CommitId flush() throws EngineException
Engineflush in class EngineEngineExceptionpublic Engine.CommitId flush(boolean force, boolean waitIfOngoing) throws EngineException
Engineflush in class Engineforce - if true a lucene commit is executed even if no changes need to be committed.waitIfOngoing - if true this call will block until all currently running flushes have finished.
Otherwise this call will return without blocking.EngineExceptionpublic void forceMerge(boolean flush,
int maxNumSegments,
boolean onlyExpungeDeletes,
boolean upgrade,
boolean upgradeOnlyAncientSegments)
throws EngineException,
EngineClosedException,
java.io.IOException
EngineforceMerge in class EngineEngineExceptionEngineClosedExceptionjava.io.IOExceptionpublic org.apache.lucene.index.IndexCommit acquireIndexCommit(boolean flushFirst)
throws EngineException
EngineacquireIndexCommit in class EngineflushFirst - indicates whether the engine should flush before returning the snapshotEngineExceptionprotected boolean maybeFailEngine(java.lang.String source,
java.lang.Exception e)
EnginemaybeFailEngine in class Engineprotected org.apache.lucene.index.SegmentInfos getLastCommittedSegmentInfos()
getLastCommittedSegmentInfos in class Engineprotected final void writerSegmentStats(SegmentsStats stats)
writerSegmentStats in class Enginepublic long getIndexBufferRAMBytesUsed()
EngineAlreadyClosedException.getIndexBufferRAMBytesUsed in class Enginepublic java.util.List<Segment> segments(boolean verbose)
Engineprotected final void closeNoLock(java.lang.String reason)
closeNoLock in class Engineprotected org.apache.lucene.search.SearcherManager getSearcherManager()
getSearcherManager in class Enginepublic void activateThrottling()
EngineEngine.deactivateThrottling().activateThrottling in class Enginepublic void deactivateThrottling()
EngineEngine.activateThrottling() call.deactivateThrottling in class Enginepublic boolean isThrottled()
Enginetrue iff this engine is currently under index throttling.isThrottled in class EngineEngine.getIndexThrottleTimeInMillis()public long getIndexThrottleTimeInMillis()
EnginegetIndexThrottleTimeInMillis in class Enginepublic void onSettingsChanged()
onSettingsChanged in class Enginepublic MergeStats getMergeStats()
getMergeStats in class Enginepublic DocsStats getDocStats()
EnginegetDocStats in class Enginepublic boolean isRecovering()
Enginetrue iff this engine is currently recovering from translog.isRecovering in class Engine