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


##########
phoenix-core-client/src/main/java/org/apache/phoenix/util/ValidateLastDDLTimestampUtil.java:
##########
@@ -143,14 +143,17 @@ public static void validateLastDDLTimestamp(
 
         for (TableRef tableRef : tableRefs) {
 
-            //when querying an index, we need to validate its parent table
-            //in case the index was dropped
-            if (PTableType.INDEX.equals(tableRef.getTable().getType())) {
+            // validate all ancestors of this PTable if any
+            // index -> base table
+            // view -> parent view and its ancestors
+            // view index -> view and its ancestors
+            for (Map.Entry<PTableKey, Long> entry :
+                    
tableRef.getTable().getAncestorLastDDLTimestampMap().entrySet()) {
                 innerBuilder = 
RegionServerEndpointProtos.LastDDLTimestampRequest.newBuilder();
-                PTableKey key = new PTableKey(conn.getTenantId(),
-                        tableRef.getTable().getParentName().getString());
-                PTable parentTable = conn.getTable(key);
-                setLastDDLTimestampRequestParameters(innerBuilder, 
conn.getTenantId(), parentTable);
+                PTable ancestorTable = conn.getTable(entry.getKey());

Review Comment:
   Do we still need to call this method `conn.getTable(entry.getKey())` ? 
   We have all the things required to construct `LastDDLTimestampRequest` 
object in `table. getAncestorLastDDLTimestampMap` map.
   The only downside is getAncestorLastDDLTimestampMap contains PTableKey which 
only has tenantID and name. Here the name is fully qualified name which is the 
combination of schema name and tableName.
   Whenever we want to call validateLastDDLTimestamp RPC, we need to split the 
fully qualified name to schema name and tableName which can increase pressure 
on memory. But definitely we don't want to call conn.getTable method.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to