org.elasticsearch.index.shard.service
Class InternalIndexShard
java.lang.Object
org.elasticsearch.index.shard.AbstractIndexShardComponent
org.elasticsearch.index.shard.service.InternalIndexShard
- All Implemented Interfaces:
- IndexShardComponent, IndexShard
@ThreadSafe
public class InternalIndexShard
- extends AbstractIndexShardComponent
- implements IndexShard
Method Summary |
void |
addListener(OperationListener listener)
|
void |
close(java.lang.String reason)
|
long |
count(float minScore,
byte[] querySource,
int querySourceOffset,
int querySourceLength,
java.lang.String queryParserName,
java.lang.String... types)
|
long |
count(float minScore,
byte[] querySource,
java.lang.String queryParserName,
java.lang.String... types)
|
ParsedDocument |
create(Engine.Create create)
|
void |
delete(Engine.Delete delete)
|
void |
deleteByQuery(byte[] querySource,
java.lang.String queryParserName,
java.lang.String... types)
|
Engine |
engine()
|
ByteSizeValue |
estimateFlushableMemorySize()
Returns the estimated flushable memory size. |
void |
flush(Engine.Flush flush)
|
byte[] |
get(java.lang.String type,
java.lang.String id)
|
boolean |
ignoreRecoveryAttempt()
Returns true if this shard can ignore a recovery attempt made to it (since the already doing/done it) |
ParsedDocument |
index(Engine.Index index)
|
void |
optimize(Engine.Optimize optimize)
|
RecoveryStatus |
peerRecoveryStatus()
The peer recovery status if this shard recovered from a peer shard. |
void |
performRecoveryFinalization(boolean withFlush)
|
void |
performRecoveryFinalization(boolean withFlush,
RecoveryStatus peerRecoveryStatus)
|
void |
performRecoveryOperation(Translog.Operation operation)
|
void |
performRecoveryPrepareForTranslog()
After the store has been recovered, we need to start the engine in order to apply operations |
Engine.Create |
prepareCreate(SourceToParse source)
|
Engine.Delete |
prepareDelete(java.lang.String type,
java.lang.String id,
long version)
|
Engine.Index |
prepareIndex(SourceToParse source)
|
void |
readAllowed()
|
void |
recover(Engine.RecoveryHandler recoveryHandler)
|
IndexShardState |
recovering(java.lang.String reason)
Marks the shard as recovering, fails with exception is recovering is not allowed to be set. |
void |
refresh(Engine.Refresh refresh)
|
InternalIndexShard |
relocated(java.lang.String reason)
|
void |
removeListener(OperationListener listener)
|
ShardRouting |
routingEntry()
|
InternalIndexShard |
routingEntry(ShardRouting shardRouting)
|
Engine.Searcher |
searcher()
|
|
snapshot(Engine.SnapshotHandler<T> snapshotHandler)
|
InternalIndexShard |
start(java.lang.String reason)
|
IndexShardState |
state()
|
Store |
store()
|
Translog |
translog()
|
void |
writeAllowed()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InternalIndexShard
@Inject
public InternalIndexShard(ShardId shardId,
@IndexSettings
Settings indexSettings,
IndicesLifecycle indicesLifecycle,
Store store,
Engine engine,
Translog translog,
ThreadPool threadPool,
MapperService mapperService,
IndexQueryParserService queryParserService,
IndexCache indexCache)
addListener
public void addListener(OperationListener listener)
- Specified by:
addListener
in interface IndexShard
removeListener
public void removeListener(OperationListener listener)
- Specified by:
removeListener
in interface IndexShard
store
public Store store()
engine
public Engine engine()
translog
public Translog translog()
routingEntry
public ShardRouting routingEntry()
- Specified by:
routingEntry
in interface IndexShard
routingEntry
public InternalIndexShard routingEntry(ShardRouting shardRouting)
recovering
public IndexShardState recovering(java.lang.String reason)
throws IndexShardStartedException,
IndexShardRelocatedException,
IndexShardRecoveringException,
IndexShardClosedException
- Marks the shard as recovering, fails with exception is recovering is not allowed to be set.
- Throws:
IndexShardStartedException
IndexShardRelocatedException
IndexShardRecoveringException
IndexShardClosedException
relocated
public InternalIndexShard relocated(java.lang.String reason)
throws IndexShardNotStartedException
- Throws:
IndexShardNotStartedException
start
public InternalIndexShard start(java.lang.String reason)
throws IndexShardStartedException,
IndexShardRelocatedException,
IndexShardClosedException
- Throws:
IndexShardStartedException
IndexShardRelocatedException
IndexShardClosedException
state
public IndexShardState state()
- Specified by:
state
in interface IndexShard
estimateFlushableMemorySize
public ByteSizeValue estimateFlushableMemorySize()
throws ElasticSearchException
- Returns the estimated flushable memory size. Returns null if not available.
- Specified by:
estimateFlushableMemorySize
in interface IndexShard
- Throws:
ElasticSearchException
prepareCreate
public Engine.Create prepareCreate(SourceToParse source)
throws ElasticSearchException
- Specified by:
prepareCreate
in interface IndexShard
- Throws:
ElasticSearchException
create
public ParsedDocument create(Engine.Create create)
throws ElasticSearchException
- Specified by:
create
in interface IndexShard
- Throws:
ElasticSearchException
prepareIndex
public Engine.Index prepareIndex(SourceToParse source)
throws ElasticSearchException
- Specified by:
prepareIndex
in interface IndexShard
- Throws:
ElasticSearchException
index
public ParsedDocument index(Engine.Index index)
throws ElasticSearchException
- Specified by:
index
in interface IndexShard
- Throws:
ElasticSearchException
prepareDelete
public Engine.Delete prepareDelete(java.lang.String type,
java.lang.String id,
long version)
throws ElasticSearchException
- Specified by:
prepareDelete
in interface IndexShard
- Throws:
ElasticSearchException
delete
public void delete(Engine.Delete delete)
throws ElasticSearchException
- Specified by:
delete
in interface IndexShard
- Throws:
ElasticSearchException
deleteByQuery
public void deleteByQuery(byte[] querySource,
@Nullable
java.lang.String queryParserName,
java.lang.String... types)
throws ElasticSearchException
- Specified by:
deleteByQuery
in interface IndexShard
- Throws:
ElasticSearchException
get
public byte[] get(java.lang.String type,
java.lang.String id)
throws ElasticSearchException
- Specified by:
get
in interface IndexShard
- Throws:
ElasticSearchException
count
public long count(float minScore,
byte[] querySource,
@Nullable
java.lang.String queryParserName,
java.lang.String... types)
throws ElasticSearchException
- Specified by:
count
in interface IndexShard
- Throws:
ElasticSearchException
count
public long count(float minScore,
byte[] querySource,
int querySourceOffset,
int querySourceLength,
@Nullable
java.lang.String queryParserName,
java.lang.String... types)
throws ElasticSearchException
- Specified by:
count
in interface IndexShard
- Throws:
ElasticSearchException
refresh
public void refresh(Engine.Refresh refresh)
throws ElasticSearchException
- Specified by:
refresh
in interface IndexShard
- Throws:
ElasticSearchException
flush
public void flush(Engine.Flush flush)
throws ElasticSearchException
- Specified by:
flush
in interface IndexShard
- Throws:
ElasticSearchException
optimize
public void optimize(Engine.Optimize optimize)
throws ElasticSearchException
- Specified by:
optimize
in interface IndexShard
- Throws:
ElasticSearchException
snapshot
public <T> T snapshot(Engine.SnapshotHandler<T> snapshotHandler)
throws EngineException
- Specified by:
snapshot
in interface IndexShard
- Throws:
EngineException
recover
public void recover(Engine.RecoveryHandler recoveryHandler)
throws EngineException
- Specified by:
recover
in interface IndexShard
- Throws:
EngineException
searcher
public Engine.Searcher searcher()
- Specified by:
searcher
in interface IndexShard
close
public void close(java.lang.String reason)
performRecoveryPrepareForTranslog
public void performRecoveryPrepareForTranslog()
throws ElasticSearchException
- After the store has been recovered, we need to start the engine in order to apply operations
- Throws:
ElasticSearchException
peerRecoveryStatus
public RecoveryStatus peerRecoveryStatus()
- The peer recovery status if this shard recovered from a peer shard.
performRecoveryFinalization
public void performRecoveryFinalization(boolean withFlush,
RecoveryStatus peerRecoveryStatus)
throws ElasticSearchException
- Throws:
ElasticSearchException
performRecoveryFinalization
public void performRecoveryFinalization(boolean withFlush)
throws ElasticSearchException
- Throws:
ElasticSearchException
performRecoveryOperation
public void performRecoveryOperation(Translog.Operation operation)
throws ElasticSearchException
- Throws:
ElasticSearchException
ignoreRecoveryAttempt
public boolean ignoreRecoveryAttempt()
- Returns true if this shard can ignore a recovery attempt made to it (since the already doing/done it)
- Specified by:
ignoreRecoveryAttempt
in interface IndexShard
readAllowed
public void readAllowed()
throws IllegalIndexShardStateException
- Throws:
IllegalIndexShardStateException
writeAllowed
public void writeAllowed()
throws IllegalIndexShardStateException
- Throws:
IllegalIndexShardStateException