You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2020/10/30 00:38:49 UTC

[GitHub] [phoenix] ChinmaySKulkarni opened a new pull request #949: PHOENIX-6032: When phoenix.allow.system.catalog.rollback=true, a view still sees data from a column that was dropped

ChinmaySKulkarni opened a new pull request #949:
URL: https://github.com/apache/phoenix/pull/949


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] ChinmaySKulkarni commented on pull request #949: PHOENIX-6032: When phoenix.allow.system.catalog.rollback=true, a view still sees data from a column that was dropped

Posted by GitBox <gi...@apache.org>.
ChinmaySKulkarni commented on pull request #949:
URL: https://github.com/apache/phoenix/pull/949#issuecomment-720785864


   Thanks for your reviews @virajjasani @gjacoby126 I have addressed all your review comments. Can I get a +1?


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] stoty commented on pull request #949: PHOENIX-6032: When phoenix.allow.system.catalog.rollback=true, a view still sees data from a column that was dropped

Posted by GitBox <gi...@apache.org>.
stoty commented on pull request #949:
URL: https://github.com/apache/phoenix/pull/949#issuecomment-719353989


   :broken_heart: **-1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime | Comment |
   |:----:|----------:|--------:|:--------|
   | +0 :ok: |  reexec  |   1m  6s |  Docker mode activated.  |
   ||| _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  No case conflicting files found.  |
   | +1 :green_heart: |  hbaseanti  |   0m  0s |  Patch does not have any anti-patterns.  |
   | +1 :green_heart: |  @author  |   0m  0s |  The patch does not contain any @author tags.  |
   | -1 :x: |  test4tests  |   0m  0s |  The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.  |
   ||| _ 4.x Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |  12m  3s |  4.x passed  |
   | +1 :green_heart: |  compile  |   1m  0s |  4.x passed  |
   | +1 :green_heart: |  checkstyle  |   1m  5s |  4.x passed  |
   | +1 :green_heart: |  javadoc  |   0m 47s |  4.x passed  |
   | +0 :ok: |  spotbugs  |   3m  8s |  phoenix-core in 4.x has 953 extant spotbugs warnings.  |
   ||| _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   6m 16s |  the patch passed  |
   | +1 :green_heart: |  compile  |   0m 58s |  the patch passed  |
   | +1 :green_heart: |  javac  |   0m 58s |  the patch passed  |
   | -1 :x: |  checkstyle  |   1m  5s |  phoenix-core: The patch generated 4 new + 2127 unchanged - 0 fixed = 2131 total (was 2127)  |
   | -1 :x: |  whitespace  |   0m  0s |  The patch 7 line(s) with tabs.  |
   | +1 :green_heart: |  javadoc  |   0m 44s |  the patch passed  |
   | +1 :green_heart: |  spotbugs  |   3m 21s |  the patch passed  |
   ||| _ Other Tests _ |
   | -1 :x: |  unit  | 174m 14s |  phoenix-core in the patch failed.  |
   | +1 :green_heart: |  asflicense  |   0m 29s |  The patch does not generate ASF License warnings.  |
   |  |   | 208m 43s |   |
   
   
   | Subsystem | Report/Notes |
   |----------:|:-------------|
   | Docker | ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-949/2/artifact/yetus-general-check/output/Dockerfile |
   | GITHUB PR | https://github.com/apache/phoenix/pull/949 |
   | JIRA Issue | PHOENIX-6032 |
   | Optional Tests | dupname asflicense javac javadoc unit spotbugs hbaseanti checkstyle compile |
   | uname | Linux b9bf4f9c9ca0 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev/phoenix-personality.sh |
   | git revision | 4.x / 2aaf2e2 |
   | Default Java | Private Build-1.8.0_242-8u242-b08-0ubuntu3~16.04-b08 |
   | checkstyle | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-949/2/artifact/yetus-general-check/output/diff-checkstyle-phoenix-core.txt |
   | whitespace | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-949/2/artifact/yetus-general-check/output/whitespace-tabs.txt |
   | unit | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-949/2/artifact/yetus-general-check/output/patch-unit-phoenix-core.txt |
   |  Test Results | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-949/2/testReport/ |
   | Max. process+thread count | 5842 (vs. ulimit of 30000) |
   | modules | C: phoenix-core U: phoenix-core |
   | Console output | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-949/2/console |
   | versions | git=2.7.4 maven=3.3.9 spotbugs=4.1.3 |
   | Powered by | Apache Yetus 0.12.0 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] ChinmaySKulkarni commented on pull request #949: PHOENIX-6032: When phoenix.allow.system.catalog.rollback=true, a view still sees data from a column that was dropped

Posted by GitBox <gi...@apache.org>.
ChinmaySKulkarni commented on pull request #949:
URL: https://github.com/apache/phoenix/pull/949#issuecomment-719102066


   Please review @yanxinyi @jpisaac @gjacoby126 @twdsilva 


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] ChinmaySKulkarni commented on a change in pull request #949: PHOENIX-6032: When phoenix.allow.system.catalog.rollback=true, a view still sees data from a column that was dropped

Posted by GitBox <gi...@apache.org>.
ChinmaySKulkarni commented on a change in pull request #949:
URL: https://github.com/apache/phoenix/pull/949#discussion_r514753994



##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogRollbackEnabledIT.java
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.RegionLocator;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.schema.ColumnNotFoundException;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.google.common.collect.Maps;
+
+/**
+ * Tests various scenarios when {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK}
+ * is set to true and SYSTEM.CATALOG should not be allowed to split. Note that this config must
+ * be set on both the client and server
+ */
+@Category(NeedsOwnMiniClusterTest.class)
+public class SystemCatalogRollbackEnabledIT extends BaseTest {
+
+	@BeforeClass
+	public static synchronized void doSetup() throws Exception {
+		Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(2);
+		Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(1);
+		serverProps.put(QueryServices.SYSTEM_CATALOG_SPLITTABLE, "false");
+        serverProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK, "true");
+        clientProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK, "true");
+		setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
+                new ReadOnlyProps(clientProps.entrySet().iterator()));
+	}
+
+    private void createTable(String tableName) throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl());
+                Statement stmt = conn.createStatement();) {
+            stmt.execute("DROP TABLE IF EXISTS " + tableName);
+            stmt.execute("CREATE TABLE " + tableName + " (TENANT_ID VARCHAR NOT NULL, " +
+                    "PK1 VARCHAR NOT NULL, V1 VARCHAR CONSTRAINT PK " +
+                    "PRIMARY KEY(TENANT_ID, PK1)) MULTI_TENANT=true");
+            try (Connection tenant1Conn = getTenantConnection("tenant1")) {
+                String view1DDL = "CREATE VIEW " + tableName + "_view1 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            try (Connection tenant1Conn = getTenantConnection("tenant2")) {
+                String view1DDL = "CREATE VIEW " + tableName + "_view2 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            conn.commit();
+        }
+    }
+
+    private Connection getTenantConnection(String tenantId) throws SQLException {
+        Properties tenantProps = new Properties();
+        tenantProps.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
+        return DriverManager.getConnection(getUrl(), tenantProps);
+    }
+
+
+    /**
+     * Make sure that SYSTEM.CATALOG cannot be split if
+     * {@link QueryServices#SYSTEM_CATALOG_SPLITTABLE} is false
+     */
+    @Test
+    public void testSystemTableDoesNotSplit() throws Exception {
+        HBaseTestingUtility testUtil = getUtility();
+        for (int i=0; i<10; i++) {
+            createTable("schema"+i+".table_"+i);
+        }
+        TableName systemCatalog = TableName.valueOf("SYSTEM.CATALOG");
+        RegionLocator rl = testUtil.getConnection().getRegionLocator(systemCatalog);
+        assertEquals(rl.getAllRegionLocations().size(), 1);

Review comment:
       I've copied this from the existing SystemCatalogIT, but will fix it anyways

##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogRollbackEnabledIT.java
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.RegionLocator;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.schema.ColumnNotFoundException;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.google.common.collect.Maps;
+
+/**
+ * Tests various scenarios when {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK}
+ * is set to true and SYSTEM.CATALOG should not be allowed to split. Note that this config must
+ * be set on both the client and server
+ */
+@Category(NeedsOwnMiniClusterTest.class)
+public class SystemCatalogRollbackEnabledIT extends BaseTest {
+
+	@BeforeClass
+	public static synchronized void doSetup() throws Exception {
+		Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(2);
+		Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(1);
+		serverProps.put(QueryServices.SYSTEM_CATALOG_SPLITTABLE, "false");
+        serverProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK, "true");
+        clientProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK, "true");
+		setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
+                new ReadOnlyProps(clientProps.entrySet().iterator()));
+	}
+
+    private void createTable(String tableName) throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl());
+                Statement stmt = conn.createStatement();) {
+            stmt.execute("DROP TABLE IF EXISTS " + tableName);
+            stmt.execute("CREATE TABLE " + tableName + " (TENANT_ID VARCHAR NOT NULL, " +
+                    "PK1 VARCHAR NOT NULL, V1 VARCHAR CONSTRAINT PK " +
+                    "PRIMARY KEY(TENANT_ID, PK1)) MULTI_TENANT=true");
+            try (Connection tenant1Conn = getTenantConnection("tenant1")) {
+                String view1DDL = "CREATE VIEW " + tableName + "_view1 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            try (Connection tenant1Conn = getTenantConnection("tenant2")) {
+                String view1DDL = "CREATE VIEW " + tableName + "_view2 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            conn.commit();
+        }
+    }
+
+    private Connection getTenantConnection(String tenantId) throws SQLException {
+        Properties tenantProps = new Properties();
+        tenantProps.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
+        return DriverManager.getConnection(getUrl(), tenantProps);
+    }
+
+
+    /**
+     * Make sure that SYSTEM.CATALOG cannot be split if
+     * {@link QueryServices#SYSTEM_CATALOG_SPLITTABLE} is false
+     */
+    @Test
+    public void testSystemTableDoesNotSplit() throws Exception {
+        HBaseTestingUtility testUtil = getUtility();
+        for (int i=0; i<10; i++) {
+            createTable("schema"+i+".table_"+i);
+        }
+        TableName systemCatalog = TableName.valueOf("SYSTEM.CATALOG");

Review comment:
       I've copied this from the existing SystemCatalogIT, but will fix it anyways




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] gjacoby126 commented on a change in pull request #949: PHOENIX-6032: When phoenix.allow.system.catalog.rollback=true, a view still sees data from a column that was dropped

Posted by GitBox <gi...@apache.org>.
gjacoby126 commented on a change in pull request #949:
URL: https://github.com/apache/phoenix/pull/949#discussion_r516276781



