Palash Chauhan created PHOENIX-7284:
---------------------------------------

             Summary: Refactor TransformTool cutover to be done through 
MetadataEndpointImpl RPC
                 Key: PHOENIX-7284
                 URL: https://issues.apache.org/jira/browse/PHOENIX-7284
             Project: Phoenix
          Issue Type: Bug
            Reporter: Palash Chauhan


During online data format change, TransformMonitorTask performs a cutover where 
we switch from using old physical table for reads and writes to the new 
physical table for reads and writes. This is done using an [UPSERT 
query|https://github.com/apache/phoenix/blob/master/phoenix-core-server/src/main/java/org/apache/phoenix/schema/transform/Transform.java#L140-L145]
 into SYSTEM.CATALOG.
{code:java}
String
                changeTable = String.format("UPSERT INTO SYSTEM.CATALOG "
                + "(TENANT_ID, TABLE_SCHEM, TABLE_NAME, PHYSICAL_TABLE_NAME %s 
) "
                + "VALUES(?, ?, ?, ? %s)", columnNames.size() > 0 ? ","
                + String.join(",", columnNames) : "", columnNames.size() > 0
            ? "," + QueryUtil.generateInListParams(columnValues.size()) : "");  
      LOGGER.info("About to do cutover via " + changeTable); {code}
If clients are using 
[PHOENIX-6883|https://issues.apache.org/jira/browse/PHOENIX-6883], they will 
never be able to learn about this change of physical table for the logical 
table. 

We can refactor the cutover logic to be implemented as an RPC in 
MetadataEndpointImpl where we can take a lock on the table, update 
LAST_DDL_TIMESTAMP and invalidate cache entries on all region servers. This way 
all clients will be able to learn about this change. 



 



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

Reply via email to