/Users/deen/code/yugabyte-db/src/yb/tablet/tablet_component.cc
Line | Count | Source |
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/tablet_component.h" |
15 | | |
16 | | #include "yb/common/index.h" |
17 | | |
18 | | #include "yb/tablet/tablet.h" |
19 | | #include "yb/tablet/tablet_metadata.h" |
20 | | |
21 | | namespace yb { |
22 | | namespace tablet { |
23 | | |
24 | | Result<TabletScopedRWOperationPauses> TabletComponent::StartShutdownRocksDBs( |
25 | 1.79k | DisableFlushOnShutdown disable_flush_on_shutdown) { |
26 | 1.79k | return tablet_.StartShutdownRocksDBs(disable_flush_on_shutdown); |
27 | 1.79k | } |
28 | | |
29 | | CHECKED_STATUS TabletComponent::CompleteShutdownRocksDBs( |
30 | 1.79k | Destroy destroy, TabletScopedRWOperationPauses* ops_pauses) { |
31 | 1.79k | return tablet_.CompleteShutdownRocksDBs(destroy, ops_pauses); |
32 | 1.79k | } |
33 | | |
34 | 1.79k | Status TabletComponent::OpenRocksDBs() { |
35 | 1.79k | return tablet_.OpenKeyValueTablet(); |
36 | 1.79k | } |
37 | | |
38 | 8.10k | std::string TabletComponent::LogPrefix() const { |
39 | 8.10k | return tablet_.LogPrefix(); |
40 | 8.10k | } |
41 | | |
42 | 2.22k | RaftGroupMetadata& TabletComponent::metadata() const { |
43 | 2.22k | return *tablet_.metadata(); |
44 | 2.22k | } |
45 | | |
46 | 2.44k | RWOperationCounter& TabletComponent::pending_op_counter() const { |
47 | 2.44k | return tablet_.pending_non_abortable_op_counter_; |
48 | 2.44k | } |
49 | | |
50 | 3.70k | rocksdb::DB& TabletComponent::regular_db() const { |
51 | 3.70k | return *tablet_.regular_db_; |
52 | 3.70k | } |
53 | | |
54 | 2.31k | bool TabletComponent::has_regular_db() const { |
55 | 2.31k | return tablet_.regular_db_ != nullptr; |
56 | 2.31k | } |
57 | | |
58 | 2.08k | rocksdb::DB& TabletComponent::intents_db() const { |
59 | 2.08k | return *tablet_.intents_db_; |
60 | 2.08k | } |
61 | | |
62 | 5.34k | bool TabletComponent::has_intents_db() const { |
63 | 5.34k | return tablet_.intents_db_ != nullptr; |
64 | 5.34k | } |
65 | | |
66 | 4.11k | std::mutex& TabletComponent::create_checkpoint_lock() const { |
67 | 4.11k | return tablet_.create_checkpoint_lock_; |
68 | 4.11k | } |
69 | | |
70 | 3.58k | rocksdb::Env& TabletComponent::rocksdb_env() const { |
71 | 3.58k | return tablet_.rocksdb_env(); |
72 | 3.58k | } |
73 | | |
74 | 30 | void TabletComponent::RefreshYBMetaDataCache() { |
75 | 30 | tablet_.ResetYBMetaDataCache(); |
76 | 30 | if (!metadata().index_map()->empty()) { |
77 | 9 | tablet_.CreateNewYBMetaDataCache(); |
78 | 9 | } |
79 | 30 | } |
80 | | |
81 | | } // namespace tablet |
82 | | } // namespace yb |