##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogRollbackEnabledIT.java
##########
@@ -0,0 +1,298 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.RegionLocator;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.schema.ColumnNotFoundException;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Tests various scenarios when
+ * {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK}
+ * is set to true and SYSTEM.CATALOG should not be allowed to split.
+ * Note that this config must
+ * be set on both the client and server
+ */
+@Category(NeedsOwnMiniClusterTest.class)
+public class SystemCatalogRollbackEnabledIT extends BaseTest {
+
+    @BeforeClass
+    public static synchronized void doSetup() throws Exception {
+        Map<String, String> serverProps = new HashMap<>(2);
+        Map<String, String> clientProps = new HashMap<>(1);
+        serverProps.put(QueryServices.SYSTEM_CATALOG_SPLITTABLE, "false");
+        serverProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        clientProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
+                new ReadOnlyProps(clientProps.entrySet().iterator()));
+    }
+
+    private void createTableAndTenantViews(String tableName) throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl());
+                Statement stmt = conn.createStatement();) {
+            stmt.execute("DROP TABLE IF EXISTS " + tableName);
+            stmt.execute("CREATE TABLE " + tableName +
+                    " (TENANT_ID VARCHAR NOT NULL, " +
+                    "PK1 VARCHAR NOT NULL, V1 VARCHAR CONSTRAINT PK " +
+                    "PRIMARY KEY(TENANT_ID, PK1)) MULTI_TENANT=true");
+            try (Connection tenant1Conn = getTenantConnection("tenant1")) {
+                String view1DDL = "CREATE VIEW " + tableName +
+                        "_view1 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            try (Connection tenant2Conn = getTenantConnection("tenant2")) {
+                String view1DDL = "CREATE VIEW " + tableName +
+                        "_view2 AS SELECT * FROM " + tableName;
+                tenant2Conn.createStatement().execute(view1DDL);
+            }
+            conn.commit();
+        }
+    }
+
+    private Connection getTenantConnection(String tenantId)
+            throws SQLException {
+        Properties tenantProps = new Properties();
+        tenantProps.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
+        return DriverManager.getConnection(getUrl(), tenantProps);
+    }
+
+
+    /**
+     * Make sure that SYSTEM.CATALOG cannot be split if
+     * {@link QueryServices#SYSTEM_CATALOG_SPLITTABLE} is false
+     */
+    @Test
+    public void testSystemTableDoesNotSplit() throws Exception {
+        HBaseTestingUtility testUtil = getUtility();
+        for (int i=0; i<10; i++) {
+            createTableAndTenantViews("schema"+i+".table_"+i);
+        }
+        TableName systemCatalog = TableName.valueOf(
+                PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME);
+        RegionLocator rl = testUtil.getConnection()
+                .getRegionLocator(systemCatalog);
+        assertEquals(1, rl.getAllRegionLocations().size());
+        try {
+            // now attempt to split SYSTEM.CATALOG
+            testUtil.getHBaseAdmin().split(systemCatalog);
+            // make sure the split finishes (there's no synchronous splitting
+            // before HBase 2.x)
+            testUtil.getHBaseAdmin().disableTable(systemCatalog);
+            testUtil.getHBaseAdmin().enableTable(systemCatalog);
+        } catch (DoNotRetryIOException e) {
+            // table is not splittable
+            assert (e.getMessage().contains("NOT splittable"));

Review comment:
       Do we require that we get this exception? If so should be an Assert.fail() after enableTable

##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogRollbackEnabledIT.java
##########
@@ -0,0 +1,298 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.RegionLocator;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.schema.ColumnNotFoundException;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Tests various scenarios when
+ * {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK}
+ * is set to true and SYSTEM.CATALOG should not be allowed to split.
+ * Note that this config must
+ * be set on both the client and server
+ */
+@Category(NeedsOwnMiniClusterTest.class)
+public class SystemCatalogRollbackEnabledIT extends BaseTest {
+
+    @BeforeClass
+    public static synchronized void doSetup() throws Exception {
+        Map<String, String> serverProps = new HashMap<>(2);
+        Map<String, String> clientProps = new HashMap<>(1);
+        serverProps.put(QueryServices.SYSTEM_CATALOG_SPLITTABLE, "false");
+        serverProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        clientProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
+                new ReadOnlyProps(clientProps.entrySet().iterator()));
+    }
+
+    private void createTableAndTenantViews(String tableName) throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl());
+                Statement stmt = conn.createStatement();) {
+            stmt.execute("DROP TABLE IF EXISTS " + tableName);
+            stmt.execute("CREATE TABLE " + tableName +
+                    " (TENANT_ID VARCHAR NOT NULL, " +
+                    "PK1 VARCHAR NOT NULL, V1 VARCHAR CONSTRAINT PK " +
+                    "PRIMARY KEY(TENANT_ID, PK1)) MULTI_TENANT=true");
+            try (Connection tenant1Conn = getTenantConnection("tenant1")) {
+                String view1DDL = "CREATE VIEW " + tableName +
+                        "_view1 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            try (Connection tenant2Conn = getTenantConnection("tenant2")) {
+                String view1DDL = "CREATE VIEW " + tableName +
+                        "_view2 AS SELECT * FROM " + tableName;
+                tenant2Conn.createStatement().execute(view1DDL);
+            }
+            conn.commit();
+        }
+    }
+
+    private Connection getTenantConnection(String tenantId)
+            throws SQLException {
+        Properties tenantProps = new Properties();
+        tenantProps.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
+        return DriverManager.getConnection(getUrl(), tenantProps);
+    }
+
+
+    /**
+     * Make sure that SYSTEM.CATALOG cannot be split if
+     * {@link QueryServices#SYSTEM_CATALOG_SPLITTABLE} is false
+     */
+    @Test
+    public void testSystemTableDoesNotSplit() throws Exception {
+        HBaseTestingUtility testUtil = getUtility();
+        for (int i=0; i<10; i++) {
+            createTableAndTenantViews("schema"+i+".table_"+i);
+        }
+        TableName systemCatalog = TableName.valueOf(
+                PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME);
+        RegionLocator rl = testUtil.getConnection()
+                .getRegionLocator(systemCatalog);
+        assertEquals(1, rl.getAllRegionLocations().size());
+        try {
+            // now attempt to split SYSTEM.CATALOG
+            testUtil.getHBaseAdmin().split(systemCatalog);
+            // make sure the split finishes (there's no synchronous splitting
+            // before HBase 2.x)
+            testUtil.getHBaseAdmin().disableTable(systemCatalog);
+            testUtil.getHBaseAdmin().enableTable(systemCatalog);
+        } catch (DoNotRetryIOException e) {
+            // table is not splittable
+            assert (e.getMessage().contains("NOT splittable"));

Review comment:
       Also, should use JUnit assertions rather than Java assert keyword

##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogRollbackEnabledIT.java
##########
@@ -0,0 +1,298 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.RegionLocator;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.schema.ColumnNotFoundException;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Tests various scenarios when
+ * {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK}
+ * is set to true and SYSTEM.CATALOG should not be allowed to split.
+ * Note that this config must
+ * be set on both the client and server
+ */
+@Category(NeedsOwnMiniClusterTest.class)
+public class SystemCatalogRollbackEnabledIT extends BaseTest {
+
+    @BeforeClass
+    public static synchronized void doSetup() throws Exception {
+        Map<String, String> serverProps = new HashMap<>(2);
+        Map<String, String> clientProps = new HashMap<>(1);
+        serverProps.put(QueryServices.SYSTEM_CATALOG_SPLITTABLE, "false");
+        serverProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        clientProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
+                new ReadOnlyProps(clientProps.entrySet().iterator()));
+    }
+
+    private void createTableAndTenantViews(String tableName) throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl());
+                Statement stmt = conn.createStatement();) {
+            stmt.execute("DROP TABLE IF EXISTS " + tableName);
+            stmt.execute("CREATE TABLE " + tableName +
+                    " (TENANT_ID VARCHAR NOT NULL, " +
+                    "PK1 VARCHAR NOT NULL, V1 VARCHAR CONSTRAINT PK " +
+                    "PRIMARY KEY(TENANT_ID, PK1)) MULTI_TENANT=true");
+            try (Connection tenant1Conn = getTenantConnection("tenant1")) {
+                String view1DDL = "CREATE VIEW " + tableName +
+                        "_view1 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            try (Connection tenant2Conn = getTenantConnection("tenant2")) {
+                String view1DDL = "CREATE VIEW " + tableName +
+                        "_view2 AS SELECT * FROM " + tableName;
+                tenant2Conn.createStatement().execute(view1DDL);
+            }
+            conn.commit();
+        }
+    }
+
+    private Connection getTenantConnection(String tenantId)
+            throws SQLException {
+        Properties tenantProps = new Properties();
+        tenantProps.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
+        return DriverManager.getConnection(getUrl(), tenantProps);
+    }
+
+
+    /**
+     * Make sure that SYSTEM.CATALOG cannot be split if
+     * {@link QueryServices#SYSTEM_CATALOG_SPLITTABLE} is false
+     */
+    @Test
+    public void testSystemTableDoesNotSplit() throws Exception {
+        HBaseTestingUtility testUtil = getUtility();
+        for (int i=0; i<10; i++) {
+            createTableAndTenantViews("schema"+i+".table_"+i);
+        }
+        TableName systemCatalog = TableName.valueOf(
+                PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME);
+        RegionLocator rl = testUtil.getConnection()
+                .getRegionLocator(systemCatalog);
+        assertEquals(1, rl.getAllRegionLocations().size());
+        try {
+            // now attempt to split SYSTEM.CATALOG
+            testUtil.getHBaseAdmin().split(systemCatalog);
+            // make sure the split finishes (there's no synchronous splitting
+            // before HBase 2.x)
+            testUtil.getHBaseAdmin().disableTable(systemCatalog);
+            testUtil.getHBaseAdmin().enableTable(systemCatalog);
+        } catch (DoNotRetryIOException e) {
+            // table is not splittable
+            assert (e.getMessage().contains("NOT splittable"));
+        }
+
+        // test again... Must still be exactly one region.
+        rl = testUtil.getConnection().getRegionLocator(systemCatalog);
+        assertEquals(1, rl.getAllRegionLocations().size());
+    }
+
+    /**
+     * Ensure that we cannot add a column to a parent table or view if
+     * {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK} is true
+     */
+    @Test
+    public void testAddColumnOnParentFails() throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            final String parentTableName = SchemaUtil.getTableName(
+                    generateUniqueName(), generateUniqueName());
+            final String parentViewName = SchemaUtil.getTableName(
+                    generateUniqueName(), generateUniqueName());
+            final String childViewName = SchemaUtil.getTableName(
+                    generateUniqueName(), generateUniqueName());
+            // create parent table
+            String ddl = "CREATE TABLE " + parentTableName
+                    + " (col1 INTEGER NOT NULL,"
+                    + " col2 INTEGER " + "CONSTRAINT pk PRIMARY KEY (col1))";
+            conn.createStatement().execute(ddl);
+
+            // create view on table
+            ddl = "CREATE VIEW " + parentViewName + " AS SELECT * FROM "
+                    + parentTableName;
+            conn.createStatement().execute(ddl);
+            try {
+                ddl = "ALTER TABLE " + parentTableName + " ADD col4 INTEGER";
+                conn.createStatement().execute(ddl);
+                fail("ALTER TABLE ADD should not be allowed on parent table");
+            } catch (SQLException e) {
+                assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE
+                        .getErrorCode(), e.getErrorCode());
+            }
+
+            // create child view on above view
+            ddl = "CREATE VIEW " + childViewName
+                    + "(col3 INTEGER) AS SELECT * FROM " + parentViewName;
+            conn.createStatement().execute(ddl);
+            try {
+                ddl = "ALTER VIEW " + parentViewName + " ADD col4 INTEGER";
+                conn.createStatement().execute(ddl);
+                fail("ALTER VIEW ADD should not be allowed on parent view");
+            } catch (SQLException e) {
+                assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE
+                        .getErrorCode(), e.getErrorCode());
+            }
+
+            // alter child view with add column should be allowed
+            ddl = "ALTER VIEW " + childViewName + " ADD col4 INTEGER";
+            conn.createStatement().execute(ddl);
+        }
+    }
+
+    /**
+     * Ensure that we cannot drop a column from a parent table or view if
+     * {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK} is true
+     */
+    @Test
+    public void testDropColumnOnParentFails() throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            final String parentTableName = SchemaUtil.getTableName(
+                    generateUniqueName(), generateUniqueName());
+            final String parentViewName = SchemaUtil.getTableName(
+                    generateUniqueName(), generateUniqueName());
+            final String childViewName = SchemaUtil.getTableName(
+                    generateUniqueName(), generateUniqueName());
+            // create parent table
+            String ddl = "CREATE TABLE " + parentTableName
+                    + " (col1 INTEGER NOT NULL, col2 INTEGER, col3 VARCHAR "
+                    + "CONSTRAINT pk PRIMARY KEY (col1))";
+            conn.createStatement().execute(ddl);
+
+            // create view on table
+            ddl = "CREATE VIEW " + parentViewName + " AS SELECT * FROM "
+                    + parentTableName;
+            conn.createStatement().execute(ddl);
+            try {
+                ddl = "ALTER TABLE " + parentTableName + " DROP COLUMN col2";
+                conn.createStatement().execute(ddl);
+                fail("ALTER TABLE DROP COLUMN should not be allowed on "
+                        + "parent table");
+            } catch (SQLException e) {
+                assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE
+                        .getErrorCode(), e.getErrorCode());
+            }
+
+            // create child view on above view
+            ddl = "CREATE VIEW " + childViewName
+                    + "(col5 INTEGER) AS SELECT * FROM " + parentViewName;
+            conn.createStatement().execute(ddl);
+            try {
+                ddl = "ALTER VIEW " + parentViewName + " DROP COLUMN col2";
+                conn.createStatement().execute(ddl);
+                fail("ALTER VIEW DROP COLUMN should not be allowed on "
+                        + "parent view");
+            } catch (SQLException e) {
+                assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE
+                        .getErrorCode(), e.getErrorCode());
+            }
+
+            // alter child view with drop column should be allowed
+            ddl = "ALTER VIEW " + childViewName + " DROP COLUMN col2";
+            conn.createStatement().execute(ddl);
+        }
+    }
+
+    // Test for PHOENIX-6032
+    @Test
+    public void testViewDoesNotSeeDataForDroppedColumn() throws Exception {
+        final String parentName = "T_" + SchemaUtil.getTableName(
+                generateUniqueName(), generateUniqueName());
+        final String viewName = "V_" + SchemaUtil.getTableName(
+                generateUniqueName(), generateUniqueName());
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            conn.createStatement().execute("CREATE TABLE " + parentName
+                    + " (A INTEGER PRIMARY KEY, B INTEGER, C"
+                    + " VARCHAR, D INTEGER)");
+            conn.createStatement().execute("CREATE VIEW " + viewName
+                    + " (VA INTEGER, VB INTEGER)"
+                    + " AS SELECT * FROM " + parentName + " WHERE B=200");
+            // Upsert some data via the view
+            conn.createStatement().execute("UPSERT INTO " + viewName
+                    + " (A,B,C,D,VA,VB) VALUES"
+                    + " (2, 200, 'def', -20, 91, 101)");
+            conn.commit();
+        }
+
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            // Query from the parent table and assert expected values
+            ResultSet rs = conn.createStatement().executeQuery(
+                    "SELECT A,B,C,D FROM " + parentName);
+            assertTrue(rs.next());
+            assertEquals(2, rs.getInt(1));
+            assertEquals(200, rs.getInt(2));
+            assertEquals("def", rs.getString(3));
+            assertEquals(-20, rs.getInt(4));
+            assertFalse(rs.next());
+
+            // Query from the view and assert expected values
+            rs = conn.createStatement().executeQuery(
+                    "SELECT A,B,C,D,VA,VB FROM " + viewName);
+            assertTrue(rs.next());
+            assertEquals(2, rs.getInt(1));
+            assertEquals(200, rs.getInt(2));
+            assertEquals("def", rs.getString(3));
+            assertEquals(-20, rs.getInt(4));
+            assertEquals(91, rs.getInt(5));
+            assertEquals(101, rs.getInt(6));
+            assertFalse(rs.next());
+        }
+
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            // Drop a parent column from the view
+            conn.createStatement().execute("ALTER VIEW " + viewName
+                    + " DROP COLUMN C");
+            try {
+                conn.createStatement().executeQuery("SELECT C FROM "
+                        + viewName);
+                fail("Expected a ColumnNotFoundException for C since it "
+                        + "was dropped");
+            } catch (ColumnNotFoundException ignore) { }
+        }

