| 608 | } |
| 609 | |
| 610 | static void spawn_merge_units( |
| 611 | tiledb::common::ThreadPool& pool, |
| 612 | size_t parallel_factor, |
| 613 | uint64_t total_items, |
| 614 | const I& streams, |
| 615 | Compare& cmp, |
| 616 | std::span<T> output, |
| 617 | ParallelMergeFuture& future) { |
| 618 | // NB: round up, if there is a shorter merge unit it will be the last one. |
| 619 | const uint64_t target_unit_size = |
| 620 | (total_items + (parallel_factor - 1)) / parallel_factor; |
| 621 | |
| 622 | pool.execute( |
| 623 | spawn_next_merge_unit, |
| 624 | &pool, |
| 625 | streams, |
| 626 | &cmp, |
| 627 | parallel_factor, |
| 628 | total_items, |
| 629 | target_unit_size, |
| 630 | static_cast<uint64_t>(0), |
| 631 | output, |
| 632 | &future); |
| 633 | } |
| 634 | |
| 635 | // friend declarations for testing |
| 636 | friend struct VerifySplitPointStream<T>; |