public class ShadowEngine extends Engine
IndexReader is opened instead of
an IndexWriter. All methods that would usually perform write
operations are no-ops, this means:
- No operations are written to or read from the translog
- Create, Index, and Delete do nothing
- Flush does not fsync any files, or make any on-disk changes
In order for new segments to become visible, the ShadowEngine may perform
stage1 of the traditional recovery process (copying segment files) from a
regular primary (which uses InternalEngine)
Notice that since this Engine does not deal with the translog, any
Engine.get(Get get) request goes directly to the searcher, meaning it is
non-realtime.Engine.CommitId, Engine.Create, Engine.Delete, Engine.DeleteByQuery, Engine.FailedEngineListener, Engine.Get, Engine.GetResult, Engine.Index, Engine.IndexingOperation, Engine.IndexThrottle, Engine.NoOpLock, Engine.Operation, Engine.Searcher, Engine.SyncedFlushResult| Modifier and Type | Field and Description |
|---|---|
static TimeValue |
DEFAULT_NONEXISTENT_INDEX_RETRY_WAIT |
static String |
NONEXISTENT_INDEX_RETRY_WAIT
how long to wait for an index to exist
|
deletionPolicy, engineConfig, failedEngine, failedEngineListener, failEngineLock, isClosed, logger, readLock, rwl, shardId, store, SYNC_COMMIT_ID, writeLock| Constructor and Description |
|---|
ShadowEngine(EngineConfig engineConfig) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
closeNoLock(String reason)
Method to close the engine while the write lock is held.
|
void |
create(Engine.Create create) |
void |
delete(Engine.Delete delete) |
void |
delete(Engine.DeleteByQuery delete)
Deprecated.
This was removed, but we keep this API so translog can replay any DBQs on upgrade.
|
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) |
protected org.apache.lucene.index.SegmentInfos |
getLastCommittedSegmentInfos() |
protected org.apache.lucene.search.SearcherManager |
getSearcherManager() |
Translog |
getTranslog()
returns the translog for this engine
|
boolean |
hasUncommittedChanges()
Returns
true the internal writer has any uncommitted changes. |
boolean |
index(Engine.Index index) |
long |
indexWriterRAMBytesUsed()
How much heap Lucene's IndexWriter is using
|
void |
refresh(String source)
Refreshes the engine for new search operations to reflect the latest
changes.
|
List<Segment> |
segments(boolean verbose)
The list of segments in the engine.
|
SnapshotIndexCommit |
snapshotIndex(boolean flushFirst)
Snapshots the index and returns a handle to it.
|
Engine.SyncedFlushResult |
syncFlush(String syncId,
Engine.CommitId expectedCommitId)
Attempts to do a special commit where the given syncID is put into the commit data.
|
acquireSearcher, acquireSearcher, close, commitStats, config, ensureOpen, failEngine, flushAndClose, forceMerge, getFromSearcher, getMergeStats, getSegmentInfo, guardedRamBytesUsed, isMergedSegment, maybeFailEngine, newSearcher, onSettingsChanged, readLastCommittedSegmentInfos, refreshNeeded, segmentReader, segmentsStats, wrapIfClosed, writerSegmentStatspublic static final String NONEXISTENT_INDEX_RETRY_WAIT
public static final TimeValue DEFAULT_NONEXISTENT_INDEX_RETRY_WAIT
public ShadowEngine(EngineConfig engineConfig)
public void create(Engine.Create create) throws EngineException
create in class EngineEngineExceptionpublic boolean index(Engine.Index index) throws EngineException
index in class EngineEngineExceptionpublic void delete(Engine.Delete delete) throws EngineException
delete in class EngineEngineException@Deprecated public void delete(Engine.DeleteByQuery delete) throws EngineException
delete in class EngineEngineExceptionpublic Engine.SyncedFlushResult syncFlush(String syncId, Engine.CommitId expectedCommitId)
Enginepublic 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
EngineforceMerge in class EngineEngineExceptionpublic Engine.GetResult get(Engine.Get get) throws EngineException
get in class EngineEngineExceptionpublic Translog getTranslog()
EnginegetTranslog in class Enginepublic List<Segment> segments(boolean verbose)
Enginepublic void refresh(String source) throws EngineException
Enginerefresh in class EngineEngineExceptionpublic SnapshotIndexCommit snapshotIndex(boolean flushFirst) throws EngineException
EnginesnapshotIndex in class EngineflushFirst - indicates whether the engine should flush before returning the snapshotEngineExceptionprotected org.apache.lucene.search.SearcherManager getSearcherManager()
getSearcherManager in class Engineprotected void closeNoLock(String reason)
EnginecloseNoLock in class Enginepublic boolean hasUncommittedChanges()
Enginetrue the internal writer has any uncommitted changes. Otherwise falsehasUncommittedChanges in class Engineprotected org.apache.lucene.index.SegmentInfos getLastCommittedSegmentInfos()
getLastCommittedSegmentInfos in class Enginepublic long indexWriterRAMBytesUsed()
EngineindexWriterRAMBytesUsed in class EngineCopyright © 2009–2016. All rights reserved.