Skip to content

Write with parallel#772

Open
ColinLeeo wants to merge 2 commits intodevelopfrom
write_with_parallel
Open

Write with parallel#772
ColinLeeo wants to merge 2 commits intodevelopfrom
write_with_parallel

Conversation

@ColinLeeo
Copy link
Copy Markdown
Contributor

@ColinLeeo ColinLeeo commented Apr 9, 2026

This change introduces thread pool-based write parallelization to the TsFile C++ write path.

Threading is controlled at compile time via the ENABLE_THREADS CMake option, with parallel_write_enabled_ and write_thread_count_ added to ConfigValue for runtime control.

The core approach: write_table() first sorts the Tablet by device (via the new Tablet::sort_by_device()) to make same-device rows contiguous, then precomputes page boundaries from page_writer_max_point_num_ and the current time page's existing point count, and finally dispatches the time column and all value columns into the thread pool in parallel — each column writes the same row segments and explicitly seals pages at the precomputed boundaries, preserving time/value page alignment required by the aligned model.

On the testing side, TsFileWriterTableTest has been converted to a gtest parameterized test, running both Serial
(parallel_write_enabled_=false) and Parallel (parallel_write_enabled_=true) suites — all 34 test cases pass under a single build configuration.

@ColinLeeo ColinLeeo force-pushed the write_with_parallel branch from 38b7336 to d0cf8a4 Compare April 9, 2026 13:17
@ColinLeeo ColinLeeo force-pushed the write_with_parallel branch from d0cf8a4 to 9207296 Compare April 9, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant