You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Integrate Max Stream Size Chunking in Velox Writer (#249)
Summary:
Pull Request resolved: #249
This is the last feature of the new chunking policy described in this [doc](https://fburl.com/gdoc/gkdwwju1). Here, we break down large streams into multiple chunks of size up to `maxStreamChunkRawSize`. This protects the reader from attempting to materialize huge chunks. We included StreamData support for this in the previous diff. In this diff, we integrate with the VeloxWriter. With this change, while memory pressure is detected, we:
1. Chunk large streams above `maxStreamChunkRawSize`, retaining stream data below the limit.
2. If there is still memory pressure after the first step, chunk streams with size above `minStreamChunkRawSize`.
During stripe flush, we chunk all remaining data, breaking down streams above `maxStreamChunkRawSize` into smaller chunks.
---
The general chunking policy has two phases:
## **Phase 1 - Memory Pressure Management (shouldChunk)**
The policy monitors total in-memory data size:
- When memory usage exceeds the maximum threshold, it initiates chunking to reduce memory footprint while continuing data ingestion.
- When previous chunking attempts succeeded and memory remains above the minimum threshold, it continues chunking to further reduce memory usage.
- When chunking fails to reduce memory usage effectively and memory stays above the minimum threshold, it forces a full stripe flush to guarantee memory relief.
## **Phase 2 - Storage Size Optimization (shouldFlush)**
Implements compression-aware stripe size prediction:
- Calculates the anticipated final compressed stripe size by applying the estimated compression ratio to unencoded data.
- Triggers stripe flush when the predicted compressed size reaches the target stripe size threshold.
Differential Revision: D82175496
0 commit comments