danny0405 commented on code in PR #13476:
URL: https://github.com/apache/hudi/pull/13476#discussion_r2167919075


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/index/HoodieIndexUtils.java:
##########
@@ -538,11 +540,35 @@ public static void register(HoodieTableMetaClient 
metaClient, HoodieIndexDefinit
     }
   }
 
+  /**
+   * Drops secondary index partitions from metadata table.
+   *
+   * @param mdtPartitionType Type of MDT partition to drop
+   * @param config Write config
+   * @param context Engine context
+   * @param table Hoodie table
+   * @param operationType Type of operation (upgrade/downgrade)
+   */
+  public static void dropMDTPartitions(
+      MetadataPartitionType mdtPartitionType, HoodieWriteConfig config, 
HoodieEngineContext context, HoodieTable table, String operationType) {
+    HoodieTableMetaClient metaClient = table.getMetaClient();
+    List<String> secIdxPartitions = 
metaClient.getTableConfig().getMetadataPartitions()
+        .stream()
+        .filter(partition -> 
partition.startsWith(mdtPartitionType.getPartitionPath()))
+        .collect(Collectors.toList());
+    LOG.info("Dropping {} from MDT for {}: {}", 
mdtPartitionType.getPartitionPath(), operationType, secIdxPartitions);
+    context.dropIndex(config, secIdxPartitions);

Review Comment:
   I don't think table related actions belong to `HoodieEngineContext`, 
instead, we should put it in `HoodieTable`.



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