[ 
https://issues.apache.org/jira/browse/PHOENIX-4612?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Xu Cang updated PHOENIX-4612:
-----------------------------
    Attachment: PHOENIX-4612-4.x-HBase-1.3.001.patch

> Index immutability doesn't change when data table immutable changes
> -------------------------------------------------------------------
>
>                 Key: PHOENIX-4612
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-4612
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: James Taylor
>            Priority: Major
>         Attachments: PHOENIX-4612-4.x-HBase-1.3.001.patch
>
>
> The immutability of an index should change when the data table immutable 
> changes. Probably best to not allow table immutability to change as part of 
> PHOENIX-1160.
> Here's a test that currently fails:
> {code}
>     private static void assertImmutability(Connection conn, String tableName, 
> boolean expectedImmutableRows) throws Exception {
>         ResultSet rs = conn.createStatement().executeQuery("SELECT /*+ 
> NO_INDEX */ v FROM " + tableName);
>         rs.next();
>         PTable table = 
> conn.unwrap(PhoenixConnection.class).getMetaDataCache().getTableRef(new 
> PTableKey(null, tableName)).getTable();
>         assertEquals(expectedImmutableRows, table.isImmutableRows());
>         PhoenixStatement stmt = 
> conn.createStatement().unwrap(PhoenixStatement.class);
>         rs = stmt.executeQuery("SELECT v FROM " + tableName);
>         rs.next();
>         assertTrue(stmt.getQueryPlan().getTableRef().getTable().getType() == 
> PTableType.INDEX);
>         table = 
> conn.unwrap(PhoenixConnection.class).getMetaDataCache().getTableRef(new 
> PTableKey(null, tableName)).getTable();
>         assertEquals(expectedImmutableRows, table.isImmutableRows());
>         for (PTable index : table.getIndexes()) {
>             assertEquals(expectedImmutableRows, index.isImmutableRows());
>         }
>     }
>     
>     @Test
>     public void testIndexImmutabilityChangesWithTable() throws Exception {
>         Connection conn = DriverManager.getConnection(getUrl());
>         String tableName = generateUniqueName();
>         String indexName = generateUniqueName();
>         conn.createStatement().execute("CREATE IMMUTABLE TABLE " + tableName 
> + "(k VARCHAR PRIMARY KEY, v VARCHAR) COLUMN_ENCODED_BYTES=NONE, 
> IMMUTABLE_STORAGE_SCHEME = ONE_CELL_PER_COLUMN");
>         conn.createStatement().execute("CREATE INDEX " + indexName + " ON " + 
> tableName + "(v)");
>         assertImmutability(conn, tableName, true);
>         conn.createStatement().execute("ALTER TABLE " + tableName + " SET 
> IMMUTABLE_ROWS=false");
>         assertImmutability(conn, tableName, false);
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to