rpuch commented on code in PR #2450:
URL: https://github.com/apache/ignite-3/pull/2450#discussion_r1301684460
##########
modules/runner/src/testFixtures/java/org/apache/ignite/internal/Cluster.java:
##########
@@ -523,6 +531,74 @@ public void removeNetworkPartitionOf(int nodeIndex) {
LOG.info("Reanimated node " + nodeIndex + " by removing an artificial
network partition");
}
+ /**
+ * Transfers leadsership over a replication group to a node identified by
the given index.
+ *
+ * @param nodeIndex Node index of the new leader.
+ * @param groupId ID of the replication group.
+ * @throws InterruptedException If interrupted while waiting.
+ */
+ public void transferLeadershipTo(int nodeIndex, ReplicationGroupId
groupId) throws InterruptedException {
+ String nodeConsistentId = node(nodeIndex).node().name();
+
+ int maxAttempts = 3;
+
+ for (int attempt = 1; attempt <= maxAttempts; attempt++) {
+ boolean transferred = tryTransferLeadershipTo(nodeConsistentId,
groupId);
+
+ if (transferred) {
+ break;
+ }
+
+ if (attempt < maxAttempts) {
+ LOG.info("Did not transfer leadership after " + attempt + "
attempts, going to retry...");
+ } else {
+ fail("Did not transfer leadership in time after " +
maxAttempts + " attempts");
Review Comment:
It's not a logger call :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]