ManyCar doesn't forward put_many_keyed

Đang mở Phù hợp với người mới
#7,910 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
database, performance

Hướng nghiên cứu

Bắt đầu tại src/db/car/many.rs, nơi issue cho biết ManyCar triển khai Blockstore, rồi kiểm tra cách nó chuyển tiếp get và put_keyed đến writer của mình. Thêm việc chuyển tiếp put_many_keyed như trong issue, sau đó chạy các bài kiểm thử liên quan của ManyCar hoặc blockstore để xác nhận các thao tác ghi theo lô đến được writer; issue không nêu tên tệp kiểm thử cụ thể.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Hey! Was reading through the db code and noticed ManyCar's Blockstore impl only overrides get and put_keyed (many.rs#L225-L244). So put_many_keyed falls back to the default and writes one block at a time, and ParityDb's batched version never gets called.

Since the daemon's store is a ManyCar over the GC'd ParityDb, I think this turns the post-export GC backfill (snapshot.rs#L445) and the write buffer flushes (migrations, CAR imports) into one commit per block instead of one per batch.

The fix should just be forwarding it to the writer:

fn put_many_keyed<D, I>(&self, blocks: I) -> anyhow::Result<()>
where
    Self: Sized,
    D: AsRef<[u8]>,
    I: IntoIterator<Item = (Cid, D)>,
{
    self.writer.put_many_keyed(blocks)
}

Happy to send a PR if that sounds right.

(Found this with help from Claude Code; I checked the code paths myself.)

Ngôn ngữ chính
Rust
Star
700
Fork
201
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
65

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ChainSafe/forest

Tất cả issue của ChainSafe/forest

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.