-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Normalized prefix for rollover API #57271
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2e33171
Normalized prefix for rollover API
Gaurav614 96f381c
Merge branch 'master' into fix_rollover_bug
Gaurav614 3a7ecb8
Added new Test case and renamed methods
Gaurav614 1f68cb6
Fixed checkstyle errors
Gaurav614 ba69fe1
Merge branch 'master' into fix_rollover_bug
Gaurav614 891e0c6
Merge branch 'master' into fix_rollover_bug
elasticmachine 39e2c85
Fix checkstyle in MetadataRolloverServiceTests
dakrone 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 |
---|---|---|
|
@@ -277,10 +277,7 @@ public void createIndex(final CreateIndexClusterStateUpdateRequest request, | |
|
||
private void onlyCreateIndex(final CreateIndexClusterStateUpdateRequest request, | ||
final ActionListener<ClusterStateUpdateResponse> listener) { | ||
Settings.Builder updatedSettingsBuilder = Settings.builder(); | ||
Settings build = updatedSettingsBuilder.put(request.settings()).normalizePrefix(IndexMetadata.INDEX_SETTING_PREFIX).build(); | ||
indexScopedSettings.validate(build, true); // we do validate here - index setting must be consistent | ||
request.settings(build); | ||
applyCreateIndexRequestInternal(request); | ||
clusterService.submitStateUpdateTask( | ||
"create-index [" + request.index() + "], cause [" + request.cause() + "]", | ||
new AckedClusterStateUpdateTask<>(Priority.URGENT, request, listener) { | ||
|
@@ -306,12 +303,20 @@ public void onFailure(String source, Exception e) { | |
}); | ||
} | ||
|
||
private void applyCreateIndexRequestInternal(CreateIndexClusterStateUpdateRequest createIndexClusterStateRequest){ | ||
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. Calling this "apply" I think is a little misleading, I think 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. Ack. |
||
Settings.Builder updatedSettingsBuilder = Settings.builder(); | ||
Settings build = updatedSettingsBuilder.put(createIndexClusterStateRequest.settings()).normalizePrefix(IndexMetadata.INDEX_SETTING_PREFIX).build(); | ||
indexScopedSettings.validate(build,true); | ||
createIndexClusterStateRequest.settings(build); | ||
} | ||
/** | ||
* Handles the cluster state transition to a version that reflects the {@link CreateIndexClusterStateUpdateRequest}. | ||
* All the requested changes are firstly validated before mutating the {@link ClusterState}. | ||
*/ | ||
public ClusterState applyCreateIndexRequest(ClusterState currentState, CreateIndexClusterStateUpdateRequest request, boolean silent, | ||
BiConsumer<Metadata.Builder, IndexMetadata> metadataTransformer) throws Exception { | ||
|
||
applyCreateIndexRequestInternal(request); | ||
logger.trace("executing IndexCreationTask for [{}] against cluster state version [{}]", request, currentState.version()); | ||
|
||
validate(request, currentState); | ||
|
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
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.
I think I'd prefer a dedicated test for this, just so that it doesn't get accidentally removed and the behavior reverted in the future, could you add a test for this? (it can basically be a copy of this test with a descriptive name)
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.
Good suggestion, made a separate test case for it !