@@ -110,8 +110,9 @@ public void testUpdateSegments() throws Exception {
110
110
111
111
engine .refresh ("test" );
112
112
113
- nrtEngine .updateSegments (engine .getLatestSegmentInfos (), engine .getProcessedLocalCheckpoint ());
114
- assertMatchingSegmentsAndCheckpoints (nrtEngine );
113
+ final SegmentInfos latestPrimaryInfos = engine .getLatestSegmentInfos ();
114
+ nrtEngine .updateSegments (latestPrimaryInfos , engine .getProcessedLocalCheckpoint ());
115
+ assertMatchingSegmentsAndCheckpoints (nrtEngine , latestPrimaryInfos );
115
116
116
117
// assert a doc from the operations exists.
117
118
final ParsedDocument parsedDoc = createParsedDoc (operations .stream ().findFirst ().get ().id (), null );
@@ -139,8 +140,9 @@ public void testUpdateSegments() throws Exception {
139
140
);
140
141
}
141
142
142
- nrtEngine .updateSegments (engine .getLastCommittedSegmentInfos (), engine .getProcessedLocalCheckpoint ());
143
- assertMatchingSegmentsAndCheckpoints (nrtEngine );
143
+ final SegmentInfos primaryInfos = engine .getLastCommittedSegmentInfos ();
144
+ nrtEngine .updateSegments (primaryInfos , engine .getProcessedLocalCheckpoint ());
145
+ assertMatchingSegmentsAndCheckpoints (nrtEngine , primaryInfos );
144
146
145
147
assertEquals (
146
148
nrtEngine .getTranslog ().getGeneration ().translogFileGeneration ,
@@ -196,14 +198,14 @@ public void testTrimTranslogOps() throws Exception {
196
198
}
197
199
}
198
200
199
- private void assertMatchingSegmentsAndCheckpoints (NRTReplicationEngine nrtEngine ) throws IOException {
201
+ private void assertMatchingSegmentsAndCheckpoints (NRTReplicationEngine nrtEngine , SegmentInfos expectedSegmentInfos )
202
+ throws IOException {
200
203
assertEquals (engine .getPersistedLocalCheckpoint (), nrtEngine .getPersistedLocalCheckpoint ());
201
204
assertEquals (engine .getProcessedLocalCheckpoint (), nrtEngine .getProcessedLocalCheckpoint ());
202
205
assertEquals (engine .getLocalCheckpointTracker ().getMaxSeqNo (), nrtEngine .getLocalCheckpointTracker ().getMaxSeqNo ());
203
- assertEquals (engine .getLatestSegmentInfos ().files (true ), nrtEngine .getLatestSegmentInfos ().files (true ));
204
- assertEquals (engine .getLatestSegmentInfos ().getUserData (), nrtEngine .getLatestSegmentInfos ().getUserData ());
205
- assertEquals (engine .getLatestSegmentInfos ().getVersion (), nrtEngine .getLatestSegmentInfos ().getVersion ());
206
- assertEquals (engine .segments (true ), nrtEngine .segments (true ));
206
+ assertEquals (expectedSegmentInfos .files (true ), nrtEngine .getLatestSegmentInfos ().files (true ));
207
+ assertEquals (expectedSegmentInfos .getUserData (), nrtEngine .getLatestSegmentInfos ().getUserData ());
208
+ assertEquals (expectedSegmentInfos .getVersion (), nrtEngine .getLatestSegmentInfos ().getVersion ());
207
209
}
208
210
209
211
private void assertSearcherHits (Engine engine , int hits ) {
0 commit comments