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
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java:
##########
@@ -837,6 +837,18 @@ public static HoodieData<HoodieRecord>
convertMetadataToRecordIndexRecords(Hoodi
// there are chances that same record key from data table has 2 entries
(1 delete from older partition and 1 insert to newer partition)
// lets do reduce by key to ignore the deleted entry.
+ // first deduce parallelism to avoid too few tasks for large number of
records.
+ long totalWriteBytesForRLI = allWriteStats.stream().mapToLong(writeStat
-> {
+ // if there are no inserts or deletes, we can ignore this write stat
for RLI
+ if (writeStat.getNumInserts() == 0 && writeStat.getNumDeletes() == 0) {
+ return 0;
+ }
+ return writeStat.getTotalWriteBytes();
+ }).sum();
+ // approximate task partition size of 100MB
+ // (TODO: make this configurable)
+ long targetPartitionSize = 100_000_000L;
Review Comment:
same comment as above
--
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]