Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

import java.io.IOException;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicLong;
Expand Down Expand Up @@ -347,7 +348,10 @@

// if we received a checkpoint during the copy event that is ahead of this
// try and process it.
processLatestReceivedCheckpoint(replicaShard, thread);
ReplicationCheckpoint latestReceivedCheckpoint = replicator.getPrimaryCheckpoint(replicaShard.shardId());
if (Objects.nonNull(latestReceivedCheckpoint) && latestReceivedCheckpoint.isAheadOf(receivedCheckpoint)) {
processLatestReceivedCheckpoint(replicaShard, thread);

Check warning on line 353 in server/src/main/java/org/opensearch/indices/replication/SegmentReplicationTargetService.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/indices/replication/SegmentReplicationTargetService.java#L353

Added line #L353 was not covered by tests
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@ public void testStartReplicationListenerSuccess() throws InterruptedException {

latch.await(2, TimeUnit.SECONDS);
verify(spy, (atLeastOnce())).updateVisibleCheckpoint(eq(0L), eq(replicaShard));
verify(spy, times(1)).processLatestReceivedCheckpoint(any(), any());
}

public void testStartReplicationListenerFailure() throws InterruptedException {
Expand Down Expand Up @@ -851,4 +852,5 @@ public void testProcessCheckpointOnClusterStateUpdate() {
spy.clusterChanged(new ClusterChangedEvent("ignored", oldState, newState));
verify(spy, times(1)).processLatestReceivedCheckpoint(eq(replicaShard), any());
}

}
Loading