-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Ensure consistency of system flag on IndexMetadata after diff is applied #16644
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Craig Perkins <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick fix. Ship it!
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #16644 +/- ##
============================================
- Coverage 72.51% 72.04% -0.48%
+ Complexity 65562 65169 -393
============================================
Files 5318 5318
Lines 303945 303945
Branches 43976 43976
============================================
- Hits 220413 218966 -1447
- Misses 65798 67002 +1204
- Partials 17734 17977 +243 ☔ View full report in Codecov by Sentry. |
@cwperks this change needs a changelog entry |
Signed-off-by: Craig Perkins <[email protected]>
Added |
Resolved conflicts in CHANGELOG |
Resolved conflicts on CHANGELOG again. Can a maintainer help to merge this PR? |
@@ -88,6 +92,36 @@ protected NamedXContentRegistry xContentRegistry() { | |||
return new NamedXContentRegistry(IndicesModule.getNamedXContents()); | |||
} | |||
|
|||
// Create the index metadata for a given index, with the specified version. | |||
private static IndexMetadata createIndexMetadata(final Index index, final long version) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick on code refactoring:
private static IndexMetadata createIndexMetadata(final Index index, final long version) {
return createIndexMetadata(index, version, false (or the default value));
}
unless setting to default vs not setting the .system()
achieves a different functionality?
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 #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.