Copilot commented on code in PR #2718:
URL: https://github.com/apache/phoenix/pull/2718#discussion_r4794184590


##########
phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java:
##########
@@ -2981,7 +2981,16 @@ Collections.<byte[]> emptySet(), HConstants.NO_NONCE, 
HConstants.NO_NONCE,
           // used by buildTable does not include 't' due to how SCN is 
implemented.
           clientTimeStamp += 1;
         }
-        PTable newTable = buildTable(tableKey, cacheKey, region, 
clientTimeStamp, clientVersion);
+        // The catalog rows are already committed here. If the table read 
fails, for example
+        // because the region moves, do not report a failure. The client then 
builds the table
+        // from its own metadata.
+        PTable newTable = null;
+        try {
+          newTable = buildTable(tableKey, cacheKey, region, clientTimeStamp, 
clientVersion);
+        } catch (IOException | SQLException e) {
+          LOGGER.warn("Could not read {} {} after create, key {}; returning 
success without it",
+            tableType, fullTableName, Bytes.toStringBinary(tableKey), e);

Review Comment:
   When this fallback is used for a base table with change detection enabled, 
`MetaDataClient` caches a null `externalSchemaId`, so subsequent writes omit 
`EXTERNAL_SCHEMA_ID` from their write-ahead-log (WAL) annotations. Even a 
forced refresh retains the missing ID because `getTable` omits base-table 
metadata when timestamps match, leaving those WAL entries without the exported 
schema lookup ID. Preserve the generated ID in the fallback response, or ensure 
the client fetches complete metadata before allowing writes.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to