codope commented on a change in pull request #4693: URL: https://github.com/apache/hudi/pull/4693#discussion_r835763435
########## File path: hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java ########## @@ -663,20 +711,82 @@ private MetadataRecordsGenerationParams getRecordsGenerationParams() { /** * Processes commit metadata from data table and commits to metadata table. + * * @param instantTime instant time of interest. * @param convertMetadataFunction converter function to convert the respective metadata to List of HoodieRecords to be written to metadata table. * @param <T> type of commit metadata. * @param canTriggerTableService true if table services can be triggered. false otherwise. */ private <T> void processAndCommit(String instantTime, ConvertMetadataFunction convertMetadataFunction, boolean canTriggerTableService) { - if (enabled && metadata != null) { - Map<MetadataPartitionType, HoodieData<HoodieRecord>> partitionRecordsMap = convertMetadataFunction.convertMetadata(); - commit(instantTime, partitionRecordsMap, canTriggerTableService); + if (!dataWriteConfig.isMetadataTableEnabled()) { + return; + } + Set<String> partitionsToUpdate = getMetadataPartitionsToUpdate(); + partitionsToUpdate.forEach(p -> { + if (enabled && metadata != null) { + Map<MetadataPartitionType, HoodieData<HoodieRecord>> partitionRecordsMap = convertMetadataFunction.convertMetadata(); + commit(instantTime, partitionRecordsMap, canTriggerTableService); + } + }); + } + + private Set<String> getMetadataPartitionsToUpdate() { + // fetch partitions to update from table config + Set<String> partitionsToUpdate = Stream.of(dataMetaClient.getTableConfig().getCompletedMetadataIndexes().split(",")) Review comment: actually, it makes sense to have `getInflightAndCompleteMetadataIndexes` in addition to existing getters. At times, we may jsut want completed index. Will change accordingly. -- 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: commits-unsubscr...@hudi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org