YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

/Users/deen/code/yugabyte-db/src/yb/master/system_tablet.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/master/system_tablet.h"
15
16
#include "yb/common/common.pb.h"
17
#include "yb/common/schema.h"
18
#include "yb/common/transaction.h"
19
20
#include "yb/master/yql_virtual_table.h"
21
22
namespace yb {
23
namespace master {
24
25
SystemTablet::SystemTablet(const Schema& schema, std::unique_ptr<YQLVirtualTable> yql_virtual_table,
26
                           const TabletId& tablet_id)
27
    : schema_(std::make_shared<Schema>(schema)),
28
      yql_virtual_table_(std::move(yql_virtual_table)),
29
32.1k
      tablet_id_(tablet_id) {
30
32.1k
}
31
32
258k
yb::SchemaPtr SystemTablet::GetSchema(const std::string& table_id) const {
33
  // table_id is ignored. It should match the system table's id.
34
258k
  return schema_;
35
258k
}
36
37
547k
const docdb::YQLStorageIf& SystemTablet::QLStorage() const {
38
547k
  return *yql_virtual_table_;
39
547k
}
40
41
260k
TableType SystemTablet::table_type() const {
42
260k
  return TableType::YQL_TABLE_TYPE;
43
260k
}
44
45
0
const TabletId& SystemTablet::tablet_id() const {
46
0
  return tablet_id_;
47
0
}
48
49
Result<HybridTime> SystemTablet::DoGetSafeTime(
50
259k
    tablet::RequireLease require_lease, HybridTime min_allowed, CoarseTimePoint deadline) const {
51
  // HybridTime doesn't matter for SystemTablets.
52
259k
  return HybridTime::kMax;
53
259k
}
54
55
Status SystemTablet::HandleQLReadRequest(CoarseTimePoint deadline,
56
                                         const ReadHybridTime& read_time,
57
                                         const QLReadRequestPB& ql_read_request,
58
                                         const TransactionMetadataPB& transaction_metadata,
59
259k
                                         tablet::QLReadRequestResult* result) {
60
259k
  DCHECK(!transaction_metadata.has_transaction_id());
61
259k
  return tablet::AbstractTablet::HandleQLReadRequest(
62
259k
      deadline, read_time, ql_read_request, TransactionOperationContext(), result);
63
259k
}
64
65
Status SystemTablet::CreatePagingStateForRead(const QLReadRequestPB& ql_read_request,
66
                                              const size_t row_count,
67
259k
                                              QLResponsePB* response) const {
68
  // We don't support pagination for system tablets. Although we need to return an OK() status
69
  // here since we don't want to raise this as an error to the client, but just want to avoid
70
  // populating any paging state here for the client.
71
259k
  return Status::OK();
72
259k
}
73
74
0
const TableName& SystemTablet::GetTableName() const {
75
0
  return yql_virtual_table_->table_name();
76
0
}
77
78
}  // namespace master
79
}  // namespace yb