nsivabalan commented on code in PR #12376:
URL: https://github.com/apache/hudi/pull/12376#discussion_r1864331871


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -1167,7 +1169,15 @@ private HoodieData<HoodieRecord> 
getSecondaryIndexUpdates(HoodieCommitMetadata c
     // This could be an expensive operation for a large commit 
(updating/deleting millions of rows)
     Map<String, String> recordKeySecondaryKeyMap = 
metadata.getSecondaryKeys(keysToRemove, indexDefinition.getIndexName());
     HoodieData<HoodieRecord> deletedRecords = 
getDeletedSecondaryRecordMapping(engineContext, recordKeySecondaryKeyMap, 
indexDefinition);
-    int parallelism = Math.min(partitionFilePairs.size(), 
dataWriteConfig.getMetadataConfig().getSecondaryIndexParallelism());
+    // first deduce parallelism to avoid too few tasks for large number of 
records.
+    long totalWriteBytesForSecondaryIndex = 
commitMetadata.getPartitionToWriteStats().values().stream()
+        .flatMap(Collection::stream)
+        .mapToLong(HoodieWriteStat::getTotalWriteBytes)
+        .sum();
+    // approximate task partition size of 100MB
+    // (TODO: make this configurable)
+    long targetPartitionSize = 100_000_000L;

Review Comment:
   can we do 100 * 1024 * 1024



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