mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-25 06:16:40 +00:00
Allocate searchable snapshots with the balancer (#54889)
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
This commit is contained in:
parent
3a3effedc2
commit
0d2195191d
@ -42,14 +42,14 @@ public class SearchableSnapshotAllocator implements ExistingShardsAllocator {
|
|||||||
if (allocateUnassignedDecision.getAllocationDecision() == AllocationDecision.YES) {
|
if (allocateUnassignedDecision.getAllocationDecision() == AllocationDecision.YES) {
|
||||||
if (shardRouting.primary() && shardRouting.recoverySource().getType() == RecoverySource.Type.EXISTING_STORE) {
|
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
|
// 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(
|
unassignedAllocationHandler.updateUnassigned(
|
||||||
shardRouting.unassignedInfo(),
|
shardRouting.unassignedInfo(),
|
||||||
RecoverySource.ExistingStoreRecoverySource.FORCE_STALE_PRIMARY_INSTANCE,
|
RecoverySource.ExistingStoreRecoverySource.FORCE_STALE_PRIMARY_INSTANCE,
|
||||||
allocation.changes()
|
allocation.changes()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
unassignedAllocationHandler.initialize(allocateUnassignedDecision.getTargetNode().getId(), null, 0L, allocation.changes());
|
|
||||||
} else {
|
} else {
|
||||||
unassignedAllocationHandler.removeAndIgnore(allocateUnassignedDecision.getAllocationStatus(), allocation.changes());
|
unassignedAllocationHandler.removeAndIgnore(allocateUnassignedDecision.getAllocationStatus(), allocation.changes());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user