Try to renew sync ID if `flush=true` on forceMerge
Today we do a force flush which wipes the sync ID if there is one which can cause the lost of all benefits of the sync ID ie. fast recovery. This commit adds a check to renew the sync ID if possible. The flush call is now also not forced since the IW will show pending changes if the forceMerge added new segments. if we keep using force we will wipe the sync ID even if no renew was actually needed. Closes #17019
This commit is contained in:
parent
be09778dc0
commit
e8152d375e
|
@ -743,7 +743,9 @@ public class InternalEngine extends Engine {
|
|||
indexWriter.forceMerge(maxNumSegments, true /* blocks and waits for merges*/);
|
||||
}
|
||||
if (flush) {
|
||||
flush(true, true);
|
||||
if (tryRenewSyncCommit() == false) {
|
||||
flush(false, true);
|
||||
}
|
||||
}
|
||||
if (upgrade) {
|
||||
logger.info("finished segment upgrade");
|
||||
|
|
|
@ -485,7 +485,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
|
||||
if (flush) {
|
||||
// we should have had just 1 merge, so last generation should be exact
|
||||
assertEquals(gen2 + 1, store.readLastCommittedSegmentsInfo().getLastGeneration());
|
||||
assertEquals(gen2, store.readLastCommittedSegmentsInfo().getLastGeneration());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -843,7 +843,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
Engine.SyncedFlushResult.SUCCESS);
|
||||
assertEquals(3, engine.segments(false).size());
|
||||
|
||||
engine.forceMerge(false, 1, false, false, false);
|
||||
engine.forceMerge(forceMergeFlushes, 1, false, false, false);
|
||||
if (forceMergeFlushes == false) {
|
||||
engine.refresh("make all segments visible");
|
||||
assertEquals(4, engine.segments(false).size());
|
||||
|
|
Loading…
Reference in New Issue