-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Separate out validation of groups of settings #34184
Merged
DaveCTurner
merged 44 commits into
elastic:master
from
cbismuth:28309_disk_watermark_validation_rejects_apparently_valid_sequence_of_updates
Jan 7, 2019
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
8852b05
Validate current setting against all target settings (#28309)
cbismuth 5a84c18
Fix misspelled comment (#28309)
cbismuth 71cfe1a
Test sequence of updates (#28309)
cbismuth f77d1e7
Add setting to apply to validation collection (#28309)
cbismuth b0dd2de
Test update of validation dependant settings (#28309)
cbismuth 177f560
Fix comment (#28309)
cbismuth ad0212e
Merge branch 'master' into 28309_disk_watermark_validation_rejects_ap…
cbismuth 94ac1d1
Improve variable naming to ease readability (#28309)
cbismuth 68044ba
Don't update settings when no value has changed (#28309)
cbismuth 395c398
Merge branch 'master' into 28309_disk_watermark_validation_rejects_ap…
cbismuth 8e138d9
Move validation API with other ones (#28309)
cbismuth 6539bd0
Add a test case when settings are below "low" default value (#28309)
cbismuth df341e9
Rework "testSequenceOfUpdates" with "updateSettings" API (#28309)
cbismuth c44b2a3
Filter target settings eagerly to avoid unnecessary validations (#28309)
cbismuth 3e67ca4
Split settings validation with and without dependencies (#28309)
cbismuth 75048ac
Reduce diffs with "master" branch (#28309)
cbismuth 158c482
Improve Java documentation (#28309)
cbismuth c195f74
Extract methods to create unknown and invalid settings in tests (#28309)
cbismuth 3e0f417
Merge branch 'master' into 28309_disk_watermark_validation_rejects_ap…
cbismuth 8d2e144
Fix compilation after rebasing with master (#28309)
cbismuth 88f42ed
Add missing validation step without dependencies validation (#28309)
cbismuth 5ff1d59
Merge branch 'master' into 28309_disk_watermark_validation_rejects_ap…
cbismuth 5bded6e
Improve JavaDoc comment (#28309).
DaveCTurner 9890ab7
Improve JavaDoc comment (#28309)
DaveCTurner f277ae9
Fix typo in test name (#28309)
DaveCTurner e4e7a64
Merge branch 'master' into 28309_disk_watermark_validation_rejects_ap…
cbismuth 2efdf1e
Split invalid in-isolation/with-dependencies test settings (#28309)
cbismuth d6f99cf
Merge remote-tracking branch 'origin/28309_disk_watermark_validation_…
cbismuth 3e58473
Split invalid in-isolation/with-dependencies setting validation (#28309)
cbismuth adf128b
Merge branch 'master' into 28309_disk_watermark_validation_rejects_ap…
cbismuth 43840f1
Fix Checkstyle line length violation (#28309)
cbismuth 1447577
Rework simple string setting with validator API (#28309)
cbismuth 64aeb4c
Merge branch 'master' into 28309_disk_watermark_validation_rejects_ap…
cbismuth bfcd828
Remove unnecessary parentheses around lambdas (#28309)
cbismuth 453a03a
Merge branch 'master' into 28309_disk_watermark_validation_rejects_ap…
cbismuth e83e210
Merge branch 'master' into 28309_disk_watermark_validation_rejects_ap…
cbismuth 7c33bfe
Fix Java documentation of the Validator class (#elasticsearch-28309)
cbismuth 17b3ab2
Merge branch 'master' into 28309_disk_watermark_validation_rejects_ap…
cbismuth adf5afb
Merge branch 'master' into 28309_disk_watermark_validation_rejects_ap…
cbismuth e277b81
Merge branch 'master' into 28309_disk_watermark_validation_rejects_ap…
cbismuth da718f1
Merge branch 'master' into 28309_disk_watermark_validation_rejects_ap…
cbismuth f76692f
Merge branch 'master' into 28309_disk_watermark_validation_rejects_ap…
cbismuth de93e7c
Merge branch 'master' into 28309_disk_watermark_validation_rejects_ap…
DaveCTurner 02a62fb
Minor Javadoc rewording
DaveCTurner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
does it make sense to delegate to
validate(T value)
here?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.
from an interface perspective I think we might be able to only have
validate(T value, Optional<Map<Setting<T>, T>> settings)
and instead check the optional if needed?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 @s1monw.
I'd prefer to keep these two API as most clients will only be interested in validating a setting in isolation (i.e. not against dependencies).
Besides, we do a fail-fast validation here where we don't have resolved setting dependencies yet. Therefore, if we want to keep this fail-fast shortcut, any client will have to implement an
if optional present/absent
block even if he's interested in validating a setting against its dependencies.What do you think about these two points?
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.
I think I prefer the two methods to the optional parameter too. In practice there are very few dependencies between settings, so the one-argument lambda is less noisy in almost all cases. Settings with dependencies can't use a lambda anyway because they have to override the
settings()
function too.I also think there's no need for the dependent validation to delegate to the other one, because we call both during settings validation. However I think this should be mentioned in the Javadocs as implementors shouldn't need to go to the implementation to check this (and I know I'd forget and have to check). Also the interface-level comment needs updating as it's no longer wholly accurate.
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.
Hi @DaveCTurner, here is a additional commit 7c33bfe to improve the
Validator
class documentation, thank you.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.
I don't have strong feelings but if I see two methods I'd only implement one and don't know what I need to do with the other. The optional makes me think about the opportunity to validate against others. I don't know what you mean by
clients
?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.
I meant developers who will implement this interface.
We tried to make javadoc more explicit, but I see what you mean: the API doesn't enforce the developer to ask himself whether or not he would like to implement dependencies validation. But as it's an edge case, I still hope the developer would read the javadoc or jump to the interface definition if he needs to do so.
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.
Another alternative would be to remove the validation shortcut and keep only the
validate(T value, Map<Setting<T>, T> settings)
interface API, I think that would make sense.We would remove this validation shortcut here and keep only this validation call here (and remove this line).
What do you think about it?