You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "lokiore (via GitHub)" <gi...@apache.org> on 2025/04/24 19:27:10 UTC

[PR] PHOENIX-7586 :- Handle Role transitions for ActiveToStanby role in Failover HAPolicy [phoenix]

lokiore opened a new pull request, #2128:
URL: https://github.com/apache/phoenix/pull/2128

   (no comment)


-- 
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: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] PHOENIX-7586 :- Handle Role transitions for ActiveToStanby role in Failover HAPolicy [phoenix]

Posted by "lokiore (via GitHub)" <gi...@apache.org>.
lokiore merged PR #2128:
URL: https://github.com/apache/phoenix/pull/2128


-- 
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: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] PHOENIX-7586 :- Handle Role transitions for ActiveToStanby role in Failover HAPolicy [phoenix]

Posted by "shahrs87 (via GitHub)" <gi...@apache.org>.
shahrs87 commented on code in PR #2128:
URL: https://github.com/apache/phoenix/pull/2128#discussion_r2067458715


##########
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:
   I would just add one more test case: Check when  we transition a cluster from ATS --> Active. It should not close any connections in this case also.



-- 
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: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] PHOENIX-7586 :- Handle Role transitions for ActiveToStanby role in Failover HAPolicy [phoenix]

Posted by "shahrs87 (via GitHub)" <gi...@apache.org>.
shahrs87 commented on code in PR #2128:
URL: https://github.com/apache/phoenix/pull/2128#discussion_r2065060172


##########
phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/HighAvailabilityPolicy.java:
##########
@@ -47,6 +48,23 @@ public Connection provide(HighAvailabilityGroup haGroup, Properties info,
             return new FailoverPhoenixConnection(context);
         }
 
+        /**
+         * Cluster Role Transitions for Failover High Availability Policy, Here we are trying to
+         * close connections late to allow existing reads to continue during Failover.
+         * ACTIVE --> ACTIVE_TO_STANDBY (Doing Nothing as we are in process of moving the current

Review Comment:
   how about state transition from ACTIVE_TO_STANDBY --> ACTIVE? We will need this to rollback state change from ACTIVE --> ACTIVE_TO_STANDBY.



-- 
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: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] PHOENIX-7586 :- Handle Role transitions for ActiveToStanby role in Failover HAPolicy [phoenix]

Posted by "lokiore (via GitHub)" <gi...@apache.org>.
lokiore commented on code in PR #2128:
URL: https://github.com/apache/phoenix/pull/2128#discussion_r2066988318


##########
phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/HighAvailabilityPolicy.java:
##########
@@ -47,6 +48,23 @@ public Connection provide(HighAvailabilityGroup haGroup, Properties info,
             return new FailoverPhoenixConnection(context);
         }
 
+        /**
+         * Cluster Role Transitions for Failover High Availability Policy, Here we are trying to
+         * close connections late to allow existing reads to continue during Failover.
+         * ACTIVE --> ACTIVE_TO_STANDBY (Doing Nothing as we are in process of moving the current

Review Comment:
   ACTIVE --> ACTIVE_TO_STANDBY is not doing anything here, as we just want to block writes and nothing else, So if we go to ACTIVE_TO_STANDBY then rolling back should be same (nothing required), 
   I see I missed commenting that will add the comment :v:



-- 
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: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] PHOENIX-7586 :- Handle Role transitions for ActiveToStanby role in Failover HAPolicy [phoenix]

Posted by "ritegarg (via GitHub)" <gi...@apache.org>.
ritegarg commented on code in PR #2128:
URL: https://github.com/apache/phoenix/pull/2128#discussion_r2064152813


##########
phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/HighAvailabilityPolicy.java:
##########
@@ -47,6 +48,23 @@ public Connection provide(HighAvailabilityGroup haGroup, Properties info,
             return new FailoverPhoenixConnection(context);
         }
 
+        /**
+         * Cluster Role Transitions for Failover High Availability Policy, Here we are trying to
+         * close connections late to allow existing reads to continue during Failover.
+         * ACTIVE --> ACTIVE_TO_STANDBY (Doing Nothing as we are in process of moving the current
+         *      to STANDBY and at this step we are blocking reads to drain replication this allows

Review Comment:
   Blocking writes



-- 
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: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] PHOENIX-7586 :- Handle Role transitions for ActiveToStanby role in Failover HAPolicy [phoenix]

Posted by "lokiore (via GitHub)" <gi...@apache.org>.
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: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org