MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / addNewPartAndRemoveCovered

Method addNewPartAndRemoveCovered

src/Interpreters/MergeTreeTransaction.cpp:119–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119void MergeTreeTransaction::addNewPartAndRemoveCovered(const StoragePtr & storage, const DataPartPtr & new_part, const DataPartsVector & covered_parts, MergeTreeTransaction * txn)
120{
121 TransactionID tid = txn ? txn->tid : Tx::NonTransactionalTID;
122 TransactionInfoContext transaction_context{storage->getStorageID(), new_part->name};
123 tryWriteEventToSystemLog(new_part->version->getLogger(), TransactionsInfoLogElement::ADD_PART, tid, transaction_context);
124 transaction_context.covering_part = std::move(transaction_context.part_name);
125 new_part->assertHasVersionMetadata(txn);
126
127 if (txn)
128 {
129 txn->addNewPart(storage, new_part);
130 for (const auto & covered : covered_parts)
131 {
132 transaction_context.part_name = covered->name;
133 txn->removeOldPart(storage, covered, transaction_context);
134 }
135 }
136 else
137 {
138 for (const auto & covered : covered_parts)
139 {
140 transaction_context.part_name = covered->name;
141 covered->version->setAndStoreNonTransactionalRemovalTID(transaction_context);
142 }
143 }
144}
145
146void MergeTreeTransaction::addNewPart(const StoragePtr & storage, const DataPartPtr & new_part)
147{

Callers

nothing calls this directly

Calls 7

removeOldPartMethod · 0.80
tryWriteEventToSystemLogFunction · 0.70
getStorageIDMethod · 0.45
getLoggerMethod · 0.45
addNewPartMethod · 0.45

Tested by

no test coverage detected