You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/02/04 02:01:06 UTC
[GitHub] [hudi] manojpec opened a new pull request #4746: [HUDI-3356][HUDI-3142] Metadata index initialization for bloom filters and column stats partitions
manojpec opened a new pull request #4746:
URL: https://github.com/apache/hudi/pull/4746
## What is the purpose of the pull request
When metadata table is created and when it decides to the initialization
from the filesystem for the user dataset, all the enabled partitions need
to be initialized along with FILES partition. This fix adds init support
for bloom filter and column stats partitions.
## Brief change log
Since the initialization can be for a huge set of files, the records prepared
are in HoodieData<HoodieRecord> format so that they can be passed on
to engine specific commit without materialization at the driver and avoid OOME.
PS: This is stacked on top of https://github.com/apache/hudi/pull/4740
Commit to review: https://github.com/apache/hudi/commit/9c4b90bbbed70350f5197b29f5477fada2d091b5
*(for example:)*
- *Modify AnnotationLocation checkstyle rule in checkstyle.xml*
## Verify this pull request
*(Please pick either of the following options)*
This pull request is a trivial rework / code cleanup without any test coverage.
*(or)*
This pull request is already covered by existing tests, such as *(please describe tests)*.
(or)
This change added tests and can be verified as follows:
*(example:)*
- *Added integration tests for end-to-end.*
- *Added HoodieClientWriteTest to verify the change.*
- *Manually verified the change by running a job locally.*
## Committer checklist
- [ ] Has a corresponding JIRA in PR title & commit
- [ ] Commit message is descriptive of the change
- [ ] CI is green
- [ ] Necessary doc changes done or have another open PR
- [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.
--
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-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] codope commented on a change in pull request #4746: [HUDI-3356][HUDI-3142] Metadata index initialization for bloom filters and column stats partitions
Posted by GitBox <gi...@apache.org>.
codope commented on a change in pull request #4746:
URL: https://github.com/apache/hudi/pull/4746#discussion_r800530826
##########
File path: hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java
##########
@@ -667,34 +660,60 @@ private static void processRollbackMetadata(HoodieActiveTimeline metadataTableTi
}
/**
- * Convert rollback action metadata to column stats index records.
+ * Convert added and deleted action metadata to column stats index records.
*/
- private static List<HoodieRecord> convertFilesToColumnStatsRecords(HoodieEngineContext engineContext,
- HoodieTableMetaClient datasetMetaClient,
- Map<String, List<String>> partitionToDeletedFiles,
- Map<String, Map<String, Long>> partitionToAppendedFiles,
- String instantTime) {
- List<HoodieRecord> records = new LinkedList<>();
- List<String> latestColumns = getLatestColumns(datasetMetaClient);
- partitionToDeletedFiles.forEach((partitionName, deletedFileList) -> deletedFileList.forEach(deletedFile -> {
+ public static HoodieData<HoodieRecord> convertFilesToColumnStatsRecords(HoodieEngineContext engineContext,
+ Map<String, List<String>> partitionToDeletedFiles,
+ Map<String, Map<String, Long>> partitionToAppendedFiles,
+ MetadataRecordsGenerationParams recordsGenerationParams) {
+ HoodieData<HoodieRecord> allRecordsRDD = engineContext.emptyHoodieData();
+ final List<String> latestColumns = getLatestColumns(recordsGenerationParams.getDataMetaClient());
+
+ final List<Pair<String, List<String>>> partitionToDeletedFilesList = partitionToDeletedFiles.entrySet()
+ .stream().map(e -> Pair.of(e.getKey(), e.getValue())).collect(Collectors.toList());
+ final HoodieData<Pair<String, List<String>>> partitionToDeletedFilesRDD = engineContext.parallelize(partitionToDeletedFilesList,
+ Math.max(partitionToDeletedFilesList.size(), recordsGenerationParams.getBloomIndexParallelism()));
+
+ HoodieData<HoodieRecord> deletedFilesRecordsRDD = partitionToDeletedFilesRDD.flatMap(partitionToDeletedFilesEntry -> {
+ final String partitionName = partitionToDeletedFilesEntry.getLeft();
final String partition = partitionName.equals(EMPTY_PARTITION_NAME) ? NON_PARTITIONED_NAME : partitionName;
- if (deletedFile.endsWith(HoodieFileFormat.PARQUET.getFileExtension())) {
+ final List<String> deletedFileList = partitionToDeletedFilesEntry.getRight();
+
+ return deletedFileList.stream().flatMap(deletedFile -> {
+ if (!FSUtils.isBaseFile(new Path(deletedFile)) || !deletedFile.endsWith(HoodieFileFormat.PARQUET.getFileExtension())) {
+ return Stream.empty();
+ }
final String filePathWithPartition = partitionName + "/" + deletedFile;
- records.addAll(getColumnStats(partition, filePathWithPartition, datasetMetaClient,
- latestColumns, true).collect(Collectors.toList()));
- }
- }));
-
- partitionToAppendedFiles.forEach((partitionName, appendedFileMap) -> appendedFileMap.forEach(
- (appendedFile, size) -> {
- final String partition = partitionName.equals(EMPTY_PARTITION_NAME) ? NON_PARTITIONED_NAME : partitionName;
- if (appendedFile.endsWith(HoodieFileFormat.PARQUET.getFileExtension())) {
- final String filePathWithPartition = partitionName + "/" + appendedFile;
- records.addAll(getColumnStats(partition, filePathWithPartition, datasetMetaClient,
- latestColumns, false).collect(Collectors.toList()));
- }
- }));
- return records;
+ return getColumnStats(partition, filePathWithPartition, recordsGenerationParams.getDataMetaClient(),
+ latestColumns, true);
+ }).iterator();
+ });
+ allRecordsRDD = allRecordsRDD.union(deletedFilesRecordsRDD);
+
+ final List<Pair<String, Map<String, Long>>> partitionToAppendedFilesList = partitionToAppendedFiles.entrySet()
+ .stream().map(entry -> Pair.of(entry.getKey(), entry.getValue())).collect(Collectors.toList());
+ final HoodieData<Pair<String, Map<String, Long>>> partitionToAppendedFilesRDD = engineContext.parallelize(partitionToAppendedFilesList,
+ Math.max(partitionToAppendedFiles.size(), recordsGenerationParams.getBloomIndexParallelism()));
+
+ HoodieData<HoodieRecord> appendedFilesRecordsRDD = partitionToAppendedFilesRDD.flatMap(partitionToAppendedFilesEntry -> {
+ final String partitionName = partitionToAppendedFilesEntry.getLeft();
+ final String partition = partitionName.equals(EMPTY_PARTITION_NAME) ? NON_PARTITIONED_NAME : partitionName;
+ final Map<String, Long> appendedFileMap = partitionToAppendedFilesEntry.getRight();
+
+ return appendedFileMap.entrySet().stream().flatMap(appendedFileNameLengthPair -> {
+ if (!FSUtils.isBaseFile(new Path(appendedFileNameLengthPair.getKey()))
+ || !appendedFileNameLengthPair.getKey().endsWith(HoodieFileFormat.PARQUET.getFileExtension())) {
Review comment:
I think we should try to generalize this if-condition to a method. I know right now we just get stats from base parquet file but it might change tomorrow.
--
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-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot removed a comment on pull request #4746: [HUDI-3356][HUDI-3142] Metadata index initialization for bloom filters and column stats partitions
Posted by GitBox <gi...@apache.org>.
hudi-bot removed a comment on pull request #4746:
URL: https://github.com/apache/hudi/pull/4746#issuecomment-1029573547
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "9c4b90bbbed70350f5197b29f5477fada2d091b5",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=5725",
"triggerID" : "9c4b90bbbed70350f5197b29f5477fada2d091b5",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 9c4b90bbbed70350f5197b29f5477fada2d091b5 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=5725)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
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-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] codope commented on a change in pull request #4746: [HUDI-3356][HUDI-3142] Metadata index initialization for bloom filters and column stats partitions
Posted by GitBox <gi...@apache.org>.
codope commented on a change in pull request #4746:
URL: https://github.com/apache/hudi/pull/4746#discussion_r803335014
##########
File path: hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java
##########
@@ -843,28 +840,37 @@ protected void cleanIfNecessary(BaseHoodieWriteClient writeClient, String instan
}
/**
- * This is invoked to bootstrap metadata table for a dataset. Bootstrap Commit has special handling mechanism due to its scale compared to
+ * This is invoked to initialize metadata table for a dataset. Bootstrap Commit has special handling mechanism due to its scale compared to
* other regular commits.
- *
*/
- protected void bootstrapCommit(List<DirectoryInfo> partitionInfoList, String createInstantTime) {
- List<String> partitions = partitionInfoList.stream().map(p ->
- p.getRelativePath().isEmpty() ? NON_PARTITIONED_NAME : p.getRelativePath()).collect(Collectors.toList());
- final int totalFiles = partitionInfoList.stream().mapToInt(p -> p.getTotalFiles()).sum();
+ private void initialCommit(String createInstantTime) {
Review comment:
+1 for extracting the actual commit part out of bootstrap (initialize filegroup). This will help me for async indexing.
How about adding partitionType as another parameter and making `initialCommit` part of the `HoodieTableMetadataWriter` interface? That way we can call from write client or any action executor if needed. Not necessary to do this in PR but just a suggestion to consider.
--
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-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #4746: [HUDI-3356][HUDI-3142] Metadata index initialization for bloom filters and column stats partitions
Posted by GitBox <gi...@apache.org>.
hudi-bot commented on pull request #4746:
URL: https://github.com/apache/hudi/pull/4746#issuecomment-1029573547
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "9c4b90bbbed70350f5197b29f5477fada2d091b5",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=5725",
"triggerID" : "9c4b90bbbed70350f5197b29f5477fada2d091b5",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 9c4b90bbbed70350f5197b29f5477fada2d091b5 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=5725)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
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-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] codope commented on pull request #4746: [HUDI-3356][HUDI-3142] Metadata index initialization for bloom filters and column stats partitions
Posted by GitBox <gi...@apache.org>.
codope commented on pull request #4746:
URL: https://github.com/apache/hudi/pull/4746#issuecomment-1044530200
Covered in #4848
--
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-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #4746: [HUDI-3356][HUDI-3142] Metadata index initialization for bloom filters and column stats partitions
Posted by GitBox <gi...@apache.org>.
hudi-bot commented on pull request #4746:
URL: https://github.com/apache/hudi/pull/4746#issuecomment-1029607733
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "9c4b90bbbed70350f5197b29f5477fada2d091b5",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=5725",
"triggerID" : "9c4b90bbbed70350f5197b29f5477fada2d091b5",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 9c4b90bbbed70350f5197b29f5477fada2d091b5 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=5725)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
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-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] codope closed pull request #4746: [HUDI-3356][HUDI-3142] Metadata index initialization for bloom filters and column stats partitions
Posted by GitBox <gi...@apache.org>.
codope closed pull request #4746:
URL: https://github.com/apache/hudi/pull/4746
--
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-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #4746: [HUDI-3356][HUDI-3142] Metadata index initialization for bloom filters and column stats partitions
Posted by GitBox <gi...@apache.org>.
hudi-bot commented on pull request #4746:
URL: https://github.com/apache/hudi/pull/4746#issuecomment-1029572167
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "9c4b90bbbed70350f5197b29f5477fada2d091b5",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "9c4b90bbbed70350f5197b29f5477fada2d091b5",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 9c4b90bbbed70350f5197b29f5477fada2d091b5 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
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-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot removed a comment on pull request #4746: [HUDI-3356][HUDI-3142] Metadata index initialization for bloom filters and column stats partitions
Posted by GitBox <gi...@apache.org>.
hudi-bot removed a comment on pull request #4746:
URL: https://github.com/apache/hudi/pull/4746#issuecomment-1029572167
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "9c4b90bbbed70350f5197b29f5477fada2d091b5",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "9c4b90bbbed70350f5197b29f5477fada2d091b5",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 9c4b90bbbed70350f5197b29f5477fada2d091b5 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
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-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org