Skip to content

Commit

Permalink
Add more log for testing
Browse files Browse the repository at this point in the history
Signed-off-by: Tianli Feng <ftianli@amazon.com>
  • Loading branch information
Tianli Feng committed Jun 15, 2023
1 parent a81ef5a commit 614c57c
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,7 @@ public void testScrollCreatedOnReplica() throws Exception {
final IndexShard replicaShard = getIndexShard(replica, INDEX_NAME);
final SegmentInfos segmentInfos = replicaShard.getLatestSegmentInfosAndCheckpoint().v1().get();
final Collection<String> snapshottedSegments = segmentInfos.files(false);
logger.info("snapshotted segments: " + snapshottedSegments);
// opens a scrolled query before a flush is called.
// this is for testing scroll segment consistency between refresh and flush
SearchResponse searchResponse = client(replica).prepareSearch()
Expand Down Expand Up @@ -960,14 +961,17 @@ public void testScrollCreatedOnReplica() throws Exception {
scrollHits += searchResponse.getHits().getHits().length;
searchResponse = client(replica).prepareSearchScroll(searchResponse.getScrollId()).setScroll(TimeValue.timeValueDays(1)).get();
assertAllSuccessful(searchResponse);
logger.info("scrollHits: " + scrollHits + ". scroll id: " + searchResponse.getScrollId());
} while (searchResponse.getHits().getHits().length > 0);

List<String> currentFiles = List.of(replicaShard.store().directory().listAll());
logger.info("currentFiles: " + currentFiles);
assertTrue("Files should be preserved", currentFiles.containsAll(snapshottedSegments));

client(replica).prepareClearScroll().addScrollId(searchResponse.getScrollId()).get();

currentFiles = List.of(replicaShard.store().directory().listAll());
logger.info("currentFiles after clearing scroll: " + currentFiles);
assertFalse("Files should be cleaned up post scroll clear request", currentFiles.containsAll(snapshottedSegments));
assertEquals(100, scrollHits);
}
Expand Down

0 comments on commit 614c57c

Please sign in to comment.