Fix possible NPE in snapshot service if a shard doesn't have primary
This commit is contained in:
parent
1d0bae0f50
commit
4ffd8a663c
|
@ -901,7 +901,7 @@ public class SnapshotsService extends AbstractComponent implements ClusterStateL
|
|||
ShardRouting primary = indexRoutingTable.shard(i).primaryShard();
|
||||
if (primary == null || !primary.assignedToNode()) {
|
||||
//TODO: Should we bailout completely or just mark this shard as failed?
|
||||
builder.put(shardId, new SnapshotMetaData.ShardSnapshotStatus(primary.currentNodeId(), State.FAILED, "primary shard is not allocated"));
|
||||
builder.put(shardId, new SnapshotMetaData.ShardSnapshotStatus(null, State.FAILED, "primary shard is not allocated"));
|
||||
} else if (!primary.started()) {
|
||||
builder.put(shardId, new SnapshotMetaData.ShardSnapshotStatus(primary.currentNodeId(), State.FAILED, "primary shard hasn't been started yet"));
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue