Skip to content

Commit 70783e8

Browse files
committed
inline
1 parent e0261ba commit 70783e8

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

server/src/main/java/org/elasticsearch/indices/IndicesService.java

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
import org.elasticsearch.core.AbstractRefCounted;
7676
import org.elasticsearch.core.CheckedConsumer;
7777
import org.elasticsearch.core.CheckedFunction;
78-
import org.elasticsearch.core.CheckedRunnable;
7978
import org.elasticsearch.core.IOUtils;
8079
import org.elasticsearch.core.Nullable;
8180
import org.elasticsearch.core.Releasable;
@@ -970,28 +969,30 @@ public void createShard(
970969
RecoveryState recoveryState = indexService.createRecoveryState(shardRouting, targetNode, sourceNode);
971970
IndexShard indexShard = indexService.createShard(shardRouting, globalCheckpointSyncer, retentionLeaseSyncer);
972971
indexShard.addShardFailureCallback(onShardFailure);
973-
final CheckedRunnable<RuntimeException> recoveryRunnable = () -> indexShard.startRecovery(
974-
recoveryState,
975-
recoveryTargetService,
976-
postRecoveryMerger.maybeMergeAfterRecovery(indexService.getMetadata(), shardRouting, recoveryListener),
977-
repositoriesService,
978-
(mapping, listener) -> {
979-
assert recoveryState.getRecoverySource().getType() == RecoverySource.Type.LOCAL_SHARDS
980-
: "mapping update consumer only required by local shards recovery";
981-
AcknowledgedRequest<PutMappingRequest> putMappingRequestAcknowledgedRequest = new PutMappingRequest()
982-
// concrete index - no name clash, it uses uuid
983-
.setConcreteIndex(shardRouting.index())
984-
.source(mapping.source().string(), XContentType.JSON);
985-
client.execute(
986-
TransportAutoPutMappingAction.TYPE,
987-
putMappingRequestAcknowledgedRequest.ackTimeout(TimeValue.MAX_VALUE).masterNodeTimeout(TimeValue.MAX_VALUE),
988-
new RefCountAwareThreadedActionListener<>(threadPool.generic(), listener.map(ignored -> null))
989-
);
990-
},
991-
this,
992-
clusterStateVersion
972+
projectResolver.executeOnProject(
973+
projectId,
974+
() -> indexShard.startRecovery(
975+
recoveryState,
976+
recoveryTargetService,
977+
postRecoveryMerger.maybeMergeAfterRecovery(indexService.getMetadata(), shardRouting, recoveryListener),
978+
repositoriesService,
979+
(mapping, listener) -> {
980+
assert recoveryState.getRecoverySource().getType() == RecoverySource.Type.LOCAL_SHARDS
981+
: "mapping update consumer only required by local shards recovery";
982+
AcknowledgedRequest<PutMappingRequest> putMappingRequestAcknowledgedRequest = new PutMappingRequest()
983+
// concrete index - no name clash, it uses uuid
984+
.setConcreteIndex(shardRouting.index())
985+
.source(mapping.source().string(), XContentType.JSON);
986+
client.execute(
987+
TransportAutoPutMappingAction.TYPE,
988+
putMappingRequestAcknowledgedRequest.ackTimeout(TimeValue.MAX_VALUE).masterNodeTimeout(TimeValue.MAX_VALUE),
989+
new RefCountAwareThreadedActionListener<>(threadPool.generic(), listener.map(ignored -> null))
990+
);
991+
},
992+
this,
993+
clusterStateVersion
994+
)
993995
);
994-
projectResolver.executeOnProject(projectId, recoveryRunnable);
995996
}
996997

997998
@Override

0 commit comments

Comments
 (0)