-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Allow setting of copy_settings
in the HLRC
#39752
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
Conversation
elastic#30255 introduced the `copy_settings` parameter in 6.x. This commit adds support for setting it via `setCopySettings` in the HLRC.
AFAIU (e.g. in Lines 60 to 72 in 73d474e
Will be happy to add PRs if this is incorrect though. |
Pinging @elastic/es-core-features |
@elasticmachine run elasticsearch-ci/default-distro |
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.
The production code looks good. I left a comment about the deprecation Javadoc, and I agree with @hub-cap to update the documentation that he referenced too.
@@ -909,6 +909,17 @@ Params withWaitForActiveShards(ActiveShardCount activeShardCount) { | |||
return withWaitForActiveShards(activeShardCount, ActiveShardCount.DEFAULT); | |||
} | |||
|
|||
/** | |||
* @deprecated <code>copy_settings</code> defaults to <code>true</code> and can not be set to 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.
Note that the default is unset and behaves as false
, however false
can not be set explicitly. copy_settings
is either unset (default) or set to true
(future behavior).
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.
@@ -868,6 +868,12 @@ private void resizeTest(ResizeType resizeType, CheckedFunction<ResizeRequest, Re | |||
ResizeRequest resizeRequest = new ResizeRequest(indices[0], indices[1]); | |||
resizeRequest.setResizeType(resizeType); | |||
Map<String, String> expectedParams = new HashMap<>(); | |||
|
|||
if (ESTestCase.randomBoolean()) { |
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 see this is in the existing style in this class, but it is at odds with the rest of the codebase where we would simply write randomBoolean()
.
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.
Addressed in ce68119; in a separate PR we can convert everything in this class to randomBoolean()
for consistency.
and use of ESTestCase.randomBoolean()
Docs have been added in 5f05978 |
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.
Looking good now, I left some minor feedback.
@@ -1683,9 +1683,13 @@ public void testShrinkIndex() throws Exception { | |||
request.setWaitForActiveShards(2); // <1> | |||
request.setWaitForActiveShards(ActiveShardCount.DEFAULT); // <2> | |||
// end::shrink-index-request-waitForActiveShards | |||
// tag::shrink-index-request-copySettings | |||
request.setCopySettings(Boolean.TRUE); // <1> |
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.
true
is more natural
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.
Addressed in de8ca18
-------------------------------------------------- | ||
include-tagged::{doc-tests-file}[{api}-request-copySettings] | ||
-------------------------------------------------- | ||
<1> Use `Boolean.TRUE` to copy the settings from the source index to the target |
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.
Use true
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.
Addressed in de8ca18
include-tagged::{doc-tests-file}[{api}-request-copySettings] | ||
-------------------------------------------------- | ||
<1> Use `Boolean.TRUE` to copy the settings from the source index to the target | ||
index. This cannot be `Boolean.FALSE`. If this method is not used, default behavior is not to copy. |
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.
Maybe 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.
Addressed in de8ca18
@@ -868,6 +868,12 @@ private void resizeTest(ResizeType resizeType, CheckedFunction<ResizeRequest, Re | |||
ResizeRequest resizeRequest = new ResizeRequest(indices[0], indices[1]); | |||
resizeRequest.setResizeType(resizeType); | |||
Map<String, String> expectedParams = new HashMap<>(); | |||
|
|||
if (randomBoolean()) { | |||
resizeRequest.setCopySettings(Boolean.TRUE); |
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.
resizeRequest.setCopySettings(Boolean.TRUE); | |
resizeRequest.setCopySettings(true); |
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.
Fixed in b20c245
include-tagged::{doc-tests-file}[{api}-request-copySettings] | ||
-------------------------------------------------- | ||
<1> Use `true` to copy the settings from the source index to the target | ||
index. This cannot be `false`. If this method is not used, default behavior is not to copy. |
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.
Can you wrap to 80 columns?
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.
Fixed in b20c245
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 left two more minors, no need for another review round. LGTM. Fire at will.
Thanks a lot for the review effort here. Will merge after CI is green. |
#30255 introduced the
copy_settings
parameter in 6.x.This commit adds support for setting it via
setCopySettings
in theHLRC.