Use Version.compareTo when calculating minimum version (elastic/elasticsearch#4505)
Results from elasticsearch change elastic/elasticsearch#22378 (6ad5486
)
Original commit: elastic/x-pack-elasticsearch@73c09657bb
This commit is contained in:
parent
ca3bbc7da0
commit
c64ad22579
|
@ -41,7 +41,6 @@ import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
@ -241,15 +240,7 @@ public class SecurityTemplateService extends AbstractComponent implements Cluste
|
||||||
|
|
||||||
public static Version oldestSecurityIndexMappingVersion(ClusterState clusterState, Logger logger) {
|
public static Version oldestSecurityIndexMappingVersion(ClusterState clusterState, Logger logger) {
|
||||||
final Set<Version> versions = securityIndexMappingVersions(clusterState, logger);
|
final Set<Version> versions = securityIndexMappingVersions(clusterState, logger);
|
||||||
return versions.stream().min((o1, o2) -> {
|
return versions.stream().min(Version::compareTo).orElse(null);
|
||||||
if(o1.before(o2)) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if(o1.after(o2)) {
|
|
||||||
return +1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}).orElse(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Set<Version> securityIndexMappingVersions(ClusterState clusterState, Logger logger) {
|
private static Set<Version> securityIndexMappingVersions(ClusterState clusterState, Logger logger) {
|
||||||
|
|
Loading…
Reference in New Issue