-
Notifications
You must be signed in to change notification settings - Fork 36
Fix for upgrading mapping #309
Fix for upgrading mapping #309
Conversation
This PR fixes two bugs of upgrading mapping: First, previously we only tried once when upgrading mapping. It is possible we need to try a few more times. The drawback is that if the code has a bug, we retry endlessly. I should fix it in the future. Second, we enclose the upgrade mapping function call under a user context in a recent commit. Upgrade mapping will fail when security plugin is enabled since a regular user cannot upgrade mappings of system indices. The PR also adds upper bounds to our dynamic settings if reasonable. Testing done: 1. Tested that upgrade mapping succeeds with new changes. 2. Tested the upper bounds of the changed settings are in effect.
Codecov Report
@@ Coverage Diff @@
## master #309 +/- ##
============================================
+ Coverage 72.06% 72.14% +0.07%
- Complexity 1969 1988 +19
============================================
Files 199 201 +2
Lines 9465 9553 +88
Branches 844 847 +3
============================================
+ Hits 6821 6892 +71
- Misses 2233 2248 +15
- Partials 411 413 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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 change, didnt realize the update mapping would fail.
ActionListener.wrap(r -> updateRunning.set(false), exception -> logger.error("Fail to updatea all mappings")), | ||
ActionListener.wrap(r -> updateRunning.set(false), exception -> { | ||
// TODO: don't retry endlessly. Can be annoying if there are too many exception logs. | ||
updateRunning.set(false); |
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.
If remove this line, will not update index mapping if any exception happens?
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.
if removing this line, we will only try to update mapping once per node.
ActionListener.wrap(r -> updateRunning.set(false), exception -> { | ||
// TODO: don't retry endlessly. Can be annoying if there are too many exception logs. | ||
updateRunning.set(false); | ||
logger.error("Fail to updatea all mappings"); |
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.
Add ad to the error message.
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.
added
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.
LGTM. Thanks for the change!
Issue #, if available:
Description of changes:
This PR fixes two bugs of upgrading mapping:
First, previously we only tried once when upgrading mapping. It is possible we need to try a few more times. The drawback is that if the code has a bug, we retry endlessly. I should fix it in the future.
Second, we enclose the upgrade mapping function call under a user context in a recent commit. Upgrade mapping will fail when security plugin is enabled since a regular user cannot upgrade mappings of system indices.
The PR also adds upper bounds to our dynamic settings if reasonable.
Testing done:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.