@@ -119,63 +119,55 @@ protected void doExecute(Task task, Request request, ActionListener<ReplicationR
119
119
}
120
120
121
121
final void backgroundSync (ShardId shardId , String primaryAllocationId , long primaryTerm , RetentionLeases retentionLeases ) {
122
- try {
123
- SystemSubject .getInstance ().runAs (() -> {
124
- final Request request = new Request (shardId , retentionLeases );
125
- final ReplicationTask task = (ReplicationTask ) taskManager .register (
126
- "transport" ,
127
- "retention_lease_background_sync" ,
128
- request
129
- );
130
- transportService .sendChildRequest (
131
- clusterService .localNode (),
132
- transportPrimaryAction ,
133
- new ConcreteShardRequest <>(request , primaryAllocationId , primaryTerm ),
134
- task ,
135
- transportOptions ,
136
- new TransportResponseHandler <ReplicationResponse >() {
137
- @ Override
138
- public ReplicationResponse read (StreamInput in ) throws IOException {
139
- return newResponseInstance (in );
140
- }
122
+ SystemSubject .getInstance ().runAs (() -> {
123
+ final Request request = new Request (shardId , retentionLeases );
124
+ final ReplicationTask task = (ReplicationTask ) taskManager .register ("transport" , "retention_lease_background_sync" , request );
125
+ transportService .sendChildRequest (
126
+ clusterService .localNode (),
127
+ transportPrimaryAction ,
128
+ new ConcreteShardRequest <>(request , primaryAllocationId , primaryTerm ),
129
+ task ,
130
+ transportOptions ,
131
+ new TransportResponseHandler <ReplicationResponse >() {
132
+ @ Override
133
+ public ReplicationResponse read (StreamInput in ) throws IOException {
134
+ return newResponseInstance (in );
135
+ }
141
136
142
- @ Override
143
- public String executor () {
144
- return ThreadPool .Names .SAME ;
145
- }
137
+ @ Override
138
+ public String executor () {
139
+ return ThreadPool .Names .SAME ;
140
+ }
146
141
147
- @ Override
148
- public void handleResponse (ReplicationResponse response ) {
149
- task .setPhase ("finished" );
150
- taskManager .unregister (task );
151
- }
142
+ @ Override
143
+ public void handleResponse (ReplicationResponse response ) {
144
+ task .setPhase ("finished" );
145
+ taskManager .unregister (task );
146
+ }
152
147
153
- @ Override
154
- public void handleException (TransportException e ) {
155
- task .setPhase ("finished" );
156
- taskManager .unregister (task );
157
- if (ExceptionsHelper .unwrap (e , NodeClosedException .class ) != null ) {
158
- // node shutting down
159
- return ;
160
- }
161
- if (ExceptionsHelper .unwrap (
162
- e ,
163
- IndexNotFoundException .class ,
164
- AlreadyClosedException .class ,
165
- IndexShardClosedException .class
166
- ) != null ) {
167
- // the index was deleted or the shard is closed
168
- return ;
169
- }
170
- getLogger ().warn (new ParameterizedMessage ("{} retention lease background sync failed" , shardId ), e );
148
+ @ Override
149
+ public void handleException (TransportException e ) {
150
+ task .setPhase ("finished" );
151
+ taskManager .unregister (task );
152
+ if (ExceptionsHelper .unwrap (e , NodeClosedException .class ) != null ) {
153
+ // node shutting down
154
+ return ;
155
+ }
156
+ if (ExceptionsHelper .unwrap (
157
+ e ,
158
+ IndexNotFoundException .class ,
159
+ AlreadyClosedException .class ,
160
+ IndexShardClosedException .class
161
+ ) != null ) {
162
+ // the index was deleted or the shard is closed
163
+ return ;
171
164
}
165
+ getLogger ().warn (new ParameterizedMessage ("{} retention lease background sync failed" , shardId ), e );
172
166
}
173
- );
174
- return null ;
175
- });
176
- } catch (Exception e ) {
177
- throw new RuntimeException (e );
178
- }
167
+ }
168
+ );
169
+ return null ;
170
+ });
179
171
}
180
172
181
173
@ Override
0 commit comments