Ver código fonte

Ensure replication response/requests implement writeable (#44392)

This commit cleans up replication response and request so that the base
class does not allow subclasses to implement Streamable.

relates #34389
Ryan Ernst 6 anos atrás
pai
commit
ca9ee218eb

+ 0 - 5
server/src/main/java/org/elasticsearch/action/admin/indices/close/TransportVerifyShardBeforeCloseAction.java

@@ -179,11 +179,6 @@ public class TransportVerifyShardBeforeCloseAction extends TransportReplicationA
             return "verify shard " + shardId + " before close with block " + clusterBlock;
         }
 
-        @Override
-        public void readFrom(final StreamInput in) {
-            throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
-        }
-
         @Override
         public void writeTo(final StreamOutput out) throws IOException {
             super.writeTo(out);

+ 0 - 5
server/src/main/java/org/elasticsearch/action/admin/indices/flush/ShardFlushRequest.java

@@ -46,11 +46,6 @@ public class ShardFlushRequest extends ReplicationRequest<ShardFlushRequest> {
         return request;
     }
 
-    @Override
-    public void readFrom(StreamInput in) throws IOException {
-        throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
-    }
-
     @Override
     public void writeTo(StreamOutput out) throws IOException {
         super.writeTo(out);

+ 0 - 5
server/src/main/java/org/elasticsearch/action/bulk/BulkShardRequest.java

@@ -84,11 +84,6 @@ public class BulkShardRequest extends ReplicatedWriteRequest<BulkShardRequest> {
         }
     }
 
-    @Override
-    public void readFrom(StreamInput in) {
-        throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
-    }
-
     @Override
     public String toString() {
         // This is included in error messages so we'll try to make it somewhat user friendly.

+ 0 - 5
server/src/main/java/org/elasticsearch/action/delete/DeleteRequest.java

@@ -289,11 +289,6 @@ public class DeleteRequest extends ReplicatedWriteRequest<DeleteRequest>
         return OpType.DELETE;
     }
 
-    @Override
-    public void readFrom(StreamInput in) {
-        throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
-    }
-
     @Override
     public void writeTo(StreamOutput out) throws IOException {
         super.writeTo(out);

+ 0 - 5
server/src/main/java/org/elasticsearch/action/index/IndexRequest.java

@@ -613,11 +613,6 @@ public class IndexRequest extends ReplicatedWriteRequest<IndexRequest> implement
         routing(metaData.resolveWriteIndexRouting(routing, index));
     }
 
-    @Override
-    public void readFrom(StreamInput in) {
-        throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
-    }
-
     @Override
     public void writeTo(StreamOutput out) throws IOException {
         super.writeTo(out);

+ 0 - 5
server/src/main/java/org/elasticsearch/action/resync/ResyncReplicationRequest.java

@@ -64,11 +64,6 @@ public final class ResyncReplicationRequest extends ReplicatedWriteRequest<Resyn
         return operations;
     }
 
-    @Override
-    public void readFrom(final StreamInput in) {
-        throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
-    }
-
     @Override
     public void writeTo(final StreamOutput out) throws IOException {
         super.writeTo(out);

+ 0 - 5
server/src/main/java/org/elasticsearch/action/support/replication/ReplicatedWriteRequest.java

@@ -61,11 +61,6 @@ public abstract class ReplicatedWriteRequest<R extends ReplicatedWriteRequest<R>
         return refreshPolicy;
     }
 
-    @Override
-    public void readFrom(StreamInput in) {
-        throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
-    }
-
     @Override
     public void writeTo(StreamOutput out) throws IOException {
         super.writeTo(out);

+ 1 - 1
server/src/main/java/org/elasticsearch/action/support/replication/ReplicationRequest.java

@@ -188,7 +188,7 @@ public abstract class ReplicationRequest<Request extends ReplicationRequest<Requ
     }
 
     @Override
-    public void readFrom(StreamInput in) throws IOException {
+    public final void readFrom(StreamInput in) throws IOException {
         throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
     }
 

+ 1 - 1
server/src/main/java/org/elasticsearch/action/support/replication/ReplicationResponse.java

@@ -58,7 +58,7 @@ public class ReplicationResponse extends ActionResponse {
     }
 
     @Override
-    public void readFrom(StreamInput in) throws IOException {
+    public final void readFrom(StreamInput in) throws IOException {
         throw new UnsupportedOperationException("Streamable no longer used");
     }
 

+ 0 - 5
server/src/main/java/org/elasticsearch/index/seqno/RetentionLeaseBackgroundSyncAction.java

@@ -131,11 +131,6 @@ public class RetentionLeaseBackgroundSyncAction extends TransportReplicationActi
             waitForActiveShards(ActiveShardCount.NONE);
         }
 
-        @Override
-        public void readFrom(final StreamInput in) {
-            throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
-        }
-
         @Override
         public void writeTo(final StreamOutput out) throws IOException {
             super.writeTo(Objects.requireNonNull(out));

+ 0 - 5
server/src/main/java/org/elasticsearch/index/seqno/RetentionLeaseSyncAction.java

@@ -135,11 +135,6 @@ public class RetentionLeaseSyncAction extends
             waitForActiveShards(ActiveShardCount.NONE);
         }
 
-        @Override
-        public void readFrom(final StreamInput in) {
-            throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
-        }
-
         @Override
         public void writeTo(final StreamOutput out) throws IOException {
             super.writeTo(Objects.requireNonNull(out));

+ 0 - 5
server/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationActionTests.java

@@ -1210,11 +1210,6 @@ public class TransportReplicationActionTests extends ESTestCase {
             super.writeTo(out);
         }
 
-        @Override
-        public void readFrom(StreamInput in) throws IOException {
-            throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
-        }
-
         @Override
         public void onRetry() {
             super.onRetry();

+ 0 - 5
x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/bulk/BulkShardOperationsRequest.java

@@ -50,11 +50,6 @@ public final class BulkShardOperationsRequest extends ReplicatedWriteRequest<Bul
         return maxSeqNoOfUpdatesOrDeletes;
     }
 
-    @Override
-    public void readFrom(final StreamInput in) {
-        throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
-    }
-
     @Override
     public void writeTo(final StreamOutput out) throws IOException {
         super.writeTo(out);