phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas D'Silva (JIRA)" <>
Subject [jira] [Commented] (PHOENIX-4195) PHOENIX-4195 Deleting tenant rows using a tenant or global connection on the base table fails
Date Thu, 07 Jun 2018 22:46:00 GMT


Thomas D'Silva commented on PHOENIX-4195:

If the table/view has a child view that added their own PK columns the optimization won't
work.  I don't think its makes sense to traverse the view hierarchy just to determine whether
or not to use this optimization. 

I suggested not using the optimization for multi-tenant tables because as you said PTable
currently doesn't indicate if it has any child views and multi-tenant tables are most likely
have child views. 

You could run a query on SYSTEM.CATALOG to see if the table/view has any child views (by querying
for the CHILD_TABLE link type). I needed to something similar PHOENIX-3534. You could adapt
the following code.
Also after PHOENIX-3534, the child links will be moved to their a separate SYSTEM.CHILD_LINK

 * @return true if the given table has at least one child view
 * @throws IOException 
 public static boolean hasChildViews(Table systemCatalog, byte[] tenantId, byte[] schemaName,
byte[] tableName, long timestamp) throws IOException {
 byte[] key = SchemaUtil.getTableKey(tenantId, schemaName, tableName);
 Scan scan = MetaDataUtil.newTableRowsScan(key, MetaDataProtocol.MIN_TABLE_TIMESTAMP, timestamp);
 SingleColumnValueFilter linkFilter =
 LinkType.CHILD_TABLE.getSerializedValueAsByteArray()) {
 // if we found a row with the CHILD_TABLE link type we are done and can
 // terminate the scan
 public boolean filterAllRemaining() throws IOException {
 return matchedColumn;
 try (ResultScanner scanner = systemCatalog.getScanner(scan)) {
 Result result =;
 return result!=null; 

> PHOENIX-4195 Deleting tenant rows using a tenant or global connection on the base table
> ---------------------------------------------------------------------------------------------
>                 Key: PHOENIX-4195
>                 URL:
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Thomas D'Silva
>            Assignee: Geoffrey Jacoby
>            Priority: Major
>         Attachments: test.diff
> The attached test fails.

This message was sent by Atlassian JIRA

View raw message