linliu-code commented on code in PR #13519:
URL: https://github.com/apache/hudi/pull/13519#discussion_r2223103971
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/UpgradeDowngradeUtils.java:
##########
@@ -214,4 +237,35 @@ static void rollbackFailedWritesAndCompact(HoodieTable
table, HoodieEngineContex
throw new HoodieException(e);
}
}
+
+ // If the metadata table is enabled for the data table, and
+ // existing metadata table is behind the data table, then delete it.
+ public static void checkAndHandleMetadataTable(HoodieEngineContext context,
+ HoodieTable table,
+ HoodieWriteConfig config,
+ HoodieTableMetaClient
metaClient) {
+ if (!table.isMetadataTable()
+ && config.isMetadataTableEnabled()
+ && isMetadataTableBehindDataTable(config, metaClient)) {
+ HoodieTableMetadataUtil.deleteMetadataTable(config.getBasePath(),
context);
+ }
+ }
+
+ public static boolean isMetadataTableBehindDataTable(HoodieWriteConfig
config,
Review Comment:
Done.
--
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]