Skip to content

Commit 9ef4173

Browse files
committed
Use shorter uninitialized period to not break tests
1 parent a12c9d7 commit 9ef4173

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlExecutionInfo.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public class EsqlExecutionInfo implements ChunkedToXContentObject, Writeable {
6868
// old Cluster Object to a new Cluster Object with the remapping function.
6969
public final ConcurrentMap<String, Cluster> clusterInfo;
7070
// Did we initialize the clusterInfo map? If not, then we will serialize it as empty.
71-
private transient volatile boolean clusterInfoInitialized = false;
71+
private transient volatile boolean clusterInfoInitialized = true;
7272
// whether the user has asked for CCS metadata to be in the JSON response (the overall took will always be present)
7373
private final boolean includeCCSMetadata;
7474

@@ -106,13 +106,11 @@ public EsqlExecutionInfo(Predicate<String> skipUnavailablePredicate, boolean inc
106106
this.includeCCSMetadata = includeCCSMetadata;
107107
this.skipUnavailablePredicate = Predicates.always();
108108
this.relativeStart = null;
109-
this.clusterInfoInitialized = true;
110109
}
111110

112111
public EsqlExecutionInfo(StreamInput in) throws IOException {
113112
this.overallTook = in.readOptionalTimeValue();
114113
this.clusterInfo = in.readMapValues(EsqlExecutionInfo.Cluster::new, Cluster::getClusterAlias, ConcurrentHashMap::new);
115-
this.clusterInfoInitialized = true;
116114
this.includeCCSMetadata = in.getTransportVersion().onOrAfter(TransportVersions.V_8_16_0) ? in.readBoolean() : false;
117115
this.isPartial = in.getTransportVersion().onOrAfter(TransportVersions.ESQL_RESPONSE_PARTIAL) ? in.readBoolean() : false;
118116
this.skipUnavailablePredicate = Predicates.always();
@@ -354,8 +352,8 @@ public boolean isStopped() {
354352
return isStopped;
355353
}
356354

357-
public void clusterInfoInitialized() {
358-
this.clusterInfoInitialized = true;
355+
public void clusterInfoInitialized(boolean clusterInfoInitialized) {
356+
this.clusterInfoInitialized = clusterInfoInitialized;
359357
}
360358

361359
/**

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session/EsqlCCSUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ public static void initCrossClusterState(
337337
patterns.getFirst().indexPattern()
338338
);
339339

340+
executionInfo.clusterInfoInitialized(false);
340341
// initialize the cluster entries in EsqlExecutionInfo before throwing the invalid license error
341342
// so that the CCS telemetry handler can recognize that this error is CCS-related
342343
for (var entry : groupedIndices.entrySet()) {
@@ -347,7 +348,7 @@ public static void initCrossClusterState(
347348
return new EsqlExecutionInfo.Cluster(clusterAlias, indexExpr, executionInfo.isSkipUnavailable(clusterAlias));
348349
});
349350
}
350-
executionInfo.clusterInfoInitialized();
351+
executionInfo.clusterInfoInitialized(true);
351352
// check if it is a cross-cluster query
352353
if (groupedIndices.size() > 1 || groupedIndices.containsKey(RemoteClusterService.LOCAL_CLUSTER_GROUP_KEY) == false) {
353354
if (EsqlLicenseChecker.isCcsAllowed(licenseState) == false) {

0 commit comments

Comments
 (0)