Skip to content

Commit 153763a

Browse files
ordering is mysterious
1 parent 7e9a5cd commit 153763a

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

server/src/main/java/org/elasticsearch/Version.java

+10-6
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,12 @@ private static class DeclaredVersionsHolder {
302302
* is a beta or RC release then the version itself is returned.
303303
*/
304304
public Version minimumCompatibilityVersion() {
305-
if (minCompatVersion == null) {
306-
minCompatVersion = computeMinCompatVersion();
305+
Version res = minCompatVersion;
306+
if (res == null) {
307+
res = computeMinCompatVersion();
308+
minCompatVersion = res;
307309
}
308-
return minCompatVersion;
310+
return res;
309311
}
310312

311313
private Version computeMinCompatVersion() {
@@ -340,10 +342,12 @@ private Version computeMinCompatVersion() {
340342
* code that is used to read / write file formats like transaction logs, cluster state, and index metadata.
341343
*/
342344
public Version minimumIndexCompatibilityVersion() {
343-
if (minIndexCompatVersion == null) {
344-
minIndexCompatVersion = computeMinIndexCompatVersion();
345+
Version res = minIndexCompatVersion;
346+
if (res == null) {
347+
res = computeMinIndexCompatVersion();
348+
minIndexCompatVersion = res;
345349
}
346-
return minIndexCompatVersion;
350+
return res;
347351
}
348352

349353
private Version computeMinIndexCompatVersion() {

0 commit comments

Comments
 (0)