-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-2332] Add clustering and compaction in Kafka Connect Sink #3857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
codope
merged 21 commits into
apache:master
from
yihua:HUDI-2332-kafka-connect-java-client
Nov 23, 2021
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
fdb919a
[HUDI-2332] Add clustering and compaction in Kafka Connect Sink
yihua 4c8dc1d
Disable validation check on instant time for compaction and adjust co…
yihua 9333df0
Add javadocs
yihua d931952
Add clustering and compaction config
yihua f653561
Fix transaction causing missing records in the target table
yihua 78d652c
Add debugging logs
yihua ba0880c
Fix kafka offset sync in participant
yihua f3565a2
Adjust how clustering and compaction are configured in kafka-connect
yihua 1d48b1f
Fix clustering strategy
yihua dea892f
Remove irrelevant changes from other published PRs
yihua 20b0ced
Update clustering logic and others
yihua 446a8df
Update README
yihua 282adfb
Fix test failures
yihua e858af8
Fix indentation
yihua 38d082a
Fix clustering config
yihua c7fd918
Add JavaCustomColumnsSortPartitioner and make async compaction enable…
yihua 36878d4
Add test for JavaCustomColumnsSortPartitioner
yihua 27d86f0
Add more changes after IDE sync
yihua 4e592b0
Update README with clarification
yihua 4d1ac8f
Fix clustering logic after rebasing
yihua 2bca1b0
Remove unrelated changes
yihua File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...org/apache/hudi/client/clustering/plan/strategy/JavaRecentDaysClusteringPlanStrategy.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.hudi.client.clustering.plan.strategy; | ||
|
|
||
| import org.apache.hudi.client.common.HoodieJavaEngineContext; | ||
| import org.apache.hudi.common.model.HoodieRecordPayload; | ||
| import org.apache.hudi.config.HoodieWriteConfig; | ||
| import org.apache.hudi.table.HoodieJavaCopyOnWriteTable; | ||
| import org.apache.hudi.table.HoodieJavaMergeOnReadTable; | ||
|
|
||
| import org.apache.log4j.LogManager; | ||
| import org.apache.log4j.Logger; | ||
|
|
||
| import java.util.Comparator; | ||
| import java.util.List; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| /** | ||
| * Clustering Strategy that only looks at latest 'daybased.lookback.partitions' partitions | ||
| * for Java engine. | ||
| */ | ||
| public class JavaRecentDaysClusteringPlanStrategy<T extends HoodieRecordPayload<T>> | ||
| extends JavaSizeBasedClusteringPlanStrategy<T> { | ||
| private static final Logger LOG = LogManager.getLogger(JavaRecentDaysClusteringPlanStrategy.class); | ||
|
|
||
| public JavaRecentDaysClusteringPlanStrategy(HoodieJavaCopyOnWriteTable<T> table, | ||
| HoodieJavaEngineContext engineContext, | ||
| HoodieWriteConfig writeConfig) { | ||
| super(table, engineContext, writeConfig); | ||
| } | ||
|
|
||
| public JavaRecentDaysClusteringPlanStrategy(HoodieJavaMergeOnReadTable<T> table, | ||
| HoodieJavaEngineContext engineContext, | ||
| HoodieWriteConfig writeConfig) { | ||
| super(table, engineContext, writeConfig); | ||
| } | ||
|
|
||
| @Override | ||
| protected List<String> filterPartitionPaths(List<String> partitionPaths) { | ||
| int targetPartitionsForClustering = getWriteConfig().getTargetPartitionsForClustering(); | ||
| int skipPartitionsFromLatestForClustering = getWriteConfig().getSkipPartitionsFromLatestForClustering(); | ||
| return partitionPaths.stream() | ||
| .sorted(Comparator.reverseOrder()) | ||
| .skip(Math.max(skipPartitionsFromLatestForClustering, 0)) | ||
| .limit(targetPartitionsForClustering > 0 ? targetPartitionsForClustering : partitionPaths.size()) | ||
| .collect(Collectors.toList()); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.