lokiore commented on code in PR #2128:
URL: https://github.com/apache/phoenix/pull/2128#discussion_r2067501650


##########
phoenix-core/src/it/java/org/apache/phoenix/jdbc/FailoverPhoenixConnection2IT.java:
##########
@@ -470,6 +474,75 @@ public void 
testAllWrappedConnectionsNotClosedAfterStandbyURLChange() throws Exc
         }
     }
 
+    /**
+     * Test connections behaviour when doing 2-step failover.
+     * cluster 1 ( ACTIVE --> ACTIVE_TO_STANDBY --> STANDBY )
+     */
+    @Test(timeout = 300000)
+    public void 
testAllWrappedConnectionsClosedAtRightTimeDuringClusterRoleChange()
+            throws Exception {
+        //Write Some data to ACTIVE cluster
+        Connection connection = createFailoverConnection();
+        Statement statement = connection.createStatement();
+        short numOfRows = 100;
+        for (int i = 0; i < numOfRows; i++) {
+            statement.executeUpdate(String.format("UPSERT INTO %s VALUES(%d, 
1984)", tableName, i));
+        }
+        connection.commit();
+
+        //Creating some connections to ACTIVE cluster
+        short numberOfConnections = 10;
+        //Create FailoverPhoenixConnections with default urls
+        List<Connection> connectionList = new ArrayList<>(numberOfConnections);
+        for (short i = 0; i < numberOfConnections; i++) {
+            connectionList.add(createFailoverConnection());
+        }
+
+        //Transit Role1 ACTIVE --> ACTIVE_TO_STANDBY

Review Comment:
   Thanks, I @shahrs87 I have added one more test for early rollback Active --> 
ATS --> Active which should not affect connections at all



-- 
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]

Reply via email to