-
Notifications
You must be signed in to change notification settings - Fork 25.6k
ILM: Add support for the searchable_snapshot action in the hot phase #64883
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
Merged
andreidan
merged 18 commits into
elastic:master
from
andreidan:searchable-snapshot-hot-phase
Nov 12, 2020
Merged
Changes from 13 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
7b68166
Enable the searchable_snapshot action in the hot phase
andreidan 0e92f00
Add IT for restoring index mounted as searchable snapshot
andreidan b278e05
Add logging
andreidan 97ec99f
Fix test
andreidan 2bd01c5
Update error message
andreidan b663f72
Make ensure `searchable_snapshot` action cannot follow itself and cle…
andreidan 82c9e66
Fix tests
andreidan b7936ee
Merge branch 'master' into searchable-snapshot-hot-phase
elasticmachine 3feb501
Fix ForceMergeActionTests
andreidan 5e2366d
Fix ForceMergeActionTest
andreidan 471d329
Fix random lifecycle generation
andreidan 0c3b35e
Fix phases validation when generating test policies
andreidan b914cfe
Merge branch 'master' into searchable-snapshot-hot-phase
elasticmachine 1128f07
Update doc
andreidan a1326c3
Duplicate sets as we remove actions to generate valid policies
andreidan 54180d6
Static loggers
andreidan a5e4354
Docs: Mention rollover is needed in order to use action in the hot phase
andreidan 56af507
Document setting name
andreidan 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 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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,14 +29,14 @@ | |
| * A {@link LifecycleAction} which shrinks the index. | ||
| */ | ||
| public class ShrinkAction implements LifecycleAction { | ||
| private final Logger logger = LogManager.getLogger(ShrinkAction.class); | ||
|
||
|
|
||
| public static final String NAME = "shrink"; | ||
| public static final String SHRUNKEN_INDEX_PREFIX = "shrink-"; | ||
| public static final ParseField NUMBER_OF_SHARDS_FIELD = new ParseField("number_of_shards"); | ||
| public static final String CONDITIONAL_SKIP_SHRINK_STEP = BranchingStep.NAME + "-check-prerequisites"; | ||
| public static final String CONDITIONAL_DATASTREAM_CHECK_KEY = BranchingStep.NAME + "-on-datastream-check"; | ||
|
|
||
| private static final Logger logger = LogManager.getLogger(ShrinkAction.class); | ||
|
|
||
| private static final ConstructingObjectParser<ShrinkAction, Void> PARSER = | ||
| new ConstructingObjectParser<>(NAME, a -> new ShrinkAction((Integer) a[0])); | ||
|
|
||
|
|
@@ -108,7 +108,19 @@ public List<Step> toSteps(Client client, String phase, Step.StepKey nextStepKey) | |
| StepKey deleteIndexKey = new StepKey(phase, NAME, DeleteStep.NAME); | ||
|
|
||
| BranchingStep conditionalSkipShrinkStep = new BranchingStep(preShrinkBranchingKey, checkNotWriteIndex, nextStepKey, | ||
| (index, clusterState) -> clusterState.getMetadata().index(index).getNumberOfShards() == numberOfShards); | ||
| (index, clusterState) -> { | ||
| IndexMetadata indexMetadata = clusterState.getMetadata().index(index); | ||
| if (indexMetadata.getNumberOfShards() == numberOfShards) { | ||
| return true; | ||
| } | ||
| if (indexMetadata.getSettings().get(LifecycleSettings.SNAPSHOT_INDEX_NAME) != null) { | ||
| logger.warn("[{}] action is configured for index [{}] in policy [{}] which is mounted as searchable snapshot. " + | ||
| "Skipping this action", ShrinkAction.NAME, indexMetadata.getIndex().getName(), | ||
| LifecycleSettings.LIFECYCLE_NAME_SETTING.get(indexMetadata.getSettings())); | ||
| return true; | ||
| } | ||
| return false; | ||
| }); | ||
| CheckNotDataStreamWriteIndexStep checkNotWriteIndexStep = new CheckNotDataStreamWriteIndexStep(checkNotWriteIndex, | ||
| waitForNoFollowerStepKey); | ||
| WaitForNoFollowersStep waitForNoFollowersStep = new WaitForNoFollowersStep(waitForNoFollowerStepKey, readOnlyKey, client); | ||
|
|
||
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
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.
Super minor, but can you add a comment about what this is for (since it's not actually an ILM setting, just one we check)