Skip to content

Commit 4e21c77

Browse files
committed
Enabled Async Shard Batch Fetch by default
Signed-off-by: Manik Garg <[email protected]>
1 parent 3638c13 commit 4e21c77

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55

66
## [Unreleased 3.x]
77
### Added
8+
- Enabled Async Shard Batch Fetch by default ([#17987](https://github.com/opensearch-project/OpenSearch/pull/17987))
89

910
### Changed
1011

server/src/main/java/org/opensearch/cluster/routing/allocation/ExistingShardsAllocator.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,19 @@ public interface ExistingShardsAllocator {
6464

6565
/**
6666
* Boolean setting to enable/disable batch allocation of unassigned shards already existing on disk.
67-
* This will allow sending all Unassigned Shards to the ExistingShard Allocator to make decision to allocate
67+
* This will allow sending all Unassigned Shards to the ExistingShard Allocator to make decision to allocate
6868
* in one or more go.
69-
*
70-
* Enable this setting if your ExistingShardAllocator is implementing the
69+
* <p>
70+
* This setting is enabled by default. In your ExistingShardAllocator implement the
7171
* {@link ExistingShardsAllocator#allocateAllUnassignedShards(RoutingAllocation, boolean)} method.
7272
* The default implementation of this method is not optimized and assigns shards one by one.
73-
*
74-
* If no plugin overrides {@link ExistingShardsAllocator} then default implementation will be use for it , i.e,
73+
* <p>
74+
* If no plugin overrides {@link ExistingShardsAllocator} then default implementation will be used for it , i.e,
7575
* {@link ShardsBatchGatewayAllocator}.
76-
*
77-
* This setting is experimental at this point.
7876
*/
7977
Setting<Boolean> EXISTING_SHARDS_ALLOCATOR_BATCH_MODE = Setting.boolSetting(
8078
"cluster.allocator.existing_shards_allocator.batch_enabled",
81-
false,
79+
true,
8280
Setting.Property.NodeScope
8381
);
8482

server/src/main/java/org/opensearch/gateway/ShardsBatchGatewayAllocator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public class ShardsBatchGatewayAllocator implements ExistingShardsAllocator {
8585
private TimeValue replicaShardsBatchGatewayAllocatorTimeout;
8686
private volatile Priority followUpRerouteTaskPriority;
8787
public static final TimeValue MIN_ALLOCATOR_TIMEOUT = TimeValue.timeValueSeconds(20);
88+
public static final TimeValue DEFAULT_ALLOCATOR_TIMEOUT = TimeValue.timeValueSeconds(20);
8889
private final ClusterManagerMetrics clusterManagerMetrics;
8990

9091
/**
@@ -105,7 +106,7 @@ public class ShardsBatchGatewayAllocator implements ExistingShardsAllocator {
105106
*/
106107
public static final Setting<TimeValue> PRIMARY_BATCH_ALLOCATOR_TIMEOUT_SETTING = Setting.timeSetting(
107108
PRIMARY_BATCH_ALLOCATOR_TIMEOUT_SETTING_KEY,
108-
TimeValue.MINUS_ONE,
109+
DEFAULT_ALLOCATOR_TIMEOUT,
109110
TimeValue.MINUS_ONE,
110111
new Setting.Validator<>() {
111112
@Override
@@ -129,7 +130,7 @@ public void validate(TimeValue timeValue) {
129130
*/
130131
public static final Setting<TimeValue> REPLICA_BATCH_ALLOCATOR_TIMEOUT_SETTING = Setting.timeSetting(
131132
REPLICA_BATCH_ALLOCATOR_TIMEOUT_SETTING_KEY,
132-
TimeValue.MINUS_ONE,
133+
DEFAULT_ALLOCATOR_TIMEOUT,
133134
TimeValue.MINUS_ONE,
134135
new Setting.Validator<>() {
135136
@Override

0 commit comments

Comments
 (0)