| 22 | |
| 23 | |
| 24 | void MergeTreeBlockOutputStream::write(const Block & block) |
| 25 | { |
| 26 | auto part_blocks = storage.writer.splitBlockIntoParts(block, max_parts_per_block, metadata_snapshot, context); |
| 27 | for (auto & current_block : part_blocks) |
| 28 | { |
| 29 | Stopwatch watch; |
| 30 | |
| 31 | MergeTreeData::MutableDataPartPtr part = storage.writer.writeTempPart(current_block, metadata_snapshot, context); |
| 32 | |
| 33 | /// If optimize_on_insert setting is true, current_block could become empty after merge |
| 34 | /// and we didn't create part. |
| 35 | if (!part) |
| 36 | continue; |
| 37 | |
| 38 | /// Part can be deduplicated, so increment counters and add to part log only if it's really added |
| 39 | if (storage.renameTempPartAndAdd(part, &storage.increment, nullptr, storage.getDeduplicationLog())) |
| 40 | { |
| 41 | PartLog::addNewPart(storage.getContext(), part, watch.elapsed()); |
| 42 | |
| 43 | /// Initiate async merge - it will be done if it's good time for merge and if there are space in 'background_pool'. |
| 44 | storage.background_executor.triggerTask(); |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | } |
nothing calls this directly
no test coverage detected