codope commented on code in PR #12525:
URL: https://github.com/apache/hudi/pull/12525#discussion_r1904233997
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java:
##########
@@ -2228,9 +2379,17 @@ public static HoodieData<HoodieRecord>
readSecondaryKeysFromBaseFiles(HoodieEngi
engineContext.setJobStatus(activeModule, "Secondary Index: reading
secondary keys from " + partitionFiles.size() + " partitions");
return engineContext.parallelize(partitionFiles,
parallelism).flatMap(partitionWithBaseAndLogFiles -> {
final String partition = partitionWithBaseAndLogFiles.getKey();
+ // get the log files for the partition and group them by fileId
+ Map<String, List<HoodieLogFile>> logFilesByFileId =
getPartitionLatestFileSlicesIncludingInflight(metaClient, Option.of(fsView),
partition).stream()
+ .map(fs -> Pair.of(fs.getFileId(),
fs.getLogFiles().collect(toList()))).collect(Collectors.toMap(Pair::getKey,
Pair::getValue));
final Pair<String, List<String>> baseAndLogFiles =
partitionWithBaseAndLogFiles.getValue();
- List<String> logFilePaths = new ArrayList<>();
- baseAndLogFiles.getValue().forEach(logFile -> logFilePaths.add(basePath
+ StoragePath.SEPARATOR + partition + StoragePath.SEPARATOR + logFile));
+ Set<String> logFilePaths = new HashSet<>();
+ baseAndLogFiles.getValue().forEach(logFile -> {
+ // add all log files for the fileId
+ logFilesByFileId.get(FSUtils.getFileIdFromFileName(logFile)).stream()
+
.map(HoodieLogFile::getPath).map(StoragePath::toString).forEach(logFilePaths::add);
+ logFilePaths.add(basePath + StoragePath.SEPARATOR + partition +
StoragePath.SEPARATOR + logFile);
Review Comment:
outdated.
--
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]