public class IndexShard extends AbstractIndexShardComponent implements IndicesClusterStateService.Shard
Modifier and Type | Class and Description |
---|---|
static class |
IndexShard.ShardFailure
Simple struct encapsulating a shard failure
|
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.atomic.AtomicReference<Engine> |
currentEngineReference |
protected EngineFactory |
engineFactory |
protected long |
primaryTerm |
protected ShardRouting |
shardRouting |
protected IndexShardState |
state |
static java.util.EnumSet<IndexShardState> |
writeAllowedStatesForPrimary |
deprecationLogger, indexSettings, logger, shardId
Constructor and Description |
---|
IndexShard(ShardRouting shardRouting,
IndexSettings indexSettings,
ShardPath path,
Store store,
java.util.function.Supplier<org.apache.lucene.search.Sort> indexSortSupplier,
IndexCache indexCache,
MapperService mapperService,
SimilarityService similarityService,
EngineFactory engineFactory,
IndexEventListener indexEventListener,
IndexSearcherWrapper indexSearcherWrapper,
ThreadPool threadPool,
BigArrays bigArrays,
Engine.Warmer warmer,
java.util.List<SearchOperationListener> searchOperationListener,
java.util.List<IndexingOperationListener> listeners,
java.lang.Runnable globalCheckpointSyncer) |
Modifier and Type | Method and Description |
---|---|
Engine.IndexCommitRef |
acquireIndexCommit(boolean flushFirst)
Creates a new
IndexCommit snapshot form the currently running engine. |
void |
acquirePrimaryOperationPermit(ActionListener<Releasable> onPermitAcquired,
java.lang.String executorOnDelay)
Acquire a primary operation permit whenever the shard is ready for indexing.
|
void |
acquireReplicaOperationPermit(long operationPrimaryTerm,
long globalCheckpoint,
ActionListener<Releasable> onPermitAcquired,
java.lang.String executorOnDelay)
Acquire a replica operation permit whenever the shard is ready for indexing (see
acquirePrimaryOperationPermit(ActionListener, String) ). |
Engine.Searcher |
acquireSearcher(java.lang.String source) |
java.io.Closeable |
acquireTranslogRetentionLock() |
void |
activateThrottling() |
void |
activateWithPrimaryContext(GlobalCheckpointTracker.PrimaryContext primaryContext)
Updates the known allocation IDs and the local checkpoints for the corresponding allocations from a primary relocation source.
|
void |
addRefreshListener(Translog.Location location,
java.util.function.Consumer<java.lang.Boolean> listener)
Add a listener for refreshes.
|
void |
addShardFailureCallback(java.util.function.Consumer<IndexShard.ShardFailure> onShardFailure) |
void |
afterWriteOperation()
Schedules a flush or translog generation roll if needed but will not schedule more than one concurrently.
|
Engine.DeleteResult |
applyDeleteOperationOnPrimary(long version,
java.lang.String type,
java.lang.String id,
VersionType versionType,
java.util.function.Consumer<Mapping> onMappingUpdate) |
Engine.DeleteResult |
applyDeleteOperationOnReplica(long seqNo,
long version,
java.lang.String type,
java.lang.String id,
VersionType versionType,
java.util.function.Consumer<Mapping> onMappingUpdate) |
Engine.IndexResult |
applyIndexOperationOnPrimary(long version,
VersionType versionType,
SourceToParse sourceToParse,
long autoGeneratedTimestamp,
boolean isRetry,
java.util.function.Consumer<Mapping> onMappingUpdate) |
Engine.IndexResult |
applyIndexOperationOnReplica(long seqNo,
long version,
VersionType versionType,
long autoGeneratedTimeStamp,
boolean isRetry,
SourceToParse sourceToParse,
java.util.function.Consumer<Mapping> onMappingUpdate) |
Engine.Result |
applyTranslogOperation(Translog.Operation operation,
Engine.Operation.Origin origin,
java.util.function.Consumer<Mapping> onMappingUpdate) |
boolean |
canIndex()
returns true if this shard supports indexing (i.e., write) operations.
|
void |
checkIdle(long inactiveTimeNS)
Called by
IndexingMemoryController to check whether more than inactiveTimeNS has passed since the last
indexing operation, and notify listeners that we are now inactive so e.g. |
void |
close(java.lang.String reason,
boolean flushEngine) |
CommitStats |
commitStats() |
CompletionStats |
completionStats(java.lang.String... fields) |
void |
deactivateThrottling() |
DocsStats |
docStats() |
void |
failShard(java.lang.String reason,
java.lang.Exception e)
Fails the shard and marks the shard store as corrupted if
e is caused by index corruption |
ShardFieldData |
fieldData() |
FieldDataStats |
fieldDataStats(java.lang.String... fields) |
void |
finalizeRecovery()
perform the last stages of recovery once all translog operations are done.
|
Engine.CommitId |
flush(FlushRequest request)
Executes the given flush request against the engine.
|
void |
flushAndCloseEngine() |
FlushStats |
flushStats() |
void |
forceMerge(ForceMergeRequest forceMerge) |
Engine.GetResult |
get(Engine.Get get) |
int |
getActiveOperationsCount() |
protected Engine |
getEngineOrNull()
NOTE: returns null if engine is not yet started (e.g.
|
long |
getGlobalCheckpoint()
Returns the global checkpoint for the shard.
|
java.lang.String |
getHistoryUUID() |
long |
getIndexBufferRAMBytesUsed()
Returns number of heap bytes used by the indexing buffer for this shard, or 0 if the shard is closed
|
IndexEventListener |
getIndexEventListener() |
org.apache.lucene.search.Sort |
getIndexSort()
Return the sort order of this index, or null if the index has no sort.
|
com.carrotsearch.hppc.ObjectLongMap<java.lang.String> |
getInSyncGlobalCheckpoints()
Get the local knowledge of the global checkpoints for all in-sync allocation IDs.
|
long |
getLocalCheckpoint()
Returns the local checkpoint for the shard.
|
long |
getPrimaryTerm()
Returns the primary term the index shard is on.
|
org.apache.lucene.search.QueryCachingPolicy |
getQueryCachingPolicy() |
ReplicationGroup |
getReplicationGroup()
Returns the current replication group for the shard.
|
SearchOperationListener |
getSearchOperationListener() |
ShardGetService |
getService() |
GetStats |
getStats() |
ThreadPool |
getThreadPool() |
Translog |
getTranslog() |
Translog.Durability |
getTranslogDurability()
Returns the current translog durability mode
|
long |
getWritingBytes()
Returns how many bytes we are currently moving from heap to disk
|
boolean |
ignoreRecoveryAttempt()
Returns true if this shard can ignore a recovery attempt made to it (since the already doing/done it)
|
IndexingStats |
indexingStats(java.lang.String... types) |
void |
initiateTracking(java.lang.String allocationId)
Called when the recovery process for a shard is ready to open the engine on the target shard.
|
boolean |
isActive() |
boolean |
isReadAllowed()
returns true if the
IndexShardState allows reading |
boolean |
isRefreshNeeded()
Returns
true iff one or more changes to the engine are not visible to via the current searcher *or* there are pending
refresh listeners. |
MapperService |
mapperService() |
void |
markAllocationIdAsInSync(java.lang.String allocationId,
long localCheckpoint)
Marks the shard with the provided allocation ID as in-sync with the primary shard.
|
IndexShardState |
markAsRecovering(java.lang.String reason,
RecoveryState recoveryState)
Marks the shard as recovering based on a recovery state, fails with exception is recovering is not allowed to be set.
|
Engine.NoOpResult |
markSeqNoAsNoop(long seqNo,
java.lang.String reason) |
void |
maybeSyncGlobalCheckpoint(java.lang.String reason)
Syncs the global checkpoint to the replicas if the global checkpoint on at least one replica is behind the global checkpoint on the
primary.
|
MergeStats |
mergeStats() |
org.apache.lucene.util.Version |
minimumCompatibleVersion() |
protected Engine |
newEngine(EngineConfig config) |
void |
noopUpdate(java.lang.String type)
Should be called for each no-op update operation to increment relevant statistics.
|
protected void |
onNewEngine(Engine newEngine) |
void |
onSettingsChanged() |
boolean |
pendingInSync()
Check if there are any recoveries pending in-sync.
|
void |
performRecoveryRestart()
called if recovery has to be restarted after network error / delay **
|
void |
performTranslogRecovery(boolean indexExists)
After the store has been recovered, we need to start the engine in order to apply operations
|
IndexShard |
postRecovery(java.lang.String reason) |
void |
prepareForIndexRecovery()
called before starting to copy index files over
|
static Engine.Index |
prepareIndex(DocumentMapperForType docMapper,
Version indexCreatedVersion,
SourceToParse source,
long seqNo,
long primaryTerm,
long version,
VersionType versionType,
Engine.Operation.Origin origin,
long autoGeneratedIdTimestamp,
boolean isRetry) |
void |
readAllowed() |
boolean |
recoverFromLocalShards(java.util.function.BiConsumer<java.lang.String,MappingMetaData> mappingUpdateConsumer,
java.util.List<IndexShard> localShards) |
boolean |
recoverFromStore() |
RecoveryState |
recoveryState()
Returns the current
RecoveryState if this shard is recovering or has been recovering. |
RecoveryStats |
recoveryStats()
returns stats about ongoing recoveries, both source and target
|
void |
refresh(java.lang.String source)
Writes all indexing changes to disk and opens a new searcher reflecting all changes.
|
RefreshStats |
refreshStats() |
void |
relocated(java.lang.String reason,
java.util.function.Consumer<GlobalCheckpointTracker.PrimaryContext> consumer)
Completes the relocation.
|
ShardRequestCache |
requestCache() |
boolean |
restoreFromRepository(Repository repository) |
ShardRouting |
routingEntry()
Returns the latest cluster routing entry received with this shard.
|
SearchStats |
searchStats(java.lang.String... groups) |
java.util.List<Segment> |
segments(boolean verbose) |
SegmentsStats |
segmentStats(boolean includeSegmentFileSizes) |
SeqNoStats |
seqNoStats() |
ShardBitsetFilterCache |
shardBitsetFilterCache() |
ShardPath |
shardPath() |
void |
skipTranslogRecovery()
After the store has been recovered, we need to start the engine.
|
Store.MetadataSnapshot |
snapshotStoreMetadata()
gets a
Store.MetadataSnapshot for the current directory. |
void |
startRecovery(RecoveryState recoveryState,
PeerRecoveryTargetService recoveryTargetService,
PeerRecoveryTargetService.RecoveryListener recoveryListener,
RepositoriesService repositoriesService,
java.util.function.BiConsumer<java.lang.String,MappingMetaData> mappingUpdateConsumer,
IndicesService indicesService) |
IndexShardState |
state()
Returns the latest internal shard state.
|
Store |
store() |
StoreStats |
storeStats() |
void |
sync() |
void |
sync(Translog.Location location,
java.util.function.Consumer<java.lang.Exception> syncListener)
Syncs the given location with the underlying storage unless already synced.
|
Engine.SyncedFlushResult |
syncFlush(java.lang.String syncId,
Engine.CommitId expectedCommitId) |
TranslogStats |
translogStats() |
void |
trimTranslog()
checks and removes translog files that no longer need to be retained.
|
void |
updateGlobalCheckpointForShard(java.lang.String allocationId,
long globalCheckpoint)
Update the local knowledge of the global checkpoint for the specified allocation ID.
|
void |
updateGlobalCheckpointOnReplica(long globalCheckpoint,
java.lang.String reason)
Updates the global checkpoint on a replica shard after it has been updated by the primary.
|
void |
updateLocalCheckpointForShard(java.lang.String allocationId,
long checkpoint)
Notifies the service to update the local checkpoint for the shard with the provided allocation ID.
|
void |
updateShardState(ShardRouting newRouting,
long newPrimaryTerm,
java.util.function.BiConsumer<IndexShard,ActionListener<PrimaryReplicaSyncer.ResyncTask>> primaryReplicaSyncer,
long applyingClusterStateVersion,
java.util.Set<java.lang.String> inSyncAllocationIds,
IndexShardRoutingTable routingTable,
java.util.Set<java.lang.String> pre60AllocationIds)
Updates the shard state based on an incoming cluster state:
- Updates and persists the new routing value.
|
org.apache.lucene.util.Version |
upgrade(UpgradeRequest upgrade)
Upgrades the shard to the current version of Lucene and returns the minimum segment version
|
protected void |
verifyActive() |
void |
waitForOpsToComplete(long seqNo)
Waits for all operations up to the provided sequence number to complete.
|
ShardIndexWarmerService |
warmerService() |
WarmerStats |
warmerStats() |
void |
writeIndexingBuffer()
Called when our shard is using too much heap and should move buffered indexed/deleted documents to disk.
|
indexSettings, nodeName, shardId
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
shardId
protected volatile ShardRouting shardRouting
protected volatile IndexShardState state
protected volatile long primaryTerm
protected final java.util.concurrent.atomic.AtomicReference<Engine> currentEngineReference
protected final EngineFactory engineFactory
public static final java.util.EnumSet<IndexShardState> writeAllowedStatesForPrimary
public IndexShard(ShardRouting shardRouting, IndexSettings indexSettings, ShardPath path, Store store, java.util.function.Supplier<org.apache.lucene.search.Sort> indexSortSupplier, IndexCache indexCache, MapperService mapperService, SimilarityService similarityService, @Nullable EngineFactory engineFactory, IndexEventListener indexEventListener, IndexSearcherWrapper indexSearcherWrapper, ThreadPool threadPool, BigArrays bigArrays, Engine.Warmer warmer, java.util.List<SearchOperationListener> searchOperationListener, java.util.List<IndexingOperationListener> listeners, java.lang.Runnable globalCheckpointSyncer) throws java.io.IOException
java.io.IOException
public ThreadPool getThreadPool()
public Store store()
public org.apache.lucene.search.Sort getIndexSort()
public boolean canIndex()
public ShardGetService getService()
public ShardBitsetFilterCache shardBitsetFilterCache()
public MapperService mapperService()
public SearchOperationListener getSearchOperationListener()
public ShardIndexWarmerService warmerService()
public ShardRequestCache requestCache()
public ShardFieldData fieldData()
public long getPrimaryTerm()
IndexMetaData.primaryTerm(int)
public ShardRouting routingEntry()
routingEntry
in interface IndicesClusterStateService.Shard
public org.apache.lucene.search.QueryCachingPolicy getQueryCachingPolicy()
public void updateShardState(ShardRouting newRouting, long newPrimaryTerm, java.util.function.BiConsumer<IndexShard,ActionListener<PrimaryReplicaSyncer.ResyncTask>> primaryReplicaSyncer, long applyingClusterStateVersion, java.util.Set<java.lang.String> inSyncAllocationIds, IndexShardRoutingTable routingTable, java.util.Set<java.lang.String> pre60AllocationIds) throws java.io.IOException
IndicesClusterStateService.Shard
GlobalCheckpointTracker.updateFromMaster(long, Set, IndexShardRoutingTable, Set)
for details.updateShardState
in interface IndicesClusterStateService.Shard
newRouting
- the new routing entrynewPrimaryTerm
- the new primary termprimaryReplicaSyncer
- the primary-replica resync action to trigger when a term is increased on a primaryapplyingClusterStateVersion
- the cluster state version being applied when updating the allocation IDs from the masterinSyncAllocationIds
- the allocation ids of the currently in-sync shard copiesroutingTable
- the shard routing tablejava.io.IOException
- if shard state could not be persistedpublic IndexShardState markAsRecovering(java.lang.String reason, RecoveryState recoveryState) throws IndexShardStartedException, IndexShardRelocatedException, IndexShardRecoveringException, IndexShardClosedException
public void relocated(java.lang.String reason, java.util.function.Consumer<GlobalCheckpointTracker.PrimaryContext> consumer) throws IllegalIndexShardStateException, java.lang.InterruptedException
Runnable
is executed after all operations are successfully blocked.reason
- the reason for the relocationconsumer
- a Runnable
that is executed after operations are blockedIllegalIndexShardStateException
- if the shard is not relocating due to concurrent cancellationjava.lang.InterruptedException
- if blocking operations is interruptedpublic IndexShardState state()
IndicesClusterStateService.Shard
state
in interface IndicesClusterStateService.Shard
public Engine.IndexResult applyIndexOperationOnPrimary(long version, VersionType versionType, SourceToParse sourceToParse, long autoGeneratedTimestamp, boolean isRetry, java.util.function.Consumer<Mapping> onMappingUpdate) throws java.io.IOException
java.io.IOException
public Engine.IndexResult applyIndexOperationOnReplica(long seqNo, long version, VersionType versionType, long autoGeneratedTimeStamp, boolean isRetry, SourceToParse sourceToParse, java.util.function.Consumer<Mapping> onMappingUpdate) throws java.io.IOException
java.io.IOException
public static Engine.Index prepareIndex(DocumentMapperForType docMapper, Version indexCreatedVersion, SourceToParse source, long seqNo, long primaryTerm, long version, VersionType versionType, Engine.Operation.Origin origin, long autoGeneratedIdTimestamp, boolean isRetry)
public Engine.NoOpResult markSeqNoAsNoop(long seqNo, java.lang.String reason) throws java.io.IOException
java.io.IOException
public Engine.DeleteResult applyDeleteOperationOnPrimary(long version, java.lang.String type, java.lang.String id, VersionType versionType, java.util.function.Consumer<Mapping> onMappingUpdate) throws java.io.IOException
java.io.IOException
public Engine.DeleteResult applyDeleteOperationOnReplica(long seqNo, long version, java.lang.String type, java.lang.String id, VersionType versionType, java.util.function.Consumer<Mapping> onMappingUpdate) throws java.io.IOException
java.io.IOException
public Engine.GetResult get(Engine.Get get)
public void refresh(java.lang.String source)
AlreadyClosedException
.public long getWritingBytes()
public RefreshStats refreshStats()
public FlushStats flushStats()
public DocsStats docStats()
@Nullable public CommitStats commitStats()
CommitStats
if engine is open, otherwise null@Nullable public SeqNoStats seqNoStats()
SeqNoStats
if engine is open, otherwise nullpublic IndexingStats indexingStats(java.lang.String... types)
public SearchStats searchStats(java.lang.String... groups)
public GetStats getStats()
public StoreStats storeStats()
public MergeStats mergeStats()
public SegmentsStats segmentStats(boolean includeSegmentFileSizes)
public WarmerStats warmerStats()
public FieldDataStats fieldDataStats(java.lang.String... fields)
public TranslogStats translogStats()
public CompletionStats completionStats(java.lang.String... fields)
public Engine.SyncedFlushResult syncFlush(java.lang.String syncId, Engine.CommitId expectedCommitId)
public Engine.CommitId flush(FlushRequest request)
request
- the flush requestpublic void trimTranslog()
TranslogDeletionPolicy
for detailspublic void forceMerge(ForceMergeRequest forceMerge) throws java.io.IOException
java.io.IOException
public org.apache.lucene.util.Version upgrade(UpgradeRequest upgrade) throws java.io.IOException
java.io.IOException
public org.apache.lucene.util.Version minimumCompatibleVersion()
public Engine.IndexCommitRef acquireIndexCommit(boolean flushFirst) throws EngineException
IndexCommit
snapshot form the currently running engine. All resources referenced by this
commit won't be freed until the commit / snapshot is closed.flushFirst
- true
if the index should first be flushed to disk / a low level lucene commit should be executedEngineException
public Store.MetadataSnapshot snapshotStoreMetadata() throws java.io.IOException
Store.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.org.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.IOException
public void failShard(java.lang.String reason, @Nullable java.lang.Exception e)
e
is caused by index corruptionpublic Engine.Searcher acquireSearcher(java.lang.String source)
public void close(java.lang.String reason, boolean flushEngine) throws java.io.IOException
java.io.IOException
public IndexShard postRecovery(java.lang.String reason) throws IndexShardStartedException, IndexShardRelocatedException, IndexShardClosedException
public void prepareForIndexRecovery()
public Engine.Result applyTranslogOperation(Translog.Operation operation, Engine.Operation.Origin origin, java.util.function.Consumer<Mapping> onMappingUpdate) throws java.io.IOException
java.io.IOException
public void performTranslogRecovery(boolean indexExists) throws java.io.IOException
java.io.IOException
protected void onNewEngine(Engine newEngine)
public void skipTranslogRecovery() throws java.io.IOException
java.io.IOException
public void performRecoveryRestart() throws java.io.IOException
java.io.IOException
public RecoveryStats recoveryStats()
public RecoveryState recoveryState()
RecoveryState
if this shard is recovering or has been recovering.
Returns null if the recovery has not yet started or shard was not recovered (created via an API).recoveryState
in interface IndicesClusterStateService.Shard
public void finalizeRecovery()
postRecovery(String)
.public boolean ignoreRecoveryAttempt()
public void readAllowed() throws IllegalIndexShardStateException
IllegalIndexShardStateException
public boolean isReadAllowed()
IndexShardState
allows readingprotected final void verifyActive() throws IllegalIndexShardStateException
IllegalIndexShardStateException
public long getIndexBufferRAMBytesUsed()
public void addShardFailureCallback(java.util.function.Consumer<IndexShard.ShardFailure> onShardFailure)
public void checkIdle(long inactiveTimeNS)
IndexingMemoryController
to check whether more than inactiveTimeNS
has passed since the last
indexing operation, and notify listeners that we are now inactive so e.g. sync'd flush can happen.public boolean isActive()
public ShardPath shardPath()
public boolean recoverFromLocalShards(java.util.function.BiConsumer<java.lang.String,MappingMetaData> mappingUpdateConsumer, java.util.List<IndexShard> localShards) throws java.io.IOException
java.io.IOException
public boolean recoverFromStore()
public boolean restoreFromRepository(Repository repository)
public void onSettingsChanged()
public java.io.Closeable acquireTranslogRetentionLock()
public java.util.List<Segment> segments(boolean verbose)
public void flushAndCloseEngine() throws java.io.IOException
java.io.IOException
public Translog getTranslog()
public java.lang.String getHistoryUUID()
public IndexEventListener getIndexEventListener()
public void activateThrottling()
public void deactivateThrottling()
public void writeIndexingBuffer()
public void updateLocalCheckpointForShard(java.lang.String allocationId, long checkpoint)
GlobalCheckpointTracker.updateLocalCheckpoint(String, long)
for
details.allocationId
- the allocation ID of the shard to update the local checkpoint forcheckpoint
- the local checkpoint for the shardpublic void updateGlobalCheckpointForShard(java.lang.String allocationId, long globalCheckpoint)
allocationId
- the allocation ID to update the global checkpoint forglobalCheckpoint
- the global checkpointpublic void waitForOpsToComplete(long seqNo) throws java.lang.InterruptedException
seqNo
- the sequence number that the checkpoint must advance to before this method returnsjava.lang.InterruptedException
- if the thread was interrupted while blocking on the conditionpublic void initiateTracking(java.lang.String allocationId)
GlobalCheckpointTracker.initiateTracking(String)
for details.allocationId
- the allocation ID of the shard for which recovery was initiatedpublic void markAllocationIdAsInSync(java.lang.String allocationId, long localCheckpoint) throws java.lang.InterruptedException
GlobalCheckpointTracker.markAllocationIdAsInSync(String, long)
for additional details.allocationId
- the allocation ID of the shard to mark as in-synclocalCheckpoint
- the current local checkpoint on the shardjava.lang.InterruptedException
public long getLocalCheckpoint()
public long getGlobalCheckpoint()
public com.carrotsearch.hppc.ObjectLongMap<java.lang.String> getInSyncGlobalCheckpoints()
public void maybeSyncGlobalCheckpoint(java.lang.String reason)
public ReplicationGroup getReplicationGroup()
public void updateGlobalCheckpointOnReplica(long globalCheckpoint, java.lang.String reason)
globalCheckpoint
- the global checkpointreason
- the reason the global checkpoint was updatedpublic void activateWithPrimaryContext(GlobalCheckpointTracker.PrimaryContext primaryContext)
primaryContext
- the sequence number contextpublic boolean pendingInSync()
true
if there is at least one shard pending in-sync, otherwise falsepublic void noopUpdate(java.lang.String type)
type
- the doc type of the updateprotected Engine getEngineOrNull()
public void startRecovery(RecoveryState recoveryState, PeerRecoveryTargetService recoveryTargetService, PeerRecoveryTargetService.RecoveryListener recoveryListener, RepositoriesService repositoriesService, java.util.function.BiConsumer<java.lang.String,MappingMetaData> mappingUpdateConsumer, IndicesService indicesService)
protected Engine newEngine(EngineConfig config)
public void acquirePrimaryOperationPermit(ActionListener<Releasable> onPermitAcquired, java.lang.String executorOnDelay)
public void acquireReplicaOperationPermit(long operationPrimaryTerm, long globalCheckpoint, ActionListener<Releasable> onPermitAcquired, java.lang.String executorOnDelay)
acquirePrimaryOperationPermit(ActionListener, String)
). If the given primary term is lower than then one in
shardRouting
, the ActionListener.onFailure(Exception)
method of the provided listener is invoked with an
IllegalStateException
. If permit acquisition is delayed, the listener will be invoked on the executor with the specified
name.operationPrimaryTerm
- the operation primary termglobalCheckpoint
- the global checkpoint associated with the requestonPermitAcquired
- the listener for permit acquisitionexecutorOnDelay
- the name of the executor to invoke the listener on if permit acquisition is delayedpublic int getActiveOperationsCount()
public final void sync(Translog.Location location, java.util.function.Consumer<java.lang.Exception> syncListener)
public final void sync() throws java.io.IOException
java.io.IOException
public Translog.Durability getTranslogDurability()
public void afterWriteOperation()
public boolean isRefreshNeeded()
true
iff one or more changes to the engine are not visible to via the current searcher *or* there are pending
refresh listeners.
Otherwise false
.org.apache.lucene.store.AlreadyClosedException
- if the engine or internal indexwriter in the engine is already closedpublic void addRefreshListener(Translog.Location location, java.util.function.Consumer<java.lang.Boolean> listener)
location
- 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.