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

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

shahrs87 commented on code in PR #1854:
URL: https://github.com/apache/phoenix/pull/1854#discussion_r1525314684


##########
phoenix-core/src/test/java/org/apache/phoenix/cache/ServerMetadataCacheIT.java:
##########
@@ -85,13 +89,13 @@
 public class ServerMetadataCacheIT extends ParallelStatsDisabledIT {
 
     private final Random RANDOM = new Random(42);
-    private final long NEVER = (long) 
ConnectionProperty.UPDATE_CACHE_FREQUENCY.getValue("NEVER");
 
     private static ServerName serverName;
 
     @BeforeClass
     public static synchronized void doSetup() throws Exception {
         Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
+        props.put(QueryServices.DEFAULT_UPDATE_CACHE_FREQUENCY_ATRRIB, 
Long.toString(Long.MAX_VALUE));

Review Comment:
   ```suggestion
           props.put(QueryServices.DEFAULT_UPDATE_CACHE_FREQUENCY_ATRRIB, 
(long) ConnectionProperty.UPDATE_CACHE_FREQUENCY.getValue("NEVER"););
   ```



##########
phoenix-core/src/test/java/org/apache/phoenix/cache/ServerMetadataCacheIT.java:
##########
@@ -1700,9 +1704,109 @@ public void testInheritedIndexOnTenantViews(boolean 
sameTenantViewNames) throws
         }
     }
 
+    /**
+     * Test that a client can learn about the changes to a base table's
+     * sequence number after a view is created on the table.
+     */
+    @Test
+    public void testBaseTableSequenceNumberAfterCreateView() throws Exception {

Review Comment:
   Do we need this test? AlterTableIT#testAddingColumnsToTablesAndViews does 
the exact same thing.





> Always resolve table before DDL operations.
> -------------------------------------------
>
>                 Key: PHOENIX-7270
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-7270
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Rushabh Shah
>            Assignee: Palash Chauhan
>            Priority: Major
>
> After we set the UCF = NEVER to all tables, we are validating last ddl 
> timestamps for read and write queries.
> For DDL operations, we are reading the PTable from the client side cache.
> In some cases, after the DDL operations we are updating/invalidating the 
> cache for the table which is being altered but we don't invalidate the cache 
> for the parent table (in case of views) or indexes. 
> When column encoding is set to true, we increment the seq number for base 
> physical table (for views) whenever we create a view. Refer 
> [here|https://github.com/apache/phoenix/blob/master/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java#L2924-L2931]
>  for more details. Once the create view command is executed successfully, we 
> only add the view to the cache but we don't update the base table in the 
> cache. This can cause an inconsistency when we use the same cached PTable 
> object for next DDL operations on the base table.
> Solutions:
> 1. Validate last ddl timestamps for table, view hierarchy and indexes for 
> every DDL operations like we do for read and write queries.
> 2. Always resolve the table, view hierarchy and indexes for every DDL 
> operation. It will have the same effect as UCF is set to ALWAYS but just for 
> DDL operations.
> I would prefer option#2 since that will guarantee we always get the latest 
> Ptable object for DDL operations.



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

Reply via email to