parse longs not doubles, for the 'units missing' upgrade
This commit is contained in:
parent
6c07c11ef5
commit
51eae3ec3d
|
@ -1324,11 +1324,11 @@ public class MetaData implements Iterable<IndexMetaData>, Diffable<MetaData> {
|
||||||
String settingValue = ent.getValue();
|
String settingValue = ent.getValue();
|
||||||
if (CLUSTER_BYTES_SIZE_SETTINGS.contains(settingName)) {
|
if (CLUSTER_BYTES_SIZE_SETTINGS.contains(settingName)) {
|
||||||
try {
|
try {
|
||||||
Double.parseDouble(settingValue);
|
Long.parseLong(settingValue);
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// It's a naked number; add default unit (b for bytes):
|
// It's a naked number that previously would be interpreted as default unit (bytes); now we add it:
|
||||||
logger.warn("byte-sized cluster setting [{}] with value [{}] is missing units; now adding default units (b)", settingName, settingValue);
|
logger.warn("byte-sized cluster setting [{}] with value [{}] is missing units; now adding default units (b)", settingName, settingValue);
|
||||||
if (newPersistentSettings == null) {
|
if (newPersistentSettings == null) {
|
||||||
newPersistentSettings = Settings.builder();
|
newPersistentSettings = Settings.builder();
|
||||||
|
@ -1338,11 +1338,11 @@ public class MetaData implements Iterable<IndexMetaData>, Diffable<MetaData> {
|
||||||
}
|
}
|
||||||
if (CLUSTER_TIME_SETTINGS.contains(settingName)) {
|
if (CLUSTER_TIME_SETTINGS.contains(settingName)) {
|
||||||
try {
|
try {
|
||||||
Double.parseDouble(settingValue);
|
Long.parseLong(settingValue);
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// It's a naked number; add default unit (b for bytes):
|
// It's a naked number that previously would be interpreted as default unit (ms); now we add it:
|
||||||
logger.warn("time cluster setting [{}] with value [{}] is missing units; now adding default units (ms)", settingName, settingValue);
|
logger.warn("time cluster setting [{}] with value [{}] is missing units; now adding default units (ms)", settingName, settingValue);
|
||||||
if (newPersistentSettings == null) {
|
if (newPersistentSettings == null) {
|
||||||
newPersistentSettings = Settings.builder();
|
newPersistentSettings = Settings.builder();
|
||||||
|
|
|
@ -186,11 +186,11 @@ public class MetaDataIndexUpgradeService extends AbstractComponent {
|
||||||
String value = settings.get(byteSizeSetting);
|
String value = settings.get(byteSizeSetting);
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
try {
|
try {
|
||||||
Double.parseDouble(value);
|
Long.parseLong(value);
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// It's a naked number; add default unit (b for bytes):
|
// It's a naked number that previously would be interpreted as default unit (bytes); now we add it:
|
||||||
logger.warn("byte-sized index setting [{}] with value [{}] is missing units; now adding default units (b)", byteSizeSetting, value);
|
logger.warn("byte-sized index setting [{}] with value [{}] is missing units; now adding default units (b)", byteSizeSetting, value);
|
||||||
if (newSettings == null) {
|
if (newSettings == null) {
|
||||||
newSettings = Settings.builder();
|
newSettings = Settings.builder();
|
||||||
|
@ -203,11 +203,11 @@ public class MetaDataIndexUpgradeService extends AbstractComponent {
|
||||||
String value = settings.get(timeSetting);
|
String value = settings.get(timeSetting);
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
try {
|
try {
|
||||||
Double.parseDouble(value);
|
Long.parseLong(value);
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// It's a naked number; add default unit (ms for msec):
|
// It's a naked number that previously would be interpreted as default unit (ms); now we add it:
|
||||||
logger.warn("time index setting [{}] with value [{}] is missing units; now adding default units (ms)", timeSetting, value);
|
logger.warn("time index setting [{}] with value [{}] is missing units; now adding default units (ms)", timeSetting, value);
|
||||||
if (newSettings == null) {
|
if (newSettings == null) {
|
||||||
newSettings = Settings.builder();
|
newSettings = Settings.builder();
|
||||||
|
|
Loading…
Reference in New Issue