bug(layers/throttle): throttle streaming ReadStream bytes instead of pre-charging ReadOptions::limit upper bounds on open()

オープン
#9,567 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@Xuanwo がすでに取り組んでいます。

2026年12月4日 から。

  • #9638 @Xuanwo による — オープン

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
rust

調査の方向性

Start with core/layers/throttle/src/lib.rs and trace how ThrottleWrapper::open charges bytes and how oio::ReadStream::read handles streaming reads. Read core/core/src/raw/oio/read/api.rs for the exact range read behavior, then check the CacheLayer pointer lookup path. Done means the acceptance criteria pass, including regression coverage for unbounded reads, limits above burst, large buffers, and cancellation.

索引モデルが issue の本文から書いたものです。

説明

bug core
Background

Re-evaluating #7453 in light of newly added ReadOptions::limit and CacheLayer:

  • In core/layers/throttle/src/lib.rs:137-154,266-296, ThrottleWrapper::open pre-charges range.size() upfront before streaming any bytes, while oio::ReadStream::read performs no bandwidth charging.
  • While #7453 had a valid production reason to rate-limit concurrent exact range reads (oio::Read::read, core/core/src/raw/oio/read/api.rs:38) before dispatching requests to prevent request/FD spikes, streaming open(range) allows short EOF and now carries defensive upper bounds via ReadOptions::limit:
    1. Unbounded reads (op.read("10gb"), range = 0..) bypass ThrottleLayer completely (range.size() == None).
    2. Defensive bounded reads (op.read_with("10_bytes").limit(10_MiB)) pre-charge the full 10 MiB upper bound and fail permanently with RateLimited (InsufficientCapacity) whenever limit > burst or limit > u32::MAX.
    3. CacheLayer's pointer lookup (65,664 bytes limit) fails on a throttled cache with burst = 32 KiB, degrading cache pointer lookups to misses.
Proposed Solution
  • Preserve pre-admission rate limiting where exact-length range reads require it, and define a clear policy for requests larger than burst (e.g., chunked waiting instead of immediate InsufficientCapacity where appropriate).
  • For streaming oio::Read::open / oio::ReadStream::read, do not charge the full ReadOptions::limit upper bound upfront; throttle actual bytes transferred through ReadStream::read (handling unbounded 0.. reads, single buffers > burst, and cancellation cleanly, while clearly distinguishing body delivery vs network admission).
Acceptance Criteria
  • Streaming open(0..) reads are throttled by ThrottleLayer rather than bypassing it.
  • Streaming reads with ReadOptions::limit > burst on small files succeed and are throttled according to actual bytes read (including CacheLayer pointer lookups over a 32 KiB-burst throttled cache).
  • Add regression tests covering unbounded 0.. reads, limit > burst, single buffer > burst, and cancellation.

This issue was reopened and independently verified by both audit leaders (gemini-4-neon and gpt-6.2-astra) ahead of Apache OpenDAL v0.60.0.

主要言語
Rust
スター
5.5k
フォーク
869
平均マージ
8時間 2分
マージ済み PR(30日)
862

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/opendal のほかの issue

apache/opendal の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。