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 ThreadContextPermission for stashAndMergeHeaders and stashWithOrigin #15039

Merged
merged 3 commits into from
Jul 31, 2024

Conversation

cwperks
Copy link
Member

@cwperks cwperks commented Jul 31, 2024

Description

Similar to #15016, but extends it to more methods in the ThreadContextClass. This PR introduces permissions for stashAndMergeHeaders (used in test context only) and stashWithOrigin.

Related Issues

Related to #14931

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Craig Perkins <[email protected]>
Copy link
Contributor

❌ Gradle check result for 3892188: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@reta reta added the backport 2.x Backport to 2.x branch label Jul 31, 2024
Copy link
Contributor

❌ Gradle check result for fccc486: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@reta reta added v3.0.0 Issues and PRs related to version 3.0.0 v2.17.0 labels Jul 31, 2024
@reta reta mentioned this pull request Jul 31, 2024
20 tasks
@cwperks
Copy link
Member Author

cwperks commented Jul 31, 2024

Looking into test failures

Signed-off-by: Craig Perkins <[email protected]>
@cwperks
Copy link
Member Author

cwperks commented Jul 31, 2024

D'oh. I forgot to surround the invocations in ThreadContextAccess.doPrivileged(() -> ...). Pushed a commit to fix the failing tests.

Copy link
Contributor

❌ Gradle check result for c0324b4: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

✅ Gradle check result for c0324b4: SUCCESS

Copy link

codecov bot commented Jul 31, 2024

Codecov Report

Attention: Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.

Project coverage is 71.87%. Comparing base (eb306d2) to head (c0324b4).
Report is 4 commits behind head on main.

Files Patch % Lines
...ensearch/common/util/concurrent/ThreadContext.java 75.00% 0 Missing and 2 partials ⚠️
.../org/opensearch/client/support/AbstractClient.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #15039      +/-   ##
============================================
+ Coverage     71.77%   71.87%   +0.09%     
- Complexity    62689    62810     +121     
============================================
  Files          5163     5165       +2     
  Lines        294412   294446      +34     
  Branches      42582    42589       +7     
============================================
+ Hits         211325   211636     +311     
+ Misses        65689    65390     -299     
- Partials      17398    17420      +22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@reta reta merged commit e7ee950 into opensearch-project:main Jul 31, 2024
31 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 31, 2024
…gin (#15039)

* Add ThreadContextPermission for stashAndMergeHeaders and stashWithOrigin

Signed-off-by: Craig Perkins <[email protected]>

* Add to CHANGELOG

Signed-off-by: Craig Perkins <[email protected]>

* Use ThreadContextAccess

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
(cherry picked from commit e7ee950)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@cwperks
Copy link
Member Author

cwperks commented Jul 31, 2024

I'll open up a manual backport with the deprecationLogger

cwperks added a commit to cwperks/OpenSearch that referenced this pull request Jul 31, 2024
…gin (opensearch-project#15039)

* Add ThreadContextPermission for stashAndMergeHeaders and stashWithOrigin

Signed-off-by: Craig Perkins <[email protected]>

* Add to CHANGELOG

Signed-off-by: Craig Perkins <[email protected]>

* Use ThreadContextAccess

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
@cwperks
Copy link
Member Author

cwperks commented Jul 31, 2024

Opened a manual backport with deprecationLogger changes: #15049

@@ -213,6 +215,10 @@ public Writeable captureAsWriteable() {
* if it can't find the task in memory.
*/
public StoredContext stashWithOrigin(String origin) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cwperks my apologies, I missed that, could you please add javadocs here the same way we did for markAsSystemContext? Thank you.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes absolutely. That's my bad. I should have included that in the PR. Good catch.

reta pushed a commit that referenced this pull request Jul 31, 2024
…nd stashWithOrigin (#15049)

* Add ThreadContextPermission for stashAndMergeHeaders and stashWithOrigin (#15039)

* Add ThreadContextPermission for stashAndMergeHeaders and stashWithOrigin

Signed-off-by: Craig Perkins <[email protected]>

* Add to CHANGELOG

Signed-off-by: Craig Perkins <[email protected]>

* Use ThreadContextAccess

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>

* Add deprecationLogger

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
harshavamsi pushed a commit to harshavamsi/OpenSearch that referenced this pull request Aug 20, 2024
…gin (opensearch-project#15039)

* Add ThreadContextPermission for stashAndMergeHeaders and stashWithOrigin

Signed-off-by: Craig Perkins <[email protected]>

* Add to CHANGELOG

Signed-off-by: Craig Perkins <[email protected]>

* Use ThreadContextAccess

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
wdongyu pushed a commit to wdongyu/OpenSearch that referenced this pull request Aug 22, 2024
…gin (opensearch-project#15039)

* Add ThreadContextPermission for stashAndMergeHeaders and stashWithOrigin

Signed-off-by: Craig Perkins <[email protected]>

* Add to CHANGELOG

Signed-off-by: Craig Perkins <[email protected]>

* Use ThreadContextAccess

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch v2.17.0 v3.0.0 Issues and PRs related to version 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants