Closed navneet1v closed 3 months ago
@navneet1v How does this fix it?
@jmazanec15 so earlier the first Index Writer instance was using no merge policy but the other instance was using a merge policy. So, I ensured we have 1 IW instance.
Second, I simplified the logic for the test. IW on a JVM doesn't get closed till a JVM crashes or an index is marked as readOnly. Hence I fixed the test to be more simplified.
Third: whenever we close the IW, it does a flush and merge on flush is also a setting. But when the merge happened we didn't refresh the IR. Hence to avoid more complication on the IW and IR, I simplified the test logic.
The merge on flushes/IW close is not predictable, and better predictability is required in test to be consistent. Hence I make sure that flow is simple and predictable.
You can confirm the same using logs I provided.
I hope this ans the question.
Description
Fix a flaky unit test:testMultiFieldsKnnIndex, which was failing due to inconsistent merge behaviors
Validated by running a failing seed:
Old Logs:
The log shows that refresh and merges happening multiple times, resulting in 4 files, 2 from old segments and 2 files from new merged segment.
Logs after fix
Related Issues
Resolves https://github.com/opensearch-project/k-NN/issues/1828
Check List
--signoff
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.