diff --git a/release-notes/opensearch-asynchronous-search.release-notes-2.9.0.0.md b/release-notes/opensearch-asynchronous-search.release-notes-2.9.0.0.md new file mode 100644 index 00000000..ef061a05 --- /dev/null +++ b/release-notes/opensearch-asynchronous-search.release-notes-2.9.0.0.md @@ -0,0 +1,6 @@ +## Version 2.9.0.0 2023-07-18 + +Compatible with OpenSearch 2.9.0 + +### Maintenance +* Increment version to 2.9.0 ([300](https://github.com/opensearch-project/asynchronous-search/pull/300)) diff --git a/src/main/java/org/opensearch/search/asynchronous/context/persistence/AsynchronousSearchPersistenceContext.java b/src/main/java/org/opensearch/search/asynchronous/context/persistence/AsynchronousSearchPersistenceContext.java index 57262d17..96a4276a 100644 --- a/src/main/java/org/opensearch/search/asynchronous/context/persistence/AsynchronousSearchPersistenceContext.java +++ b/src/main/java/org/opensearch/search/asynchronous/context/persistence/AsynchronousSearchPersistenceContext.java @@ -82,7 +82,7 @@ public SearchResponse getSearchResponse() { asynchronousSearchPersistenceModel.getResponse()))); try (NamedWriteableAwareStreamInput wrapperStreamInput = new NamedWriteableAwareStreamInput(bytesReference.streamInput(), namedWriteableRegistry)) { - wrapperStreamInput.setVersion(Version.readVersion(wrapperStreamInput)); + wrapperStreamInput.setVersion(wrapperStreamInput.readVersion()); return new SearchResponse(wrapperStreamInput); } catch (IOException e) { logger.error(() -> new ParameterizedMessage("Failed to parse search response for asynchronous search [{}] Response : [{}] ", @@ -102,7 +102,7 @@ public Exception getSearchError() { .decode(asynchronousSearchPersistenceModel.getError()))); try (NamedWriteableAwareStreamInput wrapperStreamInput = new NamedWriteableAwareStreamInput(bytesReference.streamInput(), namedWriteableRegistry)) { - wrapperStreamInput.setVersion(Version.readVersion(wrapperStreamInput)); + wrapperStreamInput.setVersion(wrapperStreamInput.readVersion()); return wrapperStreamInput.readException(); } catch (IOException e) { logger.error(() -> new ParameterizedMessage("Failed to parse search error for asynchronous search [{}] Error : [{}] ", diff --git a/src/main/java/org/opensearch/search/asynchronous/context/persistence/AsynchronousSearchPersistenceModel.java b/src/main/java/org/opensearch/search/asynchronous/context/persistence/AsynchronousSearchPersistenceModel.java index bc3abf9d..5d30e0ad 100644 --- a/src/main/java/org/opensearch/search/asynchronous/context/persistence/AsynchronousSearchPersistenceModel.java +++ b/src/main/java/org/opensearch/search/asynchronous/context/persistence/AsynchronousSearchPersistenceModel.java @@ -48,7 +48,7 @@ private String serializeResponse(SearchResponse response) throws IOException { return null; } try (BytesStreamOutput out = new BytesStreamOutput()) { - Version.writeVersion(Version.CURRENT, out); + out.setVersion(Version.CURRENT); response.writeTo(out); byte[] bytes = BytesReference.toBytes(out.bytes()); return Base64.getUrlEncoder().withoutPadding().encodeToString(bytes); @@ -68,7 +68,7 @@ private String serializeError(Exception error) throws IOException { return null; } try (BytesStreamOutput out = new BytesStreamOutput()) { - Version.writeVersion(Version.CURRENT, out); + out.setVersion(Version.CURRENT); out.writeException(error instanceof OpenSearchException ? error : new OpenSearchException(error)); byte[] bytes = BytesReference.toBytes(out.bytes()); return Base64.getUrlEncoder().withoutPadding().encodeToString(bytes); diff --git a/src/main/java/org/opensearch/search/asynchronous/management/AsynchronousSearchManagementService.java b/src/main/java/org/opensearch/search/asynchronous/management/AsynchronousSearchManagementService.java index e2767fcf..17ee122b 100644 --- a/src/main/java/org/opensearch/search/asynchronous/management/AsynchronousSearchManagementService.java +++ b/src/main/java/org/opensearch/search/asynchronous/management/AsynchronousSearchManagementService.java @@ -23,7 +23,6 @@ import org.opensearch.cluster.node.DiscoveryNode; import org.opensearch.cluster.service.ClusterService; import org.opensearch.common.Randomness; -import org.opensearch.common.collect.ImmutableOpenMap; import org.opensearch.common.component.AbstractLifecycleComponent; import org.opensearch.common.inject.Inject; import org.opensearch.common.io.stream.StreamInput; @@ -46,6 +45,7 @@ import java.io.IOException; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.concurrent.atomic.AtomicReference; @@ -196,8 +196,8 @@ public final void performCleanUp() { try (ThreadContext.StoredContext ignore = threadContext.stashContext()) { // we have to execute under the system context so that if security is enabled the sync is authorized threadContext.markAsSystemContext(); - ImmutableOpenMap dataNodes = clusterService.state().nodes().getDataNodes(); - List nodes = Stream.of(dataNodes.values().toArray(DiscoveryNode.class)) + final Map dataNodes = clusterService.state().nodes().getDataNodes(); + List nodes = Stream.of(dataNodes.values().toArray(new DiscoveryNode[0])) .collect(Collectors.toList()); if (nodes == null || nodes.isEmpty()) { logger.debug("Found empty data nodes with asynchronous search enabled attribute [{}] for response clean up", dataNodes); diff --git a/src/main/java/org/opensearch/search/asynchronous/request/SubmitAsynchronousSearchRequest.java b/src/main/java/org/opensearch/search/asynchronous/request/SubmitAsynchronousSearchRequest.java index 995ef0a5..54e1f972 100644 --- a/src/main/java/org/opensearch/search/asynchronous/request/SubmitAsynchronousSearchRequest.java +++ b/src/main/java/org/opensearch/search/asynchronous/request/SubmitAsynchronousSearchRequest.java @@ -10,7 +10,7 @@ import org.opensearch.action.ActionRequestValidationException; import org.opensearch.action.search.SearchRequest; import org.opensearch.common.Nullable; -import org.opensearch.common.Strings; +import org.opensearch.core.common.Strings; import org.opensearch.common.io.stream.StreamInput; import org.opensearch.common.io.stream.StreamOutput; import org.opensearch.common.unit.TimeValue; diff --git a/src/main/java/org/opensearch/search/asynchronous/rest/RestAsynchronousSearchStatsAction.java b/src/main/java/org/opensearch/search/asynchronous/rest/RestAsynchronousSearchStatsAction.java index df983324..cdd31420 100644 --- a/src/main/java/org/opensearch/search/asynchronous/rest/RestAsynchronousSearchStatsAction.java +++ b/src/main/java/org/opensearch/search/asynchronous/rest/RestAsynchronousSearchStatsAction.java @@ -10,7 +10,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.opensearch.client.node.NodeClient; -import org.opensearch.common.Strings; +import org.opensearch.core.common.Strings; import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.RestRequest; import org.opensearch.rest.action.RestActions; diff --git a/src/main/java/org/opensearch/search/asynchronous/task/AsynchronousSearchTask.java b/src/main/java/org/opensearch/search/asynchronous/task/AsynchronousSearchTask.java index 51de4d04..42094959 100644 --- a/src/main/java/org/opensearch/search/asynchronous/task/AsynchronousSearchTask.java +++ b/src/main/java/org/opensearch/search/asynchronous/task/AsynchronousSearchTask.java @@ -11,7 +11,7 @@ import org.apache.logging.log4j.Logger; import org.opensearch.action.search.SearchRequest; import org.opensearch.action.search.SearchTask; -import org.opensearch.common.Strings; +import org.opensearch.core.common.Strings; import org.opensearch.tasks.TaskId; import java.util.Map;