codope commented on a change in pull request #4693:
URL: https://github.com/apache/hudi/pull/4693#discussion_r839147377



##########
File path: 
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/ThreeToFourUpgradeHandler.java
##########
@@ -35,7 +40,12 @@
   @Override
   public Map<ConfigProperty, String> upgrade(HoodieWriteConfig config, 
HoodieEngineContext context, String instantTime, SupportsUpgradeDowngrade 
upgradeDowngradeHelper) {
     Map<ConfigProperty, String> tablePropsToAdd = new Hashtable<>();
-    tablePropsToAdd.put(HoodieTableConfig.TABLE_CHECKSUM, 
String.valueOf(HoodieTableConfig.generateChecksum(config.getProps())));
+    tablePropsToAdd.put(TABLE_CHECKSUM, 
String.valueOf(HoodieTableConfig.generateChecksum(config.getProps())));
+    // if metadata is enabled and files partition exist then update 
TABLE_METADATA_INDEX_COMPLETED
+    // schema for the files partition is same between the two versions
+    if (config.isMetadataTableEnabled() && 
metadataPartitionExists(config.getBasePath(), context, 
MetadataPartitionType.FILES)) {
+      tablePropsToAdd.put(TABLE_METADATA_PARTITIONS, 
MetadataPartitionType.FILES.getPartitionPath());
+    }

Review comment:
       @zhangyue19921010 Good question! So, if no upgrade is required.. or 
let's say you upgraded to current version with metadata disabled and then later 
after few commits metadata was enabled, then this table config will get update 
in the metadata initialization path i.e. where 
`HoodieBackedTableMetadataWriter#updateInitializedPartitionsInTableConfig` is 
called.




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