Skip to content

Commit

Permalink
Allocate searchable snapshots with the balancer (#54889)
Browse files Browse the repository at this point in the history
Today the shards of searchable snapshots are allocated with a naive
`ExistingShardsAllocator` which selects the first valid node for each shard.
Thanks to #54729 we can now allow these shards to fall through to the balanced
shards allocator so that they are allocated in a more balanced fashion.

Relates #50999
  • Loading branch information
DaveCTurner committed Apr 8, 2020
1 parent 3a3effe commit 0d21951
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ public void allocateUnassigned(
if (allocateUnassignedDecision.getAllocationDecision() == AllocationDecision.YES) {
if (shardRouting.primary() && shardRouting.recoverySource().getType() == RecoverySource.Type.EXISTING_STORE) {
// we don't care what the allocation ID is since we know that these shards cannot really be stale, so we can
// safely ignore the allocation ID with a forced-stale allocation
// safely ignore the allocation ID with a forced-stale allocation and allow this shard to fall through to the balanced
// shards allocator
unassignedAllocationHandler.updateUnassigned(
shardRouting.unassignedInfo(),
RecoverySource.ExistingStoreRecoverySource.FORCE_STALE_PRIMARY_INSTANCE,
allocation.changes()
);
}
unassignedAllocationHandler.initialize(allocateUnassignedDecision.getTargetNode().getId(), null, 0L, allocation.changes());
} else {
unassignedAllocationHandler.removeAndIgnore(allocateUnassignedDecision.getAllocationStatus(), allocation.changes());
}
Expand Down

0 comments on commit 0d21951

Please sign in to comment.