virajjasani commented on code in PR #2658:
URL: https://github.com/apache/phoenix/pull/2658#discussion_r4498828992


##########
phoenix-core-client/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java:
##########
@@ -222,14 +222,18 @@ public void removeTable(PName tenantId, String tableName, 
String parentTableName
         for (int i = 0; i < newIndexes.size(); i++) {
           PTable index = newIndexes.get(i);
           if (index.getName().getString().equals(tableName)) {
-            newIndexes.remove(i);
-            PTableImpl.Builder parentTableBuilder =
-              PTableImpl.builderWithColumns(parentTableRef.getTable(),
-                
getColumnsToClone(parentTableRef.getTable())).setIndexes(newIndexes);
-            if (tableTimeStamp != HConstants.LATEST_TIMESTAMP) {
-              parentTableBuilder.setTimeStamp(tableTimeStamp);
+            if (tableTimeStamp == HConstants.LATEST_TIMESTAMP) {
+              // A parent copy without the index keeps the server timestamp. 
The server then
+              // reports no change, and the incomplete copy stays in the 
cache. Remove the
+              // parent entry instead. The next resolve then gets the full 
table.
+              metaData.remove(parentTableRef.getTable().getKey());
+              break;
             }
-            PTable parentTable = parentTableBuilder.build();
+            newIndexes.remove(i);
+            PTable parentTable = PTableImpl
+              .builderWithColumns(parentTableRef.getTable(),
+                getColumnsToClone(parentTableRef.getTable()))
+              .setIndexes(newIndexes).setTimeStamp(tableTimeStamp).build();

Review Comment:
   These changes only affect the client JVM executing DDL statement to switch 
consistency mode, but not other client JVMs. For them, we need changes as 
described above.



-- 
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