Review comment:
       Should also fail if we get some other exception other than ColumnNotFoundException -- can have a second catch block for Throwable and then fail() in it.

##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogRollbackEnabledIT.java
##########
@@ -0,0 +1,298 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.RegionLocator;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.schema.ColumnNotFoundException;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Tests various scenarios when
+ * {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK}
+ * is set to true and SYSTEM.CATALOG should not be allowed to split.
+ * Note that this config must
+ * be set on both the client and server
+ */
+@Category(NeedsOwnMiniClusterTest.class)
+public class SystemCatalogRollbackEnabledIT extends BaseTest {
+
+    @BeforeClass
+    public static synchronized void doSetup() throws Exception {
+        Map<String, String> serverProps = new HashMap<>(2);
+        Map<String, String> clientProps = new HashMap<>(1);
+        serverProps.put(QueryServices.SYSTEM_CATALOG_SPLITTABLE, "false");
+        serverProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        clientProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
+                new ReadOnlyProps(clientProps.entrySet().iterator()));
+    }
+
+    private void createTableAndTenantViews(String tableName) throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl());
+                Statement stmt = conn.createStatement();) {
+            stmt.execute("DROP TABLE IF EXISTS " + tableName);
+            stmt.execute("CREATE TABLE " + tableName +
+                    " (TENANT_ID VARCHAR NOT NULL, " +
+                    "PK1 VARCHAR NOT NULL, V1 VARCHAR CONSTRAINT PK " +
+                    "PRIMARY KEY(TENANT_ID, PK1)) MULTI_TENANT=true");
+            try (Connection tenant1Conn = getTenantConnection("tenant1")) {
+                String view1DDL = "CREATE VIEW " + tableName +
+                        "_view1 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            try (Connection tenant2Conn = getTenantConnection("tenant2")) {
+                String view1DDL = "CREATE VIEW " + tableName +
+                        "_view2 AS SELECT * FROM " + tableName;
+                tenant2Conn.createStatement().execute(view1DDL);
+            }
+            conn.commit();
+        }
+    }
+
+    private Connection getTenantConnection(String tenantId)
+            throws SQLException {
+        Properties tenantProps = new Properties();
+        tenantProps.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
+        return DriverManager.getConnection(getUrl(), tenantProps);
+    }
+
+
+    /**
+     * Make sure that SYSTEM.CATALOG cannot be split if
+     * {@link QueryServices#SYSTEM_CATALOG_SPLITTABLE} is false
+     */
+    @Test
+    public void testSystemTableDoesNotSplit() throws Exception {
+        HBaseTestingUtility testUtil = getUtility();
+        for (int i=0; i<10; i++) {
+            createTableAndTenantViews("schema"+i+".table_"+i);
+        }
+        TableName systemCatalog = TableName.valueOf(
+                PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME);
+        RegionLocator rl = testUtil.getConnection()
+                .getRegionLocator(systemCatalog);
+        assertEquals(1, rl.getAllRegionLocations().size());
+        try {
+            // now attempt to split SYSTEM.CATALOG
+            testUtil.getHBaseAdmin().split(systemCatalog);
+            // make sure the split finishes (there's no synchronous splitting
+            // before HBase 2.x)
+            testUtil.getHBaseAdmin().disableTable(systemCatalog);
+            testUtil.getHBaseAdmin().enableTable(systemCatalog);
+        } catch (DoNotRetryIOException e) {
+            // table is not splittable
+            assert (e.getMessage().contains("NOT splittable"));

Review comment:
       (I know this is a copied test, but good to do the simple fixes while we're at it)




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] yanxinyi commented on a change in pull request #949: PHOENIX-6032: When phoenix.allow.system.catalog.rollback=true, a view still sees data from a column that was dropped

Posted by GitBox <gi...@apache.org>.
yanxinyi commented on a change in pull request #949:
URL: https://github.com/apache/phoenix/pull/949#discussion_r514738269



##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogRollbackEnabledIT.java
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.RegionLocator;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.schema.ColumnNotFoundException;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.google.common.collect.Maps;
+
+/**
+ * Tests various scenarios when {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK}
+ * is set to true and SYSTEM.CATALOG should not be allowed to split. Note that this config must
+ * be set on both the client and server
+ */
+@Category(NeedsOwnMiniClusterTest.class)
+public class SystemCatalogRollbackEnabledIT extends BaseTest {
+
+	@BeforeClass
+	public static synchronized void doSetup() throws Exception {
+		Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(2);
+		Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(1);
+		serverProps.put(QueryServices.SYSTEM_CATALOG_SPLITTABLE, "false");
+        serverProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK, "true");
+        clientProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK, "true");
+		setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
+                new ReadOnlyProps(clientProps.entrySet().iterator()));
+	}
+
+    private void createTable(String tableName) throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl());
+                Statement stmt = conn.createStatement();) {
+            stmt.execute("DROP TABLE IF EXISTS " + tableName);
+            stmt.execute("CREATE TABLE " + tableName + " (TENANT_ID VARCHAR NOT NULL, " +
+                    "PK1 VARCHAR NOT NULL, V1 VARCHAR CONSTRAINT PK " +
+                    "PRIMARY KEY(TENANT_ID, PK1)) MULTI_TENANT=true");
+            try (Connection tenant1Conn = getTenantConnection("tenant1")) {
+                String view1DDL = "CREATE VIEW " + tableName + "_view1 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            try (Connection tenant1Conn = getTenantConnection("tenant2")) {
+                String view1DDL = "CREATE VIEW " + tableName + "_view2 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            conn.commit();
+        }
+    }
+
+    private Connection getTenantConnection(String tenantId) throws SQLException {
+        Properties tenantProps = new Properties();
+        tenantProps.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
+        return DriverManager.getConnection(getUrl(), tenantProps);
+    }
+
+
+    /**
+     * Make sure that SYSTEM.CATALOG cannot be split if
+     * {@link QueryServices#SYSTEM_CATALOG_SPLITTABLE} is false
+     */
+    @Test
+    public void testSystemTableDoesNotSplit() throws Exception {
+        HBaseTestingUtility testUtil = getUtility();
+        for (int i=0; i<10; i++) {
+            createTable("schema"+i+".table_"+i);
+        }
+        TableName systemCatalog = TableName.valueOf("SYSTEM.CATALOG");
+        RegionLocator rl = testUtil.getConnection().getRegionLocator(systemCatalog);
+        assertEquals(rl.getAllRegionLocations().size(), 1);

Review comment:
       nit: the expected value should be the first argument 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] yanxinyi commented on a change in pull request #949: PHOENIX-6032: When phoenix.allow.system.catalog.rollback=true, a view still sees data from a column that was dropped

