YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

/Users/deen/code/yugabyte-db/src/yb/common/row_mark.h
Line
Count
Source
1
//
2
// Copyright (c) YugaByte, Inc.
3
//
4
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5
// in compliance with the License.  You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software distributed under the License
10
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11
// or implied.  See the License for the specific language governing permissions and limitations
12
// under the License.
13
//
14
#ifndef YB_COMMON_ROW_MARK_H
15
#define YB_COMMON_ROW_MARK_H
16
17
#include <glog/logging.h>
18
19
#include "yb/common/transaction.pb.h"
20
21
namespace yb {
22
23
template <typename PB>
24
7.81M
RowMarkType GetRowMarkTypeFromPB(const PB& pb) {
25
7.81M
  if (pb.has_row_mark_type()) {
26
50.3k
    if (IsValidRowMarkType(pb.row_mark_type())) {
27
50.3k
      return pb.row_mark_type();
28
2
    } else {
29
      // We shouldn't get here because other row lock types are disabled at the postgres level.
30
2
      LOG(DFATAL) << "Unsupported row lock of type " << RowMarkType_Name(pb.row_mark_type());
31
2
    }
32
50.3k
  }
33
7.76M
  return RowMarkType::ROW_MARK_ABSENT;
34
7.81M
}
_ZN2yb20GetRowMarkTypeFromPBINS_5docdb20KeyValueWriteBatchPBEEENS_11RowMarkTypeERKT_
Line
Count
Source
24
3.54M
RowMarkType GetRowMarkTypeFromPB(const PB& pb) {
25
3.54M
  if (pb.has_row_mark_type()) {
26
24.3k
    if (IsValidRowMarkType(pb.row_mark_type())) {
27
24.3k
      return pb.row_mark_type();
28
1
    } else {
29
      // We shouldn't get here because other row lock types are disabled at the postgres level.
30
1
      LOG(DFATAL) << "Unsupported row lock of type " << RowMarkType_Name(pb.row_mark_type());
31
1
    }
32
24.3k
  }
33
3.52M
  return RowMarkType::ROW_MARK_ABSENT;
34
3.54M
}
_ZN2yb20GetRowMarkTypeFromPBINS_18PgsqlReadRequestPBEEENS_11RowMarkTypeERKT_
Line
Count
Source
24
4.26M
RowMarkType GetRowMarkTypeFromPB(const PB& pb) {
25
4.26M
  if (pb.has_row_mark_type()) {
26
25.9k
    if (IsValidRowMarkType(pb.row_mark_type())) {
27
25.9k
      return pb.row_mark_type();
28
1
    } else {
29
      // We shouldn't get here because other row lock types are disabled at the postgres level.
30
1
      LOG(DFATAL) << "Unsupported row lock of type " << RowMarkType_Name(pb.row_mark_type());
31
1
    }
32
25.9k
  }
33
4.23M
  return RowMarkType::ROW_MARK_ABSENT;
34
4.26M
}
35
36
// Get the most restrictive row mark type from a list of row mark types.
37
RowMarkType GetStrongestRowMarkType(std::initializer_list<RowMarkType> row_mark_types);
38
39
// Determine whether a row mark type is valid.
40
bool IsValidRowMarkType(RowMarkType row_mark_type);
41
42
/*
43
 * Returns whether an operation with this row mark should try to use a higher priority txn.
44
 * Currently txn layer will use a best-effort approach, by setting the txn priority to highest if
45
 * this is a new txn (first operation within a transaction).
46
 */
47
bool RowMarkNeedsHigherPriority(RowMarkType row_mark_type);
48
49
} // namespace yb
50
51
#endif // YB_COMMON_ROW_MARK_H