new feature: switch glob to one recursive listing when the walk finds many directories

Open
#9,034 4 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
backend

Research direction

Start with GlobLayer and the walk-versus-recursive-listing choice in src/daft-io/src/object_store_glob.rs, the file the payload names for the existing fanout_limit. Read #8966 to see how the current filter path works. Done means a directory-count limit that switches to one recursive listing, no duplicate entries after the switch, and limit, start_after, versions and delete markers unchanged.

Written by the indexing model from the issue text.

Description

core enhancement
Feature Description

GlobLayer filters one recursive listing when the walk would list every directory, and walks in all other cases (#8966). Add a third case: walk, and switch to one recursive listing of a directory when the walk finds many directories below it.

Problem and Solution

A recursive listing reads every key below its prefix. It costs fewer requests than the walk when the walk skips few directories, and more when the walk skips many. The pattern alone cannot tell these cases apart.

List requests on memory, counted as S3 pages of 1,000 keys, for a tree of 49,200 keys:

pattern walk (main) one recursive listing
t/*/_meta.json 201 2
*/*/m=03/*/*.json 227 50
logs/*/m=03/d=05/*.json 7 48
logs/*/*/ 3 48

On real S3, with 1,000 keys under t/part=0..199/, t/*/*.parquet takes 201 requests and 51 s with the walk, and 1 request and 0.37 s with one recursive listing.

Proposed solution: count the directories that each walked listing returns. Past a limit, replace the rest of the walk below that directory with one recursive listing of it, filtered by the pattern. Daft does this with fanout_limit (default 1024) in src/daft-io/src/object_store_glob.rs.

Points to decide:

  • The limit. The walk does not know the key count below a directory, so the limit can only use the directory count.
  • After the switch, entries that the walk already returned must not repeat.
  • limit, start_after, versions and delete markers keep their current behavior.
Additional Context

Follow-up to #8966. Services with native glob, such as fs (#9018), are not affected.

Dominant language
Rust
Stars
5.5k
Forks
869
Avg merge
8h 2m
Merged PRs (30d)
862

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/opendal

All issues in apache/opendal

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.