ChunkCache drops a dirty chunk if saving it during eviction fails

Đang mở
#372 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cloud, java
Lĩnh vực
data-engineering

Hướng nghiên cứu

Start with ChunkCache and the eviction listener wired through Caffeine's .executor(Runnable::run), plus the chunkSaver.save call that catches IOException and NonWritableChannelException. The issue suggests a side map drained by flush() or excluding dirty chunks from eviction, but the design choice is open. Done means a dirty chunk survives a failed save during eviction and is written or reported by force(), which needs fault-injected tests since reproduction is unclear.

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

Mô tả

I was reading ChunkCache while working on #370 and noticed this:

try {
    chunkSaver.save(index, chunk);
} catch (IOException | NonWritableChannelException e) {
    exceptionsDuringWrite.add(e);
}
bufferPool.recycle(chunk.data());

By the time this runs the chunk is already out of the cache, so if the save fails there is nothing left to retry. The exception is recorded and surfaces later in force(), but the data is gone, and the write() that produced it had already returned, so from the caller's side it looks written.

The cache holds at most five idle chunks (MAX_CACHED_CLEARTEXT_CHUNKS), so writing a file with more chunks evicts dirty ones as a matter of course. A transient ENOSPC or EIO at the wrong moment is enough.

I have not tried to reproduce it. It needs the save to fail exactly during eviction, so I guess it takes fault injection rather than a real filesystem.

It also does not look like a one-liner: the listener runs inside Caffeine's eviction (.executor(Runnable::run)), so re-inserting from there would just evict again. Keeping failed chunks in a side map drained by flush(), or keeping dirty chunks out of eviction altogether, both seem plausible.

Happy to take this if you think it is worth fixing.

Ngôn ngữ chính
Java
Star
110
Fork
39
Merge trung bình
1 ngày 28 phút
Pull request đã merge (30 ngày)
4

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 cryptomator/cryptofs

Tất cả issue của cryptomator/cryptofs

Issue tương tự

Thêm issue về Java

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.