-
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
Deprecate not copy settings and explicitly disallow #30404
Merged
jasontedor
merged 10 commits into
elastic:master
from
jasontedor:no-copy-settings-for-you
May 13, 2018
Merged
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e87c9d8
Deprecate not copy settings and explicitly disallow
jasontedor add8989
Adjust docs
jasontedor 56ceb89
Fix docs test
jasontedor d2288e4
Merge remote-tracking branch 'origin/master' into no-copy-settings-fo…
jasontedor d756e66
Merge branch 'master' into no-copy-settings-for-you
jasontedor 6c0a153
Newlines
jasontedor 2c20228
Move validation
jasontedor 030a3e9
Merge remote-tracking branch 'elastic/master' into no-copy-settings-f…
jasontedor 790b0fd
Merge branch 'master' into no-copy-settings-for-you
jasontedor 6aabd70
Fix merge from master
jasontedor 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,7 +123,7 @@ the following request: | |
|
||
[source,js] | ||
-------------------------------------------------- | ||
POST my_source_index/_split/my_target_index | ||
POST my_source_index/_split/my_target_index?copy_settings=true | ||
{ | ||
"settings": { | ||
"index.number_of_shards": 2 | ||
|
@@ -158,7 +158,7 @@ and accepts `settings` and `aliases` parameters for the target index: | |
|
||
[source,js] | ||
-------------------------------------------------- | ||
POST my_source_index/_split/my_target_index | ||
POST my_source_index/_split/my_target_index?copy_settings=true | ||
{ | ||
"settings": { | ||
"index.number_of_shards": 5 <1> | ||
|
@@ -181,9 +181,11 @@ NOTE: By default, with the exception of `index.analysis`, `index.similarity`, | |
and `index.sort` settings, index settings on the source index are not copied | ||
during a split operation. With the exception of non-copyable settings, settings | ||
from the source index can be copied to the target index by adding the URL | ||
parameter `copy_settings=true` to the request. | ||
parameter `copy_settings=true` to the request. Note that `copy_settings` can not | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above ^ |
||
be set to `false`. The parameter `copy_settings` will be removed in 9.0.0 | ||
|
||
deprecated[6.4.0, `copy_settings` will default to `true` in 8.x and will be removed in 9.0.0] | ||
deprecated[6.4.0, not copying settings is deprecated, copying settings will be | ||
the default behavior in 8.x] | ||
|
||
[float] | ||
=== Monitoring the split process | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,7 @@ public class ResizeRequest extends AcknowledgedRequest<ResizeRequest> implements | |
private CreateIndexRequest targetIndexRequest; | ||
private String sourceIndex; | ||
private ResizeType type = ResizeType.SHRINK; | ||
private boolean copySettings = false; | ||
private Boolean copySettings; | ||
|
||
ResizeRequest() {} | ||
|
||
|
@@ -80,6 +80,9 @@ public ActionRequestValidationException validate() { | |
if (type == ResizeType.SPLIT && IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.exists(targetIndexRequest.settings()) == false) { | ||
validationException = addValidationError("index.number_of_shards is required for split operations", validationException); | ||
} | ||
if (copySettings != null && copySettings == false) { | ||
validationException = addValidationError("[copySettings] can not be explicitly set to [false]", validationException); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we instead do this validation on the setter method? That way:
|
||
return validationException; | ||
} | ||
|
||
|
@@ -98,10 +101,12 @@ public void readFrom(StreamInput in) throws IOException { | |
} else { | ||
type = ResizeType.SHRINK; // BWC this used to be shrink only | ||
} | ||
if (in.getVersion().onOrAfter(Version.V_6_4_0)) { | ||
if (in.getVersion().before(Version.V_6_4_0)) { | ||
copySettings = null; | ||
} else if (in.getVersion().onOrAfter(Version.V_6_4_0) && in.getVersion().before(Version.V_7_0_0_alpha1)){ | ||
copySettings = in.readBoolean(); | ||
} else { | ||
copySettings = false; | ||
copySettings = in.readOptionalBoolean(); | ||
} | ||
} | ||
|
||
|
@@ -113,8 +118,12 @@ public void writeTo(StreamOutput out) throws IOException { | |
if (out.getVersion().onOrAfter(ResizeAction.COMPATIBILITY_VERSION)) { | ||
out.writeEnum(type); | ||
} | ||
if (out.getVersion().onOrAfter(Version.V_6_4_0)) { | ||
out.writeBoolean(copySettings); | ||
if (out.getVersion().before(Version.V_6_4_0)) { | ||
|
||
} else if (out.getVersion().onOrAfter(Version.V_6_4_0) && out.getVersion().before(Version.V_7_0_0_alpha1)) { | ||
out.writeBoolean(copySettings == null ? false : copySettings); | ||
} else { | ||
out.writeOptionalBoolean(copySettings); | ||
} | ||
} | ||
|
||
|
@@ -187,11 +196,11 @@ public ResizeType getResizeType() { | |
return type; | ||
} | ||
|
||
public void setCopySettings(final boolean copySettings) { | ||
public void setCopySettings(final Boolean copySettings) { | ||
this.copySettings = copySettings; | ||
} | ||
|
||
public boolean getCopySettings() { | ||
public Boolean getCopySettings() { | ||
return copySettings; | ||
} | ||
|
||
|
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.
should this be
cannot
? I feel like the meaning of this as written statesthat it can be set to something other than
false
, while writingcannot
makes it clear thatfalse
is not allowed.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'm confused @talevy? I thought that "can not" and "cannot" can be used interchangeably?
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 guess it is up to the reader. I just find it ambiguous since it takes on a different meaning when it proceeds expressions that have "not" in them.
If you see both interchangeable in that example, then I am probably wrong
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 agree with @jasontedor that
cannot
andcan not
can be used interchangably