/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 | 48.1k | tablet_id_(tablet_id) { |
30 | 48.1k | } |
31 | | |
32 | 259k | yb::SchemaPtr SystemTablet::GetSchema(const std::string& table_id) const { |
33 | | // table_id is ignored. It should match the system table's id. |
34 | 259k | return schema_; |
35 | 259k | } |
36 | | |
37 | 897k | const docdb::YQLStorageIf& SystemTablet::QLStorage() const { |
38 | 897k | return *yql_virtual_table_; |
39 | 897k | } |
40 | | |
41 | 261k | TableType SystemTablet::table_type() const { |
42 | 261k | return TableType::YQL_TABLE_TYPE; |
43 | 261k | } |
44 | | |
45 | 0 | const TabletId& SystemTablet::tablet_id() const { |
46 | 0 | return tablet_id_; |
47 | 0 | } |
48 | | |
49 | | Result<HybridTime> SystemTablet::DoGetSafeTime( |
50 | 262k | tablet::RequireLease require_lease, HybridTime min_allowed, CoarseTimePoint deadline) const { |
51 | | // HybridTime doesn't matter for SystemTablets. |
52 | 262k | return HybridTime::kMax; |
53 | 262k | } |
54 | | |
55 | | Status SystemTablet::HandleQLReadRequest(CoarseTimePoint deadline, |
56 | | const ReadHybridTime& read_time, |
57 | | const QLReadRequestPB& ql_read_request, |
58 | | const TransactionMetadataPB& transaction_metadata, |
59 | 261k | tablet::QLReadRequestResult* result) { |
60 | 261k | DCHECK(!transaction_metadata.has_transaction_id()); |
61 | 261k | return tablet::AbstractTablet::HandleQLReadRequest( |
62 | 261k | deadline, read_time, ql_read_request, TransactionOperationContext(), result); |
63 | 261k | } |
64 | | |
65 | | Status SystemTablet::CreatePagingStateForRead(const QLReadRequestPB& ql_read_request, |
66 | | const size_t row_count, |
67 | 261k | 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 | 261k | return Status::OK(); |
72 | 261k | } |
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 |