Skip to content

Commit

Permalink
Make query groups persistent across process restarts (#16370)
Browse files Browse the repository at this point in the history
* add QueryGroupMetadata to namedXContentWritables

Signed-off-by: Kaushal Kumar <[email protected]>

* add UT

Signed-off-by: Kaushal Kumar <[email protected]>

* apply spotless

Signed-off-by: Kaushal Kumar <[email protected]>

* add CHANGELOG entry

Signed-off-by: Kaushal Kumar <[email protected]>

* improve changelog comment

Signed-off-by: Kaushal Kumar <[email protected]>

---------

Signed-off-by: Kaushal Kumar <[email protected]>
  • Loading branch information
kaushalmahi12 authored and dbwiddis committed Oct 18, 2024
1 parent c5941db commit b119d56
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Fix multi-search with template doesn't return status code ([#16265](https://github.com/opensearch-project/OpenSearch/pull/16265))
- [Streaming Indexing] Fix intermittent 'The bulk request must be terminated by a newline [\n]' failures [#16337](https://github.com/opensearch-project/OpenSearch/pull/16337))
- 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))
- [Workload Management] Make query groups persistent across process restarts [#16370](https://github.com/opensearch-project/OpenSearch/pull/16370)

### Security

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,13 @@ public static List<NamedXContentRegistry.Entry> getNamedXWriteables() {
DecommissionAttributeMetadata::fromXContent
)
);
entries.add(
new NamedXContentRegistry.Entry(
Metadata.Custom.class,
new ParseField(QueryGroupMetadata.TYPE),
QueryGroupMetadata::fromXContent
)
);
return entries;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
import org.opensearch.common.settings.SettingsModule;
import org.opensearch.common.util.concurrent.ThreadContext;
import org.opensearch.core.common.io.stream.NamedWriteableRegistry;
import org.opensearch.core.xcontent.NamedXContentRegistry;
import org.opensearch.gateway.GatewayAllocator;
import org.opensearch.plugins.ClusterPlugin;
import org.opensearch.telemetry.metrics.noop.NoopMetricsRegistry;
Expand Down Expand Up @@ -331,10 +332,18 @@ public void testRejectsDuplicateExistingShardsAllocatorName() {

public void testQueryGroupMetadataRegister() {
List<NamedWriteableRegistry.Entry> customEntries = ClusterModule.getNamedWriteables();
List<NamedXContentRegistry.Entry> customXEntries = ClusterModule.getNamedXWriteables();
assertTrue(
customEntries.stream()
.anyMatch(entry -> entry.categoryClass == Metadata.Custom.class && entry.name.equals(QueryGroupMetadata.TYPE))
);

assertTrue(
customXEntries.stream()
.anyMatch(
entry -> entry.categoryClass == Metadata.Custom.class && entry.name.getPreferredName().equals(QueryGroupMetadata.TYPE)
)
);
}

public void testRerouteServiceSetForBalancedShardsAllocator() {
Expand Down

0 comments on commit b119d56

Please sign in to comment.