|
@@ -189,7 +189,6 @@ public class ReadOnlyEngineTests extends EngineTestCase {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/67232")
|
|
|
public void testForceMergeOnReadOnlyEngine() throws IOException {
|
|
|
IOUtils.close(engine, store);
|
|
|
final AtomicLong globalCheckpoint = new AtomicLong(SequenceNumbers.NO_OPS_PERFORMED);
|
|
@@ -208,15 +207,16 @@ public class ReadOnlyEngineTests extends EngineTestCase {
|
|
|
engine.syncTranslog();
|
|
|
engine.flushAndClose();
|
|
|
numSegments = engine.getLastCommittedSegmentInfos().size();
|
|
|
- assertTrue( numSegments > 1);
|
|
|
}
|
|
|
|
|
|
try (ReadOnlyEngine readOnlyEngine = new ReadOnlyEngine(config, null , null, true, Function.identity(), true)) {
|
|
|
- UnsupportedOperationException exception = expectThrows(UnsupportedOperationException.class,
|
|
|
- () -> readOnlyEngine.forceMerge(
|
|
|
- true, numSegments-1, false, false, false, UUIDs.randomBase64UUID()));
|
|
|
- assertThat(exception.getMessage(), equalTo("force merge is not supported on a read-only engine, " +
|
|
|
- "target max number of segments[" + (numSegments-1) + "], current number of segments[" + numSegments + "]."));
|
|
|
+ if (numSegments > 1) {
|
|
|
+ final int target = between(1, numSegments - 1);
|
|
|
+ UnsupportedOperationException exception = expectThrows(UnsupportedOperationException.class,
|
|
|
+ () -> readOnlyEngine.forceMerge(true, target, false, false, false, UUIDs.randomBase64UUID()));
|
|
|
+ assertThat(exception.getMessage(), equalTo("force merge is not supported on a read-only engine, " +
|
|
|
+ "target max number of segments[" + target + "], current number of segments[" + numSegments + "]."));
|
|
|
+ }
|
|
|
|
|
|
readOnlyEngine.forceMerge(true, ForceMergeRequest.Defaults.MAX_NUM_SEGMENTS,
|
|
|
false, false, false, UUIDs.randomBase64UUID());
|