Call `beforeIndexShardCreated` listener earlier in `createShard`
Some listeners may need to do work before a shard's path is accessed (such as creating the directory in a plugin), so the listener should be called before anything happens (as its name implies).
This commit is contained in:
parent
38fdacdbf7
commit
9f03f8cf44
|
@ -301,6 +301,7 @@ public class IndexService extends AbstractIndexComponent implements IndexCompone
|
||||||
Injector shardInjector = null;
|
Injector shardInjector = null;
|
||||||
try {
|
try {
|
||||||
lock = nodeEnv.shardLock(shardId, TimeUnit.SECONDS.toMillis(5));
|
lock = nodeEnv.shardLock(shardId, TimeUnit.SECONDS.toMillis(5));
|
||||||
|
indicesLifecycle.beforeIndexShardCreated(shardId, indexSettings);
|
||||||
ShardPath path;
|
ShardPath path;
|
||||||
try {
|
try {
|
||||||
path = ShardPath.loadShardPath(logger, nodeEnv, shardId, indexSettings);
|
path = ShardPath.loadShardPath(logger, nodeEnv, shardId, indexSettings);
|
||||||
|
@ -325,7 +326,6 @@ public class IndexService extends AbstractIndexComponent implements IndexCompone
|
||||||
throw new IndexShardAlreadyExistsException(shardId + " already exists");
|
throw new IndexShardAlreadyExistsException(shardId + " already exists");
|
||||||
}
|
}
|
||||||
|
|
||||||
indicesLifecycle.beforeIndexShardCreated(shardId, indexSettings);
|
|
||||||
logger.debug("creating shard_id {}", shardId);
|
logger.debug("creating shard_id {}", shardId);
|
||||||
// if we are on a shared FS we only own the shard (ie. we can safely delete it) if we are the primary.
|
// if we are on a shared FS we only own the shard (ie. we can safely delete it) if we are the primary.
|
||||||
final boolean canDeleteShardContent = IndexMetaData.isOnSharedFilesystem(indexSettings) == false ||
|
final boolean canDeleteShardContent = IndexMetaData.isOnSharedFilesystem(indexSettings) == false ||
|
||||||
|
|
Loading…
Reference in New Issue