@@ -99,6 +99,10 @@ protected boolean accumulateExceptions() {
99
99
return true ;
100
100
}
101
101
102
+ protected boolean ignoreException (Throwable t ) {
103
+ return false ;
104
+ }
105
+
102
106
protected boolean ignoreNonActiveExceptions () {
103
107
return false ;
104
108
}
@@ -267,13 +271,15 @@ void performOperation(final ShardIterator shardIt, final ShardRouting shard, boo
267
271
@ SuppressWarnings ({"unchecked" }) void onOperation (@ Nullable ShardRouting shard , final ShardIterator shardIt , Throwable t ) {
268
272
ShardRouting nextShard = shardIt .nextOrNull ();
269
273
if (nextShard != null ) {
270
- // trace log this exception
271
- if (logger .isTraceEnabled ()) {
272
- if (t != null ) {
273
- if (shard != null ) {
274
- logger .trace (shard .shortSummary () + ": Failed to execute [" + request + "]" , t );
275
- } else {
276
- logger .trace (shardIt .shardId () + ": Failed to execute [" + request + "]" , t );
274
+ if (t != null ) {
275
+ // trace log this exception
276
+ if (logger .isTraceEnabled ()) {
277
+ if (!ignoreException (t )) {
278
+ if (shard != null ) {
279
+ logger .trace (shard .shortSummary () + ": Failed to execute [" + request + "]" , t );
280
+ } else {
281
+ logger .trace (shardIt .shardId () + ": Failed to execute [" + request + "]" , t );
282
+ }
277
283
}
278
284
}
279
285
}
@@ -286,10 +292,12 @@ void performOperation(final ShardIterator shardIt, final ShardRouting shard, boo
286
292
// e is null when there is no next active....
287
293
if (logger .isDebugEnabled ()) {
288
294
if (t != null ) {
289
- if (shard != null ) {
290
- logger .debug (shard .shortSummary () + ": Failed to execute [" + request + "]" , t );
291
- } else {
292
- logger .debug (shardIt .shardId () + ": Failed to execute [" + request + "]" , t );
295
+ if (!ignoreException (t )) {
296
+ if (shard != null ) {
297
+ logger .debug (shard .shortSummary () + ": Failed to execute [" + request + "]" , t );
298
+ } else {
299
+ logger .debug (shardIt .shardId () + ": Failed to execute [" + request + "]" , t );
300
+ }
293
301
}
294
302
}
295
303
}
@@ -300,8 +308,14 @@ void performOperation(final ShardIterator shardIt, final ShardRouting shard, boo
300
308
if (!ignoreNonActiveExceptions ()) {
301
309
t = new BroadcastShardOperationFailedException (shardIt .shardId (), "No active shard(s)" );
302
310
}
303
- } else if (!(t instanceof BroadcastShardOperationFailedException )) {
304
- t = new BroadcastShardOperationFailedException (shardIt .shardId (), t );
311
+ } else {
312
+ if (ignoreException (t )) {
313
+ t = null ;
314
+ } else {
315
+ if (!(t instanceof BroadcastShardOperationFailedException )) {
316
+ t = new BroadcastShardOperationFailedException (shardIt .shardId (), t );
317
+ }
318
+ }
305
319
}
306
320
shardsResponses .set (index , t );
307
321
}
0 commit comments