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

[Remove] LegacyESVersion.V_7_8_* and V_7_9_* constants #4855

Merged
merged 5 commits into from
Nov 1, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Remove deprecated serialization logic from pipeline aggs ([#4847](https://github.com/opensearch-project/OpenSearch/pull/4847))
- Remove unused private methods ([#4926](https://github.com/opensearch-project/OpenSearch/pull/4926))
- Revert PR 4656 to unblock Windows CI ([#4949](https://github.com/opensearch-project/OpenSearch/pull/4949))
- Remove LegacyESVersion.V_7_8_ and V_7_9_ Constants ([#4855](https://github.com/opensearch-project/OpenSearch/pull/4855))

### Fixed
- `opensearch-service.bat start` and `opensearch-service.bat manager` failing to run ([#4289](https://github.com/opensearch-project/OpenSearch/pull/4289))
Expand Down
6 changes: 0 additions & 6 deletions server/src/main/java/org/opensearch/LegacyESVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ public class LegacyESVersion extends Version {
public static final LegacyESVersion V_7_6_2 = new LegacyESVersion(7060299, org.apache.lucene.util.Version.LUCENE_8_4_0);
public static final LegacyESVersion V_7_7_0 = new LegacyESVersion(7070099, org.apache.lucene.util.Version.LUCENE_8_5_1);
public static final LegacyESVersion V_7_7_1 = new LegacyESVersion(7070199, org.apache.lucene.util.Version.LUCENE_8_5_1);
public static final LegacyESVersion V_7_8_0 = new LegacyESVersion(7080099, org.apache.lucene.util.Version.LUCENE_8_5_1);
public static final LegacyESVersion V_7_8_1 = new LegacyESVersion(7080199, org.apache.lucene.util.Version.LUCENE_8_5_1);
public static final LegacyESVersion V_7_9_0 = new LegacyESVersion(7090099, org.apache.lucene.util.Version.LUCENE_8_6_0);
public static final LegacyESVersion V_7_9_1 = new LegacyESVersion(7090199, org.apache.lucene.util.Version.LUCENE_8_6_2);
public static final LegacyESVersion V_7_9_2 = new LegacyESVersion(7090299, org.apache.lucene.util.Version.LUCENE_8_6_2);
public static final LegacyESVersion V_7_9_3 = new LegacyESVersion(7090399, org.apache.lucene.util.Version.LUCENE_8_6_2);
public static final LegacyESVersion V_7_10_0 = new LegacyESVersion(7100099, org.apache.lucene.util.Version.LUCENE_8_7_0);
public static final LegacyESVersion V_7_10_1 = new LegacyESVersion(7100199, org.apache.lucene.util.Version.LUCENE_8_7_0);
public static final LegacyESVersion V_7_10_2 = new LegacyESVersion(7100299, org.apache.lucene.util.Version.LUCENE_8_7_0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1576,13 +1576,13 @@ private enum OpenSearchExceptionHandle {
org.opensearch.indices.recovery.PeerRecoveryNotFound.class,
org.opensearch.indices.recovery.PeerRecoveryNotFound::new,
158,
LegacyESVersion.V_7_9_0
UNKNOWN_VERSION_ADDED
),
NODE_HEALTH_CHECK_FAILURE_EXCEPTION(
org.opensearch.cluster.coordination.NodeHealthCheckFailureException.class,
org.opensearch.cluster.coordination.NodeHealthCheckFailureException::new,
159,
LegacyESVersion.V_7_9_0
UNKNOWN_VERSION_ADDED
),
NO_SEED_NODE_LEFT_EXCEPTION(
org.opensearch.transport.NoSeedNodeLeftException.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,7 @@ public static OpType fromString(String sOpType) {
* Read a document write (index/delete/update) request
*
* @param shardId shard id of the request. {@code null} when reading as part of a {@link org.opensearch.action.bulk.BulkRequest}
* that does not have a unique shard id or when reading from a stream of version older than
* {@link org.opensearch.action.bulk.BulkShardRequest#COMPACT_SHARD_ID_VERSION}
* that does not have a unique shard id
*/
static DocWriteRequest<?> readDocumentRequest(@Nullable ShardId shardId, StreamInput in) throws IOException {
byte type = in.readByte();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

package org.opensearch.action.admin.cluster.configuration;

import org.opensearch.LegacyESVersion;
import org.opensearch.action.ActionRequestValidationException;
import org.opensearch.action.support.clustermanager.ClusterManagerNodeRequest;
import org.opensearch.cluster.ClusterState;
Expand Down Expand Up @@ -110,13 +109,8 @@ public AddVotingConfigExclusionsRequest(String[] nodeDescriptions, String[] node
public AddVotingConfigExclusionsRequest(StreamInput in) throws IOException {
super(in);
nodeDescriptions = in.readStringArray();
if (in.getVersion().onOrAfter(LegacyESVersion.V_7_8_0)) {
nodeIds = in.readStringArray();
nodeNames = in.readStringArray();
} else {
nodeIds = Strings.EMPTY_ARRAY;
nodeNames = Strings.EMPTY_ARRAY;
}
nodeIds = in.readStringArray();
nodeNames = in.readStringArray();
timeout = in.readTimeValue();

if (nodeDescriptions.length > 0) {
Expand Down Expand Up @@ -249,10 +243,8 @@ public ActionRequestValidationException validate() {
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeStringArray(nodeDescriptions);
if (out.getVersion().onOrAfter(LegacyESVersion.V_7_8_0)) {
out.writeStringArray(nodeIds);
out.writeStringArray(nodeNames);
}
out.writeStringArray(nodeIds);
out.writeStringArray(nodeNames);
out.writeTimeValue(timeout);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

package org.opensearch.action.admin.cluster.node.stats;

import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.action.support.nodes.BaseNodeResponse;
import org.opensearch.cluster.node.DiscoveryNode;
Expand Down Expand Up @@ -138,18 +137,10 @@ public NodeStats(StreamInput in) throws IOException {
ingestStats = in.readOptionalWriteable(IngestStats::new);
adaptiveSelectionStats = in.readOptionalWriteable(AdaptiveSelectionStats::new);
scriptCacheStats = null;
if (in.getVersion().onOrAfter(LegacyESVersion.V_7_8_0)) {
if (in.getVersion().before(LegacyESVersion.V_7_9_0)) {
scriptCacheStats = in.readOptionalWriteable(ScriptCacheStats::new);
} else if (scriptStats != null) {
scriptCacheStats = scriptStats.toScriptCacheStats();
}
}
if (in.getVersion().onOrAfter(LegacyESVersion.V_7_9_0)) {
indexingPressureStats = in.readOptionalWriteable(IndexingPressureStats::new);
} else {
indexingPressureStats = null;
if (scriptStats != null) {
scriptCacheStats = scriptStats.toScriptCacheStats();
}
indexingPressureStats = in.readOptionalWriteable(IndexingPressureStats::new);
if (in.getVersion().onOrAfter(Version.V_1_2_0)) {
shardIndexingPressureStats = in.readOptionalWriteable(ShardIndexingPressureStats::new);
} else {
Expand Down Expand Up @@ -327,12 +318,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalWriteable(discoveryStats);
out.writeOptionalWriteable(ingestStats);
out.writeOptionalWriteable(adaptiveSelectionStats);
if (out.getVersion().onOrAfter(LegacyESVersion.V_7_8_0) && out.getVersion().before(LegacyESVersion.V_7_9_0)) {
out.writeOptionalWriteable(scriptCacheStats);
}
if (out.getVersion().onOrAfter(LegacyESVersion.V_7_9_0)) {
out.writeOptionalWriteable(indexingPressureStats);
}
out.writeOptionalWriteable(indexingPressureStats);
if (out.getVersion().onOrAfter(Version.V_1_2_0)) {
out.writeOptionalWriteable(shardIndexingPressureStats);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

package org.opensearch.action.admin.cluster.node.tasks.cancel;

import org.opensearch.LegacyESVersion;
import org.opensearch.action.support.tasks.BaseTasksRequest;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
Expand Down Expand Up @@ -60,18 +59,14 @@ public CancelTasksRequest() {}
public CancelTasksRequest(StreamInput in) throws IOException {
super(in);
this.reason = in.readString();
if (in.getVersion().onOrAfter(LegacyESVersion.V_7_8_0)) {
waitForCompletion = in.readBoolean();
}
waitForCompletion = in.readBoolean();
}

@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeString(reason);
if (out.getVersion().onOrAfter(LegacyESVersion.V_7_8_0)) {
out.writeBoolean(waitForCompletion);
}
out.writeBoolean(waitForCompletion);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

package org.opensearch.action.admin.cluster.node.usage;

import org.opensearch.LegacyESVersion;
import org.opensearch.action.support.nodes.BaseNodeResponse;
import org.opensearch.cluster.node.DiscoveryNode;
import org.opensearch.common.io.stream.StreamInput;
Expand Down Expand Up @@ -61,11 +60,7 @@ public NodeUsage(StreamInput in) throws IOException {
timestamp = in.readLong();
sinceTime = in.readLong();
restUsage = (Map<String, Long>) in.readGenericValue();
if (in.getVersion().onOrAfter(LegacyESVersion.V_7_8_0)) {
aggregationUsage = (Map<String, Object>) in.readGenericValue();
} else {
aggregationUsage = null;
}
aggregationUsage = (Map<String, Object>) in.readGenericValue();
}

/**
Expand Down Expand Up @@ -144,9 +139,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeLong(timestamp);
out.writeLong(sinceTime);
out.writeGenericValue(restUsage);
if (out.getVersion().onOrAfter(LegacyESVersion.V_7_8_0)) {
out.writeGenericValue(aggregationUsage);
}
out.writeGenericValue(aggregationUsage);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

package org.opensearch.action.admin.cluster.node.usage;

import org.opensearch.LegacyESVersion;
import org.opensearch.action.support.nodes.BaseNodesRequest;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
Expand All @@ -52,9 +51,7 @@ public class NodesUsageRequest extends BaseNodesRequest<NodesUsageRequest> {
public NodesUsageRequest(StreamInput in) throws IOException {
super(in);
this.restActions = in.readBoolean();
if (in.getVersion().onOrAfter(LegacyESVersion.V_7_8_0)) {
this.aggregations = in.readBoolean();
}
this.aggregations = in.readBoolean();
}

/**
Expand Down Expand Up @@ -116,8 +113,6 @@ public NodesUsageRequest aggregations(boolean aggregations) {
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeBoolean(restActions);
if (out.getVersion().onOrAfter(LegacyESVersion.V_7_8_0)) {
out.writeBoolean(aggregations);
}
out.writeBoolean(aggregations);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,7 @@ public AliasActions(StreamInput in) throws IOException {
isHidden = in.readOptionalBoolean();
}
originalAliases = in.readStringArray();
if (in.getVersion().onOrAfter(LegacyESVersion.V_7_9_0)) {
mustExist = in.readOptionalBoolean();
} else {
mustExist = null;
}
mustExist = in.readOptionalBoolean();
}

@Override
Expand All @@ -303,9 +299,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalBoolean(isHidden);
}
out.writeStringArray(originalAliases);
if (out.getVersion().onOrAfter(LegacyESVersion.V_7_9_0)) {
out.writeOptionalBoolean(mustExist);
}
out.writeOptionalBoolean(mustExist);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
package org.opensearch.action.admin.indices.get;

import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.action.ActionResponse;
import org.opensearch.cluster.metadata.AliasMetadata;
Expand Down Expand Up @@ -152,14 +151,12 @@ public GetIndexResponse(
}
defaultSettings = defaultSettingsMapBuilder.build();

if (in.getVersion().onOrAfter(LegacyESVersion.V_7_8_0)) {
ImmutableOpenMap.Builder<String, String> dataStreamsMapBuilder = ImmutableOpenMap.builder();
int dataStreamsSize = in.readVInt();
for (int i = 0; i < dataStreamsSize; i++) {
dataStreamsMapBuilder.put(in.readString(), in.readOptionalString());
}
dataStreams = dataStreamsMapBuilder.build();
ImmutableOpenMap.Builder<String, String> dataStreamsMapBuilder = ImmutableOpenMap.builder();
int dataStreamsSize = in.readVInt();
for (int i = 0; i < dataStreamsSize; i++) {
dataStreamsMapBuilder.put(in.readString(), in.readOptionalString());
}
dataStreams = dataStreamsMapBuilder.build();
}

public String[] indices() {
Expand Down Expand Up @@ -272,12 +269,10 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeString(indexEntry.key);
Settings.writeSettingsToStream(indexEntry.value, out);
}
if (out.getVersion().onOrAfter(LegacyESVersion.V_7_8_0)) {
out.writeVInt(dataStreams.size());
for (ObjectObjectCursor<String, String> indexEntry : dataStreams) {
out.writeString(indexEntry.key);
out.writeOptionalString(indexEntry.value);
}
out.writeVInt(dataStreams.size());
for (ObjectObjectCursor<String, String> indexEntry : dataStreams) {
out.writeString(indexEntry.key);
out.writeOptionalString(indexEntry.value);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
package org.opensearch.action.admin.indices.mapping.put;

import com.carrotsearch.hppc.ObjectHashSet;
import org.opensearch.LegacyESVersion;
import org.opensearch.OpenSearchGenerationException;
import org.opensearch.Version;
import org.opensearch.action.ActionRequestValidationException;
Expand Down Expand Up @@ -119,9 +118,7 @@ public PutMappingRequest(StreamInput in) throws IOException {
source = in.readString();
concreteIndex = in.readOptionalWriteable(Index::new);
origin = in.readOptionalString();
if (in.getVersion().onOrAfter(LegacyESVersion.V_7_9_0)) {
writeIndexOnly = in.readBoolean();
}
writeIndexOnly = in.readBoolean();
}

public PutMappingRequest() {}
Expand Down Expand Up @@ -348,9 +345,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeString(source);
out.writeOptionalWriteable(concreteIndex);
out.writeOptionalString(origin);
if (out.getVersion().onOrAfter(LegacyESVersion.V_7_9_0)) {
out.writeBoolean(writeIndexOnly);
}
out.writeBoolean(writeIndexOnly);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ public class BulkItemRequest implements Writeable, Accountable {
private volatile BulkItemResponse primaryResponse;

/**
* @param shardId {@code null} if reading from a stream before {@link BulkShardRequest#COMPACT_SHARD_ID_VERSION} to force BwC read
* that includes shard id
* @param shardId the shard id
*/
BulkItemRequest(@Nullable ShardId shardId, StreamInput in) throws IOException {
id = in.readVInt();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@

import org.apache.lucene.util.Accountable;
import org.apache.lucene.util.RamUsageEstimator;
import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.action.support.replication.ReplicatedWriteRequest;
import org.opensearch.action.support.replication.ReplicationRequest;
import org.opensearch.common.io.stream.StreamInput;
Expand All @@ -54,14 +52,13 @@
*/
public class BulkShardRequest extends ReplicatedWriteRequest<BulkShardRequest> implements Accountable {

public static final Version COMPACT_SHARD_ID_VERSION = LegacyESVersion.V_7_9_0;
private static final long SHALLOW_SIZE = RamUsageEstimator.shallowSizeOfInstance(BulkShardRequest.class);

private final BulkItemRequest[] items;

public BulkShardRequest(StreamInput in) throws IOException {
super(in);
final ShardId itemShardId = in.getVersion().onOrAfter(COMPACT_SHARD_ID_VERSION) ? shardId : null;
final ShardId itemShardId = shardId;
items = in.readArray(i -> i.readOptionalWriteable(inpt -> new BulkItemRequest(itemShardId, inpt)), BulkItemRequest[]::new);
}

Expand Down Expand Up @@ -95,14 +92,14 @@ public String[] indices() {
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeArray(out.getVersion().onOrAfter(COMPACT_SHARD_ID_VERSION) ? (o, item) -> {
out.writeArray((o, item) -> {
if (item != null) {
o.writeBoolean(true);
item.writeThin(o);
} else {
o.writeBoolean(false);
}
} : StreamOutput::writeOptionalWriteable, items);
}, items);
}

@Override
Expand Down
Loading