Commit 75efb79
committed
Fix flaky DerivedSourceLeafReaderTests
testWithRandomDocuments was flaky due to two issues:
1. NoMergePolicy blocked forceMerge(1), so randomized
IndexWriterConfig settings that caused multiple flushes
resulted in multiple segments instead of the expected one.
2. The test stored _source in the index, but
DerivedSourceStoredFields injects _source via the source
provider then delegates to the underlying stored fields.
This caused the visitor to receive _source twice, with the
second call using Lucene's internal buffer which could
differ from the original bytes.
Fix by removing NoMergePolicy so forceMerge(1) works, and not
storing _source in the index, which matches the production use
case where derived source synthesizes _source from other data.
Signed-off-by: Andrew Ross <andrross@amazon.com>1 parent 23f6f21 commit 75efb79
File tree
1 file changed
+2
-4
lines changed- server/src/test/java/org/opensearch/common/lucene/index
1 file changed
+2
-4
lines changedLines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
146 | 145 | | |
147 | 146 | | |
148 | 147 | | |
149 | | - | |
150 | | - | |
| 148 | + | |
151 | 149 | | |
152 | 150 | | |
153 | 151 | | |
| |||
158 | 156 | | |
159 | 157 | | |
160 | 158 | | |
161 | | - | |
| 159 | + | |
162 | 160 | | |
163 | 161 | | |
164 | 162 | | |
| |||
0 commit comments