Skip to content

MAPREDUCE-7401. Optimize liststatus for better performance by using recursive listing - #4677

Closed
hotcodemacha wants to merge 2 commits into
apache:trunkfrom
hotcodemacha:MAPREDUCE-7401
Closed

MAPREDUCE-7401. Optimize liststatus for better performance by using recursive listing#4677
hotcodemacha wants to merge 2 commits into
apache:trunkfrom
hotcodemacha:MAPREDUCE-7401

Conversation

@hotcodemacha

@hotcodemachahotcodemacha commented Aug 2, 2022

Copy link
Copy Markdown
Contributor

Description of PR

Optimize liststatus for better performance by using recursive listing.

JIRA - MAPREDUCE-7401

How was this patch tested?

Unit tests

For code changes:

  • Does the title or this PR starts with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')?
  • Object storage: have the integration tests been executed and the endpoint declared according to the connector-specific documentation?
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE, LICENSE-binary, NOTICE-binary files?

@hotcodemachahotcodemacha changed the title MAPREDUCE-7401. Optimize liststatus for better performance by using recursive listing[Draft] MAPREDUCE-7401. Optimize liststatus for better performance by using recursive listingAug 2, 2022
@hadoop-yetus

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec23m 37sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+0 🆗codespell0m 1scodespell was not available.
+0 🆗detsecrets0m 1sdetect-secrets was not available.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚test4tests0m 0sThe patch appears to include 5 new or modified test files.
_ trunk Compile Tests _
+0 🆗mvndep14m 57sMaven dependency ordering for branch
+1 💚mvninstall29m 5strunk passed
+1 💚compile25m 34strunk passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚compile22m 7strunk passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚checkstyle4m 28strunk passed
+1 💚mvnsite3m 18strunk passed
+1 💚javadoc2m 30strunk passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚javadoc2m 0strunk passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚spotbugs4m 58strunk passed
+1 💚shadedclient25m 30sbranch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗mvndep0m 55sMaven dependency ordering for patch
+1 💚mvninstall1m 47sthe patch passed
+1 💚compile24m 35sthe patch passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚javac24m 35sthe patch passed
+1 💚compile21m 57sthe patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚javac21m 57sthe patch passed
+1 💚blanks0m 0sThe patch has no blanks issues.
-0 ⚠️checkstyle4m 28s/results-checkstyle-root.txtroot: The patch generated 12 new + 438 unchanged - 5 fixed = 450 total (was 443)
+1 💚mvnsite3m 17sthe patch passed
+1 💚javadoc2m 21sthe patch passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚javadoc2m 1sthe patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚spotbugs5m 9sthe patch passed
+1 💚shadedclient25m 28spatch has no errors when building and testing our client artifacts.
_ Other Tests _
-1 ❌unit18m 22s/patch-unit-hadoop-common-project_hadoop-common.txthadoop-common in the patch passed.
+1 💚unit7m 31shadoop-mapreduce-client-core in the patch passed.
+1 💚asflicense1m 17sThe patch does not generate ASF License warnings.
281m 8s
ReasonTests
Failed junit testshadoop.fs.TestFilterFileSystem
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4677/1/artifact/out/Dockerfile
GITHUB PR#4677
Optional Testsdupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
unameLinux bdb77f7fe201 4.15.0-175-generic #184-Ubuntu SMP Thu Mar 24 17:48:36 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/bin/hadoop.sh
git revisiontrunk / e8cc761
Default JavaPrivate Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
Multi-JDK versions/usr/lib/jvm/java-11-openjdk-amd64:Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
Test Resultshttps://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4677/1/testReport/
Max. process+thread count3144 (vs. ulimit of 5500)
modulesC: hadoop-common-project/hadoop-common hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core U: .
Console outputhttps://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4677/1/console
versionsgit=2.25.1 maven=3.6.3 spotbugs=4.2.2
Powered byApache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@steveloughransteveloughran left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1, sorry.

