/Users/deen/code/yugabyte-db/src/yb/tserver/service_util.h
Line | Count | Source (jump to first uncovered line) |
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 | | // |
15 | | |
16 | | #ifndef YB_TSERVER_SERVICE_UTIL_H |
17 | | #define YB_TSERVER_SERVICE_UTIL_H |
18 | | |
19 | | #include <boost/optional.hpp> |
20 | | |
21 | | #include "yb/common/wire_protocol.h" |
22 | | #include "yb/consensus/consensus_error.h" |
23 | | |
24 | | #include "yb/rpc/rpc_context.h" |
25 | | #include "yb/server/clock.h" |
26 | | |
27 | | #include "yb/tablet/tablet_fwd.h" |
28 | | #include "yb/tablet/tablet_peer.h" |
29 | | |
30 | | #include "yb/tserver/tablet_peer_lookup.h" |
31 | | #include "yb/tablet/tablet_error.h" |
32 | | #include "yb/tserver/tserver_error.h" |
33 | | |
34 | | #include "yb/util/logging.h" |
35 | | #include "yb/util/result.h" |
36 | | #include "yb/util/status_callback.h" |
37 | | #include "yb/util/status_format.h" |
38 | | |
39 | | namespace yb { |
40 | | namespace tserver { |
41 | | |
42 | | // Non-template helpers. |
43 | | |
44 | | void SetupErrorAndRespond(TabletServerErrorPB* error, |
45 | | const Status& s, |
46 | | TabletServerErrorPB::Code code, |
47 | | rpc::RpcContext* context); |
48 | | |
49 | | void SetupErrorAndRespond(TabletServerErrorPB* error, |
50 | | const Status& s, |
51 | | rpc::RpcContext* context); |
52 | | |
53 | | void SetupError(TabletServerErrorPB* error, const Status& s); |
54 | | |
55 | | Result<int64_t> LeaderTerm(const tablet::TabletPeer& tablet_peer); |
56 | | |
57 | | // Template helpers. |
58 | | |
59 | | template<class ReqClass> |
60 | | Result<bool> CheckUuidMatch(TabletPeerLookupIf* tablet_manager, |
61 | | const char* method_name, |
62 | | const ReqClass* req, |
63 | 10.6M | const std::string& requestor_string) { |
64 | 10.6M | const string& local_uuid = tablet_manager->NodeInstance().permanent_uuid(); |
65 | 10.6M | if (req->dest_uuid().empty()) { |
66 | | // Maintain compat in release mode, but complain. |
67 | 0 | string msg = strings::Substitute("$0: Missing destination UUID in request from $1: $2", |
68 | 0 | method_name, requestor_string, req->ShortDebugString()); |
69 | | #ifdef NDEBUG |
70 | | YB_LOG_EVERY_N(ERROR, 100) << msg; |
71 | | #else |
72 | 0 | LOG(FATAL) << msg; |
73 | 0 | #endif |
74 | 0 | return true; |
75 | 0 | } |
76 | 10.6M | if (PREDICT_FALSE(req->dest_uuid() != local_uuid)) { |
77 | 20 | const Status s = STATUS_SUBSTITUTE(InvalidArgument, |
78 | 20 | "$0: Wrong destination UUID requested. Local UUID: $1. Requested UUID: $2", |
79 | 20 | method_name, local_uuid, req->dest_uuid()); |
80 | 20 | LOG(WARNING) << s.ToString() << ": from " << requestor_string |
81 | 20 | << ": " << req->ShortDebugString(); |
82 | 20 | return s.CloneAndAddErrorCode(TabletServerError(TabletServerErrorPB::WRONG_SERVER_UUID)); |
83 | 20 | } |
84 | 10.6M | return true; |
85 | 10.6M | } _ZN2yb7tserver14CheckUuidMatchINS_6tablet23ChangeMetadataRequestPBEEENS_6ResultIbEEPNS0_18TabletPeerLookupIfEPKcPKT_RKNSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEE Line | Count | Source | 63 | 20.7k | const std::string& requestor_string) { | 64 | 20.7k | const string& local_uuid = tablet_manager->NodeInstance().permanent_uuid(); | 65 | 20.7k | if (req->dest_uuid().empty()) { | 66 | | // Maintain compat in release mode, but complain. | 67 | 0 | string msg = strings::Substitute("$0: Missing destination UUID in request from $1: $2", | 68 | 0 | method_name, requestor_string, req->ShortDebugString()); | 69 | | #ifdef NDEBUG | 70 | | YB_LOG_EVERY_N(ERROR, 100) << msg; | 71 | | #else | 72 | 0 | LOG(FATAL) << msg; | 73 | 0 | #endif | 74 | 0 | return true; | 75 | 0 | } | 76 | 20.7k | if (PREDICT_FALSE(req->dest_uuid() != local_uuid)) { | 77 | 0 | const Status s = STATUS_SUBSTITUTE(InvalidArgument, | 78 | 0 | "$0: Wrong destination UUID requested. Local UUID: $1. Requested UUID: $2", | 79 | 0 | method_name, local_uuid, req->dest_uuid()); | 80 | 0 | LOG(WARNING) << s.ToString() << ": from " << requestor_string | 81 | 0 | << ": " << req->ShortDebugString(); | 82 | 0 | return s.CloneAndAddErrorCode(TabletServerError(TabletServerErrorPB::WRONG_SERVER_UUID)); | 83 | 0 | } | 84 | 20.7k | return true; | 85 | 20.7k | } |
_ZN2yb7tserver14CheckUuidMatchINS0_20GetSafeTimeRequestPBEEENS_6ResultIbEEPNS0_18TabletPeerLookupIfEPKcPKT_RKNSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEE Line | Count | Source | 63 | 2.66k | const std::string& requestor_string) { | 64 | 2.66k | const string& local_uuid = tablet_manager->NodeInstance().permanent_uuid(); | 65 | 2.66k | if (req->dest_uuid().empty()) { | 66 | | // Maintain compat in release mode, but complain. | 67 | 0 | string msg = strings::Substitute("$0: Missing destination UUID in request from $1: $2", | 68 | 0 | method_name, requestor_string, req->ShortDebugString()); | 69 | | #ifdef NDEBUG | 70 | | YB_LOG_EVERY_N(ERROR, 100) << msg; | 71 | | #else | 72 | 0 | LOG(FATAL) << msg; | 73 | 0 | #endif | 74 | 0 | return true; | 75 | 0 | } | 76 | 2.66k | if (PREDICT_FALSE(req->dest_uuid() != local_uuid)) { | 77 | 0 | const Status s = STATUS_SUBSTITUTE(InvalidArgument, | 78 | 0 | "$0: Wrong destination UUID requested. Local UUID: $1. Requested UUID: $2", | 79 | 0 | method_name, local_uuid, req->dest_uuid()); | 80 | 0 | LOG(WARNING) << s.ToString() << ": from " << requestor_string | 81 | 0 | << ": " << req->ShortDebugString(); | 82 | 0 | return s.CloneAndAddErrorCode(TabletServerError(TabletServerErrorPB::WRONG_SERVER_UUID)); | 83 | 0 | } | 84 | 2.66k | return true; | 85 | 2.66k | } |
_ZN2yb7tserver14CheckUuidMatchINS0_22BackfillIndexRequestPBEEENS_6ResultIbEEPNS0_18TabletPeerLookupIfEPKcPKT_RKNSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEE Line | Count | Source | 63 | 2.71k | const std::string& requestor_string) { | 64 | 2.71k | const string& local_uuid = tablet_manager->NodeInstance().permanent_uuid(); | 65 | 2.71k | if (req->dest_uuid().empty()) { | 66 | | // Maintain compat in release mode, but complain. | 67 | 0 | string msg = strings::Substitute("$0: Missing destination UUID in request from $1: $2", | 68 | 0 | method_name, requestor_string, req->ShortDebugString()); | 69 | | #ifdef NDEBUG | 70 | | YB_LOG_EVERY_N(ERROR, 100) << msg; | 71 | | #else | 72 | 0 | LOG(FATAL) << msg; | 73 | 0 | #endif | 74 | 0 | return true; | 75 | 0 | } | 76 | 2.71k | if (PREDICT_FALSE(req->dest_uuid() != local_uuid)) { | 77 | 0 | const Status s = STATUS_SUBSTITUTE(InvalidArgument, | 78 | 0 | "$0: Wrong destination UUID requested. Local UUID: $1. Requested UUID: $2", | 79 | 0 | method_name, local_uuid, req->dest_uuid()); | 80 | 0 | LOG(WARNING) << s.ToString() << ": from " << requestor_string | 81 | 0 | << ": " << req->ShortDebugString(); | 82 | 0 | return s.CloneAndAddErrorCode(TabletServerError(TabletServerErrorPB::WRONG_SERVER_UUID)); | 83 | 0 | } | 84 | 2.71k | return true; | 85 | 2.71k | } |
_ZN2yb7tserver14CheckUuidMatchINS0_21CreateTabletRequestPBEEENS_6ResultIbEEPNS0_18TabletPeerLookupIfEPKcPKT_RKNSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEE Line | Count | Source | 63 | 81.8k | const std::string& requestor_string) { | 64 | 81.8k | const string& local_uuid = tablet_manager->NodeInstance().permanent_uuid(); | 65 | 81.8k | if (req->dest_uuid().empty()) { | 66 | | // Maintain compat in release mode, but complain. | 67 | 0 | string msg = strings::Substitute("$0: Missing destination UUID in request from $1: $2", | 68 | 0 | method_name, requestor_string, req->ShortDebugString()); | 69 | | #ifdef NDEBUG | 70 | | YB_LOG_EVERY_N(ERROR, 100) << msg; | 71 | | #else | 72 | 0 | LOG(FATAL) << msg; | 73 | 0 | #endif | 74 | 0 | return true; | 75 | 0 | } | 76 | 81.8k | if (PREDICT_FALSE(req->dest_uuid() != local_uuid)) { | 77 | 0 | const Status s = STATUS_SUBSTITUTE(InvalidArgument, | 78 | 0 | "$0: Wrong destination UUID requested. Local UUID: $1. Requested UUID: $2", | 79 | 0 | method_name, local_uuid, req->dest_uuid()); | 80 | 0 | LOG(WARNING) << s.ToString() << ": from " << requestor_string | 81 | 0 | << ": " << req->ShortDebugString(); | 82 | 0 | return s.CloneAndAddErrorCode(TabletServerError(TabletServerErrorPB::WRONG_SERVER_UUID)); | 83 | 0 | } | 84 | 81.8k | return true; | 85 | 81.8k | } |
_ZN2yb7tserver14CheckUuidMatchINS0_21DeleteTabletRequestPBEEENS_6ResultIbEEPNS0_18TabletPeerLookupIfEPKcPKT_RKNSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEE Line | Count | Source | 63 | 49.2k | const std::string& requestor_string) { | 64 | 49.2k | const string& local_uuid = tablet_manager->NodeInstance().permanent_uuid(); | 65 | 49.2k | if (req->dest_uuid().empty()) { | 66 | | // Maintain compat in release mode, but complain. | 67 | 0 | string msg = strings::Substitute("$0: Missing destination UUID in request from $1: $2", | 68 | 0 | method_name, requestor_string, req->ShortDebugString()); | 69 | | #ifdef NDEBUG | 70 | | YB_LOG_EVERY_N(ERROR, 100) << msg; | 71 | | #else | 72 | 0 | LOG(FATAL) << msg; | 73 | 0 | #endif | 74 | 0 | return true; | 75 | 0 | } | 76 | 49.2k | if (PREDICT_FALSE(req->dest_uuid() != local_uuid)) { | 77 | 0 | const Status s = STATUS_SUBSTITUTE(InvalidArgument, | 78 | 0 | "$0: Wrong destination UUID requested. Local UUID: $1. Requested UUID: $2", | 79 | 0 | method_name, local_uuid, req->dest_uuid()); | 80 | 0 | LOG(WARNING) << s.ToString() << ": from " << requestor_string | 81 | 0 | << ": " << req->ShortDebugString(); | 82 | 0 | return s.CloneAndAddErrorCode(TabletServerError(TabletServerErrorPB::WRONG_SERVER_UUID)); | 83 | 0 | } | 84 | 49.2k | return true; | 85 | 49.2k | } |
_ZN2yb7tserver14CheckUuidMatchINS0_21FlushTabletsRequestPBEEENS_6ResultIbEEPNS0_18TabletPeerLookupIfEPKcPKT_RKNSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEE Line | Count | Source | 63 | 30 | const std::string& requestor_string) { | 64 | 30 | const string& local_uuid = tablet_manager->NodeInstance().permanent_uuid(); | 65 | 30 | if (req->dest_uuid().empty()) { | 66 | | // Maintain compat in release mode, but complain. | 67 | 0 | string msg = strings::Substitute("$0: Missing destination UUID in request from $1: $2", | 68 | 0 | method_name, requestor_string, req->ShortDebugString()); | 69 | | #ifdef NDEBUG | 70 | | YB_LOG_EVERY_N(ERROR, 100) << msg; | 71 | | #else | 72 | 0 | LOG(FATAL) << msg; | 73 | 0 | #endif | 74 | 0 | return true; | 75 | 0 | } | 76 | 30 | if (PREDICT_FALSE(req->dest_uuid() != local_uuid)) { | 77 | 0 | const Status s = STATUS_SUBSTITUTE(InvalidArgument, | 78 | 0 | "$0: Wrong destination UUID requested. Local UUID: $1. Requested UUID: $2", | 79 | 0 | method_name, local_uuid, req->dest_uuid()); | 80 | 0 | LOG(WARNING) << s.ToString() << ": from " << requestor_string | 81 | 0 | << ": " << req->ShortDebugString(); | 82 | 0 | return s.CloneAndAddErrorCode(TabletServerError(TabletServerErrorPB::WRONG_SERVER_UUID)); | 83 | 0 | } | 84 | 30 | return true; | 85 | 30 | } |
_ZN2yb7tserver14CheckUuidMatchINS_6tablet20SplitTabletRequestPBEEENS_6ResultIbEEPNS0_18TabletPeerLookupIfEPKcPKT_RKNSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEE Line | Count | Source | 63 | 44 | const std::string& requestor_string) { | 64 | 44 | const string& local_uuid = tablet_manager->NodeInstance().permanent_uuid(); | 65 | 44 | if (req->dest_uuid().empty()) { | 66 | | // Maintain compat in release mode, but complain. | 67 | 0 | string msg = strings::Substitute("$0: Missing destination UUID in request from $1: $2", | 68 | 0 | method_name, requestor_string, req->ShortDebugString()); | 69 | | #ifdef NDEBUG | 70 | | YB_LOG_EVERY_N(ERROR, 100) << msg; | 71 | | #else | 72 | 0 | LOG(FATAL) << msg; | 73 | 0 | #endif | 74 | 0 | return true; | 75 | 0 | } | 76 | 44 | if (PREDICT_FALSE(req->dest_uuid() != local_uuid)) { | 77 | 0 | const Status s = STATUS_SUBSTITUTE(InvalidArgument, | 78 | 0 | "$0: Wrong destination UUID requested. Local UUID: $1. Requested UUID: $2", | 79 | 0 | method_name, local_uuid, req->dest_uuid()); | 80 | 0 | LOG(WARNING) << s.ToString() << ": from " << requestor_string | 81 | 0 | << ": " << req->ShortDebugString(); | 82 | 0 | return s.CloneAndAddErrorCode(TabletServerError(TabletServerErrorPB::WRONG_SERVER_UUID)); | 83 | 0 | } | 84 | 44 | return true; | 85 | 44 | } |
_ZN2yb7tserver14CheckUuidMatchINS_9consensus18ConsensusRequestPBEEENS_6ResultIbEEPNS0_18TabletPeerLookupIfEPKcPKT_RKNSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEE Line | Count | Source | 63 | 10.2M | const std::string& requestor_string) { | 64 | 10.2M | const string& local_uuid = tablet_manager->NodeInstance().permanent_uuid(); | 65 | 10.2M | if (req->dest_uuid().empty()) { | 66 | | // Maintain compat in release mode, but complain. | 67 | 0 | string msg = strings::Substitute("$0: Missing destination UUID in request from $1: $2", | 68 | 0 | method_name, requestor_string, req->ShortDebugString()); | 69 | | #ifdef NDEBUG | 70 | | YB_LOG_EVERY_N(ERROR, 100) << msg; | 71 | | #else | 72 | 0 | LOG(FATAL) << msg; | 73 | 0 | #endif | 74 | 0 | return true; | 75 | 0 | } | 76 | 10.2M | if (PREDICT_FALSE(req->dest_uuid() != local_uuid)) { | 77 | 12 | const Status s = STATUS_SUBSTITUTE(InvalidArgument, | 78 | 12 | "$0: Wrong destination UUID requested. Local UUID: $1. Requested UUID: $2", | 79 | 12 | method_name, local_uuid, req->dest_uuid()); | 80 | 12 | LOG(WARNING) << s.ToString() << ": from " << requestor_string | 81 | 12 | << ": " << req->ShortDebugString(); | 82 | 12 | return s.CloneAndAddErrorCode(TabletServerError(TabletServerErrorPB::WRONG_SERVER_UUID)); | 83 | 12 | } | 84 | 10.2M | return true; | 85 | 10.2M | } |
_ZN2yb7tserver14CheckUuidMatchINS_9consensus13VoteRequestPBEEENS_6ResultIbEEPNS0_18TabletPeerLookupIfEPKcPKT_RKNSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEE Line | Count | Source | 63 | 144k | const std::string& requestor_string) { | 64 | 144k | const string& local_uuid = tablet_manager->NodeInstance().permanent_uuid(); | 65 | 144k | if (req->dest_uuid().empty()) { | 66 | | // Maintain compat in release mode, but complain. | 67 | 0 | string msg = strings::Substitute("$0: Missing destination UUID in request from $1: $2", | 68 | 0 | method_name, requestor_string, req->ShortDebugString()); | 69 | | #ifdef NDEBUG | 70 | | YB_LOG_EVERY_N(ERROR, 100) << msg; | 71 | | #else | 72 | 0 | LOG(FATAL) << msg; | 73 | 0 | #endif | 74 | 0 | return true; | 75 | 0 | } | 76 | 144k | if (PREDICT_FALSE(req->dest_uuid() != local_uuid)) { | 77 | 8 | const Status s = STATUS_SUBSTITUTE(InvalidArgument, | 78 | 8 | "$0: Wrong destination UUID requested. Local UUID: $1. Requested UUID: $2", | 79 | 8 | method_name, local_uuid, req->dest_uuid()); | 80 | 8 | LOG(WARNING) << s.ToString() << ": from " << requestor_string | 81 | 8 | << ": " << req->ShortDebugString(); | 82 | 8 | return s.CloneAndAddErrorCode(TabletServerError(TabletServerErrorPB::WRONG_SERVER_UUID)); | 83 | 8 | } | 84 | 144k | return true; | 85 | 144k | } |
_ZN2yb7tserver14CheckUuidMatchINS_9consensus21ChangeConfigRequestPBEEENS_6ResultIbEEPNS0_18TabletPeerLookupIfEPKcPKT_RKNSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEE Line | Count | Source | 63 | 2.40k | const std::string& requestor_string) { | 64 | 2.40k | const string& local_uuid = tablet_manager->NodeInstance().permanent_uuid(); | 65 | 2.40k | if (req->dest_uuid().empty()) { | 66 | | // Maintain compat in release mode, but complain. | 67 | 0 | string msg = strings::Substitute("$0: Missing destination UUID in request from $1: $2", | 68 | 0 | method_name, requestor_string, req->ShortDebugString()); | 69 | | #ifdef NDEBUG | 70 | | YB_LOG_EVERY_N(ERROR, 100) << msg; | 71 | | #else | 72 | 0 | LOG(FATAL) << msg; | 73 | 0 | #endif | 74 | 0 | return true; | 75 | 0 | } | 76 | 2.40k | if (PREDICT_FALSE(req->dest_uuid() != local_uuid)) { | 77 | 0 | const Status s = STATUS_SUBSTITUTE(InvalidArgument, | 78 | 0 | "$0: Wrong destination UUID requested. Local UUID: $1. Requested UUID: $2", | 79 | 0 | method_name, local_uuid, req->dest_uuid()); | 80 | 0 | LOG(WARNING) << s.ToString() << ": from " << requestor_string | 81 | 0 | << ": " << req->ShortDebugString(); | 82 | 0 | return s.CloneAndAddErrorCode(TabletServerError(TabletServerErrorPB::WRONG_SERVER_UUID)); | 83 | 0 | } | 84 | 2.40k | return true; | 85 | 2.40k | } |
Unexecuted instantiation: _ZN2yb7tserver14CheckUuidMatchINS_9consensus27UnsafeChangeConfigRequestPBEEENS_6ResultIbEEPNS0_18TabletPeerLookupIfEPKcPKT_RKNSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEE _ZN2yb7tserver14CheckUuidMatchINS_9consensus26RunLeaderElectionRequestPBEEENS_6ResultIbEEPNS0_18TabletPeerLookupIfEPKcPKT_RKNSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEE Line | Count | Source | 63 | 56.3k | const std::string& requestor_string) { | 64 | 56.3k | const string& local_uuid = tablet_manager->NodeInstance().permanent_uuid(); | 65 | 56.3k | if (req->dest_uuid().empty()) { | 66 | | // Maintain compat in release mode, but complain. | 67 | 0 | string msg = strings::Substitute("$0: Missing destination UUID in request from $1: $2", | 68 | 0 | method_name, requestor_string, req->ShortDebugString()); | 69 | | #ifdef NDEBUG | 70 | | YB_LOG_EVERY_N(ERROR, 100) << msg; | 71 | | #else | 72 | 0 | LOG(FATAL) << msg; | 73 | 0 | #endif | 74 | 0 | return true; | 75 | 0 | } | 76 | 56.3k | if (PREDICT_FALSE(req->dest_uuid() != local_uuid)) { | 77 | 0 | const Status s = STATUS_SUBSTITUTE(InvalidArgument, | 78 | 0 | "$0: Wrong destination UUID requested. Local UUID: $1. Requested UUID: $2", | 79 | 0 | method_name, local_uuid, req->dest_uuid()); | 80 | 0 | LOG(WARNING) << s.ToString() << ": from " << requestor_string | 81 | 0 | << ": " << req->ShortDebugString(); | 82 | 0 | return s.CloneAndAddErrorCode(TabletServerError(TabletServerErrorPB::WRONG_SERVER_UUID)); | 83 | 0 | } | 84 | 56.3k | return true; | 85 | 56.3k | } |
_ZN2yb7tserver14CheckUuidMatchINS_9consensus27LeaderElectionLostRequestPBEEENS_6ResultIbEEPNS0_18TabletPeerLookupIfEPKcPKT_RKNSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEE Line | Count | Source | 63 | 44 | const std::string& requestor_string) { | 64 | 44 | const string& local_uuid = tablet_manager->NodeInstance().permanent_uuid(); | 65 | 44 | if (req->dest_uuid().empty()) { | 66 | | // Maintain compat in release mode, but complain. | 67 | 0 | string msg = strings::Substitute("$0: Missing destination UUID in request from $1: $2", | 68 | 0 | method_name, requestor_string, req->ShortDebugString()); | 69 | | #ifdef NDEBUG | 70 | | YB_LOG_EVERY_N(ERROR, 100) << msg; | 71 | | #else | 72 | 0 | LOG(FATAL) << msg; | 73 | 0 | #endif | 74 | 0 | return true; | 75 | 0 | } | 76 | 44 | if (PREDICT_FALSE(req->dest_uuid() != local_uuid)) { | 77 | 0 | const Status s = STATUS_SUBSTITUTE(InvalidArgument, | 78 | 0 | "$0: Wrong destination UUID requested. Local UUID: $1. Requested UUID: $2", | 79 | 0 | method_name, local_uuid, req->dest_uuid()); | 80 | 0 | LOG(WARNING) << s.ToString() << ": from " << requestor_string | 81 | 0 | << ": " << req->ShortDebugString(); | 82 | 0 | return s.CloneAndAddErrorCode(TabletServerError(TabletServerErrorPB::WRONG_SERVER_UUID)); | 83 | 0 | } | 84 | 44 | return true; | 85 | 44 | } |
_ZN2yb7tserver14CheckUuidMatchINS_9consensus23LeaderStepDownRequestPBEEENS_6ResultIbEEPNS0_18TabletPeerLookupIfEPKcPKT_RKNSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEE Line | Count | Source | 63 | 5.88k | const std::string& requestor_string) { | 64 | 5.88k | const string& local_uuid = tablet_manager->NodeInstance().permanent_uuid(); | 65 | 5.88k | if (req->dest_uuid().empty()) { | 66 | | // Maintain compat in release mode, but complain. | 67 | 0 | string msg = strings::Substitute("$0: Missing destination UUID in request from $1: $2", | 68 | 0 | method_name, requestor_string, req->ShortDebugString()); | 69 | | #ifdef NDEBUG | 70 | | YB_LOG_EVERY_N(ERROR, 100) << msg; | 71 | | #else | 72 | 0 | LOG(FATAL) << msg; | 73 | 0 | #endif | 74 | 0 | return true; | 75 | 0 | } | 76 | 5.88k | if (PREDICT_FALSE(req->dest_uuid() != local_uuid)) { | 77 | 0 | const Status s = STATUS_SUBSTITUTE(InvalidArgument, | 78 | 0 | "$0: Wrong destination UUID requested. Local UUID: $1. Requested UUID: $2", | 79 | 0 | method_name, local_uuid, req->dest_uuid()); | 80 | 0 | LOG(WARNING) << s.ToString() << ": from " << requestor_string | 81 | 0 | << ": " << req->ShortDebugString(); | 82 | 0 | return s.CloneAndAddErrorCode(TabletServerError(TabletServerErrorPB::WRONG_SERVER_UUID)); | 83 | 0 | } | 84 | 5.88k | return true; | 85 | 5.88k | } |
_ZN2yb7tserver14CheckUuidMatchINS_9consensus20GetLastOpIdRequestPBEEENS_6ResultIbEEPNS0_18TabletPeerLookupIfEPKcPKT_RKNSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEE Line | Count | Source | 63 | 576 | const std::string& requestor_string) { | 64 | 576 | const string& local_uuid = tablet_manager->NodeInstance().permanent_uuid(); | 65 | 576 | if (req->dest_uuid().empty()) { | 66 | | // Maintain compat in release mode, but complain. | 67 | 0 | string msg = strings::Substitute("$0: Missing destination UUID in request from $1: $2", | 68 | 0 | method_name, requestor_string, req->ShortDebugString()); | 69 | | #ifdef NDEBUG | 70 | | YB_LOG_EVERY_N(ERROR, 100) << msg; | 71 | | #else | 72 | 0 | LOG(FATAL) << msg; | 73 | 0 | #endif | 74 | 0 | return true; | 75 | 0 | } | 76 | 576 | if (PREDICT_FALSE(req->dest_uuid() != local_uuid)) { | 77 | 0 | const Status s = STATUS_SUBSTITUTE(InvalidArgument, | 78 | 0 | "$0: Wrong destination UUID requested. Local UUID: $1. Requested UUID: $2", | 79 | 0 | method_name, local_uuid, req->dest_uuid()); | 80 | 0 | LOG(WARNING) << s.ToString() << ": from " << requestor_string | 81 | 0 | << ": " << req->ShortDebugString(); | 82 | 0 | return s.CloneAndAddErrorCode(TabletServerError(TabletServerErrorPB::WRONG_SERVER_UUID)); | 83 | 0 | } | 84 | 576 | return true; | 85 | 576 | } |
_ZN2yb7tserver14CheckUuidMatchINS_9consensus26GetConsensusStateRequestPBEEENS_6ResultIbEEPNS0_18TabletPeerLookupIfEPKcPKT_RKNSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEE Line | Count | Source | 63 | 3.68k | const std::string& requestor_string) { | 64 | 3.68k | const string& local_uuid = tablet_manager->NodeInstance().permanent_uuid(); | 65 | 3.68k | if (req->dest_uuid().empty()) { | 66 | | // Maintain compat in release mode, but complain. | 67 | 0 | string msg = strings::Substitute("$0: Missing destination UUID in request from $1: $2", | 68 | 0 | method_name, requestor_string, req->ShortDebugString()); | 69 | | #ifdef NDEBUG | 70 | | YB_LOG_EVERY_N(ERROR, 100) << msg; | 71 | | #else | 72 | 0 | LOG(FATAL) << msg; | 73 | 0 | #endif | 74 | 0 | return true; | 75 | 0 | } | 76 | 3.68k | if (PREDICT_FALSE(req->dest_uuid() != local_uuid)) { | 77 | 0 | const Status s = STATUS_SUBSTITUTE(InvalidArgument, | 78 | 0 | "$0: Wrong destination UUID requested. Local UUID: $1. Requested UUID: $2", | 79 | 0 | method_name, local_uuid, req->dest_uuid()); | 80 | 0 | LOG(WARNING) << s.ToString() << ": from " << requestor_string | 81 | 0 | << ": " << req->ShortDebugString(); | 82 | 0 | return s.CloneAndAddErrorCode(TabletServerError(TabletServerErrorPB::WRONG_SERVER_UUID)); | 83 | 0 | } | 84 | 3.68k | return true; | 85 | 3.68k | } |
_ZN2yb7tserver14CheckUuidMatchINS_9consensus29StartRemoteBootstrapRequestPBEEENS_6ResultIbEEPNS0_18TabletPeerLookupIfEPKcPKT_RKNSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEE Line | Count | Source | 63 | 4.91k | const std::string& requestor_string) { | 64 | 4.91k | const string& local_uuid = tablet_manager->NodeInstance().permanent_uuid(); | 65 | 4.91k | if (req->dest_uuid().empty()) { | 66 | | // Maintain compat in release mode, but complain. | 67 | 0 | string msg = strings::Substitute("$0: Missing destination UUID in request from $1: $2", | 68 | 0 | method_name, requestor_string, req->ShortDebugString()); | 69 | | #ifdef NDEBUG | 70 | | YB_LOG_EVERY_N(ERROR, 100) << msg; | 71 | | #else | 72 | 0 | LOG(FATAL) << msg; | 73 | 0 | #endif | 74 | 0 | return true; | 75 | 0 | } | 76 | 4.91k | if (PREDICT_FALSE(req->dest_uuid() != local_uuid)) { | 77 | 0 | const Status s = STATUS_SUBSTITUTE(InvalidArgument, | 78 | 0 | "$0: Wrong destination UUID requested. Local UUID: $1. Requested UUID: $2", | 79 | 0 | method_name, local_uuid, req->dest_uuid()); | 80 | 0 | LOG(WARNING) << s.ToString() << ": from " << requestor_string | 81 | 0 | << ": " << req->ShortDebugString(); | 82 | 0 | return s.CloneAndAddErrorCode(TabletServerError(TabletServerErrorPB::WRONG_SERVER_UUID)); | 83 | 0 | } | 84 | 4.91k | return true; | 85 | 4.91k | } |
_ZN2yb7tserver14CheckUuidMatchINS0_25TabletSnapshotOpRequestPBEEENS_6ResultIbEEPNS0_18TabletPeerLookupIfEPKcPKT_RKNSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEE Line | Count | Source | 63 | 4 | const std::string& requestor_string) { | 64 | 4 | const string& local_uuid = tablet_manager->NodeInstance().permanent_uuid(); | 65 | 4 | if (req->dest_uuid().empty()) { | 66 | | // Maintain compat in release mode, but complain. | 67 | 0 | string msg = strings::Substitute("$0: Missing destination UUID in request from $1: $2", | 68 | 0 | method_name, requestor_string, req->ShortDebugString()); | 69 | | #ifdef NDEBUG | 70 | | YB_LOG_EVERY_N(ERROR, 100) << msg; | 71 | | #else | 72 | 0 | LOG(FATAL) << msg; | 73 | 0 | #endif | 74 | 0 | return true; | 75 | 0 | } | 76 | 4 | if (PREDICT_FALSE(req->dest_uuid() != local_uuid)) { | 77 | 0 | const Status s = STATUS_SUBSTITUTE(InvalidArgument, | 78 | 0 | "$0: Wrong destination UUID requested. Local UUID: $1. Requested UUID: $2", | 79 | 0 | method_name, local_uuid, req->dest_uuid()); | 80 | 0 | LOG(WARNING) << s.ToString() << ": from " << requestor_string | 81 | 0 | << ": " << req->ShortDebugString(); | 82 | 0 | return s.CloneAndAddErrorCode(TabletServerError(TabletServerErrorPB::WRONG_SERVER_UUID)); | 83 | 0 | } | 84 | 4 | return true; | 85 | 4 | } |
|
86 | | |
87 | | template<class ReqClass, class RespClass> |
88 | | bool CheckUuidMatchOrRespond(TabletPeerLookupIf* tablet_manager, |
89 | | const char* method_name, |
90 | | const ReqClass* req, |
91 | | RespClass* resp, |
92 | 10.6M | rpc::RpcContext* context) { |
93 | 10.6M | Result<bool> result = CheckUuidMatch(tablet_manager, method_name, |
94 | 10.6M | req, context->requestor_string()); |
95 | 10.6M | if (!result.ok()) { |
96 | 20 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); |
97 | 20 | return false; |
98 | 20 | } |
99 | 10.6M | return result.get(); |
100 | 10.6M | } _ZN2yb7tserver23CheckUuidMatchOrRespondINS_6tablet23ChangeMetadataRequestPBENS0_24ChangeMetadataResponsePBEEEbPNS0_18TabletPeerLookupIfEPKcPKT_PT0_PNS_3rpc10RpcContextE Line | Count | Source | 92 | 20.6k | rpc::RpcContext* context) { | 93 | 20.6k | Result<bool> result = CheckUuidMatch(tablet_manager, method_name, | 94 | 20.6k | req, context->requestor_string()); | 95 | 20.6k | if (!result.ok()) { | 96 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 97 | 0 | return false; | 98 | 0 | } | 99 | 20.6k | return result.get(); | 100 | 20.6k | } |
_ZN2yb7tserver23CheckUuidMatchOrRespondINS0_20GetSafeTimeRequestPBENS0_21GetSafeTimeResponsePBEEEbPNS0_18TabletPeerLookupIfEPKcPKT_PT0_PNS_3rpc10RpcContextE Line | Count | Source | 92 | 2.66k | rpc::RpcContext* context) { | 93 | 2.66k | Result<bool> result = CheckUuidMatch(tablet_manager, method_name, | 94 | 2.66k | req, context->requestor_string()); | 95 | 2.66k | if (!result.ok()) { | 96 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 97 | 0 | return false; | 98 | 0 | } | 99 | 2.66k | return result.get(); | 100 | 2.66k | } |
_ZN2yb7tserver23CheckUuidMatchOrRespondINS0_22BackfillIndexRequestPBENS0_23BackfillIndexResponsePBEEEbPNS0_18TabletPeerLookupIfEPKcPKT_PT0_PNS_3rpc10RpcContextE Line | Count | Source | 92 | 2.70k | rpc::RpcContext* context) { | 93 | 2.70k | Result<bool> result = CheckUuidMatch(tablet_manager, method_name, | 94 | 2.70k | req, context->requestor_string()); | 95 | 2.70k | if (!result.ok()) { | 96 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 97 | 0 | return false; | 98 | 0 | } | 99 | 2.70k | return result.get(); | 100 | 2.70k | } |
_ZN2yb7tserver23CheckUuidMatchOrRespondINS0_21CreateTabletRequestPBENS0_22CreateTabletResponsePBEEEbPNS0_18TabletPeerLookupIfEPKcPKT_PT0_PNS_3rpc10RpcContextE Line | Count | Source | 92 | 81.5k | rpc::RpcContext* context) { | 93 | 81.5k | Result<bool> result = CheckUuidMatch(tablet_manager, method_name, | 94 | 81.5k | req, context->requestor_string()); | 95 | 81.5k | if (!result.ok()) { | 96 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 97 | 0 | return false; | 98 | 0 | } | 99 | 81.5k | return result.get(); | 100 | 81.5k | } |
_ZN2yb7tserver23CheckUuidMatchOrRespondINS0_21DeleteTabletRequestPBENS0_22DeleteTabletResponsePBEEEbPNS0_18TabletPeerLookupIfEPKcPKT_PT0_PNS_3rpc10RpcContextE Line | Count | Source | 92 | 49.3k | rpc::RpcContext* context) { | 93 | 49.3k | Result<bool> result = CheckUuidMatch(tablet_manager, method_name, | 94 | 49.3k | req, context->requestor_string()); | 95 | 49.3k | if (!result.ok()) { | 96 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 97 | 0 | return false; | 98 | 0 | } | 99 | 49.3k | return result.get(); | 100 | 49.3k | } |
_ZN2yb7tserver23CheckUuidMatchOrRespondINS0_21FlushTabletsRequestPBENS0_22FlushTabletsResponsePBEEEbPNS0_18TabletPeerLookupIfEPKcPKT_PT0_PNS_3rpc10RpcContextE Line | Count | Source | 92 | 30 | rpc::RpcContext* context) { | 93 | 30 | Result<bool> result = CheckUuidMatch(tablet_manager, method_name, | 94 | 30 | req, context->requestor_string()); | 95 | 30 | if (!result.ok()) { | 96 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 97 | 0 | return false; | 98 | 0 | } | 99 | 30 | return result.get(); | 100 | 30 | } |
_ZN2yb7tserver23CheckUuidMatchOrRespondINS_6tablet20SplitTabletRequestPBENS0_21SplitTabletResponsePBEEEbPNS0_18TabletPeerLookupIfEPKcPKT_PT0_PNS_3rpc10RpcContextE Line | Count | Source | 92 | 44 | rpc::RpcContext* context) { | 93 | 44 | Result<bool> result = CheckUuidMatch(tablet_manager, method_name, | 94 | 44 | req, context->requestor_string()); | 95 | 44 | if (!result.ok()) { | 96 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 97 | 0 | return false; | 98 | 0 | } | 99 | 44 | return result.get(); | 100 | 44 | } |
_ZN2yb7tserver23CheckUuidMatchOrRespondINS_9consensus18ConsensusRequestPBENS2_19ConsensusResponsePBEEEbPNS0_18TabletPeerLookupIfEPKcPKT_PT0_PNS_3rpc10RpcContextE Line | Count | Source | 92 | 10.2M | rpc::RpcContext* context) { | 93 | 10.2M | Result<bool> result = CheckUuidMatch(tablet_manager, method_name, | 94 | 10.2M | req, context->requestor_string()); | 95 | 10.2M | if (!result.ok()) { | 96 | 12 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 97 | 12 | return false; | 98 | 12 | } | 99 | 10.2M | return result.get(); | 100 | 10.2M | } |
_ZN2yb7tserver23CheckUuidMatchOrRespondINS_9consensus13VoteRequestPBENS2_14VoteResponsePBEEEbPNS0_18TabletPeerLookupIfEPKcPKT_PT0_PNS_3rpc10RpcContextE Line | Count | Source | 92 | 144k | rpc::RpcContext* context) { | 93 | 144k | Result<bool> result = CheckUuidMatch(tablet_manager, method_name, | 94 | 144k | req, context->requestor_string()); | 95 | 144k | if (!result.ok()) { | 96 | 8 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 97 | 8 | return false; | 98 | 8 | } | 99 | 144k | return result.get(); | 100 | 144k | } |
_ZN2yb7tserver23CheckUuidMatchOrRespondINS_9consensus21ChangeConfigRequestPBENS2_22ChangeConfigResponsePBEEEbPNS0_18TabletPeerLookupIfEPKcPKT_PT0_PNS_3rpc10RpcContextE Line | Count | Source | 92 | 2.41k | rpc::RpcContext* context) { | 93 | 2.41k | Result<bool> result = CheckUuidMatch(tablet_manager, method_name, | 94 | 2.41k | req, context->requestor_string()); | 95 | 2.41k | if (!result.ok()) { | 96 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 97 | 0 | return false; | 98 | 0 | } | 99 | 2.41k | return result.get(); | 100 | 2.41k | } |
Unexecuted instantiation: _ZN2yb7tserver23CheckUuidMatchOrRespondINS_9consensus27UnsafeChangeConfigRequestPBENS2_28UnsafeChangeConfigResponsePBEEEbPNS0_18TabletPeerLookupIfEPKcPKT_PT0_PNS_3rpc10RpcContextE _ZN2yb7tserver23CheckUuidMatchOrRespondINS_9consensus26RunLeaderElectionRequestPBENS2_27RunLeaderElectionResponsePBEEEbPNS0_18TabletPeerLookupIfEPKcPKT_PT0_PNS_3rpc10RpcContextE Line | Count | Source | 92 | 56.5k | rpc::RpcContext* context) { | 93 | 56.5k | Result<bool> result = CheckUuidMatch(tablet_manager, method_name, | 94 | 56.5k | req, context->requestor_string()); | 95 | 56.5k | if (!result.ok()) { | 96 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 97 | 0 | return false; | 98 | 0 | } | 99 | 56.5k | return result.get(); | 100 | 56.5k | } |
_ZN2yb7tserver23CheckUuidMatchOrRespondINS_9consensus27LeaderElectionLostRequestPBENS2_28LeaderElectionLostResponsePBEEEbPNS0_18TabletPeerLookupIfEPKcPKT_PT0_PNS_3rpc10RpcContextE Line | Count | Source | 92 | 44 | rpc::RpcContext* context) { | 93 | 44 | Result<bool> result = CheckUuidMatch(tablet_manager, method_name, | 94 | 44 | req, context->requestor_string()); | 95 | 44 | if (!result.ok()) { | 96 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 97 | 0 | return false; | 98 | 0 | } | 99 | 44 | return result.get(); | 100 | 44 | } |
_ZN2yb7tserver23CheckUuidMatchOrRespondINS_9consensus23LeaderStepDownRequestPBENS2_24LeaderStepDownResponsePBEEEbPNS0_18TabletPeerLookupIfEPKcPKT_PT0_PNS_3rpc10RpcContextE Line | Count | Source | 92 | 5.88k | rpc::RpcContext* context) { | 93 | 5.88k | Result<bool> result = CheckUuidMatch(tablet_manager, method_name, | 94 | 5.88k | req, context->requestor_string()); | 95 | 5.88k | if (!result.ok()) { | 96 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 97 | 0 | return false; | 98 | 0 | } | 99 | 5.88k | return result.get(); | 100 | 5.88k | } |
_ZN2yb7tserver23CheckUuidMatchOrRespondINS_9consensus20GetLastOpIdRequestPBENS2_21GetLastOpIdResponsePBEEEbPNS0_18TabletPeerLookupIfEPKcPKT_PT0_PNS_3rpc10RpcContextE Line | Count | Source | 92 | 576 | rpc::RpcContext* context) { | 93 | 576 | Result<bool> result = CheckUuidMatch(tablet_manager, method_name, | 94 | 576 | req, context->requestor_string()); | 95 | 576 | if (!result.ok()) { | 96 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 97 | 0 | return false; | 98 | 0 | } | 99 | 576 | return result.get(); | 100 | 576 | } |
_ZN2yb7tserver23CheckUuidMatchOrRespondINS_9consensus26GetConsensusStateRequestPBENS2_27GetConsensusStateResponsePBEEEbPNS0_18TabletPeerLookupIfEPKcPKT_PT0_PNS_3rpc10RpcContextE Line | Count | Source | 92 | 3.68k | rpc::RpcContext* context) { | 93 | 3.68k | Result<bool> result = CheckUuidMatch(tablet_manager, method_name, | 94 | 3.68k | req, context->requestor_string()); | 95 | 3.68k | if (!result.ok()) { | 96 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 97 | 0 | return false; | 98 | 0 | } | 99 | 3.68k | return result.get(); | 100 | 3.68k | } |
_ZN2yb7tserver23CheckUuidMatchOrRespondINS_9consensus29StartRemoteBootstrapRequestPBENS2_30StartRemoteBootstrapResponsePBEEEbPNS0_18TabletPeerLookupIfEPKcPKT_PT0_PNS_3rpc10RpcContextE Line | Count | Source | 92 | 4.91k | rpc::RpcContext* context) { | 93 | 4.91k | Result<bool> result = CheckUuidMatch(tablet_manager, method_name, | 94 | 4.91k | req, context->requestor_string()); | 95 | 4.91k | if (!result.ok()) { | 96 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 97 | 0 | return false; | 98 | 0 | } | 99 | 4.91k | return result.get(); | 100 | 4.91k | } |
_ZN2yb7tserver23CheckUuidMatchOrRespondINS0_25TabletSnapshotOpRequestPBENS0_26TabletSnapshotOpResponsePBEEEbPNS0_18TabletPeerLookupIfEPKcPKT_PT0_PNS_3rpc10RpcContextE Line | Count | Source | 92 | 4 | rpc::RpcContext* context) { | 93 | 4 | Result<bool> result = CheckUuidMatch(tablet_manager, method_name, | 94 | 4 | req, context->requestor_string()); | 95 | 4 | if (!result.ok()) { | 96 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 97 | 0 | return false; | 98 | 0 | } | 99 | 4 | return result.get(); | 100 | 4 | } |
|
101 | | |
102 | | template <class RespType> |
103 | | void HandleErrorResponse(RespType* resp, rpc::RpcContext* context, const Status& s, |
104 | 2.48k | const boost::optional<TabletServerErrorPB::Code>& error_code = boost::none) { |
105 | 2.48k | resp->Clear(); |
106 | 2.48k | SetupErrorAndRespond(resp->mutable_error(), s, |
107 | 2.48k | error_code.get_value_or(TabletServerErrorPB::UNKNOWN_ERROR), context); |
108 | 2.48k | } _ZN2yb7tserver19HandleErrorResponseINS0_22DeleteTabletResponsePBEEEvPT_PNS_3rpc10RpcContextERKNS_6StatusERKN5boost8optionalINS0_24TabletServerErrorPB_CodeEEE Line | Count | Source | 104 | 1.76k | const boost::optional<TabletServerErrorPB::Code>& error_code = boost::none) { | 105 | 1.76k | resp->Clear(); | 106 | 1.76k | SetupErrorAndRespond(resp->mutable_error(), s, | 107 | 1.76k | error_code.get_value_or(TabletServerErrorPB::UNKNOWN_ERROR), context); | 108 | 1.76k | } |
_ZN2yb7tserver19HandleErrorResponseINS_9consensus22ChangeConfigResponsePBEEEvPT_PNS_3rpc10RpcContextERKNS_6StatusERKN5boost8optionalINS0_24TabletServerErrorPB_CodeEEE Line | Count | Source | 104 | 721 | const boost::optional<TabletServerErrorPB::Code>& error_code = boost::none) { | 105 | 721 | resp->Clear(); | 106 | 721 | SetupErrorAndRespond(resp->mutable_error(), s, | 107 | 721 | error_code.get_value_or(TabletServerErrorPB::UNKNOWN_ERROR), context); | 108 | 721 | } |
Unexecuted instantiation: _ZN2yb7tserver19HandleErrorResponseINS_9consensus28UnsafeChangeConfigResponsePBEEEvPT_PNS_3rpc10RpcContextERKNS_6StatusERKN5boost8optionalINS0_24TabletServerErrorPB_CodeEEE Unexecuted instantiation: _ZN2yb7tserver19HandleErrorResponseINS_9consensus21GetLastOpIdResponsePBEEEvPT_PNS_3rpc10RpcContextERKNS_6StatusERKN5boost8optionalINS0_24TabletServerErrorPB_CodeEEE Unexecuted instantiation: _ZN2yb7tserver19HandleErrorResponseINS_9consensus27GetConsensusStateResponsePBEEEvPT_PNS_3rpc10RpcContextERKNS_6StatusERKN5boost8optionalINS0_24TabletServerErrorPB_CodeEEE |
109 | | |
110 | | template <class RespType> |
111 | | void HandleResponse(RespType* resp, |
112 | | const std::shared_ptr<rpc::RpcContext>& context, |
113 | 1.78k | const Status& s) { |
114 | 1.78k | if (PREDICT_FALSE(!s.ok())) { |
115 | 4 | HandleErrorResponse(resp, context.get(), s); |
116 | 4 | return; |
117 | 4 | } |
118 | 1.78k | context->RespondSuccess(); |
119 | 1.78k | } |
120 | | |
121 | | template <class RespType> |
122 | | StdStatusCallback BindHandleResponse(RespType* resp, |
123 | 2.50k | const std::shared_ptr<rpc::RpcContext>& context) { |
124 | 2.50k | return std::bind(&HandleResponse<RespType>, resp, context, std::placeholders::_1); |
125 | 2.50k | } |
126 | | |
127 | | struct TabletPeerTablet { |
128 | | std::shared_ptr<tablet::TabletPeer> tablet_peer; |
129 | | tablet::TabletPtr tablet; |
130 | | }; |
131 | | |
132 | | // Lookup the given tablet, ensuring that it both exists and is RUNNING. |
133 | | // If it is not, respond to the RPC associated with 'context' after setting |
134 | | // resp->mutable_error() to indicate the failure reason. |
135 | | // |
136 | | // Returns true if successful. |
137 | | Result<TabletPeerTablet> LookupTabletPeer( |
138 | | TabletPeerLookupIf* tablet_manager, |
139 | | const TabletId& tablet_id); |
140 | | |
141 | | template<class RespClass> |
142 | | Result<TabletPeerTablet> LookupTabletPeerOrRespond( |
143 | | TabletPeerLookupIf* tablet_manager, |
144 | | const string& tablet_id, |
145 | | RespClass* resp, |
146 | 11.0M | rpc::RpcContext* context) { |
147 | 11.0M | Result<TabletPeerTablet> result = LookupTabletPeer(tablet_manager, tablet_id); |
148 | 11.0M | if (!result.ok()) { |
149 | 54.3k | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); |
150 | 54.3k | return result.status(); |
151 | 54.3k | } |
152 | 10.9M | return result.get(); |
153 | 10.9M | } Unexecuted instantiation: _ZN2yb7tserver25LookupTabletPeerOrRespondINS0_29VerifyTableRowRangeResponsePBEEENS_6ResultINS0_16TabletPeerTabletEEEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS8_11char_traitsIcEENS8_9allocatorIcEEEEPT_PNS_3rpc10RpcContextE _ZN2yb7tserver25LookupTabletPeerOrRespondINS0_27UpdateTransactionResponsePBEEENS_6ResultINS0_16TabletPeerTabletEEEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS8_11char_traitsIcEENS8_9allocatorIcEEEEPT_PNS_3rpc10RpcContextE Line | Count | Source | 146 | 548k | rpc::RpcContext* context) { | 147 | 548k | Result<TabletPeerTablet> result = LookupTabletPeer(tablet_manager, tablet_id); | 148 | 548k | if (!result.ok()) { | 149 | 121 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 150 | 121 | return result.status(); | 151 | 121 | } | 152 | 548k | return result.get(); | 153 | 548k | } |
_ZN2yb7tserver25LookupTabletPeerOrRespondINS0_22FlushTabletsResponsePBEEENS_6ResultINS0_16TabletPeerTabletEEEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS8_11char_traitsIcEENS8_9allocatorIcEEEEPT_PNS_3rpc10RpcContextE Line | Count | Source | 146 | 26 | rpc::RpcContext* context) { | 147 | 26 | Result<TabletPeerTablet> result = LookupTabletPeer(tablet_manager, tablet_id); | 148 | 26 | if (!result.ok()) { | 149 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 150 | 0 | return result.status(); | 151 | 0 | } | 152 | 26 | return result.get(); | 153 | 26 | } |
_ZN2yb7tserver25LookupTabletPeerOrRespondINS_9consensus19ConsensusResponsePBEEENS_6ResultINS0_16TabletPeerTabletEEEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEEPT_PNS_3rpc10RpcContextE Line | Count | Source | 146 | 10.2M | rpc::RpcContext* context) { | 147 | 10.2M | Result<TabletPeerTablet> result = LookupTabletPeer(tablet_manager, tablet_id); | 148 | 10.2M | if (!result.ok()) { | 149 | 11.5k | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 150 | 11.5k | return result.status(); | 151 | 11.5k | } | 152 | 10.2M | return result.get(); | 153 | 10.2M | } |
_ZN2yb7tserver25LookupTabletPeerOrRespondINS_9consensus14VoteResponsePBEEENS_6ResultINS0_16TabletPeerTabletEEEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEEPT_PNS_3rpc10RpcContextE Line | Count | Source | 146 | 144k | rpc::RpcContext* context) { | 147 | 144k | Result<TabletPeerTablet> result = LookupTabletPeer(tablet_manager, tablet_id); | 148 | 144k | if (!result.ok()) { | 149 | 19.1k | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 150 | 19.1k | return result.status(); | 151 | 19.1k | } | 152 | 124k | return result.get(); | 153 | 124k | } |
_ZN2yb7tserver25LookupTabletPeerOrRespondINS_9consensus22ChangeConfigResponsePBEEENS_6ResultINS0_16TabletPeerTabletEEEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEEPT_PNS_3rpc10RpcContextE Line | Count | Source | 146 | 2.50k | rpc::RpcContext* context) { | 147 | 2.50k | Result<TabletPeerTablet> result = LookupTabletPeer(tablet_manager, tablet_id); | 148 | 2.50k | if (!result.ok()) { | 149 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 150 | 0 | return result.status(); | 151 | 0 | } | 152 | 2.50k | return result.get(); | 153 | 2.50k | } |
Unexecuted instantiation: _ZN2yb7tserver25LookupTabletPeerOrRespondINS_9consensus28UnsafeChangeConfigResponsePBEEENS_6ResultINS0_16TabletPeerTabletEEEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEEPT_PNS_3rpc10RpcContextE _ZN2yb7tserver25LookupTabletPeerOrRespondINS_9consensus27RunLeaderElectionResponsePBEEENS_6ResultINS0_16TabletPeerTabletEEEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEEPT_PNS_3rpc10RpcContextE Line | Count | Source | 146 | 56.4k | rpc::RpcContext* context) { | 147 | 56.4k | Result<TabletPeerTablet> result = LookupTabletPeer(tablet_manager, tablet_id); | 148 | 56.4k | if (!result.ok()) { | 149 | 23.5k | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 150 | 23.5k | return result.status(); | 151 | 23.5k | } | 152 | 32.9k | return result.get(); | 153 | 32.9k | } |
_ZN2yb7tserver25LookupTabletPeerOrRespondINS_9consensus28LeaderElectionLostResponsePBEEENS_6ResultINS0_16TabletPeerTabletEEEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEEPT_PNS_3rpc10RpcContextE Line | Count | Source | 146 | 44 | rpc::RpcContext* context) { | 147 | 44 | Result<TabletPeerTablet> result = LookupTabletPeer(tablet_manager, tablet_id); | 148 | 44 | if (!result.ok()) { | 149 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 150 | 0 | return result.status(); | 151 | 0 | } | 152 | 44 | return result.get(); | 153 | 44 | } |
_ZN2yb7tserver25LookupTabletPeerOrRespondINS_9consensus24LeaderStepDownResponsePBEEENS_6ResultINS0_16TabletPeerTabletEEEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEEPT_PNS_3rpc10RpcContextE Line | Count | Source | 146 | 5.88k | rpc::RpcContext* context) { | 147 | 5.88k | Result<TabletPeerTablet> result = LookupTabletPeer(tablet_manager, tablet_id); | 148 | 5.88k | if (!result.ok()) { | 149 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 150 | 0 | return result.status(); | 151 | 0 | } | 152 | 5.88k | return result.get(); | 153 | 5.88k | } |
_ZN2yb7tserver25LookupTabletPeerOrRespondINS_9consensus21GetLastOpIdResponsePBEEENS_6ResultINS0_16TabletPeerTabletEEEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEEPT_PNS_3rpc10RpcContextE Line | Count | Source | 146 | 576 | rpc::RpcContext* context) { | 147 | 576 | Result<TabletPeerTablet> result = LookupTabletPeer(tablet_manager, tablet_id); | 148 | 576 | if (!result.ok()) { | 149 | 19 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 150 | 19 | return result.status(); | 151 | 19 | } | 152 | 557 | return result.get(); | 153 | 557 | } |
_ZN2yb7tserver25LookupTabletPeerOrRespondINS_9consensus27GetConsensusStateResponsePBEEENS_6ResultINS0_16TabletPeerTabletEEEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEEPT_PNS_3rpc10RpcContextE Line | Count | Source | 146 | 3.68k | rpc::RpcContext* context) { | 147 | 3.68k | Result<TabletPeerTablet> result = LookupTabletPeer(tablet_manager, tablet_id); | 148 | 3.68k | if (!result.ok()) { | 149 | 2 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 150 | 2 | return result.status(); | 151 | 2 | } | 152 | 3.68k | return result.get(); | 153 | 3.68k | } |
Unexecuted instantiation: _ZN2yb7tserver25LookupTabletPeerOrRespondINS0_20ImportDataResponsePBEEENS_6ResultINS0_16TabletPeerTabletEEEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS8_11char_traitsIcEENS8_9allocatorIcEEEEPT_PNS_3rpc10RpcContextE |
154 | | |
155 | | template <class Response> |
156 | | auto MakeRpcOperationCompletionCallback( |
157 | | rpc::RpcContext context, |
158 | | Response* response, |
159 | 6.20M | const server::ClockPtr& clock) { |
160 | 6.20M | return [context = std::make_shared<rpc::RpcContext>(std::move(context)), |
161 | 6.18M | response, clock](const Status& status) { |
162 | 6.18M | if (clock) { |
163 | 6.18M | response->set_propagated_hybrid_time(clock->Now().ToUint64()); |
164 | 6.18M | } |
165 | 6.18M | if (!status.ok()) { |
166 | 52.6k | SetupErrorAndRespond(response->mutable_error(), status, context.get()); |
167 | 6.13M | } else { |
168 | 6.13M | context->RespondSuccess(); |
169 | 6.13M | } |
170 | 6.18M | }; _ZZN2yb7tserver34MakeRpcOperationCompletionCallbackINS0_14ReadResponsePBEEEDaNS_3rpc10RpcContextEPT_RK13scoped_refptrINS_6server5ClockEEENKUlRKNS_6StatusEE_clESG_ Line | Count | Source | 161 | 4.63M | response, clock](const Status& status) { | 162 | 4.63M | if (clock) { | 163 | 4.63M | response->set_propagated_hybrid_time(clock->Now().ToUint64()); | 164 | 4.63M | } | 165 | 4.63M | if (!status.ok()) { | 166 | 0 | SetupErrorAndRespond(response->mutable_error(), status, context.get()); | 167 | 4.63M | } else { | 168 | 4.63M | context->RespondSuccess(); | 169 | 4.63M | } | 170 | 4.63M | }; |
_ZZN2yb7tserver34MakeRpcOperationCompletionCallbackINS0_15WriteResponsePBEEEDaNS_3rpc10RpcContextEPT_RK13scoped_refptrINS_6server5ClockEEENKUlRKNS_6StatusEE_clESG_ Line | Count | Source | 161 | 1 | response, clock](const Status& status) { | 162 | 1 | if (clock) { | 163 | 1 | response->set_propagated_hybrid_time(clock->Now().ToUint64()); | 164 | 1 | } | 165 | 1 | if (!status.ok()) { | 166 | 0 | SetupErrorAndRespond(response->mutable_error(), status, context.get()); | 167 | 1 | } else { | 168 | 1 | context->RespondSuccess(); | 169 | 1 | } | 170 | 1 | }; |
_ZZN2yb7tserver34MakeRpcOperationCompletionCallbackINS0_24ChangeMetadataResponsePBEEEDaNS_3rpc10RpcContextEPT_RK13scoped_refptrINS_6server5ClockEEENKUlRKNS_6StatusEE_clESG_ Line | Count | Source | 161 | 20.5k | response, clock](const Status& status) { | 162 | 20.5k | if (clock) { | 163 | 20.5k | response->set_propagated_hybrid_time(clock->Now().ToUint64()); | 164 | 20.5k | } | 165 | 20.5k | if (!status.ok()) { | 166 | 10 | SetupErrorAndRespond(response->mutable_error(), status, context.get()); | 167 | 20.5k | } else { | 168 | 20.5k | context->RespondSuccess(); | 169 | 20.5k | } | 170 | 20.5k | }; |
_ZZN2yb7tserver34MakeRpcOperationCompletionCallbackINS0_27UpdateTransactionResponsePBEEEDaNS_3rpc10RpcContextEPT_RK13scoped_refptrINS_6server5ClockEEENKUlRKNS_6StatusEE_clESG_ Line | Count | Source | 161 | 1.47M | response, clock](const Status& status) { | 162 | 1.47M | if (clock) { | 163 | 1.47M | response->set_propagated_hybrid_time(clock->Now().ToUint64()); | 164 | 1.47M | } | 165 | 1.47M | if (!status.ok()) { | 166 | 52.6k | SetupErrorAndRespond(response->mutable_error(), status, context.get()); | 167 | 1.42M | } else { | 168 | 1.42M | context->RespondSuccess(); | 169 | 1.42M | } | 170 | 1.47M | }; |
_ZZN2yb7tserver34MakeRpcOperationCompletionCallbackINS0_18TruncateResponsePBEEEDaNS_3rpc10RpcContextEPT_RK13scoped_refptrINS_6server5ClockEEENKUlRKNS_6StatusEE_clESG_ Line | Count | Source | 161 | 53.6k | response, clock](const Status& status) { | 162 | 53.6k | if (clock) { | 163 | 53.5k | response->set_propagated_hybrid_time(clock->Now().ToUint64()); | 164 | 53.5k | } | 165 | 53.6k | if (!status.ok()) { | 166 | 4 | SetupErrorAndRespond(response->mutable_error(), status, context.get()); | 167 | 53.6k | } else { | 168 | 53.6k | context->RespondSuccess(); | 169 | 53.6k | } | 170 | 53.6k | }; |
_ZZN2yb7tserver34MakeRpcOperationCompletionCallbackINS0_21SplitTabletResponsePBEEEDaNS_3rpc10RpcContextEPT_RK13scoped_refptrINS_6server5ClockEEENKUlRKNS_6StatusEE_clESG_ Line | Count | Source | 161 | 17 | response, clock](const Status& status) { | 162 | 17 | if (clock) { | 163 | 17 | response->set_propagated_hybrid_time(clock->Now().ToUint64()); | 164 | 17 | } | 165 | 17 | if (!status.ok()) { | 166 | 0 | SetupErrorAndRespond(response->mutable_error(), status, context.get()); | 167 | 17 | } else { | 168 | 17 | context->RespondSuccess(); | 169 | 17 | } | 170 | 17 | }; |
_ZZN2yb7tserver34MakeRpcOperationCompletionCallbackINS0_26TabletSnapshotOpResponsePBEEEDaNS_3rpc10RpcContextEPT_RK13scoped_refptrINS_6server5ClockEEENKUlRKNS_6StatusEE_clESG_ Line | Count | Source | 161 | 3 | response, clock](const Status& status) { | 162 | 3 | if (clock) { | 163 | 3 | response->set_propagated_hybrid_time(clock->Now().ToUint64()); | 164 | 3 | } | 165 | 3 | if (!status.ok()) { | 166 | 0 | SetupErrorAndRespond(response->mutable_error(), status, context.get()); | 167 | 3 | } else { | 168 | 3 | context->RespondSuccess(); | 169 | 3 | } | 170 | 3 | }; |
|
171 | 6.20M | } _ZN2yb7tserver34MakeRpcOperationCompletionCallbackINS0_14ReadResponsePBEEEDaNS_3rpc10RpcContextEPT_RK13scoped_refptrINS_6server5ClockEE Line | Count | Source | 159 | 4.64M | const server::ClockPtr& clock) { | 160 | 4.64M | return [context = std::make_shared<rpc::RpcContext>(std::move(context)), | 161 | 4.64M | response, clock](const Status& status) { | 162 | 4.64M | if (clock) { | 163 | 4.64M | response->set_propagated_hybrid_time(clock->Now().ToUint64()); | 164 | 4.64M | } | 165 | 4.64M | if (!status.ok()) { | 166 | 4.64M | SetupErrorAndRespond(response->mutable_error(), status, context.get()); | 167 | 4.64M | } else { | 168 | 4.64M | context->RespondSuccess(); | 169 | 4.64M | } | 170 | 4.64M | }; | 171 | 4.64M | } |
_ZN2yb7tserver34MakeRpcOperationCompletionCallbackINS0_24ChangeMetadataResponsePBEEEDaNS_3rpc10RpcContextEPT_RK13scoped_refptrINS_6server5ClockEE Line | Count | Source | 159 | 20.5k | const server::ClockPtr& clock) { | 160 | 20.5k | return [context = std::make_shared<rpc::RpcContext>(std::move(context)), | 161 | 20.5k | response, clock](const Status& status) { | 162 | 20.5k | if (clock) { | 163 | 20.5k | response->set_propagated_hybrid_time(clock->Now().ToUint64()); | 164 | 20.5k | } | 165 | 20.5k | if (!status.ok()) { | 166 | 20.5k | SetupErrorAndRespond(response->mutable_error(), status, context.get()); | 167 | 20.5k | } else { | 168 | 20.5k | context->RespondSuccess(); | 169 | 20.5k | } | 170 | 20.5k | }; | 171 | 20.5k | } |
_ZN2yb7tserver34MakeRpcOperationCompletionCallbackINS0_27UpdateTransactionResponsePBEEEDaNS_3rpc10RpcContextEPT_RK13scoped_refptrINS_6server5ClockEE Line | Count | Source | 159 | 1.48M | const server::ClockPtr& clock) { | 160 | 1.48M | return [context = std::make_shared<rpc::RpcContext>(std::move(context)), | 161 | 1.48M | response, clock](const Status& status) { | 162 | 1.48M | if (clock) { | 163 | 1.48M | response->set_propagated_hybrid_time(clock->Now().ToUint64()); | 164 | 1.48M | } | 165 | 1.48M | if (!status.ok()) { | 166 | 1.48M | SetupErrorAndRespond(response->mutable_error(), status, context.get()); | 167 | 1.48M | } else { | 168 | 1.48M | context->RespondSuccess(); | 169 | 1.48M | } | 170 | 1.48M | }; | 171 | 1.48M | } |
_ZN2yb7tserver34MakeRpcOperationCompletionCallbackINS0_18TruncateResponsePBEEEDaNS_3rpc10RpcContextEPT_RK13scoped_refptrINS_6server5ClockEE Line | Count | Source | 159 | 53.5k | const server::ClockPtr& clock) { | 160 | 53.5k | return [context = std::make_shared<rpc::RpcContext>(std::move(context)), | 161 | 53.5k | response, clock](const Status& status) { | 162 | 53.5k | if (clock) { | 163 | 53.5k | response->set_propagated_hybrid_time(clock->Now().ToUint64()); | 164 | 53.5k | } | 165 | 53.5k | if (!status.ok()) { | 166 | 53.5k | SetupErrorAndRespond(response->mutable_error(), status, context.get()); | 167 | 53.5k | } else { | 168 | 53.5k | context->RespondSuccess(); | 169 | 53.5k | } | 170 | 53.5k | }; | 171 | 53.5k | } |
_ZN2yb7tserver34MakeRpcOperationCompletionCallbackINS0_21SplitTabletResponsePBEEEDaNS_3rpc10RpcContextEPT_RK13scoped_refptrINS_6server5ClockEE Line | Count | Source | 159 | 19 | const server::ClockPtr& clock) { | 160 | 19 | return [context = std::make_shared<rpc::RpcContext>(std::move(context)), | 161 | 19 | response, clock](const Status& status) { | 162 | 19 | if (clock) { | 163 | 19 | response->set_propagated_hybrid_time(clock->Now().ToUint64()); | 164 | 19 | } | 165 | 19 | if (!status.ok()) { | 166 | 19 | SetupErrorAndRespond(response->mutable_error(), status, context.get()); | 167 | 19 | } else { | 168 | 19 | context->RespondSuccess(); | 169 | 19 | } | 170 | 19 | }; | 171 | 19 | } |
_ZN2yb7tserver34MakeRpcOperationCompletionCallbackINS0_15WriteResponsePBEEEDaNS_3rpc10RpcContextEPT_RK13scoped_refptrINS_6server5ClockEE Line | Count | Source | 159 | 1 | const server::ClockPtr& clock) { | 160 | 1 | return [context = std::make_shared<rpc::RpcContext>(std::move(context)), | 161 | 1 | response, clock](const Status& status) { | 162 | 1 | if (clock) { | 163 | 1 | response->set_propagated_hybrid_time(clock->Now().ToUint64()); | 164 | 1 | } | 165 | 1 | if (!status.ok()) { | 166 | 1 | SetupErrorAndRespond(response->mutable_error(), status, context.get()); | 167 | 1 | } else { | 168 | 1 | context->RespondSuccess(); | 169 | 1 | } | 170 | 1 | }; | 171 | 1 | } |
_ZN2yb7tserver34MakeRpcOperationCompletionCallbackINS0_26TabletSnapshotOpResponsePBEEEDaNS_3rpc10RpcContextEPT_RK13scoped_refptrINS_6server5ClockEE Line | Count | Source | 159 | 3 | const server::ClockPtr& clock) { | 160 | 3 | return [context = std::make_shared<rpc::RpcContext>(std::move(context)), | 161 | 3 | response, clock](const Status& status) { | 162 | 3 | if (clock) { | 163 | 3 | response->set_propagated_hybrid_time(clock->Now().ToUint64()); | 164 | 3 | } | 165 | 3 | if (!status.ok()) { | 166 | 3 | SetupErrorAndRespond(response->mutable_error(), status, context.get()); | 167 | 3 | } else { | 168 | 3 | context->RespondSuccess(); | 169 | 3 | } | 170 | 3 | }; | 171 | 3 | } |
|
172 | | |
173 | | struct LeaderTabletPeer { |
174 | | tablet::TabletPeerPtr peer; |
175 | | tablet::TabletPtr tablet; |
176 | | int64_t leader_term; |
177 | | |
178 | 3.29M | bool operator!() const { |
179 | 3.29M | return !peer; |
180 | 3.29M | } |
181 | | |
182 | | CHECKED_STATUS FillTerm(); |
183 | | void FillTabletPeer(TabletPeerTablet source); |
184 | | }; |
185 | | |
186 | | Result<LeaderTabletPeer> LookupLeaderTablet( |
187 | | TabletPeerLookupIf* tablet_manager, |
188 | | const std::string& tablet_id, |
189 | | TabletPeerTablet peer = TabletPeerTablet()); |
190 | | |
191 | | // The "peer" argument could be provided by the caller in case the caller has already performed |
192 | | // the LookupTabletPeerOrRespond call, and we only need to fill the leader term. |
193 | | template<class RespClass> |
194 | | LeaderTabletPeer LookupLeaderTabletOrRespond( |
195 | | TabletPeerLookupIf* tablet_manager, |
196 | | const std::string& tablet_id, |
197 | | RespClass* resp, |
198 | | rpc::RpcContext* context, |
199 | 2.74M | TabletPeerTablet peer = TabletPeerTablet()) { |
200 | 2.74M | auto result = LookupLeaderTablet(tablet_manager, tablet_id, std::move(peer)); |
201 | 2.74M | if (!result.ok()) { |
202 | 62.2k | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); |
203 | 62.2k | return LeaderTabletPeer(); |
204 | 62.2k | } |
205 | | |
206 | 2.68M | resp->clear_error(); |
207 | 2.68M | return *result; |
208 | 2.68M | } _ZN2yb7tserver27LookupLeaderTabletOrRespondINS0_24ChangeMetadataResponsePBEEENS0_16LeaderTabletPeerEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEPT_PNS_3rpc10RpcContextENS0_16TabletPeerTabletE Line | Count | Source | 199 | 20.5k | TabletPeerTablet peer = TabletPeerTablet()) { | 200 | 20.5k | auto result = LookupLeaderTablet(tablet_manager, tablet_id, std::move(peer)); | 201 | 20.5k | if (!result.ok()) { | 202 | 13 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 203 | 13 | return LeaderTabletPeer(); | 204 | 13 | } | 205 | | | 206 | 20.5k | resp->clear_error(); | 207 | 20.5k | return *result; | 208 | 20.5k | } |
_ZN2yb7tserver27LookupLeaderTabletOrRespondINS0_21GetSafeTimeResponsePBEEENS0_16LeaderTabletPeerEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEPT_PNS_3rpc10RpcContextENS0_16TabletPeerTabletE Line | Count | Source | 199 | 2.64k | TabletPeerTablet peer = TabletPeerTablet()) { | 200 | 2.64k | auto result = LookupLeaderTablet(tablet_manager, tablet_id, std::move(peer)); | 201 | 2.64k | if (!result.ok()) { | 202 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 203 | 0 | return LeaderTabletPeer(); | 204 | 0 | } | 205 | | | 206 | 2.64k | resp->clear_error(); | 207 | 2.64k | return *result; | 208 | 2.64k | } |
_ZN2yb7tserver27LookupLeaderTabletOrRespondINS0_23BackfillIndexResponsePBEEENS0_16LeaderTabletPeerEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEPT_PNS_3rpc10RpcContextENS0_16TabletPeerTabletE Line | Count | Source | 199 | 2.69k | TabletPeerTablet peer = TabletPeerTablet()) { | 200 | 2.69k | auto result = LookupLeaderTablet(tablet_manager, tablet_id, std::move(peer)); | 201 | 2.69k | if (!result.ok()) { | 202 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 203 | 0 | return LeaderTabletPeer(); | 204 | 0 | } | 205 | | | 206 | 2.69k | resp->clear_error(); | 207 | 2.69k | return *result; | 208 | 2.69k | } |
_ZN2yb7tserver27LookupLeaderTabletOrRespondINS0_27UpdateTransactionResponsePBEEENS0_16LeaderTabletPeerEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEPT_PNS_3rpc10RpcContextENS0_16TabletPeerTabletE Line | Count | Source | 199 | 938k | TabletPeerTablet peer = TabletPeerTablet()) { | 200 | 938k | auto result = LookupLeaderTablet(tablet_manager, tablet_id, std::move(peer)); | 201 | 938k | if (!result.ok()) { | 202 | 6.72k | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 203 | 6.72k | return LeaderTabletPeer(); | 204 | 6.72k | } | 205 | | | 206 | 932k | resp->clear_error(); | 207 | 932k | return *result; | 208 | 932k | } |
_ZN2yb7tserver27LookupLeaderTabletOrRespondINS0_30GetTransactionStatusResponsePBEEENS0_16LeaderTabletPeerEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEPT_PNS_3rpc10RpcContextENS0_16TabletPeerTabletE Line | Count | Source | 199 | 208k | TabletPeerTablet peer = TabletPeerTablet()) { | 200 | 208k | auto result = LookupLeaderTablet(tablet_manager, tablet_id, std::move(peer)); | 201 | 208k | if (!result.ok()) { | 202 | 45 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 203 | 45 | return LeaderTabletPeer(); | 204 | 45 | } | 205 | | | 206 | 208k | resp->clear_error(); | 207 | 208k | return *result; | 208 | 208k | } |
Unexecuted instantiation: _ZN2yb7tserver27LookupLeaderTabletOrRespondINS0_43GetTransactionStatusAtParticipantResponsePBEEENS0_16LeaderTabletPeerEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEPT_PNS_3rpc10RpcContextENS0_16TabletPeerTabletE _ZN2yb7tserver27LookupLeaderTabletOrRespondINS0_26AbortTransactionResponsePBEEENS0_16LeaderTabletPeerEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEPT_PNS_3rpc10RpcContextENS0_16TabletPeerTabletE Line | Count | Source | 199 | 125k | TabletPeerTablet peer = TabletPeerTablet()) { | 200 | 125k | auto result = LookupLeaderTablet(tablet_manager, tablet_id, std::move(peer)); | 201 | 125k | if (!result.ok()) { | 202 | 9.80k | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 203 | 9.80k | return LeaderTabletPeer(); | 204 | 9.80k | } | 205 | | | 206 | 116k | resp->clear_error(); | 207 | 116k | return *result; | 208 | 116k | } |
_ZN2yb7tserver27LookupLeaderTabletOrRespondINS0_18TruncateResponsePBEEENS0_16LeaderTabletPeerEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEPT_PNS_3rpc10RpcContextENS0_16TabletPeerTabletE Line | Count | Source | 199 | 53.3k | TabletPeerTablet peer = TabletPeerTablet()) { | 200 | 53.3k | auto result = LookupLeaderTablet(tablet_manager, tablet_id, std::move(peer)); | 201 | 53.3k | if (!result.ok()) { | 202 | 9 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 203 | 9 | return LeaderTabletPeer(); | 204 | 9 | } | 205 | | | 206 | 53.3k | resp->clear_error(); | 207 | 53.3k | return *result; | 208 | 53.3k | } |
_ZN2yb7tserver27LookupLeaderTabletOrRespondINS0_26AddTableToTabletResponsePBEEENS0_16LeaderTabletPeerEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEPT_PNS_3rpc10RpcContextENS0_16TabletPeerTabletE Line | Count | Source | 199 | 27 | TabletPeerTablet peer = TabletPeerTablet()) { | 200 | 27 | auto result = LookupLeaderTablet(tablet_manager, tablet_id, std::move(peer)); | 201 | 27 | if (!result.ok()) { | 202 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 203 | 0 | return LeaderTabletPeer(); | 204 | 0 | } | 205 | | | 206 | 27 | resp->clear_error(); | 207 | 27 | return *result; | 208 | 27 | } |
_ZN2yb7tserver27LookupLeaderTabletOrRespondINS0_31RemoveTableFromTabletResponsePBEEENS0_16LeaderTabletPeerEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEPT_PNS_3rpc10RpcContextENS0_16TabletPeerTabletE Line | Count | Source | 199 | 15 | TabletPeerTablet peer = TabletPeerTablet()) { | 200 | 15 | auto result = LookupLeaderTablet(tablet_manager, tablet_id, std::move(peer)); | 201 | 15 | if (!result.ok()) { | 202 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 203 | 0 | return LeaderTabletPeer(); | 204 | 0 | } | 205 | | | 206 | 15 | resp->clear_error(); | 207 | 15 | return *result; | 208 | 15 | } |
_ZN2yb7tserver27LookupLeaderTabletOrRespondINS0_21SplitTabletResponsePBEEENS0_16LeaderTabletPeerEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEPT_PNS_3rpc10RpcContextENS0_16TabletPeerTabletE Line | Count | Source | 199 | 44 | TabletPeerTablet peer = TabletPeerTablet()) { | 200 | 44 | auto result = LookupLeaderTablet(tablet_manager, tablet_id, std::move(peer)); | 201 | 44 | if (!result.ok()) { | 202 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 203 | 0 | return LeaderTabletPeer(); | 204 | 0 | } | 205 | | | 206 | 44 | resp->clear_error(); | 207 | 44 | return *result; | 208 | 44 | } |
_ZN2yb7tserver27LookupLeaderTabletOrRespondINS0_15WriteResponsePBEEENS0_16LeaderTabletPeerEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEPT_PNS_3rpc10RpcContextENS0_16TabletPeerTabletE Line | Count | Source | 199 | 1.39M | TabletPeerTablet peer = TabletPeerTablet()) { | 200 | 1.39M | auto result = LookupLeaderTablet(tablet_manager, tablet_id, std::move(peer)); | 201 | 1.39M | if (!result.ok()) { | 202 | 45.6k | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 203 | 45.6k | return LeaderTabletPeer(); | 204 | 45.6k | } | 205 | | | 206 | 1.34M | resp->clear_error(); | 207 | 1.34M | return *result; | 208 | 1.34M | } |
_ZN2yb7tserver27LookupLeaderTabletOrRespondINS0_21GetSplitKeyResponsePBEEENS0_16LeaderTabletPeerEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEPT_PNS_3rpc10RpcContextENS0_16TabletPeerTabletE Line | Count | Source | 199 | 49 | TabletPeerTablet peer = TabletPeerTablet()) { | 200 | 49 | auto result = LookupLeaderTablet(tablet_manager, tablet_id, std::move(peer)); | 201 | 49 | if (!result.ok()) { | 202 | 2 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 203 | 2 | return LeaderTabletPeer(); | 204 | 2 | } | 205 | | | 206 | 47 | resp->clear_error(); | 207 | 47 | return *result; | 208 | 47 | } |
_ZN2yb7tserver27LookupLeaderTabletOrRespondINS0_26TabletSnapshotOpResponsePBEEENS0_16LeaderTabletPeerEPNS0_18TabletPeerLookupIfERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEPT_PNS_3rpc10RpcContextENS0_16TabletPeerTabletE Line | Count | Source | 199 | 3 | TabletPeerTablet peer = TabletPeerTablet()) { | 200 | 3 | auto result = LookupLeaderTablet(tablet_manager, tablet_id, std::move(peer)); | 201 | 3 | if (!result.ok()) { | 202 | 0 | SetupErrorAndRespond(resp->mutable_error(), result.status(), context); | 203 | 0 | return LeaderTabletPeer(); | 204 | 0 | } | 205 | | | 206 | 3 | resp->clear_error(); | 207 | 3 | return *result; | 208 | 3 | } |
|
209 | | |
210 | | CHECKED_STATUS CheckPeerIsLeader(const tablet::TabletPeer& tablet_peer); |
211 | | |
212 | | // Checks if the peer is ready for servicing IOs. |
213 | | // allow_split_tablet specifies whether to reject requests to tablets which have been already |
214 | | // split. |
215 | | CHECKED_STATUS CheckPeerIsReady( |
216 | | const tablet::TabletPeer& tablet_peer, AllowSplitTablet allow_split_tablet); |
217 | | |
218 | | Result<std::shared_ptr<tablet::AbstractTablet>> GetTablet( |
219 | | TabletPeerLookupIf* tablet_manager, const TabletId& tablet_id, |
220 | | tablet::TabletPeerPtr tablet_peer, YBConsistencyLevel consistency_level, |
221 | | AllowSplitTablet allow_split_tablet); |
222 | | |
223 | | CHECKED_STATUS CheckWriteThrottling(double score, tablet::TabletPeer* tablet_peer); |
224 | | |
225 | | } // namespace tserver |
226 | | } // namespace yb |
227 | | |
228 | | // Macro helpers. |
229 | | |
230 | | #define RETURN_UNKNOWN_ERROR_IF_NOT_OK(s, resp, context) \ |
231 | 126k | do { \ |
232 | 126k | Status ss = s; \ |
233 | 126k | if (PREDICT_FALSE(!ss.ok())) { \ |
234 | 19 | SetupErrorAndRespond((resp)->mutable_error(), ss, \ |
235 | 19 | (context)); \ |
236 | 19 | return; \ |
237 | 19 | } \ |
238 | 126k | } while (0) |
239 | | |
240 | | #endif // YB_TSERVER_SERVICE_UTIL_H |