Skip to content

Commit c57ea79

Browse files
committed
Fix recovery last access and routing diff test
Signed-off-by: Max Lepikhin <[email protected]>
1 parent 4263de5 commit c57ea79

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

server/src/main/java/org/opensearch/indices/replication/common/ReplicationTarget.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,10 @@ public ActionListener<Void> createOrFinishListener(
224224
listener = voidListener;
225225
}
226226

227+
// Only touch last access when we will actually handle the request (i.e., not a duplicate replay)
228+
if (listener != null) {
229+
setLastAccessTime();
230+
}
227231
return listener;
228232
}
229233

server/src/test/java/org/opensearch/cluster/routing/remote/RemoteRoutingTableServiceTests.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -573,13 +573,11 @@ public void testGetAsyncIndexRoutingReadAction() throws Exception {
573573
compressor,
574574
Version.CURRENT
575575
);
576-
when(blobContainer.readBlob(indexName)).thenReturn(
577-
remoteIndexRoutingTable.indexRoutingTableFormat.serialize(
578-
clusterState.getRoutingTable().getIndicesRouting().get(indexName),
579-
uploadedFileName,
580-
compressor
581-
).streamInput()
582-
);
576+
when(blobContainer.readBlob(indexName)).thenAnswer(invocation -> remoteIndexRoutingTable.indexRoutingTableFormat.serialize(
577+
clusterState.getRoutingTable().getIndicesRouting().get(indexName),
578+
uploadedFileName,
579+
compressor
580+
).streamInput());
583581
TestCapturingListener<IndexRoutingTable> listener = new TestCapturingListener<>();
584582
CountDownLatch latch = new CountDownLatch(1);
585583

@@ -611,8 +609,8 @@ public void testGetAsyncIndexRoutingTableDiffReadAction() throws Exception {
611609
compressor,
612610
Version.CURRENT
613611
);
614-
when(blobContainer.readBlob(indexName)).thenReturn(
615-
remoteRoutingTableDiff.remoteRoutingTableDiffFormat.serialize(diff, uploadedFileName, compressor).streamInput()
612+
when(blobContainer.readBlob(indexName)).thenAnswer(
613+
invocation -> remoteRoutingTableDiff.remoteRoutingTableDiffFormat.serialize(diff, uploadedFileName, compressor).streamInput()
616614
);
617615

618616
TestCapturingListener<Diff<RoutingTable>> listener = new TestCapturingListener<>();

0 commit comments

Comments
 (0)