chitralverma opened a new pull request, #9103: URL: https://github.com/apache/opendal/pull/9103
# Which issue does this PR close? Follow-up to #8966. # Rationale for this change The guided glob walk lists one directory at a time. On object stores, each list request takes a round trip, so a pattern that walks many directories, as `t/*/*.parquet`, waits for each request in turn. The walk already knows which child directories it will enter next, so it can list them while it returns entries. # What changes are included in this PR? - With an executor, the walk lists up to 8 child directories of the current directory in the background. Each background listing reads one batch of entries: the caller's page size, or 1,000 entries. The walk then continues each listing in order, as before. A child directory that the walk filters with one recursive listing is listed ahead in the same way. - The walk sends the same requests and returns the same entries in the same order. Only the time of each request changes. - Errors keep their current behavior. The walk returns the entries before an error, then the error. It skips discovered directories that are not found, are not directories, or cannot be read. - Without an executor, the walk lists each directory when it enters it, as before. A background listing that does not start, for example on a current-thread runtime that no thread drives, does not block the walk: the walk lists that directory itself. - A background listing uses the executor's timeout for each request, because `TimeoutLayer` wraps only the listing that the caller reads. - On wasm32, the walk lists each directory when it enters it. Requests and time on a fake S3 server with 0.29 s per request and pages of 1,000 keys. The tree has 49,200 keys (`t/part=0..199/` with 6 keys each, `logs/y=*/m=*/d=*/` with 200 keys each). `skew` has 200 directories in `s/`, and one of them holds 1,000,000 more keys. `dense` has 40 directories in `d/` with 2,000 keys each. Patterns with a gain of less than 1 s are omitted. | pattern | entries | requests | `main` | this PR | |---|---:|---:|---:|---:| | `t/*/*.parquet` | 1,000 | 201 | 59.7 s | 7.7 s | | `t/*/_meta.json` | 200 | 201 | 59.7 s | 7.8 s | | `t/*/x/*.parquet` | 0 | 201 | 59.6 s | 7.8 s | | `t/part=1*/*.parquet` | 555 | 112 | 33.3 s | 4.5 s | | `*/*/m=03/*/*.json` | 4,000 | 227 | 67.4 s | 10.1 s | | `logs/y=*/**/f0.json` | 240 | 49 | 14.8 s | 7.6 s | | `logs/y=2024/m=03/*/*.json` | 2,000 | 11 | 3.3 s | 0.9 s | | `s/*/_meta.json` (skew) | 200 | 201 | 59.7 s | 7.7 s | | `d/*/f*` (dense) | 80,000 | 81 | 24.5 s | 12.7 s | Over 34 patterns (30 on the model tree, 2 on skew, 2 on dense), time goes from 786 s to 468 s. Requests stay at 2,620. Each pattern sends the same number of requests and returns the same entries in the same order as `main`. No pattern is slower. Patterns that `main` reads with one recursive listing, as `logs/**`, do not change. # Are there any user-facing changes? - `glob()` returns sooner for patterns that walk many directories. Requests, entries, and entry order do not change. - Up to 8 list requests can be in flight for one `glob()` listing. If the caller stops reading early, background listings that already started can send requests that `main` does not send. Dropping the lister cancels them. - Background listings do not go through the listers of layers above `GlobLayer`, as `ConcurrentLimitLayer` and `RetryLayer`. HTTP limits of `ConcurrentLimitLayer` still apply, through the operation context. # Breaking changes # AI Usage Statement - Harness: Jcode - Model: claude-opus-5-5 - Effort: low - Role: Wrote the patch, tests and this description, and ran the checks listed below. The human author reviewed the change and the results. Verified: requests, time, entries, and entry order against `main` on a fake S3 server for 34 patterns on 3 trees (49,200, 1,000,200, and 80,000 keys): 0 changed entries or order, 0 patterns with more or fewer requests, 0 slower; memory gate with an order-sensitive hash for 36 patterns on 4 trees, with native and simulated recursion (288 cases): same entries, order, and requests as `main`; differential on fs and memory, with and without directory markers: same entries as `main`; blocking operator on a current-thread runtime: the walk completes, with and without a recursive child; unit tests for order and requests with no executor, an eager executor, and an idle executor, with and without recursive child listings, for entries before an error, for skipped unreadable directories, and for the timeout; `cargo test -p opendal-core --lib --all-features` (529); behavior tests with `OPENDAL_TEST=memory` (119) and `OPENDAL_TEST=fs` (139); `cargo clippy -p opendal-core --all-targets --all-fea tures -- -D warnings`; `cargo fmt --all --check`. Not verified: real S3, services other than memory and fs on real backends, the compio executor, and wasm32. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
