[Improvement]: Implement heap-based flush mechanism for SortedPosDeleteWriter to prevent OOM
Maintainer thường phản hồi trong vòng 2 ngày
@slfan1989 đang làm issue này rồi.
Từ ngày 19/7/2026.
Đá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
- 52/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- java
- Lĩnh vực
- data-engineering, databases
Hướng nghiên cứu
Bắt đầu từ SortedPosDeleteWriter và TODO liên quan đến điều kiện flush theo số lượng bản ghi của nó; lần theo các constructor và cách xử lý thuộc tính bảng. Định nghĩa HeapUsageProvider và policy dựa trên heap bên cạnh ngưỡng bản ghi hiện có, sau đó xác minh bằng các test rằng các kiểm tra về số bản ghi tối thiểu và tỷ lệ không hợp lệ, tính tương thích của constructor và việc giám sát không ép buộc GC đều được bao phủ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Search before asking
- I have searched in the issues and found no similar issues.
What would you like to be improved?
Currently, SortedPosDeleteWriter only flushes buffered position deletes based on a record count threshold. There is a TODO comment in the code indicating the need for a heap memory-based flush policy:
// TODO Flush buffer based on the policy that checking whether whole heap memory size exceed the
// threshold.
if (records >= recordsNumThreshold) {
flushDeletes();
}
Problem: When processing large-scale position deletes, the in-memory buffer in SortedPosDeleteWriter can grow unbounded (if record threshold is set very high or to Long.MAX_VALUE), potentially causing OutOfMemoryError (OOM) issues, especially in memory-constrained environments.
Current behavior:
- Only flushes when record count reaches recordsNumThreshold
- No protection against heap memory pressure
- Can lead to OOM when processing large delete operations
How should we improve?
Implement a heap memory-based flush mechanism with the following features:
1. New table properties:
pos-delete.flush.heap.ratio (default: 0.8)- Heap usage ratio threshold to trigger flushpos-delete.flush.records (default: Long.MAX_VALUE)- Record count thresholdpos-delete.flush.heap.min-records (default: 1000)- Minimum records before heap-based flush kicks in
2. Implementation details:
- Add
HeapUsageProviderinterface to monitor JVM heap usage - Implement
shouldFlushByHeap()method to check if heap usage exceeds threshold - Modify flush logic to:
if (records >= recordsNumThreshold || shouldFlushByHeap()) - Ensure backward compatibility through constructor overloads
3. Safety guards:
- Prevent frequent small flushes with minimum record count
- Allow disabling heap-based flush by setting invalid ratio (≤0 or ≥1)
- Non-intrusive monitoring (no forced GC)
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Subtasks
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
- Ngôn ngữ chính
- Java
- Star
- 1.2k
- Fork
- 398
- Merge trung bình
- 1 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 19
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/amoro
-
[CI] Core CI doesn't run for changes to amoro-format-lance (and amoro-web)Có thể đã có người làm @MarkAlex1234 đã nhận 1 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 2 ngày
-
fix: low-contrast secondary text color in global theme tokenCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởstale
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
apache/amoro#4157 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
fix: mock api server enabled in production build masks real error/loading uxCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởstale
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
apache/amoro#4155 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: Connection validation rejects bracketed IPv6 endpointsCó thể đã có người làm @hutiefang76 đã nhận 3 ngày trước. Đang mởtype:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: Table pagination parameters can overflow or return server errorsCó thể đã có người làm @hutiefang76 đã nhận 3 ngày trước. Đang mởtype:bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 2 ngày
Issue tương tự
-
Bump up AWS SDK to 2.54.3Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
jenkinsci/ec2-plugin#2041 ·
-
L: github:actions L: php:composer
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
dependabot/dependabot-core#16493 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
SHOW EDIT of a subclass for an object of its superclass: the form fails to open with AssertionErrorĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
FlashyReese/sodium-extra#608 ·