phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From twdsilva <...@git.apache.org>
Subject [GitHub] phoenix pull request #303: PHOENIX-3534 Support multi region SYSTEM.CATALOG ...
Date Sat, 02 Jun 2018 20:27:57 GMT
Github user twdsilva commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/303#discussion_r192569643
  
    --- Diff: phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java ---
    @@ -388,51 +435,65 @@ public void testViewAndTableInDifferentSchemas(boolean isNamespaceMapped)
throws
             } catch (TableNotFoundException ignore) {
             }
             ddl = "DROP TABLE " + fullTableName1;
    -        validateCannotDropTableWithChildViewsWithoutCascade(conn, fullTableName1);
             ddl = "DROP VIEW " + fullViewName2;
             conn.createStatement().execute(ddl);
             ddl = "DROP TABLE " + fullTableName1;
             conn.createStatement().execute(ddl);
         }
     
    -    
    +
         @Test
    -    public void testDisallowDropOfColumnOnParentTable() throws Exception {
    +    public void testDropOfColumnOnParentTableInvalidatesView() throws Exception {
             Connection conn = DriverManager.getConnection(getUrl());
    +        String fullTableName = generateUniqueTableName();
    +        String viewName = generateUniqueViewName();
    +        splitSystemCatalog(Lists.newArrayList(fullTableName, viewName));
    +
             String ddl = "CREATE TABLE " + fullTableName + " (k1 INTEGER NOT NULL, k2 INTEGER
NOT NULL, v1 DECIMAL, CONSTRAINT pk PRIMARY KEY (k1, k2))" + tableDDLOptions;
             conn.createStatement().execute(ddl);
    -        String viewName = "V_" + generateUniqueName();
             ddl = "CREATE VIEW " + viewName + "(v2 VARCHAR, v3 VARCHAR) AS SELECT * FROM
" + fullTableName + " WHERE v1 = 1.0";
             conn.createStatement().execute(ddl);
             
    -        try {
    -            conn.createStatement().execute("ALTER TABLE " + fullTableName + " DROP COLUMN
v1");
    -            fail();
    -        } catch (SQLException e) {
    -            assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE.getErrorCode(), e.getErrorCode());
    +        conn.createStatement().execute("ALTER TABLE " + fullTableName + " DROP COLUMN
v1");
    +        // TODO see if its possibel to prevent the dropping of a column thats required
by a child view (for its view where clause)
    +        // the view should be invalid
    --- End diff --
    
    @JamesRTaylor 
    
    We don't need to do the checkAndPut on the header row of the base table as this will block
clients making changes to different columns. We only need to ensure that if multiple clients
are making changes to the same column only one of them is allowed to make the change. So we
can use the rowkey of the column row. We could also do the checkAndPut on the new SYSTEM.CHILD_LINK
table instead of SYSTEM.CATALOG. This would be done from MetadataClient to ensure that no
other client can make a conflicting change before we call addColumn or dropColumn.


---

Mime
View raw message