40
40
import org .apache .logging .log4j .core .LogEvent ;
41
41
import org .apache .logging .log4j .core .appender .AbstractAppender ;
42
42
import org .apache .logging .log4j .core .filter .RegexFilter ;
43
- import org .apache .lucene .codecs .LiveDocsFormat ;
44
43
import org .apache .lucene .document .Field ;
45
44
import org .apache .lucene .document .KeywordField ;
46
45
import org .apache .lucene .document .LongPoint ;
@@ -3237,22 +3236,10 @@ public void testUnreferencedFileCleanUpOnSegmentMergeFailureWithCleanUpEnabled()
3237
3236
MockDirectoryWrapper wrapper = newMockDirectory ();
3238
3237
final CountDownLatch cleanupCompleted = new CountDownLatch (1 );
3239
3238
MockDirectoryWrapper .Failure fail = new MockDirectoryWrapper .Failure () {
3240
- public boolean didFail1 ;
3241
- public boolean didFail2 ;
3242
-
3243
3239
@ Override
3244
3240
public void eval (MockDirectoryWrapper dir ) throws IOException {
3245
- if (!doFail ) {
3246
- return ;
3247
- }
3248
-
3249
- // Fail segment merge with diskfull during merging terms.
3250
- if (callStackContainsAnyOf ("mergeTerms" ) && !didFail1 ) {
3251
- didFail1 = true ;
3252
- throw new IOException ("No space left on device" );
3253
- }
3254
- if (callStackContains (LiveDocsFormat .class , "writeLiveDocs" ) && !didFail2 ) {
3255
- didFail2 = true ;
3241
+ // Fail segment merge with diskfull during merging terms
3242
+ if (callStackContainsAnyOf ("mergeTerms" )) {
3256
3243
throw new IOException ("No space left on device" );
3257
3244
}
3258
3245
}
@@ -3325,7 +3312,6 @@ public void onFailedEngine(String reason, Exception e) {
3325
3312
segments = engine .segments (false );
3326
3313
assertThat (segments .size (), equalTo (2 ));
3327
3314
3328
- fail .setDoFail ();
3329
3315
// IndexWriter can throw either IOException or IllegalStateException depending on whether tragedy is set or not.
3330
3316
expectThrowsAnyOf (
3331
3317
Arrays .asList (IOException .class , IllegalStateException .class ),
@@ -3345,20 +3331,10 @@ public void testUnreferencedFileCleanUpOnSegmentMergeFailureWithCleanUpDisabled(
3345
3331
MockDirectoryWrapper wrapper = newMockDirectory ();
3346
3332
final CountDownLatch cleanupCompleted = new CountDownLatch (1 );
3347
3333
MockDirectoryWrapper .Failure fail = new MockDirectoryWrapper .Failure () {
3348
- public boolean didFail1 ;
3349
- public boolean didFail2 ;
3350
3334
3351
3335
@ Override
3352
3336
public void eval (MockDirectoryWrapper dir ) throws IOException {
3353
- if (!doFail ) {
3354
- return ;
3355
- }
3356
- if (callStackContainsAnyOf ("mergeTerms" ) && !didFail1 ) {
3357
- didFail1 = true ;
3358
- throw new IOException ("No space left on device" );
3359
- }
3360
- if (callStackContains (LiveDocsFormat .class , "writeLiveDocs" ) && !didFail2 ) {
3361
- didFail2 = true ;
3337
+ if (callStackContainsAnyOf ("mergeTerms" )) {
3362
3338
throw new IOException ("No space left on device" );
3363
3339
}
3364
3340
}
@@ -3439,7 +3415,6 @@ public void onFailedEngine(String reason, Exception e) {
3439
3415
segments = engine .segments (false );
3440
3416
assertThat (segments .size (), equalTo (2 ));
3441
3417
3442
- fail .setDoFail ();
3443
3418
// IndexWriter can throw either IOException or IllegalStateException depending on whether tragedy is set or not.
3444
3419
expectThrowsAnyOf (
3445
3420
Arrays .asList (IOException .class , IllegalStateException .class ),
@@ -3459,20 +3434,10 @@ public void testUnreferencedFileCleanUpFailsOnSegmentMergeFailureWhenDirectoryCl
3459
3434
MockDirectoryWrapper wrapper = newMockDirectory ();
3460
3435
final CountDownLatch cleanupCompleted = new CountDownLatch (1 );
3461
3436
MockDirectoryWrapper .Failure fail = new MockDirectoryWrapper .Failure () {
3462
- public boolean didFail1 ;
3463
- public boolean didFail2 ;
3464
3437
3465
3438
@ Override
3466
3439
public void eval (MockDirectoryWrapper dir ) throws IOException {
3467
- if (!doFail ) {
3468
- return ;
3469
- }
3470
- if (callStackContainsAnyOf ("mergeTerms" ) && !didFail1 ) {
3471
- didFail1 = true ;
3472
- throw new IOException ("No space left on device" );
3473
- }
3474
- if (callStackContains (LiveDocsFormat .class , "writeLiveDocs" ) && !didFail2 ) {
3475
- didFail2 = true ;
3440
+ if (callStackContainsAnyOf ("mergeTerms" )) {
3476
3441
throw new IOException ("No space left on device" );
3477
3442
}
3478
3443
}
@@ -3537,7 +3502,6 @@ public void onFailedEngine(String reason, Exception e) {
3537
3502
segments = engine .segments (false );
3538
3503
assertThat (segments .size (), equalTo (2 ));
3539
3504
3540
- fail .setDoFail ();
3541
3505
// Close the store so that unreferenced file cleanup will fail.
3542
3506
store .close ();
3543
3507
0 commit comments