YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/Users/deen/code/yugabyte-db/src/yb/tablet/operations/truncate_operation.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/operations/truncate_operation.h"
15
16
#include <glog/logging.h>
17
18
#include "yb/consensus/consensus_round.h"
19
#include "yb/consensus/consensus.pb.h"
20
21
#include "yb/tablet/tablet.h"
22
23
#include "yb/util/trace.h"
24
25
namespace yb {
26
namespace tablet {
27
28
template <>
29
void RequestTraits<TruncatePB>::SetAllocatedRequest(
30
0
    consensus::ReplicateMsg* replicate, TruncatePB* request) {
31
0
  replicate->set_allocated_truncate(request);
32
0
}
33
34
template <>
35
227k
TruncatePB* RequestTraits<TruncatePB>::MutableRequest(consensus::ReplicateMsg* replicate) {
36
227k
  return replicate->mutable_truncate();
37
227k
}
38
39
5
Status TruncateOperation::DoAborted(const Status& status) {
40
5
  return status;
41
5
}
42
43
171k
Status TruncateOperation::DoReplicated(int64_t leader_term, Status* complete_status) {
44
171k
  TRACE("APPLY TRUNCATE: started");
45
46
171k
  RETURN_NOT_OK(tablet()->Truncate(this));
47
48
171k
  TRACE("APPLY TRUNCATE: finished");
49
50
171k
  return Status::OK();
51
171k
}
52
53
}  // namespace tablet
54
}  // namespace yb