[phoenix] 24/34: PHOENIX-5247 DROP TABLE and DROP VIEW commands fail to drop second or higher level child views
This is an automated email from the ASF dual-hosted git repository. tdsilva pushed a commit to branch 4.14-HBase-1.4 in repository https://gitbox.apache.org/repos/asf/phoenix.git commit 7d2aac130180119fa183c717940a367e7706672f Author: Kadir AuthorDate: Wed Apr 17 17:27:16 2019 -0700 PHOENIX-5247 DROP TABLE and DROP VIEW commands fail to drop second or higher level child views --- .../src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java | 4 ++-- phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java | 2 +- .../java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java index d33d538..6d2dfb9 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java @@ -422,7 +422,7 @@ public class BasePermissionsIT extends BaseTest { @Override public Object run() throws Exception { try (Connection conn = getConnection(); Statement stmt = conn.createStatement();) { -assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName)); +assertFalse(stmt.execute(String.format("DROP TABLE IF EXISTS %s CASCADE", tableName))); } return null; } @@ -647,7 +647,7 @@ public class BasePermissionsIT extends BaseTest { @Override public Object run() throws Exception { try (Connection conn = getConnection(); Statement stmt = conn.createStatement();) { -assertFalse(stmt.execute("DROP VIEW " + viewName)); +assertFalse(stmt.execute(String.format("DROP VIEW %s CASCADE", viewName))); } return null; } diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java index 34292ba..a6e066b 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java @@ -428,7 +428,7 @@ public class ViewIT extends BaseViewIT { ddl = "CREATE LOCAL INDEX idx on " + fullViewName1 + "(v2)"; conn.createStatement().execute(ddl); String fullViewName2 = SchemaUtil.getTableName(viewSchemaName, "V_" + generateUniqueName()); -ddl = "CREATE VIEW " + fullViewName2 + "(v2 VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE k > 10"; +ddl = "CREATE VIEW " + fullViewName2 + "(v3 VARCHAR) AS SELECT * FROM " + fullViewName1 + " WHERE k > 10"; conn.createStatement().execute(ddl); validateCannotDropTableWithChildViewsWithoutCascade(conn, fullTableName); diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java index a87325e..f810dd7 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java @@ -2169,7 +2169,7 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements Coprocesso EnvironmentEdgeManager.currentTimeMillis(), null); } -if (tableType == PTableType.TABLE || tableType == PTableType.SYSTEM) { +if (tableType == PTableType.TABLE || tableType == PTableType.SYSTEM || tableType == PTableType.VIEW) { // Handle any child views that exist TableViewFinder tableViewFinderResult = findChildViews(region, tenantId, table, clientVersion, !isCascade); if (tableViewFinderResult.hasViews()) { @@ -2191,7 +2191,7 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements Coprocesso acquireLock(region, viewKey, locks); MetaDataMutationResult result = doDropTable(viewKey, viewTenantId, viewSchemaName, viewName, null, PTableType.VIEW, rowsToDelete, invalidateList, locks, -tableNamesToDelete, sharedTablesToDelete, false, clientVersion); +tableNamesToDelete, sharedTablesToDelete, true, clientVersion); if (result.getMutationCode() != MutationCode.TABLE_ALREADY_EXISTS) { return result; } } }
[phoenix] 24/34: PHOENIX-5247 DROP TABLE and DROP VIEW commands fail to drop second or higher level child views
This is an automated email from the ASF dual-hosted git repository. tdsilva pushed a commit to branch 4.14-HBase-1.3 in repository https://gitbox.apache.org/repos/asf/phoenix.git commit 88a00e21ee700b8a4d011068a9b65461aa0c123c Author: Kadir AuthorDate: Wed Apr 17 17:27:16 2019 -0700 PHOENIX-5247 DROP TABLE and DROP VIEW commands fail to drop second or higher level child views --- .../src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java | 4 ++-- phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java | 2 +- .../java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java index d33d538..6d2dfb9 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java @@ -422,7 +422,7 @@ public class BasePermissionsIT extends BaseTest { @Override public Object run() throws Exception { try (Connection conn = getConnection(); Statement stmt = conn.createStatement();) { -assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName)); +assertFalse(stmt.execute(String.format("DROP TABLE IF EXISTS %s CASCADE", tableName))); } return null; } @@ -647,7 +647,7 @@ public class BasePermissionsIT extends BaseTest { @Override public Object run() throws Exception { try (Connection conn = getConnection(); Statement stmt = conn.createStatement();) { -assertFalse(stmt.execute("DROP VIEW " + viewName)); +assertFalse(stmt.execute(String.format("DROP VIEW %s CASCADE", viewName))); } return null; } diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java index 34292ba..a6e066b 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java @@ -428,7 +428,7 @@ public class ViewIT extends BaseViewIT { ddl = "CREATE LOCAL INDEX idx on " + fullViewName1 + "(v2)"; conn.createStatement().execute(ddl); String fullViewName2 = SchemaUtil.getTableName(viewSchemaName, "V_" + generateUniqueName()); -ddl = "CREATE VIEW " + fullViewName2 + "(v2 VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE k > 10"; +ddl = "CREATE VIEW " + fullViewName2 + "(v3 VARCHAR) AS SELECT * FROM " + fullViewName1 + " WHERE k > 10"; conn.createStatement().execute(ddl); validateCannotDropTableWithChildViewsWithoutCascade(conn, fullTableName); diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java index a87325e..f810dd7 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java @@ -2169,7 +2169,7 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements Coprocesso EnvironmentEdgeManager.currentTimeMillis(), null); } -if (tableType == PTableType.TABLE || tableType == PTableType.SYSTEM) { +if (tableType == PTableType.TABLE || tableType == PTableType.SYSTEM || tableType == PTableType.VIEW) { // Handle any child views that exist TableViewFinder tableViewFinderResult = findChildViews(region, tenantId, table, clientVersion, !isCascade); if (tableViewFinderResult.hasViews()) { @@ -2191,7 +2191,7 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements Coprocesso acquireLock(region, viewKey, locks); MetaDataMutationResult result = doDropTable(viewKey, viewTenantId, viewSchemaName, viewName, null, PTableType.VIEW, rowsToDelete, invalidateList, locks, -tableNamesToDelete, sharedTablesToDelete, false, clientVersion); +tableNamesToDelete, sharedTablesToDelete, true, clientVersion); if (result.getMutationCode() != MutationCode.TABLE_ALREADY_EXISTS) { return result; } } }
[phoenix] 24/34: PHOENIX-5247 DROP TABLE and DROP VIEW commands fail to drop second or higher level child views
This is an automated email from the ASF dual-hosted git repository. tdsilva pushed a commit to branch 4.14-HBase-1.2 in repository https://gitbox.apache.org/repos/asf/phoenix.git commit 9070d99309e6fd83ed861b1c4340d828156d571e Author: Kadir AuthorDate: Wed Apr 17 17:27:16 2019 -0700 PHOENIX-5247 DROP TABLE and DROP VIEW commands fail to drop second or higher level child views --- .../src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java | 4 ++-- phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java | 2 +- .../java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java index d33d538..6d2dfb9 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java @@ -422,7 +422,7 @@ public class BasePermissionsIT extends BaseTest { @Override public Object run() throws Exception { try (Connection conn = getConnection(); Statement stmt = conn.createStatement();) { -assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName)); +assertFalse(stmt.execute(String.format("DROP TABLE IF EXISTS %s CASCADE", tableName))); } return null; } @@ -647,7 +647,7 @@ public class BasePermissionsIT extends BaseTest { @Override public Object run() throws Exception { try (Connection conn = getConnection(); Statement stmt = conn.createStatement();) { -assertFalse(stmt.execute("DROP VIEW " + viewName)); +assertFalse(stmt.execute(String.format("DROP VIEW %s CASCADE", viewName))); } return null; } diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java index 34292ba..a6e066b 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java @@ -428,7 +428,7 @@ public class ViewIT extends BaseViewIT { ddl = "CREATE LOCAL INDEX idx on " + fullViewName1 + "(v2)"; conn.createStatement().execute(ddl); String fullViewName2 = SchemaUtil.getTableName(viewSchemaName, "V_" + generateUniqueName()); -ddl = "CREATE VIEW " + fullViewName2 + "(v2 VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE k > 10"; +ddl = "CREATE VIEW " + fullViewName2 + "(v3 VARCHAR) AS SELECT * FROM " + fullViewName1 + " WHERE k > 10"; conn.createStatement().execute(ddl); validateCannotDropTableWithChildViewsWithoutCascade(conn, fullTableName); diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java index a87325e..f810dd7 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java @@ -2169,7 +2169,7 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements Coprocesso EnvironmentEdgeManager.currentTimeMillis(), null); } -if (tableType == PTableType.TABLE || tableType == PTableType.SYSTEM) { +if (tableType == PTableType.TABLE || tableType == PTableType.SYSTEM || tableType == PTableType.VIEW) { // Handle any child views that exist TableViewFinder tableViewFinderResult = findChildViews(region, tenantId, table, clientVersion, !isCascade); if (tableViewFinderResult.hasViews()) { @@ -2191,7 +2191,7 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements Coprocesso acquireLock(region, viewKey, locks); MetaDataMutationResult result = doDropTable(viewKey, viewTenantId, viewSchemaName, viewName, null, PTableType.VIEW, rowsToDelete, invalidateList, locks, -tableNamesToDelete, sharedTablesToDelete, false, clientVersion); +tableNamesToDelete, sharedTablesToDelete, true, clientVersion); if (result.getMutationCode() != MutationCode.TABLE_ALREADY_EXISTS) { return result; } } }