ritegarg commented on code in PR #2075:
URL: https://github.com/apache/phoenix/pull/2075#discussion_r1982322651


##########
phoenix-core/src/it/java/org/apache/phoenix/cache/ServerMetadataCacheIT.java:
##########
@@ -138,6 +131,82 @@ private ServerMetadataCacheTestImpl 
getServerMetadataCache() {
         return (ServerMetadataCacheTestImpl)cache;
     }
 
+    /**
+     * This test checks the mutation block enabled feature
+     * 1. Initialize Cache
+     * 2. Create new CRR records with ACTIVE_TO_STANDBY and STANDBY states
+     * 3. Check CRR records are picked up and mutation is blocked
+     * 4. Delete the CRR records
+     * 5. Check now that mutation is NOT blocked
+     * 6. Create CRR records again with ACTIVE and STANDBY states
+     * 7. Check now that mutation is NOT blocked
+     * 8. Update CRR records with ACTIVE_TO_STANDBY and STANDBY states
+     * 9. Check new CRR records mutation is blocked
+     * 10. Delete the CRRs
+     * 11. Check now that mutation is NOT blocked
+     *
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testCacheForMutationBlockEnabled() throws Exception {
+        PhoenixHAAdmin haAdmin = new PhoenixHAAdmin(config);
+        ServerMetadataCacheTestImpl cache = getServerMetadataCache();;
+
+        ClusterRoleRecord crr1 = new ClusterRoleRecord("failover",
+                HighAvailabilityPolicy.FAILOVER, haAdmin.getZkUrl(), 
ClusterRoleRecord.ClusterRole.ACTIVE_TO_STANDBY,
+                "random-zk-url", ClusterRoleRecord.ClusterRole.STANDBY, 2L);
+        ClusterRoleRecord crr2 = new ClusterRoleRecord("parallel",
+                HighAvailabilityPolicy.PARALLEL, haAdmin.getZkUrl(), 
ClusterRoleRecord.ClusterRole.ACTIVE,
+                "random-zk-url", ClusterRoleRecord.ClusterRole.STANDBY, 2L);
+        haAdmin.createOrUpdateDataOnZookeeper(crr1);
+        haAdmin.createOrUpdateDataOnZookeeper(crr2);
+
+        Thread.sleep(1000L);

Review Comment:
   It takes a while to get the event from ZK triggered. For all my testing this 
has worked. I have put this in a variable so that it can be adjusted if needed



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