-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Flaky - testForceMergeWithSoftDeletesRetentionAndRecoverySource #5364 #11494
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1822,8 +1822,8 @@ public void testForceMergeWithSoftDeletesRetentionAndRecoverySource() throws Exc | |
) | ||
) { | ||
int numDocs = scaledRandomIntBetween(10, 100); | ||
boolean useRecoverySource = randomBoolean() || omitSourceAllTheTime; | ||
for (int i = 0; i < numDocs; i++) { | ||
boolean useRecoverySource = randomBoolean() || omitSourceAllTheTime; | ||
ParsedDocument doc = testParsedDocument(Integer.toString(i), null, testDocument(), B_1, null, useRecoverySource); | ||
engine.index(indexForDoc(doc)); | ||
liveDocs.add(doc.id()); | ||
|
@@ -1832,14 +1832,14 @@ public void testForceMergeWithSoftDeletesRetentionAndRecoverySource() throws Exc | |
} | ||
} | ||
for (int i = 0; i < numDocs; i++) { | ||
boolean useRecoverySource = randomBoolean() || omitSourceAllTheTime; | ||
ParsedDocument doc = testParsedDocument(Integer.toString(i), null, testDocument(), B_1, null, useRecoverySource); | ||
if (randomBoolean()) { | ||
boolean isDeleted = randomBoolean(); | ||
if (isDeleted) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean that if |
||
engine.delete(new Engine.Delete(doc.id(), newUid(doc.id()), primaryTerm.get())); | ||
liveDocs.remove(doc.id()); | ||
liveDocsWithSource.remove(doc.id()); | ||
} | ||
if (randomBoolean()) { | ||
if (isDeleted) { | ||
engine.index(indexForDoc(doc)); | ||
liveDocs.add(doc.id()); | ||
if (useRecoverySource == false) { | ||
|
@@ -1848,9 +1848,8 @@ public void testForceMergeWithSoftDeletesRetentionAndRecoverySource() throws Exc | |
liveDocsWithSource.remove(doc.id()); | ||
} | ||
} | ||
if (randomBoolean()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why remove the if condition? |
||
engine.flush(randomBoolean(), true); | ||
} | ||
engine.flush(randomBoolean(), true); | ||
|
||
} | ||
engine.flush(); | ||
globalCheckpoint.set(randomLongBetween(0, engine.getPersistedLocalCheckpoint())); | ||
|
@@ -1896,7 +1895,6 @@ public void testForceMergeWithSoftDeletesRetentionAndRecoverySource() throws Exc | |
numSegments = searcher.getDirectoryReader().leaves().size(); | ||
} | ||
if (numSegments == 1) { | ||
boolean useRecoverySource = randomBoolean() || omitSourceAllTheTime; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
ParsedDocument doc = testParsedDocument("dummy", null, testDocument(), B_1, null, useRecoverySource); | ||
engine.index(indexForDoc(doc)); | ||
if (useRecoverySource == false) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the
useRecoverySource
flag out of the for loop makes every document has same flag, the randomness is lost, I think we need to keep the randomness in order to cover different cases.