This repository was archived by the owner on Apr 15, 2025. It is now read-only.
Allow null settings in ES when using SetClusterSetting#74
Merged
nickcanz merged 4 commits intogithub:masterfrom Jan 16, 2020
Merged
Allow null settings in ES when using SetClusterSetting#74nickcanz merged 4 commits intogithub:masterfrom
nickcanz merged 4 commits intogithub:masterfrom
Conversation
This function now takes *string where a nil value is treated as a JSON null value. It allows you to pass the nil *string that is returned as "existingValue" back in as the "newValue" to reset it at the end of an operation. This allows you to "remove" settings by setting them to JSON null. This is the recommended way to remove an explicit configuration to fall back to defaults in Elasticsearch.
This implements the new "null"ing function in the CLI to allow the user to reset a configuration back to its defaults by using the "--remove" flag. Also adds logic to manage the "--remove" and "--value|-v" flags. Adds a helper function to print nil *strings in a nicer manner.
go mod why: github.com/github/vulcanizer/pkg/cli github.com/spf13/cobra github.com/spf13/pflag
Add a check at the beginning of integration check to make sure vm.max_map_count is set correctly as it will cause silent Elasticsearch Docker failures otherwise
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Sorry I've been sitting on this one for a while, got busy.
This adds the ability to "null" settings when using
SetClusterSetting().fixes #68
The function signature is now
and if you pass a nil
*stringas the newvalueit will reset thatsettingin Elasticsearch to its default value.It also returns a
*stringas theexistingValueandnewValue. This allows you to save the original state of a potential null/unset setting and use it in a second call toSetClusterSetting()to reset the original state after the operation has finished.In this example the
indices.recovery.max_bytes_per_secis probably unset (default) and should be reset to itsnullstate when the shard migration is complete.Other random stuff:
buildTestServer, I had an extra space in the body and it took me way too long to figure it out.stringToPointer(v string) *stringhelper function.go.modentry forgithub.com/spf13/pflag, not sure how this one wasn't already there as it's required bygithub.com/spf13/cobra.Passes unit tests and integration tests.