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

Make ActionRequests that extend UpdateRequest to extend more generic ActionRequest #1311

Merged
merged 22 commits into from
Dec 13, 2024

Conversation

cwperks
Copy link
Member

@cwperks cwperks commented Nov 26, 2024

Description

WIP to fix errors seen in CI with security checks.

See more details on opensearch-project/security#4937

Related Issues

Resolves #1281

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

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.

@cwperks
Copy link
Member Author

cwperks commented Nov 26, 2024

Adding changes from #1310

Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
This reverts commit 7c82470.

Signed-off-by: Craig Perkins <[email protected]>
@@ -268,17 +268,27 @@ constructor(
updateSettingReqsList.add(
UpdateSettingsRequest().indices(*readOnlyIndices.map { indices[it] }.toTypedArray())
.settings(
Settings.builder().put(ManagedIndexSettings.AUTO_MANAGE.key, false)
.put(INDEX_READ_ONLY_SETTING.key, true),
Settings.builder().put(INDEX_READ_ONLY_SETTING.key, false),
Copy link
Member Author

Choose a reason for hiding this comment

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

The changes in this file are needed to adapt to a bugfix in core: https://github.com/opensearch-project/OpenSearch/pull/16568/files#diff-4294469155ee17976f9046a05d7fb983ddce7d8398f780b7e60c17065e521f4f

Core allows the readonly settings to change in an update request if and only if its the only setting being changed.

There used to be a bug in core that allowed changes of multiple settings because the conditional did not group the settings together in the same group (i.e. condition1 && condition2 || condition3 || condition4 instead of condition1 && (condition2 || condition3 || condition4))

if (request.settings().size() == 1 &&  // we have to allow resetting these settings otherwise users can't unblock an index
  IndexMetadata.INDEX_BLOCKS_METADATA_SETTING.exists(request.settings())
  || IndexMetadata.INDEX_READ_ONLY_SETTING.exists(request.settings())
  || IndexMetadata.INDEX_BLOCKS_READ_ONLY_ALLOW_DELETE_SETTING.exists(request.settings())) { ... }

To adapt to the change, this is now setting readonly to false initially and then doing a follow-up request to set it back to true and auto-manage to false.

@cwperks
Copy link
Member Author

cwperks commented Dec 12, 2024

@vikasvb90 @bowenlan-amzn @tandonks All checks are passing now that the 2.x build was fixed in #1315

@bowenlan-amzn bowenlan-amzn merged commit 6617cf0 into opensearch-project:main Dec 13, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix CI failure when upgrade to jdk 21
3 participants