public class IndicesService extends AbstractLifecycleComponent<IndicesService> implements Iterable<IndexService>
| Modifier and Type | Field and Description |
|---|---|
static String |
INDICES_SHARDS_CLOSED_TIMEOUT |
lifecyclecomponentSettings, logger, settings| Constructor and Description |
|---|
IndicesService(Settings settings,
IndicesLifecycle indicesLifecycle,
IndicesAnalysisService indicesAnalysisService,
Injector injector,
NodeEnvironment nodeEnv) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPendingDelete(Index index,
Settings settings)
Adds a pending delete for the given index.
|
void |
addPendingDelete(ShardId shardId,
Settings settings)
Adds a pending delete for the given index shard.
|
boolean |
canDeleteIndexContents(Index index,
Settings indexSettings)
This method returns true if the current node is allowed to delete the
given index.
|
boolean |
canDeleteShardContent(ShardId shardId,
IndexMetaData metaData)
Returns
true iff the shards content for the given shard can be deleted. |
boolean |
changesAllowed()
Returns true if changes (adding / removing) indices, shards and so on are allowed.
|
IndexService |
createIndex(String sIndexName,
Settings settings,
String localNodeId) |
void |
deleteClosedIndex(String reason,
IndexMetaData metaData,
ClusterState clusterState) |
void |
deleteIndex(String index,
String reason)
Deletes the given index.
|
void |
deleteIndexStore(String reason,
IndexMetaData metaData,
ClusterState clusterState)
Deletes the index store trying to acquire all shards locks for this index.
|
void |
deleteShardStore(String reason,
ShardId shardId,
ClusterState clusterState)
This method deletes the shard contents on disk for the given shard ID.
|
void |
deleteShardStore(String reason,
ShardLock lock,
Settings indexSettings)
Deletes the shard with an already acquired shard lock.
|
protected void |
doClose() |
protected void |
doStart() |
protected void |
doStop() |
boolean |
hasIndex(String index) |
IndexService |
indexService(String index)
Returns an IndexService for the specified index if exists otherwise returns
null. |
IndexService |
indexServiceSafe(String index)
Returns an IndexService for the specified index if exists otherwise a
IndexMissingException is thrown. |
IndicesLifecycle |
indicesLifecycle() |
Iterator<IndexService> |
iterator() |
void |
processPendingDeletes(Index index,
Settings indexSettings,
TimeValue timeout)
Processes all pending deletes for the given index.
|
void |
removeIndex(String index,
String reason)
Removes the given index from this service and releases all associated resources.
|
NodeIndicesStats |
stats(boolean includePrevious)
Returns the node stats indices stats.
|
NodeIndicesStats |
stats(boolean includePrevious,
CommonStatsFlags flags) |
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stopnodeNameclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic static final String INDICES_SHARDS_CLOSED_TIMEOUT
@Inject public IndicesService(Settings settings, IndicesLifecycle indicesLifecycle, IndicesAnalysisService indicesAnalysisService, Injector injector, NodeEnvironment nodeEnv)
protected void doStart()
throws ElasticsearchException
doStart in class AbstractLifecycleComponent<IndicesService>ElasticsearchExceptionprotected void doStop()
throws ElasticsearchException
doStop in class AbstractLifecycleComponent<IndicesService>ElasticsearchExceptionprotected void doClose()
throws ElasticsearchException
doClose in class AbstractLifecycleComponent<IndicesService>ElasticsearchExceptionpublic IndicesLifecycle indicesLifecycle()
public NodeIndicesStats stats(boolean includePrevious)
public NodeIndicesStats stats(boolean includePrevious, CommonStatsFlags flags)
public boolean changesAllowed()
public Iterator<IndexService> iterator()
iterator in interface Iterable<IndexService>public boolean hasIndex(String index)
@Nullable public IndexService indexService(String index)
null.public IndexService indexServiceSafe(String index) throws IndexMissingException
IndexMissingException is thrown.IndexMissingExceptionpublic IndexService createIndex(String sIndexName, @IndexSettings Settings settings, String localNodeId) throws ElasticsearchException
ElasticsearchExceptionpublic void removeIndex(String index, String reason) throws ElasticsearchException
index - the index to removereason - the high level reason causing this removalElasticsearchExceptionpublic void deleteIndex(String index, String reason) throws IOException
removeIndex(String, String) but fires
different lifecycle events to ensure pending resources of this index are immediately removed.index - the index to deletereason - the high level reason causing this deleteIOExceptionpublic void deleteClosedIndex(String reason, IndexMetaData metaData, ClusterState clusterState)
public void deleteIndexStore(String reason, IndexMetaData metaData, ClusterState clusterState) throws IOException
IOExceptionpublic void deleteShardStore(String reason, ShardLock lock, Settings indexSettings) throws IOException
reason - the reason for the shard deletionlock - the lock of the shard to deleteindexSettings - the shards index settings.IOException - if an IOException occurspublic void deleteShardStore(String reason, ShardId shardId, ClusterState clusterState) throws IOException
canDeleteShardContent(org.elasticsearch.index.shard.ShardId, org.elasticsearch.cluster.metadata.IndexMetaData)
of if the shards lock can not be acquired.
On data nodes, if the deleted shard is the last shard folder in its index, the method will attempt to remove the index folder as well.reason - the reason for the shard deletionshardId - the shards ID to deleteclusterState - . This is required to access the indexes settings etc.IOException - if an IOException occurspublic boolean canDeleteIndexContents(Index index, Settings indexSettings)
index - Index to check whether deletion is allowedindexSettings - Settings for the given indexpublic boolean canDeleteShardContent(ShardId shardId, IndexMetaData metaData)
true iff the shards content for the given shard can be deleted.
This method will return false if:
shardId - the shard to delete.metaData - the shards index metadata. This is required to access the indexes settings etc.public void addPendingDelete(ShardId shardId, @IndexSettings Settings settings)
public void addPendingDelete(Index index, @IndexSettings Settings settings)
public void processPendingDeletes(Index index, @IndexSettings Settings indexSettings, TimeValue timeout) throws IOException
index - the index to process the pending deletes fortimeout - the timeout used for processing pending deletesIOExceptionCopyright © 2009–2016. All rights reserved.