[ https://issues.apache.org/jira/browse/PHOENIX-7212?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Palash Chauhan updated PHOENIX-7212: ------------------------------------ Description: When a tenant view is resolved and it inherits an index from its parent view/table, a PTable object for the inherited index is added to the list of index PTables in the tenant view PTable object. This PTable object has a modified name of the form `TenantView#Index` and has its tenantId attribute set to that of the tenant view. During a query/upsert, along with the table/view, we also add the indexes of the table/view to the request for validating LAST_DDL_TIMESTAMP. We provide the key of the PTables i.e. (tenantId, schemaName, tableName) to the server. Server looks up its cache based on this key to find out the LAST_DDL_TIMESTAMP and if the key is not present, it fetches the table from SYSCAT. Suppose we perform a query on a tenant view which has inherited an index still in BUILDING state. After the query finishes, server would have cached (tenantId,schema,table) for the actual global index. The index is then built and its state changes to ACTIVE. Cache invalidation happens for the key (null, schema, table). A subsequent query on the tenant view will successfully validate the inherited index and will not learn about the state change. was: When a tenant view is resolved and it inherits an index from its parent view/table, a PTable object for the inherited index is added to the list of index PTables in the tenant view PTable object. This PTable object has a modified name of the form `TenantView#Index` and has its tenantId attribute set to that of the tenant view. During a query/upsert, along with the table/view, we also add the indexes of the table/view to the request for validating LAST_DDL_TIMESTAMP. We provide the key of the PTables i.e. (tenantId, schemaName, tableName) to the server. Server looks up its cache based on this key to find out the LAST_DDL_TIMESTAMP and if the key is not present, it fetches the table from SYSCAT. Suppose we perform a query on a tenant view which has inherited an index still in BUILDING state. After the query finishes, server would have cached (tenantId,schema,table) for the actual global index. The index is then built and its state changes to ACTIVE. Cache invalidation happens for the key (null, schema, table). A subsequent query on the tenant view will successfully validate the inherited index and will not learn about the state change. > Handle inherited indexes for tenant views when validating LAST_DDL_TIMESTAMPS > ----------------------------------------------------------------------------- > > Key: PHOENIX-7212 > URL: https://issues.apache.org/jira/browse/PHOENIX-7212 > Project: Phoenix > Issue Type: Sub-task > Reporter: Palash Chauhan > Assignee: Palash Chauhan > Priority: Major > > When a tenant view is resolved and it inherits an index from its parent > view/table, a PTable object for the inherited index is added to the list of > index PTables in the tenant view PTable object. This PTable object has a > modified name of the form `TenantView#Index` and has its tenantId attribute > set to that of the tenant view. > During a query/upsert, along with the table/view, we also add the indexes of > the table/view to the request for validating LAST_DDL_TIMESTAMP. We provide > the key of the PTables i.e. (tenantId, schemaName, tableName) to the server. > Server looks up its cache based on this key to find out the > LAST_DDL_TIMESTAMP and if the key is not present, it fetches the table from > SYSCAT. > Suppose we perform a query on a tenant view which has inherited an index > still in BUILDING state. After the query finishes, server would have cached > (tenantId,schema,table) for the actual global index. The index is then built > and its state changes to ACTIVE. Cache invalidation happens for the key > (null, schema, table). A subsequent query on the tenant view will > successfully validate the inherited index and will not learn about the state > change. -- This message was sent by Atlassian Jira (v8.20.10#820010)