Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 2.9 release notes and fixing compilation errors #307

Merged
merged 1 commit into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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))
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.opensearch.Version;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.io.stream.NamedWriteableAwareStreamInput;
Expand Down Expand Up @@ -82,7 +81,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 : [{}] ",
Expand All @@ -102,7 +101,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 : [{}] ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private String serializeResponse(SearchResponse response) throws IOException {
return null;
}
try (BytesStreamOutput out = new BytesStreamOutput()) {
Version.writeVersion(Version.CURRENT, out);
out.writeVersion(Version.CURRENT);
response.writeTo(out);
byte[] bytes = BytesReference.toBytes(out.bytes());
return Base64.getUrlEncoder().withoutPadding().encodeToString(bytes);
Expand All @@ -68,7 +68,7 @@ private String serializeError(Exception error) throws IOException {
return null;
}
try (BytesStreamOutput out = new BytesStreamOutput()) {
Version.writeVersion(Version.CURRENT, out);
out.writeVersion(Version.CURRENT);
out.writeException(error instanceof OpenSearchException ? error : new OpenSearchException(error));
byte[] bytes = BytesReference.toBytes(out.bytes());
return Base64.getUrlEncoder().withoutPadding().encodeToString(bytes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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<String, DiscoveryNode> dataNodes = clusterService.state().nodes().getDataNodes();
List<DiscoveryNode> nodes = Stream.of(dataNodes.values().toArray(DiscoveryNode.class))
final Map<String, DiscoveryNode> dataNodes = clusterService.state().nodes().getDataNodes();
List<DiscoveryNode> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public void testNodewiseStats() throws InterruptedException {
submitAsynchronousSearchRequest.waitForCompletionTimeout(TimeValue.timeValueSeconds(2));
submitAsynchronousSearchRequest.keepOnCompletion(true);
List<DiscoveryNode> dataNodes = new LinkedList<>();
clusterService().state().nodes().getDataNodes().iterator().forEachRemaining(node -> {
dataNodes.add(node.value);
clusterService().state().nodes().getDataNodes().values().iterator().forEachRemaining(node -> {
dataNodes.add(node);
});
assertFalse(dataNodes.isEmpty());
DiscoveryNode randomDataNode = dataNodes.get(randomInt(dataNodes.size() - 1));
Expand Down Expand Up @@ -118,8 +118,8 @@ public void testStatsAcrossNodes() throws InterruptedException, ExecutionExcepti
client().prepareIndex(index).setId("3").setSource("field1", "quick"));

List<DiscoveryNode> dataNodes = new LinkedList<>();
clusterService().state().nodes().getDataNodes().iterator().forEachRemaining(node -> {
dataNodes.add(node.value);
clusterService().state().nodes().getDataNodes().values().iterator().forEachRemaining(node -> {
dataNodes.add(node);
});
assertFalse(dataNodes.isEmpty());
int numThreads = 20;
Expand Down Expand Up @@ -243,8 +243,8 @@ public void testThrottledAsynchronousSearchCount() throws InterruptedException,
client().prepareIndex(index).setId("3").setSource("field1", "quick"));

List<DiscoveryNode> dataNodes = new LinkedList<>();
clusterService().state().nodes().getDataNodes().iterator().forEachRemaining(node -> {
dataNodes.add(node.value);
clusterService().state().nodes().getDataNodes().values().iterator().forEachRemaining(node -> {
dataNodes.add(node);
});
assertFalse(dataNodes.isEmpty());
DiscoveryNode randomDataNode = dataNodes.get(randomInt(dataNodes.size() - 1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.opensearch.client.ResponseException;
import org.opensearch.common.CheckedFunction;
import org.opensearch.common.Nullable;
import org.opensearch.common.Strings;
import org.opensearch.core.common.Strings;
import org.opensearch.common.settings.Settings;
import org.opensearch.core.xcontent.DeprecationHandler;
import org.opensearch.core.xcontent.NamedXContentRegistry;
Expand Down Expand Up @@ -222,7 +222,7 @@ protected void updateClusterSettings(String settingKey, Object value) throws Exc
.endObject()
.endObject();
Request request = new Request("PUT", "_cluster/settings");
request.setJsonEntity(Strings.toString(builder));
request.setJsonEntity(org.opensearch.common.Strings.toString(builder));
Response response = client().performRequest(request);
assertEquals(RestStatus.OK, RestStatus.fromCode(response.getStatusLine().getStatusCode()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.opensearch.client.Request;
import org.opensearch.cluster.health.ClusterHealthStatus;
import org.opensearch.common.Priority;
import org.opensearch.common.Strings;
import org.opensearch.core.common.Strings;
import org.opensearch.common.SuppressForbidden;
import org.opensearch.common.lucene.uid.Versions;
import org.opensearch.common.unit.TimeValue;
Expand Down
Loading