Do not go near this unless you can show that the current `listFiles(path, recursive)' is inadequate. Which I do not believe it is.

If you can make the case that it doesn't change it then you have to look very closely at the Javadocs at the top of FileSystem and any recent changes to the API to see how they are managed. Vectored IO for example. also look at HADOOP-16898 and HADOOP-16898 to see their listing changes including my unhappiness about something going in without more publicity across the different teams.

Any change in that API is public facing and has to be maintained forever. It needs to be supported effectively in HDFS and in cloud storage. That means you're going to have to do a full api specification, write contract tests, implement those contact tests on in hadoop-aws and azure, and ideally anywhere else (google gcs). then make sure that you don't break the external libs named in the javadocs.

Assume that I will automatically veto any new list method returning an array. It hits scale problems on HDFS -lock duration, size of responses to marshall- and prevents us doing things in the object stores including prefetching, IOStatistics collection and supporting close(). Also using builder APIs and returning a CompletableFuture.

Look at the s3a and abfs listing code to see how implement listFiles, and the s3a and manifest I committed to see how they are effectively used. we kick off operations (treewalk, file loading) while waiting for next page of responses to come in, ideally swallowing the entire latency of each list call.

Note also that because listFiles only returns files, not directories, we can do O(files/page size) deep list calls against s3.

If the justification is that we need path filtering, see HADOOP-16673Add filter parameter to FileSystem>>listFiles to see why that doesn't work in cloud and hence closed as WONTFIX.

I think a more manageable focus of this work would be to see how FileInputFormat could be speeded up by using the existing APIs, I am at with all work done knowing that many external libraries subclass that. For example, Parquet, Avro and ORC. Any incompatible change will stop them upgrading and we cannot do that.

Am I being very negative here? Yes I am. If you do want to change the Apis then you need to start talking about it on the HDFS and common lists, show that it delivers tangible benefit on-prem and in cloud, and undertake the extensive piece of work needed to implement in the primary cloud stores to show it is performant.

Finally, when you consider that the future of tables is one of manifest files (iceberg, hudi, delta lake), IMO it is better to focus on making workign with those formats faster. treewalk listing may be slow with hive partitioned data, but they are so pathologically bad in cloud for commit as well as query planning, that new code is moving beyond them

* The input filter that can be used to filter files/dirs.
* @throws IOException
*/
protected void addInputPathRecursively(List<FileStatus> result,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can't remove this as it breaks methods external classes may use

@hadoop-yetus

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 40sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+0 🆗codespell0m 0scodespell was not available.
+0 🆗detsecrets0m 0sdetect-secrets was not available.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚test4tests0m 0sThe patch appears to include 5 new or modified test files.
_ trunk Compile Tests _
+0 🆗mvndep15m 22sMaven dependency ordering for branch
+1 💚mvninstall28m 23strunk passed
+1 💚compile23m 29strunk passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚compile20m 44strunk passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚checkstyle4m 28strunk passed
+1 💚mvnsite3m 44strunk passed
+1 💚javadoc2m 53strunk passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚javadoc2m 32strunk passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚spotbugs5m 17strunk passed
+1 💚shadedclient23m 45sbranch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗mvndep0m 31sMaven dependency ordering for patch
+1 💚mvninstall1m 44sthe patch passed
+1 💚compile24m 36sthe patch passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚javac24m 36sthe patch passed
+1 💚compile22m 51sthe patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚javac22m 51sthe patch passed
+1 💚blanks0m 0sThe patch has no blanks issues.
+1 💚checkstyle4m 13sroot: The patch generated 0 new + 437 unchanged - 6 fixed = 437 total (was 443)
+1 💚mvnsite3m 33sthe patch passed
+1 💚javadoc2m 18sthe patch passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚javadoc2m 13sthe patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚spotbugs5m 19sthe patch passed
+1 💚shadedclient23m 13spatch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚unit19m 11shadoop-common in the patch passed.
+1 💚unit7m 36shadoop-mapreduce-client-core in the patch passed.
+1 💚asflicense1m 21sThe patch does not generate ASF License warnings.
253m 52s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4677/2/artifact/out/Dockerfile
GITHUB PR#4677
Optional Testsdupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
unameLinux a2681ddc1b47 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/bin/hadoop.sh
git revisiontrunk / 4843c21
Default JavaPrivate Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
Multi-JDK versions/usr/lib/jvm/java-11-openjdk-amd64:Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
Test Resultshttps://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4677/2/testReport/
Max. process+thread count3103 (vs. ulimit of 5500)
modulesC: hadoop-common-project/hadoop-common hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core U: .
Console outputhttps://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4677/2/console
versionsgit=2.25.1 maven=3.6.3 spotbugs=4.2.2
Powered byApache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@hotcodemacha
hotcodemacha marked this pull request as ready for review August 3, 2022 21:01
@hotcodemachahotcodemacha changed the title [Draft] MAPREDUCE-7401. Optimize liststatus for better performance by using recursive listingMAPREDUCE-7401. Optimize liststatus for better performance by using recursive listingAug 3, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@hotcodemacha@hadoop-yetus@steveloughran