Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add changes to propagate queryGroupId across child requests and nodes #14614

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
58303c6
add query group header propagator
kaushalmahi12 Jul 1, 2024
5efa3e3
apply spotless check
kaushalmahi12 Jul 1, 2024
ede0efa
add new propagator in ThreadContext
kaushalmahi12 Jul 1, 2024
51c5222
spotlessApply
kaushalmahi12 Jul 1, 2024
dfa53b1
address comments
kaushalmahi12 Jul 2, 2024
153134d
Bump com.microsoft.azure:msal4j from 1.15.1 to 1.16.0 in /plugins/rep…
dependabot[bot] Jul 1, 2024
ec9d435
[Bugfix] Fix ICacheKeySerializerTests flakiness (#14564)
peteralfonsi Jul 1, 2024
bda1bfa
Correct typo in method name (#14621)
imvtsl Jul 2, 2024
6abdba2
Refactoring FilterPath.parse by using an iterative approach instead o…
deshsidd Jul 2, 2024
38c9f82
Removing String format in RemoteStoreMigrationAllocationDecider to op…
RS146BIJAY Jul 3, 2024
a5b991e
Clear templates before Adding; Use NamedWriteableAwareStreamInput for…
soosinha Jul 3, 2024
b1b5f87
add changelog
kaushalmahi12 Jul 3, 2024
9a1c7b9
add PR link changelog
kaushalmahi12 Jul 3, 2024
cbcbb0e
Improve reroute performance by optimising List.removeAll in LocalShar…
RS146BIJAY Jul 4, 2024
1abe6b1
Fix assertion failure while deleting remote backed index (#14601)
sachinpkale Jul 5, 2024
1d20abe
Allow system index warning in OpenSearchRestTestCase.refreshAllIndice…
cwperks Jul 5, 2024
fe1983e
Star tree codec changes (#14514)
bharath-techie Jul 8, 2024
ba851fb
Bump com.github.spullara.mustache.java:compiler from 0.9.13 to 0.9.14…
dependabot[bot] Jul 8, 2024
3925aac
Bump net.minidev:accessors-smart from 2.5.0 to 2.5.1 in /plugins/repo…
dependabot[bot] Jul 8, 2024
aa7c560
Merge branch 'main' into feature/sandbox-qgHdrPropagatino
kaushalmahi12 Jul 8, 2024
eea2a2c
rebase with upstream
kaushalmahi12 Jul 10, 2024
7b21688
move query group thread context propagator out of ThreadContext
kaushalmahi12 Jul 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Add batching supported processor base type AbstractBatchingProcessor ([#14554](https://github.com/opensearch-project/OpenSearch/pull/14554))
- Fix race condition while parsing derived fields from search definition ([14445](https://github.com/opensearch-project/OpenSearch/pull/14445))
- Add allowlist setting for ingest-common and search-pipeline-common processors ([#14439](https://github.com/opensearch-project/OpenSearch/issues/14439))
- [Workload Management] add queryGroupId header propagator across requests and nodes ([#14614](https://github.com/opensearch-project/OpenSearch/pull/14614))
- Create SystemIndexRegistry with helper method matchesSystemIndex ([#14415](https://github.com/opensearch-project/OpenSearch/pull/14415))

### Dependencies
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.wlm;

import org.opensearch.common.util.concurrent.ThreadContextStatePropagator;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* This class is used to propagate QueryGroup related headers to request and nodes
*/
public class QueryGroupThreadContextStatePropagator implements ThreadContextStatePropagator {
// TODO: move this constant to QueryGroupService class once the QueryGroup monitoring framework PR is ready
public static List<String> PROPAGATED_HEADERS = List.of("queryGroupId");

/**
* @param source current context transient headers
* @return the map of header and their values to be propagated across request threadContexts
*/
@Override
@SuppressWarnings("removal")
public Map<String, Object> transients(Map<String, Object> source) {
final Map<String, Object> transientHeaders = new HashMap<>();

for (String headerName : PROPAGATED_HEADERS) {
transientHeaders.compute(headerName, (k, v) -> source.get(headerName));
}
return transientHeaders;
}

/**
* @param source current context headers
* @return map of header and their values to be propagated across nodes
*/
@Override
@SuppressWarnings("removal")
public Map<String, String> headers(Map<String, Object> source) {
final Map<String, String> propagatedHeaders = new HashMap<>();

for (String headerName : PROPAGATED_HEADERS) {
propagatedHeaders.compute(headerName, (k, v) -> (String) source.get(headerName));
}
return propagatedHeaders;
}
}
13 changes: 13 additions & 0 deletions server/src/main/java/org/opensearch/wlm/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

/**
* This package contains workload management constructs
*/
kaushalmahi12 marked this conversation as resolved.
Show resolved Hide resolved

package org.opensearch.wlm;
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.wlm;

import org.opensearch.test.OpenSearchTestCase;

import java.util.Map;

public class QueryGroupThreadContextStatePropagatorTests extends OpenSearchTestCase {

public void testTransients() {
QueryGroupThreadContextStatePropagator sut = new QueryGroupThreadContextStatePropagator();
Map<String, Object> source = Map.of("queryGroupId", "adgarja0r235te");
Map<String, Object> transients = sut.transients(source);
assertEquals("adgarja0r235te", transients.get("queryGroupId"));
}

public void testHeaders() {
QueryGroupThreadContextStatePropagator sut = new QueryGroupThreadContextStatePropagator();
Map<String, Object> source = Map.of("queryGroupId", "adgarja0r235te");
Map<String, String> headers = sut.headers(source);
assertEquals("adgarja0r235te", headers.get("queryGroupId"));
}
}
Loading