Posted by GitBox <gi...@apache.org>.
yanxinyi commented on a change in pull request #949:
URL: https://github.com/apache/phoenix/pull/949#discussion_r514740510



##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogRollbackEnabledIT.java
##########
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.RegionLocator;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.schema.ColumnNotFoundException;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.google.common.collect.Maps;
+
+/**
+ * Tests various scenarios when {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK}
+ * is set to true and SYSTEM.CATALOG should not be allowed to split. Note that this config must
+ * be set on both the client and server
+ */
+@Category(NeedsOwnMiniClusterTest.class)
+public class SystemCatalogRollbackEnabledIT extends BaseTest {
+
+	@BeforeClass
+	public static synchronized void doSetup() throws Exception {
+		Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(2);
+		Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(1);
+		serverProps.put(QueryServices.SYSTEM_CATALOG_SPLITTABLE, "false");
+        serverProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK, "true");
+        clientProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK, "true");
+		setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
+                new ReadOnlyProps(clientProps.entrySet().iterator()));
+	}
+
+    private void createTable(String tableName) throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl());
+                Statement stmt = conn.createStatement();) {
+            stmt.execute("DROP TABLE IF EXISTS " + tableName);
+            stmt.execute("CREATE TABLE " + tableName + " (TENANT_ID VARCHAR NOT NULL, " +
+                    "PK1 VARCHAR NOT NULL, V1 VARCHAR CONSTRAINT PK " +
+                    "PRIMARY KEY(TENANT_ID, PK1)) MULTI_TENANT=true");
+            try (Connection tenant1Conn = getTenantConnection("tenant1")) {
+                String view1DDL = "CREATE VIEW " + tableName + "_view1 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            try (Connection tenant1Conn = getTenantConnection("tenant2")) {
+                String view1DDL = "CREATE VIEW " + tableName + "_view2 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            conn.commit();
+        }
+    }
+
+    private Connection getTenantConnection(String tenantId) throws SQLException {
+        Properties tenantProps = new Properties();
+        tenantProps.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
+        return DriverManager.getConnection(getUrl(), tenantProps);
+    }
+
+
+    /**
+     * Make sure that SYSTEM.CATALOG cannot be split if
+     * {@link QueryServices#SYSTEM_CATALOG_SPLITTABLE} is false
+     */
+    @Test
+    public void testSystemTableDoesNotSplit() throws Exception {
+        HBaseTestingUtility testUtil = getUtility();
+        for (int i=0; i<10; i++) {
+            createTable("schema"+i+".table_"+i);
+        }
+        TableName systemCatalog = TableName.valueOf("SYSTEM.CATALOG");

Review comment:
       nit: using PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] stoty commented on pull request #949: PHOENIX-6032: When phoenix.allow.system.catalog.rollback=true, a view still sees data from a column that was dropped

Posted by GitBox <gi...@apache.org>.
stoty commented on pull request #949:
URL: https://github.com/apache/phoenix/pull/949#issuecomment-720826602






----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] ChinmaySKulkarni commented on a change in pull request #949: PHOENIX-6032: When phoenix.allow.system.catalog.rollback=true, a view still sees data from a column that was dropped

Posted by GitBox <gi...@apache.org>.
ChinmaySKulkarni commented on a change in pull request #949:
URL: https://github.com/apache/phoenix/pull/949#discussion_r516230051



##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogRollbackEnabledIT.java
##########
@@ -0,0 +1,273 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.RegionLocator;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.schema.ColumnNotFoundException;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Tests various scenarios when {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK}
+ * is set to true and SYSTEM.CATALOG should not be allowed to split. Note that this config must
+ * be set on both the client and server
+ */
+@Category(NeedsOwnMiniClusterTest.class)
+public class SystemCatalogRollbackEnabledIT extends BaseTest {
+
+    @BeforeClass
+    public static synchronized void doSetup() throws Exception {
+        Map<String, String> serverProps = new HashMap<>(2);
+        Map<String, String> clientProps = new HashMap<>(1);
+        serverProps.put(QueryServices.SYSTEM_CATALOG_SPLITTABLE, "false");
+        serverProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        clientProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
+                new ReadOnlyProps(clientProps.entrySet().iterator()));
+    }
+
+    private void createTable(String tableName) throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl());
+                Statement stmt = conn.createStatement();) {
+            stmt.execute("DROP TABLE IF EXISTS " + tableName);
+            stmt.execute("CREATE TABLE " + tableName + " (TENANT_ID VARCHAR NOT NULL, " +
+                    "PK1 VARCHAR NOT NULL, V1 VARCHAR CONSTRAINT PK " +
+                    "PRIMARY KEY(TENANT_ID, PK1)) MULTI_TENANT=true");
+            try (Connection tenant1Conn = getTenantConnection("tenant1")) {
+                String view1DDL = "CREATE VIEW " + tableName + "_view1 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            try (Connection tenant1Conn = getTenantConnection("tenant2")) {
+                String view1DDL = "CREATE VIEW " + tableName + "_view2 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            conn.commit();
+        }
+    }
+
+    private Connection getTenantConnection(String tenantId) throws SQLException {
+        Properties tenantProps = new Properties();
+        tenantProps.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
+        return DriverManager.getConnection(getUrl(), tenantProps);
+    }
+
+
+    /**
+     * Make sure that SYSTEM.CATALOG cannot be split if
+     * {@link QueryServices#SYSTEM_CATALOG_SPLITTABLE} is false
+     */
+    @Test
+    public void testSystemTableDoesNotSplit() throws Exception {
+        HBaseTestingUtility testUtil = getUtility();
+        for (int i=0; i<10; i++) {
+            createTable("schema"+i+".table_"+i);
+        }
+        TableName systemCatalog = TableName.valueOf(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME);
+        RegionLocator rl = testUtil.getConnection().getRegionLocator(systemCatalog);
+        assertEquals(1, rl.getAllRegionLocations().size());
+        try {
+            // now attempt to split SYSTEM.CATALOG
+            testUtil.getHBaseAdmin().split(systemCatalog);
+            // make sure the split finishes (there's no synchronous splitting before HBase 2.x)
+            testUtil.getHBaseAdmin().disableTable(systemCatalog);
+            testUtil.getHBaseAdmin().enableTable(systemCatalog);
+        } catch (DoNotRetryIOException e) {
+            // table is not splittable
+            assert (e.getMessage().contains("NOT splittable"));
+        }
+
+        // test again... Must still be exactly one region.
+        rl = testUtil.getConnection().getRegionLocator(systemCatalog);
+        assertEquals(1, rl.getAllRegionLocations().size());
+    }
+
+    /**
+     * Ensure that we cannot add a column to a parent table or view if
+     * {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK} is true
+     */
+    @Test
+    public void testAddColumnOnParentFails() throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            final String parentTableName = SchemaUtil.getTableName(generateUniqueName(),
+                    generateUniqueName());
+            final String parentViewName = SchemaUtil.getTableName(generateUniqueName(),
+                    generateUniqueName());
+            final String childViewName = SchemaUtil.getTableName(generateUniqueName(),
+                    generateUniqueName());
+            // create parent table
+            String ddl = "CREATE TABLE " + parentTableName + " (col1 INTEGER NOT NULL,"
+                    + " col2 INTEGER " + "CONSTRAINT pk PRIMARY KEY (col1))";
+            conn.createStatement().execute(ddl);
+
+            // create view on table
+            ddl = "CREATE VIEW " + parentViewName + " AS SELECT * FROM " + parentTableName;
+            conn.createStatement().execute(ddl);
+            try {
+                ddl = "ALTER TABLE " + parentTableName + " ADD col4 INTEGER";
+                conn.createStatement().execute(ddl);
+                fail("ALTER TABLE ADD should not be allowed on parent table");
+            } catch (SQLException e) {
+                assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE.getErrorCode(), e.getErrorCode());
+            }
+
+            // create child view on above view
+            ddl = "CREATE VIEW " + childViewName + "(col3 INTEGER) AS SELECT * FROM "
+                    + parentViewName;
+            conn.createStatement().execute(ddl);
+            try {
+                ddl = "ALTER VIEW " + parentViewName + " ADD col4 INTEGER";
+                conn.createStatement().execute(ddl);
+                fail("ALTER VIEW ADD should not be allowed on parent view");
+            } catch (SQLException e) {
+                assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE.getErrorCode(), e.getErrorCode());
+            }
+
+            // alter child view with add column should be allowed
+            ddl = "ALTER VIEW " + childViewName + " ADD col4 INTEGER";
+            conn.createStatement().execute(ddl);
+        }
+    }
+
+    /**
+     * Ensure that we cannot drop a column from a parent table or view if
+     * {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK} is true
+     */
+    @Test
+    public void testDropColumnOnParentFails() throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            final String parentTableName = SchemaUtil.getTableName(generateUniqueName(),
+                    generateUniqueName());
+            final String parentViewName = SchemaUtil.getTableName(generateUniqueName(),
+                    generateUniqueName());
+            final String childViewName = SchemaUtil.getTableName(generateUniqueName(),
+                    generateUniqueName());
+            // create parent table
+            String ddl = "CREATE TABLE " + parentTableName
+                    + " (col1 INTEGER NOT NULL, col2 INTEGER, col3 VARCHAR "
+                    + "CONSTRAINT pk PRIMARY KEY (col1))";
+            conn.createStatement().execute(ddl);
+
+            // create view on table
+            ddl = "CREATE VIEW " + parentViewName + " AS SELECT * FROM " + parentTableName;
+            conn.createStatement().execute(ddl);
+            try {
+                ddl = "ALTER TABLE " + parentTableName + " DROP COLUMN col2";
+                conn.createStatement().execute(ddl);
+                fail("ALTER TABLE DROP COLUMN should not be allowed on parent table");
+            } catch (SQLException e) {
+                assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE.getErrorCode(), e.getErrorCode());
+            }
+
+            // create child view on above view
+            ddl = "CREATE VIEW " + childViewName + "(col5 INTEGER) AS SELECT * FROM "
+                    + parentViewName;
+            conn.createStatement().execute(ddl);
+            try {
+                ddl = "ALTER VIEW " + parentViewName + " DROP COLUMN col2";
+                conn.createStatement().execute(ddl);
+                fail("ALTER VIEW DROP COLUMN should not be allowed on parent view");
+            } catch (SQLException e) {
+                assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE.getErrorCode(), e.getErrorCode());
+            }
+
+            // alter child view with drop column should be allowed
+            ddl = "ALTER VIEW " + childViewName + " DROP COLUMN col2";
+            conn.createStatement().execute(ddl);
+        }
+    }
+
+    // Test for PHOENIX-6032
+    @Test
+    public void testViewDoesNotSeeDataForDroppedColumn() throws Exception {
+        final String parentName = "T_"
+                + SchemaUtil.getTableName(generateUniqueName(), generateUniqueName());
+        final String viewName = "V_"
+                + SchemaUtil.getTableName(generateUniqueName(), generateUniqueName());
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            conn.createStatement().execute("CREATE TABLE " + parentName
+                    + " (A INTEGER PRIMARY KEY, B INTEGER, C VARCHAR, D INTEGER)");
+            conn.createStatement().execute("CREATE VIEW " + viewName + " (VA INTEGER, VB INTEGER)"
+                    + " AS SELECT * FROM " + parentName + " WHERE B=200");
+            // Upsert some data via the view
+            conn.createStatement().execute("UPSERT INTO " + viewName + " (A,B,C,D,VA,VB) VALUES"
+                    + " (2, 200, 'def', -20, 91, 101)");
+            conn.commit();
+        }
+
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            // Query from the parent table and assert expected values
+            ResultSet rs = conn.createStatement().executeQuery("SELECT A,B,C,D FROM " + parentName);
+            assertTrue(rs.next());
+            assertEquals(2, rs.getInt(1));
+            assertEquals(200, rs.getInt(2));
+            assertEquals("def", rs.getString(3));
+            assertEquals(-20, rs.getInt(4));
+            assertFalse(rs.next());
+
+            // Query from the view and assert expected values
+            rs = conn.createStatement().executeQuery("SELECT A,B,C,D,VA,VB FROM " + viewName);
+            assertTrue(rs.next());
+            assertEquals(2, rs.getInt(1));
+            assertEquals(200, rs.getInt(2));
+            assertEquals("def", rs.getString(3));
+            assertEquals(-20, rs.getInt(4));
+            assertEquals(91, rs.getInt(5));
+            assertEquals(101, rs.getInt(6));
+            assertFalse(rs.next());
+        }
+
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            // Drop a parent column from the view
+            conn.createStatement().execute("ALTER VIEW " + viewName + " DROP COLUMN C");
+            try {
+                conn.createStatement().executeQuery("SELECT C FROM " + viewName);
+                fail("Expected a ColumnNotFoundException for C since it was dropped");
+            } catch (ColumnNotFoundException ignore) { }

