-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Add setting to bypass Rollover action #36235
Changes from 11 commits
1944320
6b43803
e3bf1b2
a48a0e6
9feaf3b
d48ec84
68e1504
3726cbb
3c69a7f
df19da5
8b399c1
38c6cdf
d00961f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
import org.elasticsearch.common.io.stream.StreamInput; | ||
import org.elasticsearch.common.io.stream.StreamOutput; | ||
import org.elasticsearch.common.settings.Setting; | ||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.common.unit.ByteSizeValue; | ||
import org.elasticsearch.common.unit.TimeValue; | ||
import org.elasticsearch.common.xcontent.ConstructingObjectParser; | ||
|
@@ -29,6 +30,7 @@ | |
*/ | ||
public class RolloverAction implements LifecycleAction { | ||
public static final String NAME = "rollover"; | ||
public static final String INDEXING_COMPLETE_STEP_NAME = "set-indexing-complete"; | ||
public static final ParseField MAX_SIZE_FIELD = new ParseField("max_size"); | ||
public static final ParseField MAX_DOCS_FIELD = new ParseField("max_docs"); | ||
public static final ParseField MAX_AGE_FIELD = new ParseField("max_age"); | ||
|
@@ -132,23 +134,30 @@ public boolean isSafeAction() { | |
|
||
@Override | ||
public List<Step> toSteps(Client client, String phase, Step.StepKey nextStepKey) { | ||
Settings indexingComplete = Settings.builder().put(LifecycleSettings.LIFECYCLE_INDEXING_COMPLETE, true).build(); | ||
|
||
StepKey waitForRolloverReadyStepKey = new StepKey(phase, NAME, WaitForRolloverReadyStep.NAME); | ||
StepKey rolloverStepKey = new StepKey(phase, NAME, RolloverStep.NAME); | ||
StepKey updateDateStepKey = new StepKey(phase, NAME, UpdateRolloverLifecycleDateStep.NAME); | ||
StepKey setIndexingCompleteStepKey = new StepKey(phase, NAME, INDEXING_COMPLETE_STEP_NAME); | ||
|
||
WaitForRolloverReadyStep waitForRolloverReadyStep = new WaitForRolloverReadyStep(waitForRolloverReadyStepKey, rolloverStepKey, | ||
client, maxSize, maxAge, maxDocs); | ||
RolloverStep rolloverStep = new RolloverStep(rolloverStepKey, updateDateStepKey, client); | ||
UpdateRolloverLifecycleDateStep updateDateStep = new UpdateRolloverLifecycleDateStep(updateDateStepKey, nextStepKey); | ||
return Arrays.asList(waitForRolloverReadyStep, rolloverStep, updateDateStep); | ||
UpdateRolloverLifecycleDateStep updateDateStep = new UpdateRolloverLifecycleDateStep(updateDateStepKey, setIndexingCompleteStepKey, | ||
System::currentTimeMillis); | ||
UpdateSettingsStep setIndexingCompleteStep = new UpdateSettingsStep(setIndexingCompleteStepKey, nextStepKey, | ||
client, indexingComplete); | ||
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. Does this actually need to be a different step to the lifecycle date step? I think we could do both things in one step? 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. I put it in a different step originally because I felt it was better to keep separate actions in separate steps. I've rolled it into Also, I've added some documentation. I'm not sure it's in the best place though. 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. After discussing this synchronously, I'm going to revert the change and keep this in a separate step, as it's good to go through the Settings infrastructure if we can, rather than bypassing it in a ClusterStateActionStep. |
||
return Arrays.asList(waitForRolloverReadyStep, rolloverStep, updateDateStep, setIndexingCompleteStep); | ||
} | ||
|
||
@Override | ||
public List<StepKey> toStepKeys(String phase) { | ||
StepKey rolloverReadyStepKey = new StepKey(phase, NAME, WaitForRolloverReadyStep.NAME); | ||
StepKey rolloverStepKey = new StepKey(phase, NAME, RolloverStep.NAME); | ||
StepKey updateDateStepKey = new StepKey(phase, NAME, UpdateRolloverLifecycleDateStep.NAME); | ||
return Arrays.asList(rolloverReadyStepKey, rolloverStepKey, updateDateStepKey); | ||
StepKey setIndexingCompleteStepKey = new StepKey(phase, NAME, INDEXING_COMPLETE_STEP_NAME); | ||
return Arrays.asList(rolloverReadyStepKey, rolloverStepKey, updateDateStepKey, setIndexingCompleteStepKey); | ||
} | ||
|
||
@Override | ||
|
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.
typo?