Skip to content

Commit 9a2b614

Browse files
committed
Handle recovery of shards created during resharding split
1 parent 8d0c9ce commit 9a2b614

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

server/src/main/java/org/elasticsearch/index/shard/StoreRecovery.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,16 @@ private void internalRecoverFromStore(IndexShard indexShard, ActionListener<Void
423423

424424
.<Void>andThen(l -> {
425425
final RecoveryState recoveryState = indexShard.recoveryState();
426-
final boolean indexShouldExists = recoveryState.getRecoverySource().getType() != RecoverySource.Type.EMPTY_STORE;
426+
// TODO
427+
// hack due to resharding using RecoverySource.Type.EMPTY_STORE
428+
final boolean indexShouldExists = recoveryState.getRecoverySource().getType() != RecoverySource.Type.EMPTY_STORE
429+
|| (indexShard.indexSettings().getIndexMetadata().getReshardingMetadata() != null
430+
&& indexShard.indexSettings().getIndexMetadata().getReshardingMetadata().isSplit()
431+
&& indexShard.indexSettings()
432+
.getIndexMetadata()
433+
.getReshardingMetadata()
434+
.getSplit()
435+
.isTargetShard(indexShard.shardId.getId()));
427436
indexShard.prepareForIndexRecovery();
428437
SegmentInfos si = null;
429438
final Store store = indexShard.store();

0 commit comments

Comments
 (0)