ChinmaySKulkarni commented on a change in pull request #710: PHOENIX-5673 : The 
mutation state is silently getting cleared on the …
URL: https://github.com/apache/phoenix/pull/710#discussion_r383448977
 
 

 ##########
 File path: 
phoenix-core/src/test/java/org/apache/phoenix/execute/MutationStateTest.java
 ##########
 @@ -175,4 +185,43 @@ public void testGetMutationBatchList() {
 
     }
 
+    @Test(expected = SQLException.class)
+    public void testPendingMutationsOnDDL() throws Exception {
+        Connection conn = null;
+        PhoenixConnection spy = null;
+        try {
+            Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+            
props.setProperty(QueryServices.PENDING_MUTATIONS_DDL_THROW_ATTRIB, "true");
+            conn = DriverManager.getConnection(getUrl(), props);
+            MutationState mutationState = mock(MutationState.class);
+            when(mutationState.getNumRows()).thenReturn(1);
+
+            spy = spy((PhoenixConnection) conn);
+
+            // Create a connection with mutation state and mock it
+            doReturn(mutationState).when(spy).getMutationState();
+            spy.createStatement().execute("create table MUTATION_TEST1"
+                    + "( id1 UNSIGNED_INT not null primary key," + "appId1 
VARCHAR)");
+
+        } finally {
+            if (spy != null) {
+                spy.close();
+            }
+        }
+    }
+
+    @Test
+    public void testNoPendingMutationsOnDDL() throws Exception {
+        Connection conn = null;
+        try {
+            conn = DriverManager.getConnection(getUrl());
+            conn.createStatement().execute("create table MUTATION_TEST1"
 
 Review comment:
   Same comment about adding try-with-resources for the connection

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to