yihua commented on code in PR #13711:
URL: https://github.com/apache/hudi/pull/13711#discussion_r2302110253
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/UpgradeDowngradeUtils.java:
##########
@@ -285,23 +284,15 @@ static boolean
isMetadataTableBehindDataTable(HoodieWriteConfig config,
* @param table Hoodie table
* @param operationType Type of operation (upgrade/downgrade)
*/
- public static void dropNonV1SecondaryIndexPartitions(HoodieWriteConfig
config, HoodieEngineContext context,
- HoodieTable table,
SupportsUpgradeDowngrade upgradeDowngradeHelper, String operationType) {
+ public static void dropNonV1IndexPartitions(HoodieWriteConfig config,
HoodieEngineContext context,
+ HoodieTable table,
SupportsUpgradeDowngrade upgradeDowngradeHelper, String operationType) {
HoodieTableMetaClient metaClient = table.getMetaClient();
try (BaseHoodieWriteClient writeClient =
upgradeDowngradeHelper.getWriteClient(config, context)) {
List<String> mdtPartitions =
metaClient.getTableConfig().getMetadataPartitions()
.stream()
- .filter(partition -> {
- // Only drop secondary indexes that are not V1
- return metaClient.getIndexForMetadataPartition(partition)
- .map(indexDef -> {
- if
(MetadataPartitionType.fromPartitionPath(indexDef.getIndexName()).equals(MetadataPartitionType.SECONDARY_INDEX))
{
- return
HoodieIndexVersion.V1.lowerThan(indexDef.getVersion());
- }
- return false;
- })
- .orElse(false);
- })
+ .filter(partition ->
metaClient.getIndexForMetadataPartition(partition)
+ .map(indexDef ->
HoodieIndexVersion.V1.lowerThan(indexDef.getVersion()))
Review Comment:
Could we abstract index upgrade process and move the logic to a central
place so it's easier to handle index layout upgrade/downgrade?
--
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]