99
1010package org .elasticsearch .action .admin .indices .flush ;
1111
12- import org .elasticsearch .TransportVersions ;
1312import org .elasticsearch .action .ActionListener ;
1413import org .elasticsearch .action .ActionType ;
1514import org .elasticsearch .action .support .ActionFilters ;
1817import org .elasticsearch .cluster .action .shard .ShardStateAction ;
1918import org .elasticsearch .cluster .service .ClusterService ;
2019import org .elasticsearch .common .io .stream .StreamInput ;
21- import org .elasticsearch .common .io .stream .StreamOutput ;
2220import org .elasticsearch .common .settings .Settings ;
2321import org .elasticsearch .index .shard .IndexShard ;
24- import org .elasticsearch .index .shard .ShardId ;
2522import org .elasticsearch .indices .IndicesService ;
2623import org .elasticsearch .injection .guice .Inject ;
27- import org .elasticsearch .tasks .Task ;
2824import org .elasticsearch .threadpool .ThreadPool ;
29- import org .elasticsearch .transport .AbstractTransportRequest ;
30- import org .elasticsearch .transport .TransportChannel ;
31- import org .elasticsearch .transport .TransportRequestHandler ;
3225import org .elasticsearch .transport .TransportService ;
3326
3427import java .io .IOException ;
@@ -64,12 +57,6 @@ public TransportShardFlushAction(
6457 PrimaryActionExecution .RejectOnOverload ,
6558 ReplicaActionExecution .SubjectToCircuitBreaker
6659 );
67- transportService .registerRequestHandler (
68- PRE_SYNCED_FLUSH_ACTION_NAME ,
69- threadPool .executor (ThreadPool .Names .FLUSH ),
70- PreShardSyncedFlushRequest ::new ,
71- new PreSyncedFlushTransportHandler (indicesService )
72- );
7360 }
7461
7562 @ Override
@@ -96,43 +83,4 @@ protected void shardOperationOnReplica(ShardFlushRequest request, IndexShard rep
9683 return new ReplicaResult ();
9784 }));
9885 }
99-
100- // TODO: Remove this transition in 9.0
101- private static final String PRE_SYNCED_FLUSH_ACTION_NAME = "internal:indices/flush/synced/pre" ;
102-
103- private static class PreShardSyncedFlushRequest extends AbstractTransportRequest {
104- private final ShardId shardId ;
105-
106- private PreShardSyncedFlushRequest (StreamInput in ) throws IOException {
107- super (in );
108- assert in .getTransportVersion ().before (TransportVersions .V_8_0_0 ) : "received pre_sync request from a new node" ;
109- this .shardId = new ShardId (in );
110- }
111-
112- @ Override
113- public String toString () {
114- return "PreShardSyncedFlushRequest{" + "shardId=" + shardId + '}' ;
115- }
116-
117- @ Override
118- public void writeTo (StreamOutput out ) throws IOException {
119- assert false : "must not send pre_sync request from a new node" ;
120- throw new UnsupportedOperationException ("" );
121- }
122- }
123-
124- private static final class PreSyncedFlushTransportHandler implements TransportRequestHandler <PreShardSyncedFlushRequest > {
125- private final IndicesService indicesService ;
126-
127- PreSyncedFlushTransportHandler (IndicesService indicesService ) {
128- this .indicesService = indicesService ;
129- }
130-
131- @ Override
132- public void messageReceived (PreShardSyncedFlushRequest request , TransportChannel channel , Task task ) {
133- IndexShard indexShard = indicesService .indexServiceSafe (request .shardId .getIndex ()).getShard (request .shardId .id ());
134- indexShard .flush (new FlushRequest ().force (false ).waitIfOngoing (true ));
135- throw new UnsupportedOperationException ("Synced flush was removed and a normal flush was performed instead." );
136- }
137- }
13886}
0 commit comments