Skip to content

HDDS-15892. Massive local build time degradation when using agent worktrees#10791

Merged
errose28 merged 1 commit into
apache:masterfrom
errose28:worktree/build-time
Jul 17, 2026
Merged

HDDS-15892. Massive local build time degradation when using agent worktrees#10791
errose28 merged 1 commit into
apache:masterfrom
errose28:worktree/build-time

Conversation

@errose28

@errose28 errose28 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Fix identified and implemented by Claude Code Opus 4.8

Issue

Agents like Claude and Cursor add worktrees to hidden directories within the repo by default, like .claude/worktrees/. I have not been super proactive about cleaning worktrees when I'm done with them, and have accumulated ~20 so far.

My local build command is:

mvn -DskipTests=true -Dmaven.javadoc.skip=true -DskipRecon --threads 2.0C -DskipShade -Dskip.npx clean package

This finishes in ~2 minutes in worktrees, but has crept up to 4+ minutes when run from the repo root. All the extra time seems to come from the distribution step.

From repo root:

[INFO] Apache Ozone Distribution .......................... SUCCESS [02:55 min]

From worktree:

[INFO] Apache Ozone Distribution .......................... SUCCESS [ 37.590 s]

Cause

The culprit looks to be the find commands in dist-layout-stitching which are traversing all subdirectories to find classpath and jar files, even hidden ones, which means they are incorrectly operating on every worktree's build results as well.

Fix

The solution proposed here ignores all hidden directories that are immediate children of the repo root. This is a generic fix which will ignore directories like .claude and .cursor, and also save some time traversing other potentially large hidden directories.

What is the link to the Apache JIRA

HDDS-15892

How was this patch tested?

Built locally from the master branch from repo root (not a worktree) with this patch applied:

$ mvn -DskipTests=true -Dmaven.javadoc.skip=true -DskipRecon --threads 2.0C -DskipShade -Dskip.npx clean package
...
[INFO] Apache Ozone Distribution .......................... SUCCESS [ 29.942 s]
[INFO] Apache Ozone Fault Injection Tests ................. SUCCESS [  0.353 s]
[INFO] Apache Ozone Network Tests ......................... SUCCESS [  0.293 s]
[INFO] Apache Ozone Mini Cluster .......................... SUCCESS [  1.089 s]
[INFO] Apache Ozone Integration Tests ..................... SUCCESS [  4.847 s]
[INFO] Apache Ozone Recon Integration Tests ............... SUCCESS [  0.712 s]
[INFO] Apache Ozone S3 Integration Tests .................. SUCCESS [  0.952 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:43 min (Wall Clock)
[INFO] Finished at: 2026-07-17T13:57:22-04:00
[INFO] ------------------------------------------------------------------------
[INFO] 936 goals, 936 executed

@errose28
errose28 requested a review from adoroszlai July 17, 2026 18:13
@errose28 errose28 added the build Pull request that modifies the build process label Jul 17, 2026
@errose28

Copy link
Copy Markdown
Contributor Author

Thanks @adoroszlai for the review!

@errose28
errose28 merged commit 1bb35b2 into apache:master Jul 17, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Pull request that modifies the build process

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants