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/07/05 01:23:49 UTC

[GitHub] [hudi] yihua commented on a diff in pull request #5286: [HUDI-3836] Improve the way of fetching metadata partitions from table

yihua commented on code in PR #5286:
URL: https://github.com/apache/hudi/pull/5286#discussion_r913317157


##########
hudi-utilities/src/test/java/org/apache/hudi/utilities/TestHoodieIndexer.java:
##########
@@ -192,9 +191,9 @@ public void testIndexerForExceptionWithNonFilesPartition() {
 
     // validate table config
     metaClient = reload(metaClient);
-    assertFalse(getCompletedMetadataPartitions(metaClient.getTableConfig()).contains(FILES.getPartitionPath()));
-    assertFalse(getCompletedMetadataPartitions(metaClient.getTableConfig()).contains(COLUMN_STATS.getPartitionPath()));
-    assertFalse(getCompletedMetadataPartitions(metaClient.getTableConfig()).contains(BLOOM_FILTERS.getPartitionPath()));
+    assertFalse(reload(metaClient).getTableConfig().getMetadataPartitions().contains(FILES.getPartitionPath()));
+    assertFalse(reload(metaClient).getTableConfig().getMetadataPartitions().contains(COLUMN_STATS.getPartitionPath()));
+    assertFalse(reload(metaClient).getTableConfig().getMetadataPartitions().contains(BLOOM_FILTERS.getPartitionPath()));

Review Comment:
   No need to reload the metaClient here?



##########
hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableConfig.java:
##########
@@ -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)
+      );

Review Comment:
   This is not thread-safe.  Could the method just return a new HashSet instance each time?



-- 
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