MCPcopy Create free account
hub / github.com/ByConity/ByConity / write

Method write

src/Storages/MergeTree/MergeTreeBlockOutputStream.cpp:24–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22
23
24void 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}

Callers

nothing calls this directly

Calls 7

splitBlockIntoPartsMethod · 0.80
writeTempPartMethod · 0.80
renameTempPartAndAddMethod · 0.80
getDeduplicationLogMethod · 0.80
triggerTaskMethod · 0.80
getContextMethod · 0.45
elapsedMethod · 0.45

Tested by

no test coverage detected