[CORE-14786] rptest: speedup data_stat#30329
Merged
WillemKauf merged 1 commit intoredpanda-data:devfrom Apr 29, 2026
Merged
Conversation
Contributor
Author
|
For example, comparing the three options in my And within a directory with 1M files in 100 sub directories, |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes RedpandaService.data_stat() in the rptest harness by avoiding per-file stat subprocess invocations, aiming to prevent CI timeouts when many files exist under the Redpanda data directory.
Changes:
- Replace
find ... -exec stat ... \;with afind ... -printf ...approach to avoid forkingstatfor each file. - Update inline commentary to reflect how transient filesystem races appear in output.
Currently, we use:
```
f"find {RedpandaService.DATA_DIR} -type f -exec stat -c '%n %s' '{{}}' \\;"
```
as a way to stat all of the files in a `redpanda` directory on a node.
This is bad: with `-exec stat ... \;`, `find` runs one `stat` process per file.
We can do better simply by changing this command instead to:
```
f"find {RedpandaService.DATA_DIR} -type f -exec stat -c '%n %s' '{{}}' +"
```
Where `find` will batch as many files as possible to each `stat` call.
However, we can do even better by not using `-exec` at all:
```
f"find {RedpandaService.DATA_DIR} -ignore_readdir_race -type f -printf '%p %s\\n'"
```
Here, we don't need to fork any extra processes at all, and everything is
handled natively in `find`. Concurrent removal of files is silenced with
the flag `-ignore_readdir_race`.
This should fix timeouts in CI for tests with large numbers of files,
where 20+ minutes is spent waiting on these stat commands.
Collaborator
Retry command for Build#83784please wait until all jobs are finished before running the slash command |
Collaborator
CI test resultstest results on build#83784
|
Contributor
|
please backport to 26.1 and 25.3 to which we still frequently backport changes |
Contributor
Author
Ack! |
Collaborator
|
/backport v26.1.x |
Collaborator
|
/backport v25.3.x |
This was referenced Apr 29, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Currently, we use:
as a way to stat all of the files in a
redpandadirectory on a node.This is bad: with
-exec stat ... \;,findruns onestatprocess per file.We can do better simply by changing this command instead to:
Where
findwill batch as many files as possible to eachstatcall.However, we can do even better by not using
-execat all:Here, we don't fork any external processes at all, and everything is handled natively in
find. Failures due to the concurrent removal of files is silenced with the flag-ignore_readdir_race.This should fix timeouts in CI for tests with large numbers of files, where 20+ minutes is spent waiting on these stat commands.
Backports Required
Release Notes