| 530 | } |
| 531 | |
| 532 | void DiskObjectStorageTransaction::commit() |
| 533 | { |
| 534 | auto component_guard = Coordination::setCurrentComponent("DiskObjectStorageTransaction::commit"); |
| 535 | for (size_t i = 0; i < operations_to_execute.size(); ++i) |
| 536 | { |
| 537 | try |
| 538 | { |
| 539 | operations_to_execute[i](metadata_transaction); |
| 540 | } |
| 541 | catch (...) |
| 542 | { |
| 543 | tryLogCurrentException( |
| 544 | getLogger("DiskObjectStorageTransaction"), |
| 545 | fmt::format("An error occurred while executing transaction's operation #{}", i)); |
| 546 | |
| 547 | undo(); |
| 548 | |
| 549 | throw; |
| 550 | } |
| 551 | } |
| 552 | |
| 553 | try |
| 554 | { |
| 555 | fiu_do_on(FailPoints::disk_object_storage_fail_commit_metadata_transaction, |
| 556 | { |
| 557 | throw Exception(ErrorCodes::FAULT_INJECTED, "disk_object_storage_fail_commit_metadata_transaction"); |
| 558 | }); |
| 559 | |
| 560 | metadata_transaction->commit(NoCommitOptions{}); |
| 561 | } |
| 562 | catch (...) |
| 563 | { |
| 564 | undo(); |
| 565 | throw; |
| 566 | } |
| 567 | |
| 568 | if (wait_blob_removal) |
| 569 | waitBlobRemoval(metadata_transaction->getSubmittedForRemovalBlobs()); |
| 570 | |
| 571 | operations_to_execute.clear(); |
| 572 | written_blobs.clear(); |
| 573 | LOG_TEST(getLogger("DiskObjectStorageTransaction"), "Transaction committed successfully"); |
| 574 | } |
| 575 | |
| 576 | TransactionCommitOutcomeVariant DiskObjectStorageTransaction::tryCommit(const TransactionCommitOptionsVariant & options) |
| 577 | { |