Skip to content

Commit 3b004bf

Browse files
Make query groups persistent across process restarts (#16370)
* add QueryGroupMetadata to namedXContentWritables Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com> * add UT Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com> * apply spotless Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com> * add CHANGELOG entry Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com> * improve changelog comment Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com> --------- Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
1 parent ebcf5e3 commit 3b004bf

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8585
- [Streaming Indexing] Fix intermittent 'The bulk request must be terminated by a newline [\n]' failures [#16337](https://github.com/opensearch-project/OpenSearch/pull/16337))
8686
- Fix wrong default value when setting `index.number_of_routing_shards` to null on index creation ([#16331](https://github.com/opensearch-project/OpenSearch/pull/16331))
8787
- Fix disk usage exceeds threshold cluster can't spin up issue ([#15258](https://github.com/opensearch-project/OpenSearch/pull/15258)))
88+
- [Workload Management] Make query groups persistent across process restarts [#16370](https://github.com/opensearch-project/OpenSearch/pull/16370)
8889

8990
- Fix inefficient Stream API call chains ending with count() ([#15386](https://github.com/opensearch-project/OpenSearch/pull/15386))
9091

server/src/main/java/org/opensearch/cluster/ClusterModule.java

+7
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,13 @@ public static List<NamedXContentRegistry.Entry> getNamedXWriteables() {
327327
DecommissionAttributeMetadata::fromXContent
328328
)
329329
);
330+
entries.add(
331+
new NamedXContentRegistry.Entry(
332+
Metadata.Custom.class,
333+
new ParseField(QueryGroupMetadata.TYPE),
334+
QueryGroupMetadata::fromXContent
335+
)
336+
);
330337
return entries;
331338
}
332339

server/src/test/java/org/opensearch/cluster/ClusterModuleTests.java

+9
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
import org.opensearch.common.settings.SettingsModule;
7272
import org.opensearch.common.util.concurrent.ThreadContext;
7373
import org.opensearch.core.common.io.stream.NamedWriteableRegistry;
74+
import org.opensearch.core.xcontent.NamedXContentRegistry;
7475
import org.opensearch.gateway.GatewayAllocator;
7576
import org.opensearch.plugins.ClusterPlugin;
7677
import org.opensearch.telemetry.metrics.noop.NoopMetricsRegistry;
@@ -331,10 +332,18 @@ public void testRejectsDuplicateExistingShardsAllocatorName() {
331332

332333
public void testQueryGroupMetadataRegister() {
333334
List<NamedWriteableRegistry.Entry> customEntries = ClusterModule.getNamedWriteables();
335+
List<NamedXContentRegistry.Entry> customXEntries = ClusterModule.getNamedXWriteables();
334336
assertTrue(
335337
customEntries.stream()
336338
.anyMatch(entry -> entry.categoryClass == Metadata.Custom.class && entry.name.equals(QueryGroupMetadata.TYPE))
337339
);
340+
341+
assertTrue(
342+
customXEntries.stream()
343+
.anyMatch(
344+
entry -> entry.categoryClass == Metadata.Custom.class && entry.name.getPreferredName().equals(QueryGroupMetadata.TYPE)
345+
)
346+
);
338347
}
339348

340349
public void testRerouteServiceSetForBalancedShardsAllocator() {

0 commit comments

Comments
 (0)