public final class ShadowIndexShard extends IndexShard
IndexShard to add file synchronization
from the primary when a flush happens. It also ensures that a replica being
promoted to a primary causes the shard to fail, kicking off a re-allocation
of the primary shard.IndexShard.ShardFailurecurrentEngineReference, engineFactory, primaryTerm, shardRouting, state, writeAllowedStatesForPrimarydeprecationLogger, indexSettings, logger, shardId| Constructor and Description |
|---|
ShadowIndexShard(ShardRouting shardRouting,
IndexSettings indexSettings,
ShardPath path,
Store store,
IndexCache indexCache,
MapperService mapperService,
SimilarityService similarityService,
IndexFieldDataService indexFieldDataService,
EngineFactory engineFactory,
IndexEventListener indexEventListener,
IndexSearcherWrapper wrapper,
ThreadPool threadPool,
BigArrays bigArrays,
Engine.Warmer engineWarmer,
java.util.List<SearchOperationListener> searchOperationListeners) |
| Modifier and Type | Method and Description |
|---|---|
void |
addRefreshListener(Translog.Location location,
java.util.function.Consumer<java.lang.Boolean> listener)
Add a listener for refreshes.
|
protected RefreshListeners |
buildRefreshListeners()
Build RefreshListeners for this shard.
|
boolean |
canIndex()
returns true if this shard supports indexing (i.e., write) operations.
|
MergeStats |
mergeStats() |
protected Engine |
newEngine(EngineConfig config) |
protected void |
onNewEngine(Engine newEngine) |
boolean |
shouldFlush()
Returns
true iff this shard needs to be flushed due to too many translog operation or a too large transaction log. |
Store.MetadataSnapshot |
snapshotStoreMetadata()
gets a
Store.MetadataSnapshot for the current directory. |
TranslogStats |
translogStats() |
void |
updateRoutingEntry(ShardRouting newRouting)
In addition to the regular accounting done in
IndexShard.updateRoutingEntry(ShardRouting),
if this shadow replica needs to be promoted to a primary, the shard is
failed in order to allow a new primary to be re-allocated. |
acquireIndexCommit, acquirePrimaryOperationLock, acquireReplicaOperationLock, acquireSearcher, acquireTranslogView, activateThrottling, addShardFailureCallback, checkIdle, close, commitStats, completionStats, deactivateThrottling, delete, docStats, failShard, fieldData, fieldDataStats, finalizeRecovery, flush, flushAndCloseEngine, flushStats, forceMerge, get, getActiveOperationsCount, getEngineOrNull, getIndexBufferRAMBytesUsed, getIndexEventListener, getPrimaryTerm, getQueryCachingPolicy, getSearchOperationListener, getService, getStats, getTranslog, getTranslogDurability, getWritingBytes, ignoreRecoveryAttempt, index, indexFieldDataService, indexingStats, isActive, isRefreshNeeded, mapperService, markAsRecovering, maybeFlush, minimumCompatibleVersion, noopUpdate, onSettingsChanged, performBatchRecovery, performRecoveryRestart, performTranslogRecovery, postRecovery, prepareDeleteOnPrimary, prepareDeleteOnReplica, prepareForIndexRecovery, prepareIndexOnPrimary, prepareIndexOnReplica, readAllowed, recoverFromLocalShards, recoverFromStore, recoveryState, recoveryStats, refresh, refreshStats, releaseIndexCommit, relocated, requestCache, restoreFromRepository, routingEntry, searchStats, segments, segmentStats, shardBitsetFilterCache, shardPath, skipTranslogRecovery, startRecovery, state, store, storeStats, sync, syncFlush, updatePrimaryTerm, upgrade, verifyActive, warmerService, warmerStats, writeIndexingBufferindexSettings, nodeName, shardIdclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitshardIdpublic ShadowIndexShard(ShardRouting shardRouting, IndexSettings indexSettings, ShardPath path, Store store, IndexCache indexCache, MapperService mapperService, SimilarityService similarityService, IndexFieldDataService indexFieldDataService, @Nullable EngineFactory engineFactory, IndexEventListener indexEventListener, IndexSearcherWrapper wrapper, ThreadPool threadPool, BigArrays bigArrays, Engine.Warmer engineWarmer, java.util.List<SearchOperationListener> searchOperationListeners) throws java.io.IOException
java.io.IOExceptionpublic void updateRoutingEntry(ShardRouting newRouting) throws java.io.IOException
IndexShard.updateRoutingEntry(ShardRouting),
if this shadow replica needs to be promoted to a primary, the shard is
failed in order to allow a new primary to be re-allocated.updateRoutingEntry in interface IndicesClusterStateService.ShardupdateRoutingEntry in class IndexShardjava.io.IOException - if shard state could not be persistedpublic MergeStats mergeStats()
mergeStats in class IndexShardpublic boolean canIndex()
IndexShardcanIndex in class IndexShardprotected Engine newEngine(EngineConfig config)
newEngine in class IndexShardprotected RefreshListeners buildRefreshListeners()
IndexShardbuildRefreshListeners in class IndexShardpublic boolean shouldFlush()
IndexShardtrue iff this shard needs to be flushed due to too many translog operation or a too large transaction log.
Otherwise false.public TranslogStats translogStats()
translogStats in class IndexShardpublic void addRefreshListener(Translog.Location location, java.util.function.Consumer<java.lang.Boolean> listener)
IndexShardaddRefreshListener in class IndexShardlocation - the location to listen forlistener - for the refresh. Called with true if registering the listener ran it out of slots and forced a refresh. Called with
false otherwise.public Store.MetadataSnapshot snapshotStoreMetadata() throws java.io.IOException
IndexShardStore.MetadataSnapshot for the current directory. This method is safe to call in all lifecycle of the index shard,
without having to worry about the current state of the engine and concurrent flushes.snapshotStoreMetadata in class IndexShardorg.apache.lucene.index.IndexNotFoundException - if no index is found in the current directoryorg.apache.lucene.index.CorruptIndexException - if the lucene index is corrupted. This can be caused by a checksum
mismatch or an unexpected exception when opening the index reading the
segments file.org.apache.lucene.index.IndexFormatTooOldException - if the lucene index is too old to be opened.org.apache.lucene.index.IndexFormatTooNewException - if the lucene index is too new to be opened.java.io.FileNotFoundException - if one or more files referenced by a commit are not present.java.nio.file.NoSuchFileException - if one or more files referenced by a commit are not present.java.io.IOExceptionprotected void onNewEngine(Engine newEngine)
onNewEngine in class IndexShard