Skip to content

Commit

Permalink
Address review comments & mute breaking bwc-test
Browse files Browse the repository at this point in the history
Signed-off-by: Suraj Singh <surajrider@gmail.com>
  • Loading branch information
dreamer-89 committed Jul 10, 2023
1 parent bd015d1 commit b84762d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ public void testIndexing() throws IOException, ParseException {
*
* @throws Exception
*/
@AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/8322")
public void testIndexingWithSegRep() throws Exception {
if (UPGRADE_FROM_VERSION.before(Version.V_2_4_0)) {
logger.info("--> Skip test for version {} where segment replication feature is not available", UPGRADE_FROM_VERSION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public synchronized void sendFiles(GetSegmentFilesRequest request, ActionListene
// Short circuit when no files to transfer
if (request.getFilesToFetch().isEmpty()) {
// before completion, alert the primary of the replica's state.
this.updateVisibleCheckpointForShard(request.getTargetAllocationId(), copyState.getCheckpoint());
shard.updateVisibleCheckpointForShard(request.getTargetAllocationId(), copyState.getCheckpoint());
listener.onResponse(new GetSegmentFilesResponse(Collections.emptyList()));
return;
}
Expand Down Expand Up @@ -169,7 +169,7 @@ public synchronized void sendFiles(GetSegmentFilesRequest request, ActionListene

sendFileStep.whenComplete(r -> {
try {
this.updateVisibleCheckpointForShard(allocationId, copyState.getCheckpoint());
shard.updateVisibleCheckpointForShard(allocationId, copyState.getCheckpoint());
future.onResponse(new GetSegmentFilesResponse(List.of(storeFileMetadata)));
} finally {
IOUtils.close(resources);
Expand All @@ -187,15 +187,6 @@ public synchronized void sendFiles(GetSegmentFilesRequest request, ActionListene
}
}

// Update target replication checkpoint on source for node-node communication. For remote store enabled indices, checkpoint
// update on source is performed via separate UPDATE_VISIBLE_CHECKPOINT transport call
private void updateVisibleCheckpointForShard(String allocationId, ReplicationCheckpoint replicationCheckpoint) {
if (shard.indexSettings().isRemoteStoreEnabled() == false) {
// update visible checkpoint to primary
shard.updateVisibleCheckpointForShard(allocationId, replicationCheckpoint);
}
}

/**
* Cancels the replication and interrupts all eligible threads.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,13 @@ public void testReplicationAlreadyRunning() throws IOException {
1
);

final List<StoreFileMetadata> expectedFiles = List.of(new StoreFileMetadata("_0.si", 20, "test", Version.CURRENT.luceneVersion));

final GetSegmentFilesRequest getSegmentFilesRequest = new GetSegmentFilesRequest(
1L,
replica.routingEntry().allocationId().getId(),
replicaDiscoveryNode,
Collections.emptyList(),
expectedFiles,
latestReplicationCheckpoint
);

Expand All @@ -224,11 +226,12 @@ public void testCancelReplication() throws IOException, InterruptedException {
1
);

final List<StoreFileMetadata> expectedFiles = List.of(new StoreFileMetadata("_0.si", 20, "test", Version.CURRENT.luceneVersion));
final GetSegmentFilesRequest getSegmentFilesRequest = new GetSegmentFilesRequest(
1L,
replica.routingEntry().allocationId().getId(),
replicaDiscoveryNode,
Collections.emptyList(),
expectedFiles,
latestReplicationCheckpoint
);

Expand Down

0 comments on commit b84762d

Please sign in to comment.