Skip to content

Commit 95c2d84

Browse files
committed
Internal: remove some more bwc code
Some more code that was left for backwards compatibility can now be removed on master since 2.0 will require a full cluster restart. Closes #8778
1 parent 5f329bd commit 95c2d84

File tree

6 files changed

+4
-53
lines changed

6 files changed

+4
-53
lines changed

src/main/java/org/elasticsearch/action/admin/indices/get/TransportGetIndexAction.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ protected void doMasterOperation(final GetIndexRequest request, String[] concret
8080
ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> mappingsResult = ImmutableOpenMap.of();
8181
ImmutableOpenMap<String, ImmutableList<AliasMetaData>> aliasesResult = ImmutableOpenMap.of();
8282
ImmutableOpenMap<String, Settings> settings = ImmutableOpenMap.of();
83-
Feature[] features = request.featuresAsEnums();
83+
Feature[] features = request.features();
8484
boolean doneAliases = false;
8585
boolean doneMappings = false;
8686
boolean doneSettings = false;

src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsRequest.java

-15
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@
2323
import org.elasticsearch.action.ActionRequestValidationException;
2424
import org.elasticsearch.action.IndicesRequest;
2525
import org.elasticsearch.action.support.IndicesOptions;
26-
import org.elasticsearch.action.support.master.MasterNodeOperationRequest;
2726
import org.elasticsearch.common.Strings;
2827
import org.elasticsearch.common.io.stream.StreamInput;
2928
import org.elasticsearch.common.io.stream.StreamOutput;
30-
import org.elasticsearch.common.unit.TimeValue;
3129

3230
import java.io.IOException;
3331

@@ -49,15 +47,6 @@ public GetFieldMappingsRequest() {
4947

5048
}
5149

52-
public GetFieldMappingsRequest(GetFieldMappingsRequest other) {
53-
this.local = other.local;
54-
this.includeDefaults = other.includeDefaults;
55-
this.indices = other.indices;
56-
this.types = other.types;
57-
this.indicesOptions = other.indicesOptions;
58-
this.fields = other.fields;
59-
}
60-
6150
/**
6251
* Indicate whether the receiving node should operate based on local index information or forward requests,
6352
* where needed, to other nodes. If running locally, request will not raise errors if running locally & missing indices.
@@ -129,8 +118,6 @@ public ActionRequestValidationException validate() {
129118
@Override
130119
public void writeTo(StreamOutput out) throws IOException {
131120
super.writeTo(out);
132-
// This request used to inherit from MasterNodeOperationRequest, so for bwc we need to keep serializing it.
133-
MasterNodeOperationRequest.DEFAULT_MASTER_NODE_TIMEOUT.writeTo(out);
134121
out.writeStringArray(indices);
135122
out.writeStringArray(types);
136123
indicesOptions.writeIndicesOptions(out);
@@ -142,8 +129,6 @@ public void writeTo(StreamOutput out) throws IOException {
142129
@Override
143130
public void readFrom(StreamInput in) throws IOException {
144131
super.readFrom(in);
145-
// This request used to inherit from MasterNodeOperationRequest, so for bwc we need to keep serializing it.
146-
TimeValue.readTimeValue(in);
147132
indices = in.readStringArray();
148133
types = in.readStringArray();
149134
indicesOptions = IndicesOptions.readIndicesOptions(in);

src/main/java/org/elasticsearch/action/search/SearchScrollRequest.java

-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
package org.elasticsearch.action.search;
2121

22-
import org.elasticsearch.Version;
2322
import org.elasticsearch.action.ActionRequest;
2423
import org.elasticsearch.action.ActionRequestValidationException;
2524
import org.elasticsearch.common.io.stream.StreamInput;
@@ -100,9 +99,6 @@ public SearchScrollRequest scroll(String keepAlive) {
10099
@Override
101100
public void readFrom(StreamInput in) throws IOException {
102101
super.readFrom(in);
103-
if (in.getVersion().before(Version.V_1_2_0)) {
104-
in.readByte(); // backward comp. for operation threading
105-
}
106102
scrollId = in.readString();
107103
if (in.readBoolean()) {
108104
scroll = readScroll(in);
@@ -112,9 +108,6 @@ public void readFrom(StreamInput in) throws IOException {
112108
@Override
113109
public void writeTo(StreamOutput out) throws IOException {
114110
super.writeTo(out);
115-
if (out.getVersion().before(Version.V_1_2_0)) {
116-
out.writeByte((byte) 2); // operation threading
117-
}
118111
out.writeString(scrollId);
119112
if (scroll == null) {
120113
out.writeBoolean(false);

src/main/java/org/elasticsearch/action/support/broadcast/BroadcastOperationRequest.java

-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
package org.elasticsearch.action.support.broadcast;
2121

22-
import org.elasticsearch.Version;
2322
import org.elasticsearch.action.ActionRequest;
2423
import org.elasticsearch.action.ActionRequestValidationException;
2524
import org.elasticsearch.action.IndicesRequest;
@@ -89,19 +88,13 @@ protected void beforeLocalFork() {
8988
public void writeTo(StreamOutput out) throws IOException {
9089
super.writeTo(out);
9190
out.writeStringArrayNullable(indices);
92-
if (out.getVersion().before(Version.V_1_2_0)) {
93-
out.writeByte((byte) 2); // bwc operation threading
94-
}
9591
indicesOptions.writeIndicesOptions(out);
9692
}
9793

9894
@Override
9995
public void readFrom(StreamInput in) throws IOException {
10096
super.readFrom(in);
10197
indices = in.readStringArray();
102-
if (in.getVersion().before(Version.V_1_2_0)) {
103-
in.readByte(); // bwc operation threading
104-
}
10598
indicesOptions = IndicesOptions.readIndicesOptions(in);
10699
}
107100
}

src/main/java/org/elasticsearch/discovery/zen/ping/ZenPingService.java

-19
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ public class ZenPingService extends AbstractLifecycleComponent<ZenPing> implemen
5050

5151
private volatile ImmutableList<? extends ZenPing> zenPings = ImmutableList.of();
5252

53-
// here for backward comp. with discovery plugins
54-
public ZenPingService(Settings settings, ThreadPool threadPool, TransportService transportService, ClusterName clusterName, NetworkService networkService,
55-
ElectMasterService electMasterService, @Nullable Set<UnicastHostsProvider> unicastHostsProviders) {
56-
this(settings, threadPool, transportService, clusterName, networkService, Version.CURRENT, electMasterService, unicastHostsProviders);
57-
}
58-
5953
@Inject
6054
public ZenPingService(Settings settings, ThreadPool threadPool, TransportService transportService, ClusterName clusterName, NetworkService networkService,
6155
Version version, ElectMasterService electMasterService, @Nullable Set<UnicastHostsProvider> unicastHostsProviders) {
@@ -74,19 +68,6 @@ public ImmutableList<? extends ZenPing> zenPings() {
7468
return this.zenPings;
7569
}
7670

77-
public void zenPings(ImmutableList<? extends ZenPing> pings) {
78-
this.zenPings = pings;
79-
if (lifecycle.started()) {
80-
for (ZenPing zenPing : zenPings) {
81-
zenPing.start();
82-
}
83-
} else if (lifecycle.stopped()) {
84-
for (ZenPing zenPing : zenPings) {
85-
zenPing.stop();
86-
}
87-
}
88-
}
89-
9071
@Override
9172
public void setPingContextProvider(PingContextProvider contextProvider) {
9273
if (lifecycle.started()) {

src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,9 @@ public void handleRequest(final RestRequest request, final RestChannel channel,
106106
@Override
107107
public RestResponse buildResponse(ExplainResponse response, XContentBuilder builder) throws Exception {
108108
builder.startObject();
109-
//null checks for bw comp, since we only added in 1.4 index, type and id to ExplainResponse
110-
builder.field(Fields._INDEX, response.getIndex() != null ? response.getIndex() : explainRequest.index())
111-
.field(Fields._TYPE, response.getType() != null ? response.getType() : explainRequest.type())
112-
.field(Fields._ID, response.getId() != null ? response.getId() : explainRequest.id())
109+
builder.field(Fields._INDEX, response.getIndex())
110+
.field(Fields._TYPE, response.getType())
111+
.field(Fields._ID, response.getId())
113112
.field(Fields.MATCHED, response.isMatch());
114113

115114
if (response.hasExplanation()) {

0 commit comments

Comments
 (0)