Review comment:
       I think it would be a much bigger bug if a view alteration caused the base table's data to be deleted :) This patch doesn't change any of that, so not sure that an extra check is valuable after this.

##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogRollbackEnabledIT.java
##########
@@ -0,0 +1,273 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.RegionLocator;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.schema.ColumnNotFoundException;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Tests various scenarios when {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK}
+ * is set to true and SYSTEM.CATALOG should not be allowed to split. Note that this config must
+ * be set on both the client and server
+ */
+@Category(NeedsOwnMiniClusterTest.class)
+public class SystemCatalogRollbackEnabledIT extends BaseTest {
+
+    @BeforeClass
+    public static synchronized void doSetup() throws Exception {
+        Map<String, String> serverProps = new HashMap<>(2);
+        Map<String, String> clientProps = new HashMap<>(1);
+        serverProps.put(QueryServices.SYSTEM_CATALOG_SPLITTABLE, "false");
+        serverProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        clientProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
+                new ReadOnlyProps(clientProps.entrySet().iterator()));
+    }
+
+    private void createTable(String tableName) throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl());
+                Statement stmt = conn.createStatement();) {
+            stmt.execute("DROP TABLE IF EXISTS " + tableName);
+            stmt.execute("CREATE TABLE " + tableName + " (TENANT_ID VARCHAR NOT NULL, " +
+                    "PK1 VARCHAR NOT NULL, V1 VARCHAR CONSTRAINT PK " +
+                    "PRIMARY KEY(TENANT_ID, PK1)) MULTI_TENANT=true");
+            try (Connection tenant1Conn = getTenantConnection("tenant1")) {
+                String view1DDL = "CREATE VIEW " + tableName + "_view1 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            try (Connection tenant1Conn = getTenantConnection("tenant2")) {
+                String view1DDL = "CREATE VIEW " + tableName + "_view2 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            conn.commit();
+        }
+    }
+
+    private Connection getTenantConnection(String tenantId) throws SQLException {
+        Properties tenantProps = new Properties();
+        tenantProps.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
+        return DriverManager.getConnection(getUrl(), tenantProps);
+    }
+
+
+    /**
+     * Make sure that SYSTEM.CATALOG cannot be split if
+     * {@link QueryServices#SYSTEM_CATALOG_SPLITTABLE} is false
+     */
+    @Test
+    public void testSystemTableDoesNotSplit() throws Exception {
+        HBaseTestingUtility testUtil = getUtility();
+        for (int i=0; i<10; i++) {
+            createTable("schema"+i+".table_"+i);
+        }
+        TableName systemCatalog = TableName.valueOf(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME);
+        RegionLocator rl = testUtil.getConnection().getRegionLocator(systemCatalog);
+        assertEquals(1, rl.getAllRegionLocations().size());
+        try {
+            // now attempt to split SYSTEM.CATALOG
+            testUtil.getHBaseAdmin().split(systemCatalog);
+            // make sure the split finishes (there's no synchronous splitting before HBase 2.x)
+            testUtil.getHBaseAdmin().disableTable(systemCatalog);
+            testUtil.getHBaseAdmin().enableTable(systemCatalog);
+        } catch (DoNotRetryIOException e) {
+            // table is not splittable
+            assert (e.getMessage().contains("NOT splittable"));
+        }
+
+        // test again... Must still be exactly one region.
+        rl = testUtil.getConnection().getRegionLocator(systemCatalog);
+        assertEquals(1, rl.getAllRegionLocations().size());
+    }
+
+    /**
+     * Ensure that we cannot add a column to a parent table or view if
+     * {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK} is true
+     */
+    @Test
+    public void testAddColumnOnParentFails() throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            final String parentTableName = SchemaUtil.getTableName(generateUniqueName(),
+                    generateUniqueName());
+            final String parentViewName = SchemaUtil.getTableName(generateUniqueName(),
+                    generateUniqueName());
+            final String childViewName = SchemaUtil.getTableName(generateUniqueName(),
+                    generateUniqueName());
+            // create parent table
+            String ddl = "CREATE TABLE " + parentTableName + " (col1 INTEGER NOT NULL,"
+                    + " col2 INTEGER " + "CONSTRAINT pk PRIMARY KEY (col1))";
+            conn.createStatement().execute(ddl);
+
+            // create view on table
+            ddl = "CREATE VIEW " + parentViewName + " AS SELECT * FROM " + parentTableName;
+            conn.createStatement().execute(ddl);
+            try {
+                ddl = "ALTER TABLE " + parentTableName + " ADD col4 INTEGER";
+                conn.createStatement().execute(ddl);
+                fail("ALTER TABLE ADD should not be allowed on parent table");
+            } catch (SQLException e) {
+                assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE.getErrorCode(), e.getErrorCode());
+            }
+
+            // create child view on above view
+            ddl = "CREATE VIEW " + childViewName + "(col3 INTEGER) AS SELECT * FROM "
+                    + parentViewName;
+            conn.createStatement().execute(ddl);
+            try {
+                ddl = "ALTER VIEW " + parentViewName + " ADD col4 INTEGER";
+                conn.createStatement().execute(ddl);
+                fail("ALTER VIEW ADD should not be allowed on parent view");
+            } catch (SQLException e) {
+                assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE.getErrorCode(), e.getErrorCode());
+            }
+
+            // alter child view with add column should be allowed
+            ddl = "ALTER VIEW " + childViewName + " ADD col4 INTEGER";
+            conn.createStatement().execute(ddl);
+        }
+    }
+
+    /**
+     * Ensure that we cannot drop a column from a parent table or view if
+     * {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK} is true
+     */
+    @Test
+    public void testDropColumnOnParentFails() throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            final String parentTableName = SchemaUtil.getTableName(generateUniqueName(),
+                    generateUniqueName());
+            final String parentViewName = SchemaUtil.getTableName(generateUniqueName(),
+                    generateUniqueName());
+            final String childViewName = SchemaUtil.getTableName(generateUniqueName(),
+                    generateUniqueName());
+            // create parent table
+            String ddl = "CREATE TABLE " + parentTableName
+                    + " (col1 INTEGER NOT NULL, col2 INTEGER, col3 VARCHAR "
+                    + "CONSTRAINT pk PRIMARY KEY (col1))";
+            conn.createStatement().execute(ddl);
+
+            // create view on table
+            ddl = "CREATE VIEW " + parentViewName + " AS SELECT * FROM " + parentTableName;
+            conn.createStatement().execute(ddl);
+            try {
+                ddl = "ALTER TABLE " + parentTableName + " DROP COLUMN col2";
+                conn.createStatement().execute(ddl);
+                fail("ALTER TABLE DROP COLUMN should not be allowed on parent table");
+            } catch (SQLException e) {
+                assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE.getErrorCode(), e.getErrorCode());
+            }
+
+            // create child view on above view
+            ddl = "CREATE VIEW " + childViewName + "(col5 INTEGER) AS SELECT * FROM "
+                    + parentViewName;
+            conn.createStatement().execute(ddl);
+            try {
+                ddl = "ALTER VIEW " + parentViewName + " DROP COLUMN col2";
+                conn.createStatement().execute(ddl);
+                fail("ALTER VIEW DROP COLUMN should not be allowed on parent view");
+            } catch (SQLException e) {
+                assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE.getErrorCode(), e.getErrorCode());
+            }
+
+            // alter child view with drop column should be allowed
+            ddl = "ALTER VIEW " + childViewName + " DROP COLUMN col2";
+            conn.createStatement().execute(ddl);
+        }
+    }
+
+    // Test for PHOENIX-6032
+    @Test
+    public void testViewDoesNotSeeDataForDroppedColumn() throws Exception {
+        final String parentName = "T_"
+                + SchemaUtil.getTableName(generateUniqueName(), generateUniqueName());
+        final String viewName = "V_"
+                + SchemaUtil.getTableName(generateUniqueName(), generateUniqueName());
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            conn.createStatement().execute("CREATE TABLE " + parentName
+                    + " (A INTEGER PRIMARY KEY, B INTEGER, C VARCHAR, D INTEGER)");
+            conn.createStatement().execute("CREATE VIEW " + viewName + " (VA INTEGER, VB INTEGER)"
+                    + " AS SELECT * FROM " + parentName + " WHERE B=200");
+            // Upsert some data via the view
+            conn.createStatement().execute("UPSERT INTO " + viewName + " (A,B,C,D,VA,VB) VALUES"
+                    + " (2, 200, 'def', -20, 91, 101)");
+            conn.commit();
+        }
+
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            // Query from the parent table and assert expected values
+            ResultSet rs = conn.createStatement().executeQuery("SELECT A,B,C,D FROM " + parentName);
+            assertTrue(rs.next());
+            assertEquals(2, rs.getInt(1));
+            assertEquals(200, rs.getInt(2));
+            assertEquals("def", rs.getString(3));
+            assertEquals(-20, rs.getInt(4));
+            assertFalse(rs.next());
+
+            // Query from the view and assert expected values
+            rs = conn.createStatement().executeQuery("SELECT A,B,C,D,VA,VB FROM " + viewName);
+            assertTrue(rs.next());
+            assertEquals(2, rs.getInt(1));
+            assertEquals(200, rs.getInt(2));
+            assertEquals("def", rs.getString(3));
+            assertEquals(-20, rs.getInt(4));
+            assertEquals(91, rs.getInt(5));
+            assertEquals(101, rs.getInt(6));
+            assertFalse(rs.next());
+        }
+
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            // Drop a parent column from the view
+            conn.createStatement().execute("ALTER VIEW " + viewName + " DROP COLUMN C");
+            try {
+                conn.createStatement().executeQuery("SELECT C FROM " + viewName);
+                fail("Expected a ColumnNotFoundException for C since it was dropped");
+            } catch (ColumnNotFoundException ignore) { }

