opensearch-project / OpenSearch

🔎 Open source distributed and RESTful search engine.
https://opensearch.org/docs/latest/opensearch/index/
Apache License 2.0
9.84k stars 1.83k forks source link

Ensure consistency of system flag on IndexMetadata after diff is applied #16644

Open cwperks opened 1 week ago

cwperks commented 1 week ago

Description

This PR ensures the consistency of the isSystem flag between leader and follower after the IndexMetadataDiff is applied when computing new cluster state.

This inconsistency can appear during rolling upgrades if nodes of a new version know of an index as a system index, but nodes of a previous version treat the same index as a regular index. For example, if a plugin retroactively declares an index to be a system index through SystemIndexPlugin.getSystemIndexDescriptors (Example PR) there can be a discrepancy in the IndexMetadata (for the same version) between the cluster manager node and other nodes in the cluster.

The reason this happens is because when the IndexMetadataDiff is applied, its taking the value from the previous metadata on the node instead of the new metadata that it has received from the incoming publishRequest. As a result, the diff here is being computed incorrectly. It should take the value from the diff instead of from the previous index metadata.

Related Issues

Resolves https://github.com/opensearch-project/OpenSearch/issues/16643

Check List

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.

github-actions[bot] commented 1 week ago

:white_check_mark: Gradle check result for b526a45b5155135184990d711c92d31d9befe736: SUCCESS

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 72.19%. Comparing base (05513df) to head (76bde0e).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #16644 +/- ## ============================================ + Coverage 72.11% 72.19% +0.07% - Complexity 65230 65299 +69 ============================================ Files 5318 5318 Lines 303915 303915 Branches 43975 43975 ============================================ + Hits 219180 219421 +241 + Misses 66813 66544 -269 - Partials 17922 17950 +28 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features:

owaiskazi19 commented 1 week ago

@cwperks this change needs a changelog entry

cwperks commented 1 week ago

@cwperks this change needs a changelog entry

Added

github-actions[bot] commented 1 week ago

:white_check_mark: Gradle check result for 7ff0651dd39b8539b34d55001e7658556f8647ab: SUCCESS

cwperks commented 2 days ago

Resolved conflicts in CHANGELOG

github-actions[bot] commented 2 days ago

:white_check_mark: Gradle check result for 76bde0ec9c862402c730528c5cd3982c114b4e1f: SUCCESS