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 2020/07/30 13:04:27 UTC

[GitHub] [hudi] thomasrynnehmrc opened a new issue #1889: [SUPPORT]

thomasrynnehmrc opened a new issue #1889:
URL: https://github.com/apache/hudi/issues/1889


   **Describe the problem you faced**
   spark.read.format("").load("s3://<bucket>/prefix") takes 3 hours
   
   **To Reproduce**
   
   Steps to reproduce the behaviour:
   
   1. Write 500k files of 120 Meg each, partitioned by date with 500 different dates to S3. Data is written using batch-insert, 1 week at a time. This might not be sufficient as the issue is related to slow S3 listing and I am not sure how to reproduce that. 
   
   2. Run spark.read.format("").load("s3://<bucket>/prefix")
   
   **Expected behavior**
   The read should complete in a reasonable time, ideally the same or better than spark.read.parquet(...) 
   
   **Environment Description**
   
   * Hudi version : 0.5.3
   
   * Spark version : 2.4.4
   
   * Hive version : x
   
   * Hadoop version : 2.8.5
   
   * Storage (HDFS/S3/GCS..) : S3
   
   * Running on Docker? (yes/no) : no (using emr)
   
   
   **Additional context**
   
   * A command line recursive listing of all the files in S3 takes 3 minutes
   * A command line listing of the .hoodie folder takes 15 seconds, sometimes 30 seconds
   * A command line listing of the base folder folder takes 3 seconds
   * A command line listing of the files in a partition takes 1 second
   * spark.read.parquet("s3://...) takes less than 1 minute
   
   I used kill -QUIT to get thread dumps and nearly all the time seems to be spent listing the .hoodie directory
   The logs show that happens for each partition, and also confirm that this is where the time is spent.
   
   This line is where it reads the active timeline which requires listing the .hoodie directory
   https://github.com/apache/hudi/blob/37ea79566de190605d0a941d6b65e2f46196de88/hudi-hadoop-mr/src/main/java/org/apache/hudi/hadoop/HoodieROTablePathFilter.java#L154
   
   It appears that even though the files in a partition are cached, when the filter is applied to a new partition the active timeline is re-created which re-lists the .hoodie directory
   
   I think a fix might be to cache the active timeline


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] bvaradar closed issue #1889: [SUPPORT]

Posted by GitBox <gi...@apache.org>.
bvaradar closed issue #1889:
URL: https://github.com/apache/hudi/issues/1889


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] thomasrynnehmrc commented on issue #1889: [SUPPORT]

Posted by GitBox <gi...@apache.org>.
thomasrynnehmrc commented on issue #1889:
URL: https://github.com/apache/hudi/issues/1889#issuecomment-667119148


   Yes, this has fixed it, thank you.
   
   After this change the filtering took 2 minutes instead of 3 hours.
   
   I was not able to run against a full rebuild of Hudi, but I added a copy of HoodieROTablePathFilter to our project, with the changes applied, and also added a copy of DefaultSource that referenced the modified HoodieROTablePathFilter
   
   I would appreciate it if you could add this fix to hudi ahead of the planned listing changes so that I can remove the copied code and also so that we do not need to apply the fix to all clients.
   
   The listing changes you mention sound good too.
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] bvaradar commented on issue #1889: [SUPPORT]

Posted by GitBox <gi...@apache.org>.
bvaradar commented on issue #1889:
URL: https://github.com/apache/hudi/issues/1889#issuecomment-666775499


   Let me take a look at this tonight/tomorrow morning and get back.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] bvaradar commented on issue #1889: [SUPPORT]

Posted by GitBox <gi...@apache.org>.
bvaradar commented on issue #1889:
URL: https://github.com/apache/hudi/issues/1889#issuecomment-668063037


   Opened https://issues.apache.org/jira/browse/HUDI-1144 . I will land it today/tomorrow and will have it for 0.6.0 release


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] bvaradar commented on issue #1889: [SUPPORT]

Posted by GitBox <gi...@apache.org>.
bvaradar commented on issue #1889:
URL: https://github.com/apache/hudi/issues/1889#issuecomment-667059345


   @thomasrynnehmrc : Thanks for opening the ticket. This is a known bottleneck with S3. We will be targeting listing in general with our next release after 0.6 release (https://cwiki.apache.org/confluence/display/HUDI/RFC+-+15%3A+HUDI+File+Listing+and+Query+Planning+Improvements). Since you are specifically noticing .hoodie folder listing as bottleneck, can you just try the below patch for my curiosity (This is untested though). This would work if the same PathFilter instance is being used to filter (your observation after trying this patch should tell us).
   
   ```
   diff --git a/hudi-hadoop-mr/src/main/java/org/apache/hudi/hadoop/HoodieROTablePathFilter.java b/hudi-hadoop-mr/src/main/java/org/apache/hudi/hadoop/HoodieROTablePathFilter.java
   index 86199d25..5be27ed6 100644
   --- a/hudi-hadoop-mr/src/main/java/org/apache/hudi/hadoop/HoodieROTablePathFilter.java
   +++ b/hudi-hadoop-mr/src/main/java/org/apache/hudi/hadoop/HoodieROTablePathFilter.java
   @@ -67,6 +67,8 @@ public class HoodieROTablePathFilter implements Configurable, PathFilter, Serial
       */
      private HashSet<String> nonHoodiePathCache;
    
   +  private HashMap<String, HoodieTableMetaClient> metaClientMap;
   +
      /**
       * Hadoop configurations for the FileSystem.
       */
   @@ -82,6 +84,7 @@ public class HoodieROTablePathFilter implements Configurable, PathFilter, Serial
        this.hoodiePathCache = new HashMap<>();
        this.nonHoodiePathCache = new HashSet<>();
        this.conf = new SerializableConfiguration(conf);
   +    this.metaClientMap = new HashMap<>();
      }
    
      /**
   @@ -149,7 +152,12 @@ public class HoodieROTablePathFilter implements Configurable, PathFilter, Serial
    
          if (baseDir != null) {
            try {
   -          HoodieTableMetaClient metaClient = new HoodieTableMetaClient(fs.getConf(), baseDir.toString());
   +          HoodieTableMetaClient metaClient = metaClientMap.get(baseDir.toString());
   +          if (null == metaClient) {
   +            metaClient = new HoodieTableMetaClient(fs.getConf(), baseDir.toString(), true);
   +            metaClientMap.put(baseDir.toString(), metaClient);
   +          }
   +
              HoodieTableFileSystemView fsView = new HoodieTableFileSystemView(metaClient,
                  metaClient.getActiveTimeline().getCommitsTimeline().filterCompletedInstants(), fs.listStatus(folder));
              List<HoodieBaseFile> latestFiles = fsView.getLatestBaseFiles().collect(Collectors.toList());
   ```


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hudi] bvaradar commented on issue #1889: [SUPPORT]

Posted by GitBox <gi...@apache.org>.
bvaradar commented on issue #1889:
URL: https://github.com/apache/hudi/issues/1889#issuecomment-669715644


   Closing this issue as we have landed the fix.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org