Review comment:
       I think it would be a much bigger bug if a view alteration caused the base table's schema to be changed. This patch doesn't change any of that, so not sure that an extra check is valuable after this.

##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogRollbackEnabledIT.java
##########
@@ -0,0 +1,273 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.RegionLocator;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.schema.ColumnNotFoundException;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Tests various scenarios when {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK}
+ * is set to true and SYSTEM.CATALOG should not be allowed to split. Note that this config must
+ * be set on both the client and server
+ */
+@Category(NeedsOwnMiniClusterTest.class)
+public class SystemCatalogRollbackEnabledIT extends BaseTest {
+
+    @BeforeClass
+    public static synchronized void doSetup() throws Exception {
+        Map<String, String> serverProps = new HashMap<>(2);
+        Map<String, String> clientProps = new HashMap<>(1);
+        serverProps.put(QueryServices.SYSTEM_CATALOG_SPLITTABLE, "false");
+        serverProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        clientProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
+                new ReadOnlyProps(clientProps.entrySet().iterator()));
+    }
+
+    private void createTable(String tableName) throws Exception {

Review comment:
       This is copied over from an existing class to consolidate tests, but sure I will rename it.

##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogRollbackEnabledIT.java
##########
@@ -0,0 +1,273 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.RegionLocator;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.schema.ColumnNotFoundException;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Tests various scenarios when {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK}
+ * is set to true and SYSTEM.CATALOG should not be allowed to split. Note that this config must
+ * be set on both the client and server
+ */
+@Category(NeedsOwnMiniClusterTest.class)
+public class SystemCatalogRollbackEnabledIT extends BaseTest {
+
+    @BeforeClass
+    public static synchronized void doSetup() throws Exception {
+        Map<String, String> serverProps = new HashMap<>(2);
+        Map<String, String> clientProps = new HashMap<>(1);
+        serverProps.put(QueryServices.SYSTEM_CATALOG_SPLITTABLE, "false");
+        serverProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        clientProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
+                new ReadOnlyProps(clientProps.entrySet().iterator()));
+    }
+
+    private void createTable(String tableName) throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl());
+                Statement stmt = conn.createStatement();) {
+            stmt.execute("DROP TABLE IF EXISTS " + tableName);
+            stmt.execute("CREATE TABLE " + tableName + " (TENANT_ID VARCHAR NOT NULL, " +
+                    "PK1 VARCHAR NOT NULL, V1 VARCHAR CONSTRAINT PK " +
+                    "PRIMARY KEY(TENANT_ID, PK1)) MULTI_TENANT=true");
+            try (Connection tenant1Conn = getTenantConnection("tenant1")) {
+                String view1DDL = "CREATE VIEW " + tableName + "_view1 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            try (Connection tenant1Conn = getTenantConnection("tenant2")) {

Review comment:
       Similarly, this is just copied over but I will change it. Thanks

##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogRollbackEnabledIT.java
##########
@@ -0,0 +1,298 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.RegionLocator;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.schema.ColumnNotFoundException;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Tests various scenarios when
+ * {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK}
+ * is set to true and SYSTEM.CATALOG should not be allowed to split.
+ * Note that this config must
+ * be set on both the client and server
+ */
+@Category(NeedsOwnMiniClusterTest.class)
+public class SystemCatalogRollbackEnabledIT extends BaseTest {
+
+    @BeforeClass
+    public static synchronized void doSetup() throws Exception {
+        Map<String, String> serverProps = new HashMap<>(2);
+        Map<String, String> clientProps = new HashMap<>(1);
+        serverProps.put(QueryServices.SYSTEM_CATALOG_SPLITTABLE, "false");
+        serverProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        clientProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
+                new ReadOnlyProps(clientProps.entrySet().iterator()));
+    }
+
+    private void createTableAndTenantViews(String tableName) throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl());
+                Statement stmt = conn.createStatement();) {
+            stmt.execute("DROP TABLE IF EXISTS " + tableName);
+            stmt.execute("CREATE TABLE " + tableName +
+                    " (TENANT_ID VARCHAR NOT NULL, " +
+                    "PK1 VARCHAR NOT NULL, V1 VARCHAR CONSTRAINT PK " +
+                    "PRIMARY KEY(TENANT_ID, PK1)) MULTI_TENANT=true");
+            try (Connection tenant1Conn = getTenantConnection("tenant1")) {
+                String view1DDL = "CREATE VIEW " + tableName +
+                        "_view1 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            try (Connection tenant2Conn = getTenantConnection("tenant2")) {
+                String view1DDL = "CREATE VIEW " + tableName +
+                        "_view2 AS SELECT * FROM " + tableName;
+                tenant2Conn.createStatement().execute(view1DDL);
+            }
+            conn.commit();
+        }
+    }
+
+    private Connection getTenantConnection(String tenantId)
+            throws SQLException {
+        Properties tenantProps = new Properties();
+        tenantProps.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
+        return DriverManager.getConnection(getUrl(), tenantProps);
+    }
+
+
+    /**
+     * Make sure that SYSTEM.CATALOG cannot be split if
+     * {@link QueryServices#SYSTEM_CATALOG_SPLITTABLE} is false
+     */
+    @Test
+    public void testSystemTableDoesNotSplit() throws Exception {
+        HBaseTestingUtility testUtil = getUtility();
+        for (int i=0; i<10; i++) {
+            createTableAndTenantViews("schema"+i+".table_"+i);
+        }
+        TableName systemCatalog = TableName.valueOf(
+                PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME);
+        RegionLocator rl = testUtil.getConnection()
+                .getRegionLocator(systemCatalog);
+        assertEquals(1, rl.getAllRegionLocations().size());
+        try {
+            // now attempt to split SYSTEM.CATALOG
+            testUtil.getHBaseAdmin().split(systemCatalog);
+            // make sure the split finishes (there's no synchronous splitting
+            // before HBase 2.x)
+            testUtil.getHBaseAdmin().disableTable(systemCatalog);
+            testUtil.getHBaseAdmin().enableTable(systemCatalog);
+        } catch (DoNotRetryIOException e) {
+            // table is not splittable
+            assert (e.getMessage().contains("NOT splittable"));

Review comment:
       hmm I'm not sure. This diff is just a result of copy pasting from the original test `SystemCatalogIT` Let me try to find out. Will change to using JUnit assert.

##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogRollbackEnabledIT.java
##########
@@ -0,0 +1,298 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.RegionLocator;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.schema.ColumnNotFoundException;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Tests various scenarios when
+ * {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK}
+ * is set to true and SYSTEM.CATALOG should not be allowed to split.
+ * Note that this config must
+ * be set on both the client and server
+ */
+@Category(NeedsOwnMiniClusterTest.class)
+public class SystemCatalogRollbackEnabledIT extends BaseTest {
+
+    @BeforeClass
+    public static synchronized void doSetup() throws Exception {
+        Map<String, String> serverProps = new HashMap<>(2);
+        Map<String, String> clientProps = new HashMap<>(1);
+        serverProps.put(QueryServices.SYSTEM_CATALOG_SPLITTABLE, "false");
+        serverProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        clientProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
+                new ReadOnlyProps(clientProps.entrySet().iterator()));
+    }
+
+    private void createTableAndTenantViews(String tableName) throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl());
+                Statement stmt = conn.createStatement();) {
+            stmt.execute("DROP TABLE IF EXISTS " + tableName);
+            stmt.execute("CREATE TABLE " + tableName +
+                    " (TENANT_ID VARCHAR NOT NULL, " +
+                    "PK1 VARCHAR NOT NULL, V1 VARCHAR CONSTRAINT PK " +
+                    "PRIMARY KEY(TENANT_ID, PK1)) MULTI_TENANT=true");
+            try (Connection tenant1Conn = getTenantConnection("tenant1")) {
+                String view1DDL = "CREATE VIEW " + tableName +
+                        "_view1 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            try (Connection tenant2Conn = getTenantConnection("tenant2")) {
+                String view1DDL = "CREATE VIEW " + tableName +
+                        "_view2 AS SELECT * FROM " + tableName;
+                tenant2Conn.createStatement().execute(view1DDL);
+            }
+            conn.commit();
+        }
+    }
+
+    private Connection getTenantConnection(String tenantId)
+            throws SQLException {
+        Properties tenantProps = new Properties();
+        tenantProps.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
+        return DriverManager.getConnection(getUrl(), tenantProps);
+    }
+
+
+    /**
+     * Make sure that SYSTEM.CATALOG cannot be split if
+     * {@link QueryServices#SYSTEM_CATALOG_SPLITTABLE} is false
+     */
+    @Test
+    public void testSystemTableDoesNotSplit() throws Exception {
+        HBaseTestingUtility testUtil = getUtility();
+        for (int i=0; i<10; i++) {
+            createTableAndTenantViews("schema"+i+".table_"+i);
+        }
+        TableName systemCatalog = TableName.valueOf(
+                PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME);
+        RegionLocator rl = testUtil.getConnection()
+                .getRegionLocator(systemCatalog);
+        assertEquals(1, rl.getAllRegionLocations().size());
+        try {
+            // now attempt to split SYSTEM.CATALOG
+            testUtil.getHBaseAdmin().split(systemCatalog);
+            // make sure the split finishes (there's no synchronous splitting
+            // before HBase 2.x)
+            testUtil.getHBaseAdmin().disableTable(systemCatalog);
+            testUtil.getHBaseAdmin().enableTable(systemCatalog);
+        } catch (DoNotRetryIOException e) {
+            // table is not splittable
+            assert (e.getMessage().contains("NOT splittable"));
+        }
+
+        // test again... Must still be exactly one region.
+        rl = testUtil.getConnection().getRegionLocator(systemCatalog);
+        assertEquals(1, rl.getAllRegionLocations().size());
+    }
+
+    /**
+     * Ensure that we cannot add a column to a parent table or view if
+     * {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK} is true
+     */
+    @Test
+    public void testAddColumnOnParentFails() throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            final String parentTableName = SchemaUtil.getTableName(
+                    generateUniqueName(), generateUniqueName());
+            final String parentViewName = SchemaUtil.getTableName(
+                    generateUniqueName(), generateUniqueName());
+            final String childViewName = SchemaUtil.getTableName(
+                    generateUniqueName(), generateUniqueName());
+            // create parent table
+            String ddl = "CREATE TABLE " + parentTableName
+                    + " (col1 INTEGER NOT NULL,"
+                    + " col2 INTEGER " + "CONSTRAINT pk PRIMARY KEY (col1))";
+            conn.createStatement().execute(ddl);
+
+            // create view on table
+            ddl = "CREATE VIEW " + parentViewName + " AS SELECT * FROM "
+                    + parentTableName;
+            conn.createStatement().execute(ddl);
+            try {
+                ddl = "ALTER TABLE " + parentTableName + " ADD col4 INTEGER";
+                conn.createStatement().execute(ddl);
+                fail("ALTER TABLE ADD should not be allowed on parent table");
+            } catch (SQLException e) {
+                assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE
+                        .getErrorCode(), e.getErrorCode());
+            }
+
+            // create child view on above view
+            ddl = "CREATE VIEW " + childViewName
+                    + "(col3 INTEGER) AS SELECT * FROM " + parentViewName;
+            conn.createStatement().execute(ddl);
+            try {
+                ddl = "ALTER VIEW " + parentViewName + " ADD col4 INTEGER";
+                conn.createStatement().execute(ddl);
+                fail("ALTER VIEW ADD should not be allowed on parent view");
+            } catch (SQLException e) {
+                assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE
+                        .getErrorCode(), e.getErrorCode());
+            }
+
+            // alter child view with add column should be allowed
+            ddl = "ALTER VIEW " + childViewName + " ADD col4 INTEGER";
+            conn.createStatement().execute(ddl);
+        }
+    }
+
+    /**
+     * Ensure that we cannot drop a column from a parent table or view if
+     * {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK} is true
+     */
+    @Test
+    public void testDropColumnOnParentFails() throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            final String parentTableName = SchemaUtil.getTableName(
+                    generateUniqueName(), generateUniqueName());
+            final String parentViewName = SchemaUtil.getTableName(
+                    generateUniqueName(), generateUniqueName());
+            final String childViewName = SchemaUtil.getTableName(
+                    generateUniqueName(), generateUniqueName());
+            // create parent table
+            String ddl = "CREATE TABLE " + parentTableName
+                    + " (col1 INTEGER NOT NULL, col2 INTEGER, col3 VARCHAR "
+                    + "CONSTRAINT pk PRIMARY KEY (col1))";
+            conn.createStatement().execute(ddl);
+
+            // create view on table
+            ddl = "CREATE VIEW " + parentViewName + " AS SELECT * FROM "
+                    + parentTableName;
+            conn.createStatement().execute(ddl);
+            try {
+                ddl = "ALTER TABLE " + parentTableName + " DROP COLUMN col2";
+                conn.createStatement().execute(ddl);
+                fail("ALTER TABLE DROP COLUMN should not be allowed on "
+                        + "parent table");
+            } catch (SQLException e) {
+                assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE
+                        .getErrorCode(), e.getErrorCode());
+            }
+
+            // create child view on above view
+            ddl = "CREATE VIEW " + childViewName
+                    + "(col5 INTEGER) AS SELECT * FROM " + parentViewName;
+            conn.createStatement().execute(ddl);
+            try {
+                ddl = "ALTER VIEW " + parentViewName + " DROP COLUMN col2";
+                conn.createStatement().execute(ddl);
+                fail("ALTER VIEW DROP COLUMN should not be allowed on "
+                        + "parent view");
+            } catch (SQLException e) {
+                assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE
+                        .getErrorCode(), e.getErrorCode());
+            }
+
+            // alter child view with drop column should be allowed
+            ddl = "ALTER VIEW " + childViewName + " DROP COLUMN col2";
+            conn.createStatement().execute(ddl);
+        }
+    }
+
+    // Test for PHOENIX-6032
+    @Test
+    public void testViewDoesNotSeeDataForDroppedColumn() throws Exception {
+        final String parentName = "T_" + SchemaUtil.getTableName(
+                generateUniqueName(), generateUniqueName());
+        final String viewName = "V_" + SchemaUtil.getTableName(
+                generateUniqueName(), generateUniqueName());
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            conn.createStatement().execute("CREATE TABLE " + parentName
+                    + " (A INTEGER PRIMARY KEY, B INTEGER, C"
+                    + " VARCHAR, D INTEGER)");
+            conn.createStatement().execute("CREATE VIEW " + viewName
+                    + " (VA INTEGER, VB INTEGER)"
+                    + " AS SELECT * FROM " + parentName + " WHERE B=200");
+            // Upsert some data via the view
+            conn.createStatement().execute("UPSERT INTO " + viewName
+                    + " (A,B,C,D,VA,VB) VALUES"
+                    + " (2, 200, 'def', -20, 91, 101)");
+            conn.commit();
+        }
+
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            // Query from the parent table and assert expected values
+            ResultSet rs = conn.createStatement().executeQuery(
+                    "SELECT A,B,C,D FROM " + parentName);
+            assertTrue(rs.next());
+            assertEquals(2, rs.getInt(1));
+            assertEquals(200, rs.getInt(2));
+            assertEquals("def", rs.getString(3));
+            assertEquals(-20, rs.getInt(4));
+            assertFalse(rs.next());
+
+            // Query from the view and assert expected values
+            rs = conn.createStatement().executeQuery(
+                    "SELECT A,B,C,D,VA,VB FROM " + viewName);
+            assertTrue(rs.next());
+            assertEquals(2, rs.getInt(1));
+            assertEquals(200, rs.getInt(2));
+            assertEquals("def", rs.getString(3));
+            assertEquals(-20, rs.getInt(4));
+            assertEquals(91, rs.getInt(5));
+            assertEquals(101, rs.getInt(6));
+            assertFalse(rs.next());
+        }
+
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            // Drop a parent column from the view
+            conn.createStatement().execute("ALTER VIEW " + viewName
+                    + " DROP COLUMN C");
+            try {
+                conn.createStatement().executeQuery("SELECT C FROM "
+                        + viewName);
+                fail("Expected a ColumnNotFoundException for C since it "
+                        + "was dropped");
+            } catch (ColumnNotFoundException ignore) { }
+        }

