|
30 | 30 | import org.elasticsearch.common.io.stream.Writeable;
|
31 | 31 | import org.elasticsearch.common.joda.FormatDateTimeFormatter;
|
32 | 32 | import org.elasticsearch.common.joda.Joda;
|
| 33 | +import org.elasticsearch.common.logging.DeprecationLogger; |
| 34 | +import org.elasticsearch.common.logging.Loggers; |
33 | 35 | import org.elasticsearch.common.settings.Setting;
|
34 | 36 | import org.elasticsearch.common.settings.Setting.Property;
|
35 | 37 | import org.elasticsearch.common.settings.Settings;
|
|
47 | 49 | */
|
48 | 50 | public final class UnassignedInfo implements ToXContentFragment, Writeable {
|
49 | 51 |
|
| 52 | + private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(Loggers.getLogger(UnassignedInfo.class)); |
| 53 | + |
50 | 54 | public static final FormatDateTimeFormatter DATE_TIME_FORMATTER = Joda.forPattern("dateOptionalTime");
|
51 | 55 |
|
52 | 56 | public static final Setting<TimeValue> INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING =
|
53 |
| - Setting.timeSetting("index.unassigned.node_left.delayed_timeout", TimeValue.timeValueMinutes(1), Property.Dynamic, |
54 |
| - Property.IndexScope); |
| 57 | + new Setting<>("index.unassigned.node_left.delayed_timeout", (s) -> TimeValue.timeValueMinutes(1).getStringRep(), (s) -> { |
| 58 | + TimeValue parsedValue = TimeValue.parseTimeValue(s, "index.unassigned.node_left.delayed_timeout"); |
| 59 | + if (parsedValue.getNanos() < 0) { |
| 60 | + DEPRECATION_LOGGER.deprecated( |
| 61 | + "Negative values for index.unassigned.node_left.delayed_timeout [{}]" + |
| 62 | + " are deprecated and should now be set to \"0\".", s); |
| 63 | + } |
| 64 | + return parsedValue; |
| 65 | + }, Property.Dynamic, Property.IndexScope); |
| 66 | + |
55 | 67 | /**
|
56 | 68 | * Reason why the shard is in unassigned state.
|
57 | 69 | * <p>
|
|
0 commit comments