mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-25 14:26:27 +00:00
Clarify autoscaling feature flag registration (#54427)
This commit clarifies the autoscaling feature flag registration system property. The intention is that this system property is: - unset in snapshot builds - unset, true, or false in release builds - in release builds, unset behaves the same as false - therefore, we only register the enabled flag if the build is a snapshot build, or the build is a release build and the system property is set to true This commit clarifies that intention, and removed a confusion situation where the AUTOSCALING_FEATURE_FLAG_REGISTERED field would be set to false in a snapshot build, even though we were going to register the setting.
This commit is contained in:
parent
d11e977b1f
commit
5d760051a9
@ -33,7 +33,7 @@ import java.util.function.Supplier;
|
||||
*/
|
||||
public class Autoscaling extends Plugin implements ActionPlugin {
|
||||
|
||||
private static final boolean AUTOSCALING_FEATURE_FLAG_REGISTERED;
|
||||
private static final Boolean AUTOSCALING_FEATURE_FLAG_REGISTERED;
|
||||
|
||||
static {
|
||||
final String property = System.getProperty("es.autoscaling_feature_flag_registered");
|
||||
@ -42,8 +42,10 @@ public class Autoscaling extends Plugin implements ActionPlugin {
|
||||
}
|
||||
if ("true".equals(property)) {
|
||||
AUTOSCALING_FEATURE_FLAG_REGISTERED = true;
|
||||
} else if ("false".equals(property) || property == null) {
|
||||
} else if ("false".equals(property)) {
|
||||
AUTOSCALING_FEATURE_FLAG_REGISTERED = false;
|
||||
} else if (property == null) {
|
||||
AUTOSCALING_FEATURE_FLAG_REGISTERED = null;
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"expected es.autoscaling_feature_flag_registered to be unset or [true|false] but was [" + property + "]"
|
||||
@ -70,7 +72,7 @@ public class Autoscaling extends Plugin implements ActionPlugin {
|
||||
*/
|
||||
@Override
|
||||
public List<Setting<?>> getSettings() {
|
||||
if (isSnapshot() || AUTOSCALING_FEATURE_FLAG_REGISTERED) {
|
||||
if (isSnapshot() || (AUTOSCALING_FEATURE_FLAG_REGISTERED != null && AUTOSCALING_FEATURE_FLAG_REGISTERED)) {
|
||||
return Collections.singletonList(AUTOSCALING_ENABLED_SETTING);
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
|
Loading…
x
Reference in New Issue
Block a user