52
52
53
53
class LuceneIndexScrubbingTest extends FDBLuceneTestBase {
54
54
55
- TestingIndexMaintainerRegistry registry ;
55
+ private TestingIndexMaintainerRegistry registry ;
56
+ private boolean flipBoolean = false ;
56
57
57
58
@ BeforeEach
58
59
public void beforeEach () {
@@ -65,13 +66,18 @@ private void rebuildIndexMetaData(final FDBRecordContext context, final String d
65
66
this .planner = pair .getRight ();
66
67
}
67
68
68
- public static Stream <Arguments > threeBooleanArgs () {
69
+ private static Stream <Arguments > threeBooleanArgs () {
69
70
return Stream .of (false , true )
70
71
.flatMap (isSynthetic -> Stream .of (false , true )
71
72
.flatMap (isPartitioned -> Stream .of (false , true )
72
73
.map (isGrouped -> Arguments .of (isSynthetic , isGrouped , isPartitioned ))));
73
74
}
74
75
76
+ private boolean yinYang () {
77
+ flipBoolean = !flipBoolean ;
78
+ return flipBoolean ;
79
+ }
80
+
75
81
@ Nonnull
76
82
protected FDBRecordStore .Builder getStoreBuilderWithRegistry (@ Nonnull FDBRecordContext context ,
77
83
@ Nonnull RecordMetaDataProvider metaData ,
@@ -91,10 +97,8 @@ void luceneIndexScrubMissingDataModelNoIssues(boolean isSynthetic, boolean isGro
91
97
.setPartitionHighWatermark (isPartitioned ? 5 : 0 )
92
98
.build ();
93
99
94
- boolean flipFlop = false ;
95
100
for (int i = 0 ; i < 14 ; i ++) {
96
- dataModel .setReverseSaveOrder (flipFlop );
97
- flipFlop = !flipFlop ;
101
+ dataModel .setReverseSaveOrder (yinYang ());
98
102
try (final FDBRecordContext context = openContext ()) {
99
103
dataModel .saveRecords (7 , context , i / 6 );
100
104
context .commit ();
@@ -108,6 +112,7 @@ void luceneIndexScrubMissingDataModelNoIssues(boolean isSynthetic, boolean isGro
108
112
109
113
try (final FDBRecordContext context = openContext ()) {
110
114
dataModel .explicitMergeIndex (context , timer );
115
+ context .commit ();
111
116
}
112
117
try (final FDBRecordContext context = openContext ()) {
113
118
FDBRecordStore store = dataModel .createOrOpenRecordStore (context );
@@ -176,39 +181,36 @@ void luceneIndexScrubMissingDataModel(boolean isSynthetic, boolean isGrouped, bo
176
181
.setPartitionHighWatermark (isPartitioned ? 5 : 0 )
177
182
.build ();
178
183
179
- try (final FDBRecordContext context = openContext ()) {
180
- context .commit ();
181
- }
182
-
183
184
final InjectedFailureRepository injectedFailures = new InjectedFailureRepository ();
184
185
registry .overrideFactory (new MockedLuceneIndexMaintainerFactory (injectedFailures ));
185
186
186
- boolean flipFlop = false ;
187
187
for (int i = 0 ; i < 14 ; i ++) {
188
- dataModel .setReverseSaveOrder (flipFlop );
189
- flipFlop = !flipFlop ;
188
+ dataModel .setReverseSaveOrder (yinYang ());
190
189
try (final FDBRecordContext context = openContext ()) {
191
190
dataModel .saveRecords (7 , context , i / 6 );
192
191
context .commit ();
193
192
}
194
193
}
195
- try (FDBRecordContext context = openContext ()) {
196
- final FDBRecordStore recordStore = dataModel .createOrOpenRecordStore (context );
197
- dataModel .sampleRecordsUnderTest ().forEach (sampleRecord -> sampleRecord .deleteRecord (recordStore ).join ());
198
- context .commit ();
199
- }
200
194
201
195
try (final FDBRecordContext context = openContext ()) {
202
196
dataModel .explicitMergeIndex (context , timer );
197
+ context .commit ();
203
198
}
204
199
205
200
try (final FDBRecordContext context = openContext ()) {
206
201
// Write some documents
207
202
dataModel .saveRecordsToAllGroups (7 , context );
203
+ context .commit ();
208
204
}
209
205
206
+ try (FDBRecordContext context = openContext ()) {
207
+ final FDBRecordStore recordStore = dataModel .createOrOpenRecordStore (context );
208
+ dataModel .sampleRecordsUnderTest ().forEach (sampleRecord -> sampleRecord .deleteRecord (recordStore ).join ());
209
+ context .commit ();
210
+ }
210
211
try (final FDBRecordContext context = openContext ()) {
211
212
dataModel .explicitMergeIndex (context , timer );
213
+ context .commit ();
212
214
}
213
215
214
216
try (final FDBRecordContext context = openContext ()) {
@@ -229,6 +231,7 @@ void luceneIndexScrubMissingDataModel(boolean isSynthetic, boolean isGrouped, bo
229
231
230
232
try (final FDBRecordContext context = openContext ()) {
231
233
dataModel .explicitMergeIndex (context , timer );
234
+ context .commit ();
232
235
}
233
236
234
237
try (final FDBRecordContext context = openContext ()) {
0 commit comments