/Users/deen/code/yugabyte-db/src/yb/tablet/cleanup_intents_task.cc
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright (c) YugaByte, Inc. |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
4 | | // in compliance with the License. You may obtain a copy of the License at |
5 | | // |
6 | | // http://www.apache.org/licenses/LICENSE-2.0 |
7 | | // |
8 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
9 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
10 | | // or implied. See the License for the specific language governing permissions and limitations |
11 | | // under the License. |
12 | | // |
13 | | |
14 | | #include "yb/tablet/cleanup_intents_task.h" |
15 | | |
16 | | #include "yb/tablet/transaction_intent_applier.h" |
17 | | #include "yb/tablet/transaction_participant.h" |
18 | | #include "yb/tablet/transaction_participant_context.h" |
19 | | |
20 | | #include "yb/util/status_log.h" |
21 | | |
22 | | namespace yb { |
23 | | namespace tablet { |
24 | | |
25 | | CleanupIntentsTask::CleanupIntentsTask( |
26 | | TransactionParticipantContext* participant_context, TransactionIntentApplier* applier, |
27 | | const TransactionId& id) |
28 | 0 | : participant_context_(*participant_context), applier_(*applier), id_(id) {} |
29 | | |
30 | 0 | void CleanupIntentsTask::Prepare(std::shared_ptr<CleanupIntentsTask> self) { |
31 | 0 | retain_self_ = std::move(self); |
32 | 0 | } |
33 | | |
34 | 0 | void CleanupIntentsTask::Run() { |
35 | 0 | RemoveIntentsData data; |
36 | 0 | participant_context_.GetLastReplicatedData(&data); |
37 | 0 | WARN_NOT_OK(applier_.RemoveIntents(data, id_), |
38 | 0 | Format("Failed to remove intents of possible completed transaction $0", id_)); |
39 | 0 | VLOG(2) << "Cleaned intents for: " << id_; |
40 | 0 | } |
41 | | |
42 | 0 | void CleanupIntentsTask::Done(const Status& status) { |
43 | 0 | retain_self_.reset(); |
44 | 0 | } |
45 | | |
46 | | } // namespace tablet |
47 | | } // namespace yb |