-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[HUDI-3836] Improve the way of fetching metadata partitions from table #5286
Merged
Merged
Changes from 13 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
ef69e0d
HUDI-3836 Improve the way of fetching metadata partitions from table …
99a5186
Resolve the conflict
dbecbc1
remove references about HoodieTableMetadataUtil.getCompletedMetadataP…
4ee3f5b
resolve confilict
1bf8731
delete unused import
78205ae
fix bug in ITTestHoodieDataSource.java
1acbc82
Merge branch 'master' into HUDI-3836
806def9
revert changes about ITTestHoodieDataSource
bbb9a7f
update method getMetadataPartitions
8307439
Merge branch 'master' into HUDI-3836
f975d60
merge master and resolve conflict
xicm 4021102
re-run ci
xicm 26d3e49
try to fix bug in HdfsTestService
xicm c1fc722
re-run ci
xicm f1a6528
return a new HashSet in getMetadataPartitions
xicm 1ae9ad1
fix error
xicm afe418c
Merge branch 'master' into HUDI-3836
xicm aa7c571
Merge branch 'master' into HUDI-3836
xicm 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 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 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 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -57,6 +57,7 @@ | |
import java.util.Map; | ||
import java.util.Properties; | ||
import java.util.Set; | ||
import java.util.HashSet; | ||
import java.util.function.BiConsumer; | ||
import java.util.stream.Collectors; | ||
|
||
|
@@ -236,6 +237,8 @@ public class HoodieTableConfig extends HoodieConfig { | |
|
||
private static final String TABLE_CHECKSUM_FORMAT = "%s.%s"; // <database_name>.<table_name> | ||
|
||
private Set<String> metadataPartition = null; | ||
|
||
public HoodieTableConfig(FileSystem fs, String metaPath, String payloadClassName) { | ||
super(); | ||
Path propertyPath = new Path(metaPath, HOODIE_PROPERTIES_FILE); | ||
|
@@ -618,11 +621,14 @@ public List<String> getMetadataPartitionsInflight() { | |
); | ||
} | ||
|
||
public List<String> getMetadataPartitions() { | ||
return StringUtils.split( | ||
getStringOrDefault(TABLE_METADATA_PARTITIONS, StringUtils.EMPTY_STRING), | ||
CONFIG_VALUES_DELIMITER | ||
); | ||
public Set<String> getMetadataPartitions() { | ||
if (metadataPartition == null) { | ||
metadataPartition = new HashSet<>( | ||
StringUtils.split(getStringOrDefault(TABLE_METADATA_PARTITIONS, StringUtils.EMPTY_STRING), | ||
CONFIG_VALUES_DELIMITER) | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not thread-safe. Could the method just return a new HashSet instance each time? |
||
} | ||
return metadataPartition; | ||
} | ||
|
||
/** | ||
|
This file contains 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 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 |
---|---|---|
|
@@ -103,7 +103,9 @@ public MiniDFSCluster start(boolean format) throws IOException { | |
|
||
public void stop() { | ||
LOG.info("HDFS Minicluster service being shut down."); | ||
miniDfsCluster.shutdown(); | ||
if (miniDfsCluster != null) { | ||
miniDfsCluster.shutdown(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix NullPointerException
|
||
miniDfsCluster = null; | ||
hadoopConf = null; | ||
} | ||
|
This file contains 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 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep the result in static variable is not a good way, either we keep the code as it is either we introduce some cache tools like the guava interns and initialize it when building the table config(in the constructor).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for review, static is not a good way, Can we keep the result in a Set, and init when the first get is called?