Review comment:
       If any other exception apart from CNFE gets thrown here the test will fail anyways.

##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogRollbackEnabledIT.java
##########
@@ -0,0 +1,298 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.RegionLocator;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.schema.ColumnNotFoundException;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Tests various scenarios when
+ * {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK}
+ * is set to true and SYSTEM.CATALOG should not be allowed to split.
+ * Note that this config must
+ * be set on both the client and server
+ */
+@Category(NeedsOwnMiniClusterTest.class)
+public class SystemCatalogRollbackEnabledIT extends BaseTest {
+
+    @BeforeClass
+    public static synchronized void doSetup() throws Exception {
+        Map<String, String> serverProps = new HashMap<>(2);
+        Map<String, String> clientProps = new HashMap<>(1);
+        serverProps.put(QueryServices.SYSTEM_CATALOG_SPLITTABLE, "false");
+        serverProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        clientProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
+                new ReadOnlyProps(clientProps.entrySet().iterator()));
+    }
+
+    private void createTableAndTenantViews(String tableName) throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl());
+                Statement stmt = conn.createStatement();) {
+            stmt.execute("DROP TABLE IF EXISTS " + tableName);
+            stmt.execute("CREATE TABLE " + tableName +
+                    " (TENANT_ID VARCHAR NOT NULL, " +
+                    "PK1 VARCHAR NOT NULL, V1 VARCHAR CONSTRAINT PK " +
+                    "PRIMARY KEY(TENANT_ID, PK1)) MULTI_TENANT=true");
+            try (Connection tenant1Conn = getTenantConnection("tenant1")) {
+                String view1DDL = "CREATE VIEW " + tableName +
+                        "_view1 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            try (Connection tenant2Conn = getTenantConnection("tenant2")) {
+                String view1DDL = "CREATE VIEW " + tableName +
+                        "_view2 AS SELECT * FROM " + tableName;
+                tenant2Conn.createStatement().execute(view1DDL);
+            }
+            conn.commit();
+        }
+    }
+
+    private Connection getTenantConnection(String tenantId)
+            throws SQLException {
+        Properties tenantProps = new Properties();
+        tenantProps.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
+        return DriverManager.getConnection(getUrl(), tenantProps);
+    }
+
+
+    /**
+     * Make sure that SYSTEM.CATALOG cannot be split if
+     * {@link QueryServices#SYSTEM_CATALOG_SPLITTABLE} is false
+     */
+    @Test
+    public void testSystemTableDoesNotSplit() throws Exception {
+        HBaseTestingUtility testUtil = getUtility();
+        for (int i=0; i<10; i++) {
+            createTableAndTenantViews("schema"+i+".table_"+i);
+        }
+        TableName systemCatalog = TableName.valueOf(
+                PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME);
+        RegionLocator rl = testUtil.getConnection()
+                .getRegionLocator(systemCatalog);
+        assertEquals(1, rl.getAllRegionLocations().size());
+        try {
+            // now attempt to split SYSTEM.CATALOG
+            testUtil.getHBaseAdmin().split(systemCatalog);
+            // make sure the split finishes (there's no synchronous splitting
+            // before HBase 2.x)
+            testUtil.getHBaseAdmin().disableTable(systemCatalog);
+            testUtil.getHBaseAdmin().enableTable(systemCatalog);
+        } catch (DoNotRetryIOException e) {
+            // table is not splittable
+            assert (e.getMessage().contains("NOT splittable"));

Review comment:
       Looks like that test wasn't reliably trying to split SYSCAT at all. I will open a follow-up Jira to fix this since it is unrelated to 6032.

##########
File path: phoenix-core/src/it/java/org/apache/phoenix/end2end/SystemCatalogRollbackEnabledIT.java
##########
@@ -0,0 +1,298 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.RegionLocator;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.schema.ColumnNotFoundException;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Tests various scenarios when
+ * {@link QueryServices#ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK}
+ * is set to true and SYSTEM.CATALOG should not be allowed to split.
+ * Note that this config must
+ * be set on both the client and server
+ */
+@Category(NeedsOwnMiniClusterTest.class)
+public class SystemCatalogRollbackEnabledIT extends BaseTest {
+
+    @BeforeClass
+    public static synchronized void doSetup() throws Exception {
+        Map<String, String> serverProps = new HashMap<>(2);
+        Map<String, String> clientProps = new HashMap<>(1);
+        serverProps.put(QueryServices.SYSTEM_CATALOG_SPLITTABLE, "false");
+        serverProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        clientProps.put(QueryServices.ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK,
+                "true");
+        setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
+                new ReadOnlyProps(clientProps.entrySet().iterator()));
+    }
+
+    private void createTableAndTenantViews(String tableName) throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl());
+                Statement stmt = conn.createStatement();) {
+            stmt.execute("DROP TABLE IF EXISTS " + tableName);
+            stmt.execute("CREATE TABLE " + tableName +
+                    " (TENANT_ID VARCHAR NOT NULL, " +
+                    "PK1 VARCHAR NOT NULL, V1 VARCHAR CONSTRAINT PK " +
+                    "PRIMARY KEY(TENANT_ID, PK1)) MULTI_TENANT=true");
+            try (Connection tenant1Conn = getTenantConnection("tenant1")) {
+                String view1DDL = "CREATE VIEW " + tableName +
+                        "_view1 AS SELECT * FROM " +
+                        tableName;
+                tenant1Conn.createStatement().execute(view1DDL);
+            }
+            try (Connection tenant2Conn = getTenantConnection("tenant2")) {
+                String view1DDL = "CREATE VIEW " + tableName +
+                        "_view2 AS SELECT * FROM " + tableName;
+                tenant2Conn.createStatement().execute(view1DDL);
+            }
+            conn.commit();
+        }
+    }
+
+    private Connection getTenantConnection(String tenantId)
+            throws SQLException {
+        Properties tenantProps = new Properties();
+        tenantProps.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
+        return DriverManager.getConnection(getUrl(), tenantProps);
+    }
+
+
+    /**
+     * Make sure that SYSTEM.CATALOG cannot be split if
+     * {@link QueryServices#SYSTEM_CATALOG_SPLITTABLE} is false
+     */
+    @Test
+    public void testSystemTableDoesNotSplit() throws Exception {
+        HBaseTestingUtility testUtil = getUtility();
+        for (int i=0; i<10; i++) {
+            createTableAndTenantViews("schema"+i+".table_"+i);
+        }
+        TableName systemCatalog = TableName.valueOf(
+                PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME);
+        RegionLocator rl = testUtil.getConnection()
+                .getRegionLocator(systemCatalog);
+        assertEquals(1, rl.getAllRegionLocations().size());
+        try {
+            // now attempt to split SYSTEM.CATALOG
+            testUtil.getHBaseAdmin().split(systemCatalog);
+            // make sure the split finishes (there's no synchronous splitting
+            // before HBase 2.x)
+            testUtil.getHBaseAdmin().disableTable(systemCatalog);
+            testUtil.getHBaseAdmin().enableTable(systemCatalog);
+        } catch (DoNotRetryIOException e) {
+            // table is not splittable
+            assert (e.getMessage().contains("NOT splittable"));

Review comment:
       Created https://issues.apache.org/jira/browse/PHOENIX-6212




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] stoty commented on pull request #949: PHOENIX-6032: When phoenix.allow.system.catalog.rollback=true, a view still sees data from a column that was dropped

Posted by GitBox <gi...@apache.org>.
stoty commented on pull request #949:
URL: https://github.com/apache/phoenix/pull/949#issuecomment-719158406


   :broken_heart: **-1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime | Comment |
   |:----:|----------:|--------:|:--------|
   | +0 :ok: |  reexec  |   1m  5s |  Docker mode activated.  |
   ||| _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  1s |  No case conflicting files found.  |
   | +1 :green_heart: |  hbaseanti  |   0m  0s |  Patch does not have any anti-patterns.  |
   | +1 :green_heart: |  @author  |   0m  0s |  The patch does not contain any @author tags.  |
   | -1 :x: |  test4tests  |   0m  0s |  The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.  |
   ||| _ 4.x Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |  11m 41s |  4.x passed  |
   | +1 :green_heart: |  compile  |   1m  0s |  4.x passed  |
   | +1 :green_heart: |  checkstyle  |   1m  4s |  4.x passed  |
   | +1 :green_heart: |  javadoc  |   0m 46s |  4.x passed  |
   | +0 :ok: |  spotbugs  |   3m  9s |  phoenix-core in 4.x has 953 extant spotbugs warnings.  |
   ||| _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   6m 15s |  the patch passed  |
   | +1 :green_heart: |  compile  |   0m 59s |  the patch passed  |
   | +1 :green_heart: |  javac  |   0m 59s |  the patch passed  |
   | -1 :x: |  checkstyle  |   1m  4s |  phoenix-core: The patch generated 4 new + 2127 unchanged - 0 fixed = 2131 total (was 2127)  |
   | -1 :x: |  whitespace  |   0m  0s |  The patch 7 line(s) with tabs.  |
   | +1 :green_heart: |  javadoc  |   0m 45s |  the patch passed  |
   | +1 :green_heart: |  spotbugs  |   3m 21s |  the patch passed  |
   ||| _ Other Tests _ |
   | -1 :x: |  unit  | 171m 22s |  phoenix-core in the patch failed.  |
   | +1 :green_heart: |  asflicense  |   0m 28s |  The patch does not generate ASF License warnings.  |
   |  |   | 205m 29s |   |
   
   
   | Reason | Tests |
   |-------:|:------|
   | Failed junit tests | phoenix.end2end.UpsertSelectIT |
   |   | phoenix.end2end.SkipScanQueryIT |
   
   
   | Subsystem | Report/Notes |
   |----------:|:-------------|
   | Docker | ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-949/1/artifact/yetus-general-check/output/Dockerfile |
   | GITHUB PR | https://github.com/apache/phoenix/pull/949 |
   | JIRA Issue | PHOENIX-6032 |
   | Optional Tests | dupname asflicense javac javadoc unit spotbugs hbaseanti checkstyle compile |
   | uname | Linux af08208ec8c5 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev/phoenix-personality.sh |
   | git revision | 4.x / 2aaf2e2 |
   | Default Java | Private Build-1.8.0_242-8u242-b08-0ubuntu3~16.04-b08 |
   | checkstyle | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-949/1/artifact/yetus-general-check/output/diff-checkstyle-phoenix-core.txt |
   | whitespace | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-949/1/artifact/yetus-general-check/output/whitespace-tabs.txt |
   | unit | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-949/1/artifact/yetus-general-check/output/patch-unit-phoenix-core.txt |
   |  Test Results | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-949/1/testReport/ |
   | Max. process+thread count | 6075 (vs. ulimit of 30000) |
   | modules | C: phoenix-core U: phoenix-core |
   | Console output | https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-949/1/console |
   | versions | git=2.7.4 maven=3.3.9 spotbugs=4.1.3 |
   | Powered by | Apache Yetus 0.12.0 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [phoenix] ChinmaySKulkarni merged pull request #949: PHOENIX-6032: When phoenix.allow.system.catalog.rollback=true, a view still sees data from a column that was dropped

Posted by GitBox <gi...@apache.org>.
ChinmaySKulkarni merged pull request #949:
URL: https://github.com/apache/phoenix/pull/949


   


----------------------------------------------------------------
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:
users@infra.apache.org