diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java index d345578c7de6e..d7dbe200d9520 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java @@ -969,6 +969,7 @@ public void testScrollCreatedOnReplica() throws Exception { final IndexShard replicaShard = getIndexShard(replica, INDEX_NAME); final SegmentInfos segmentInfos = replicaShard.getLatestSegmentInfosAndCheckpoint().v1().get(); final Collection 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() @@ -982,8 +983,10 @@ public void testScrollCreatedOnReplica() throws Exception { .setScroll(TimeValue.timeValueDays(1)) .get(); + logger.info("before flush"); // force call flush flush(INDEX_NAME); + logger.info("after flush"); for (int i = 3; i < 50; i++) { client().prepareDelete(INDEX_NAME, String.valueOf(i)).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE).get(); @@ -1014,14 +1017,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 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); } diff --git a/server/src/main/java/org/opensearch/index/store/Store.java b/server/src/main/java/org/opensearch/index/store/Store.java index 8967100d4faf0..610dafc4832a1 100644 --- a/server/src/main/java/org/opensearch/index/store/Store.java +++ b/server/src/main/java/org/opensearch/index/store/Store.java @@ -990,6 +990,7 @@ public void close() { public void deleteFile(String msg, String name) throws IOException { deletesLogger.trace("{}: delete file {}", msg, name); super.deleteFile(name); + deletesLogger.info("{}: delete file {}", msg, name); } @Override