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

Method commit

src/Storages/MergeTree/CnchAttachProcessor.cpp:251–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249}
250
251void AttachContext::commit()
252{
253 if (new_txn != nullptr)
254 {
255 query_ctx.getCnchTransactionCoordinator().finishTransaction(new_txn);
256 }
257
258 /// If we're not in the interactive transaction session, at this point it's safe
259 /// to remove the directory lock
260 if (!src_directory.empty() && !isQueryInInteractiveSession(query_ctx.shared_from_this()) && !query_ctx.getSettingsRef().force_clean_transaction_by_dm)
261 query_ctx.getCnchCatalog()->clearFilesysLocks({src_directory}, std::nullopt);
262
263 if (!meta_files_to_delete.empty())
264 {
265 size_t total_records = 0;
266 for (const auto & [_, meta_name_records] : meta_files_to_delete)
267 total_records += meta_name_records.rename_map.size();
268 ThreadPool & pool = getWorkerPool(total_records);
269 for (const auto & [_, meta_name_records] : meta_files_to_delete)
270 {
271 for (const auto & [file_path, _] : meta_name_records.rename_map)
272 pool.scheduleOrThrowOnError([&disk = meta_name_records.disk, path = file_path]() { disk->removeFileIfExists(path); });
273 }
274 pool.wait();
275 }
276}
277
278void AttachContext::rollback()
279{

Callers 1

execMethod · 0.45

Calls 10

shared_from_thisMethod · 0.80
finishTransactionMethod · 0.45
emptyMethod · 0.45
clearFilesysLocksMethod · 0.45
getCnchCatalogMethod · 0.45
sizeMethod · 0.45
removeFileIfExistsMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected