From 906da638d59e83067689daec28fc7b7d71c54135 Mon Sep 17 00:00:00 2001 From: Gordon Brown Date: Fri, 1 Feb 2019 13:41:16 -0700 Subject: [PATCH] Review feedback --- .../WaitForNoFollowersStep.java | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/WaitForNoFollowersStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/WaitForNoFollowersStep.java index 434706e7e7880..1e3e2f6c1c548 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/WaitForNoFollowersStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/WaitForNoFollowersStep.java @@ -22,6 +22,12 @@ import java.util.Arrays; import java.util.Objects; +/** + * A step that waits until the index it's used on is no longer a leader index. + * This is necessary as there are some actions which are not safe to perform on + * a leader index, such as those which delete the index, including Shrink and + * Delete. + */ public class WaitForNoFollowersStep extends AsyncWaitStep { private static final Logger logger = LogManager.getLogger(WaitForNoFollowersStep.class); @@ -66,11 +72,10 @@ static final class Info implements ToXContentObject { static final ParseField MESSAGE_FIELD = new ParseField("message"); - private final String message; + private static final String message = "this index is a leader index; waiting for all following indices to cease " + + "following before proceeding"; - Info() { - this.message = "this index is a leader index; waiting for all following indices to cease following before proceeding"; - } + Info() { } String getMessage() { return message; @@ -86,10 +91,13 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Info info = (Info) o; - return Objects.equals(getMessage(), info.getMessage()); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return true; } @Override