|
18 | 18 | import org.opensearch.cluster.routing.allocation.command.MoveAllocationCommand;
|
19 | 19 | import org.opensearch.common.settings.Settings;
|
20 | 20 | import org.opensearch.index.IndexService;
|
| 21 | +import org.opensearch.index.ReplicationStats; |
21 | 22 | import org.opensearch.index.remote.RemoteSegmentStats;
|
22 | 23 | import org.opensearch.index.seqno.RetentionLease;
|
23 | 24 | import org.opensearch.index.seqno.RetentionLeases;
|
@@ -665,6 +666,43 @@ public void testFailoverRemotePrimaryToDocrepReplicaReseedToRemotePrimary() thro
|
665 | 666 | });
|
666 | 667 | }
|
667 | 668 |
|
| 669 | + /* |
| 670 | + Performs the same experiment as testRemotePrimaryDocRepReplica. |
| 671 | +
|
| 672 | + This ensures that the primary shard for the index has moved over to remote |
| 673 | + enabled node whereas the replica copy is still left behind on the docrep nodes |
| 674 | +
|
| 675 | + At this stage, segrep lag computation shouldn't consider the docrep shard copy while calculating bytes lag |
| 676 | + */ |
| 677 | + public void testZeroSegrepLagForShardsWithMixedReplicationGroup() throws Exception { |
| 678 | + testRemotePrimaryDocRepReplica(); |
| 679 | + String remoteNodeName = internalCluster().client() |
| 680 | + .admin() |
| 681 | + .cluster() |
| 682 | + .prepareNodesStats() |
| 683 | + .get() |
| 684 | + .getNodes() |
| 685 | + .stream() |
| 686 | + .filter(nodeStats -> nodeStats.getNode().isRemoteStoreNode()) |
| 687 | + .findFirst() |
| 688 | + .get() |
| 689 | + .getNode() |
| 690 | + .getName(); |
| 691 | + ReplicationStats replicationStats = internalCluster().client() |
| 692 | + .admin() |
| 693 | + .cluster() |
| 694 | + .prepareNodesStats(remoteNodeName) |
| 695 | + .get() |
| 696 | + .getNodes() |
| 697 | + .get(0) |
| 698 | + .getIndices() |
| 699 | + .getSegments() |
| 700 | + .getReplicationStats(); |
| 701 | + assertEquals(0, replicationStats.getMaxBytesBehind()); |
| 702 | + assertEquals(0, replicationStats.getTotalBytesBehind()); |
| 703 | + assertEquals(0, replicationStats.getMaxReplicationLag()); |
| 704 | + } |
| 705 | + |
668 | 706 | private void assertReplicaAndPrimaryConsistency(String indexName, int firstBatch, int secondBatch) throws Exception {
|
669 | 707 | assertBusy(() -> {
|
670 | 708 | Map<ShardRouting, ShardStats> shardStatsMap = internalCluster().client()
|
|
0 commit comments