[ 
https://issues.apache.org/jira/browse/PHOENIX-7190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17815435#comment-17815435
 ] 

ASF GitHub Bot commented on PHOENIX-7190:
-----------------------------------------

palashc commented on code in PR #1807:
URL: https://github.com/apache/phoenix/pull/1807#discussion_r1482125146


##########
phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java:
##########
@@ -716,9 +716,10 @@ public MetaDataMutationResult updateCache(PName 
origTenantId, String schemaName,
                             // In this case, we update the parent table which 
may in turn pull
                             // in indexes to add to this table.
                             long resolvedTime = 
TransactionUtil.getResolvedTime(connection, result);
-                            if (addColumnsAndIndexesFromAncestors(result, 
resolvedTimestamp,
+                            if 
(addColumnsIndexesAndLastDDLTimestampsFromAncestors(result, resolvedTimestamp,
                                     true, false)) {
-                                connection.addTable(result.getTable(), 
resolvedTime);
+                                
connection.addTable(updateIndexesWithAncestorMap(result.getTable()),

Review Comment:
   Oh right. Missed that!





> Changes made to base table directly are not visible to the view.
> ----------------------------------------------------------------
>
>                 Key: PHOENIX-7190
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-7190
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Rushabh Shah
>            Assignee: Palash Chauhan
>            Priority: Major
>
> Steps to reproduce:
> 1. Create base table table1 with columns: PK1, V0, V1, V2
> 2. Create view view1 on the base table as SELECT * from table1;
> 3. Run SELECT * from view1; --> This will cache PTable of view1 on the client 
> side. This will  resolve all the columns of the base table and cache it in 
> view's PTable.
> 4. Run ALTER table table1 DROP COLUMN V1;
> This will update the last ddl timestamp of table1
> 5. Run SELECT * from table1;
> Server will throw StaleMetadataCacheException and it will fetch the latest 
> PTable of the base table from server and cache it on client.
> 6. Run SELECT V1 from view1;
>  
> Expected behavior:
> Client should encounter ColumnNotFoundException since we remove V1 from the 
> base table.
>  
> Actual behavior:
> Client doesn't throw any Exception
>  
> Why?
> The client is using the PTable object of view1 which was cached after step 3.
> During the query execution, client will validate last ddl timestamp of the 
> table and the view.
> Client has upto date last ddl timestamp of the view1 after step 3
> Client has upto date last ddl timestamp of the base table after 5.
> Thats why the select query in step6 didn't fail.
> Solution:
> While caching the view on the client side, we should also store the last ddl 
> timestamp of the whole hierarchy inside view's PTable object. While 
> validating last ddl timestamp of the view, we should validate the last ddl 
> timestamp of the hierarchy which is cached inside view's PTable but the view 
> was resolved sometime in the past.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to