mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-29 06:55:27 +08:00
issue: #45486 This commit refactors the chunk writing system by introducing a two-phase approach: size calculation followed by writing to a target. This enables efficient group chunk creation where multiple fields share a single mmap region, significantly reducing the number of mmap system calls and VMAs. - Optimize `mmap` usage: single `mmap` per group chunk instead of per field - Split ChunkWriter into two phases: - `calculate_size()`: Pre-compute required memory without allocation - `write_to_target()`: Write data to a provided ChunkTarget - Implement `ChunkMmapGuard` for unified mmap region lifecycle management - Handles `munmap` and file cleanup via RAII - Shared via `std::shared_ptr` across multiple chunks in a group Signed-off-by: Shawn Wang <shawn.wang@zilliz.com> --------- Signed-off-by: Shawn Wang <shawn.wang@zilliz.com>