/Users/deen/code/yugabyte-db/src/yb/rpc/scheduler.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 | | // |
15 | | |
16 | | #ifndef YB_RPC_SCHEDULER_H |
17 | | #define YB_RPC_SCHEDULER_H |
18 | | |
19 | | #include "yb/rpc/rpc_fwd.h" |
20 | | #include "yb/util/net/net_fwd.h" |
21 | | |
22 | | #include "yb/util/status.h" |
23 | | |
24 | | namespace yb { |
25 | | |
26 | | class Status; |
27 | | |
28 | | namespace rpc { |
29 | | |
30 | | using ScheduledTaskId = int64_t; |
31 | | constexpr ScheduledTaskId kUninitializedScheduledTaskId = 0; |
32 | | |
33 | | class ScheduledTaskBase { |
34 | | public: |
35 | | explicit ScheduledTaskBase(ScheduledTaskId id, const SteadyTimePoint& time) |
36 | 7.38M | : id_(id), time_(time) {} |
37 | | |
38 | 8.67M | ScheduledTaskId id() const { return id_; } |
39 | 65.6M | SteadyTimePoint time() const { return time_; } |
40 | | |
41 | 7.26M | virtual ~ScheduledTaskBase() {} |
42 | | virtual void Run(const Status& status) = 0; |
43 | | |
44 | | private: |
45 | | ScheduledTaskId id_; |
46 | | SteadyTimePoint time_; |
47 | | }; |
48 | | |
49 | | template<class F> |
50 | | class ScheduledTask : public ScheduledTaskBase { |
51 | | public: |
52 | | explicit ScheduledTask(ScheduledTaskId id, const SteadyTimePoint& time, const F& f) |
53 | 7.06M | : ScheduledTaskBase(id, time), f_(f) {} scheduler-test.cc:_ZN2yb3rpc13ScheduledTaskIZNS0_30SetPromiseValueToStatusFunctorEPNSt3__17promiseINS_6StatusEEEE3$_0EC2ExRKNS2_6chrono10time_pointINS9_12steady_clockENS9_8durationIxNS2_5ratioILl1ELl1000000000EEEEEEERKS7_ Line | Count | Source | 53 | 2.01k | : ScheduledTaskBase(id, time), f_(f) {} |
scheduler-test.cc:_ZN2yb3rpc13ScheduledTaskIZZNS0_27SchedulerTest_Shutdown_Test8TestBodyEvENK3$_1clEvEUlRKNS_6StatusEE_EC2ExRKNSt3__16chrono10time_pointINSA_12steady_clockENSA_8durationIxNS9_5ratioILl1ELl1000000000EEEEEEERKS7_ Line | Count | Source | 53 | 352 | : ScheduledTaskBase(id, time), f_(f) {} |
call_home.cc:_ZN2yb3rpc13ScheduledTaskIZNS_8CallHome16ScheduleCallHomeEiE3$_0EC2ExRKNSt3__16chrono10time_pointINS6_12steady_clockENS6_8durationIxNS5_5ratioILl1ELl1000000000EEEEEEERKS3_ Line | Count | Source | 53 | 1.12M | : ScheduledTaskBase(id, time), f_(f) {} |
system_query_cache.cc:_ZN2yb3rpc13ScheduledTaskIZNS_9cqlserver16SystemQueryCache20ScheduleRefreshCacheEbE3$_0EC2ExRKNSt3__16chrono10time_pointINS7_12steady_clockENS7_8durationIxNS6_5ratioILl1ELl1000000000EEEEEEERKS4_ Line | Count | Source | 53 | 12.1k | : ScheduledTaskBase(id, time), f_(f) {} |
Unexecuted instantiation: redis_commands.cc:_ZN2yb3rpc13ScheduledTaskIZNS_11redisserver12_GLOBAL__N_116HandleDebugSleepENS3_16LocalCommandDataEE11SleepWaiterEC2ExRKNSt3__16chrono10time_pointINS8_12steady_clockENS8_8durationIxNS7_5ratioILl1ELl1000000000EEEEEEERKS5_ permissions.cc:_ZN2yb3rpc13ScheduledTaskIZNS_6client8internal16PermissionsCache32ScheduleGetPermissionsFromMasterEbE3$_1EC2ExRKNSt3__16chrono10time_pointINS8_12steady_clockENS8_8durationIxNS7_5ratioILl1ELl1000000000EEEEEEERKS5_ Line | Count | Source | 53 | 119k | : ScheduledTaskBase(id, time), f_(f) {} |
_ZN2yb3rpc13ScheduledTaskIZNS_6client13YBTransaction4Impl13HeartbeatDoneENS_6StatusERKNS_7tserver26UpdateTransactionRequestPBERKNS6_27UpdateTransactionResponsePBENS_17TransactionStatusERKNSt3__110shared_ptrIS3_EEEUlRKS5_E_EC2ExRKNSE_6chrono10time_pointINSN_12steady_clockENSN_8durationIxNSE_5ratioILl1ELl1000000000EEEEEEERKSL_ Line | Count | Source | 53 | 279k | : ScheduledTaskBase(id, time), f_(f) {} |
transaction_pool.cc:_ZN2yb3rpc13ScheduledTaskINSt3__16__bindIMNS_6client12_GLOBAL__N_118SingleLocalityPoolEFvRKNS_6StatusEEJPS6_RKNS2_12placeholders4__phILi1EEEEEEEC2ExRKNS2_6chrono10time_pointINSK_12steady_clockENSK_8durationIxNS2_5ratioILl1ELl1000000000EEEEEEERKSI_ Line | Count | Source | 53 | 2.05k | : ScheduledTaskBase(id, time), f_(f) {} |
periodic.cc:_ZN2yb3rpc13ScheduledTaskIZNS0_13PeriodicTimer8CallbackExE3$_0EC2ExRKNSt3__16chrono10time_pointINS6_12steady_clockENS6_8durationIxNS5_5ratioILl1ELl1000000000EEEEEEERKS3_ Line | Count | Source | 53 | 3.14M | : ScheduledTaskBase(id, time), f_(f) {} |
_ZN2yb3rpc13ScheduledTaskINSt3__16__bindIMNS0_6PollerEFvRKNS_6StatusEEJPS4_RKNS2_12placeholders4__phILi1EEEEEEEC2ExRKNS2_6chrono10time_pointINSI_12steady_clockENSI_8durationIxNS2_5ratioILl1ELl1000000000EEEEEEERKSG_ Line | Count | Source | 53 | 2.38M | : ScheduledTaskBase(id, time), f_(f) {} |
|
54 | | |
55 | 7.00M | void Run(const Status& status) override { |
56 | 7.00M | f_(status); |
57 | 7.00M | } scheduler-test.cc:_ZN2yb3rpc13ScheduledTaskIZNS0_30SetPromiseValueToStatusFunctorEPNSt3__17promiseINS_6StatusEEEE3$_0E3RunERKS4_ Line | Count | Source | 55 | 2.01k | void Run(const Status& status) override { | 56 | 2.01k | f_(status); | 57 | 2.01k | } |
scheduler-test.cc:_ZN2yb3rpc13ScheduledTaskIZZNS0_27SchedulerTest_Shutdown_Test8TestBodyEvENK3$_1clEvEUlRKNS_6StatusEE_E3RunES6_ Line | Count | Source | 55 | 365 | void Run(const Status& status) override { | 56 | 365 | f_(status); | 57 | 365 | } |
call_home.cc:_ZN2yb3rpc13ScheduledTaskIZNS_8CallHome16ScheduleCallHomeEiE3$_0E3RunERKNS_6StatusE Line | Count | Source | 55 | 1.11M | void Run(const Status& status) override { | 56 | 1.11M | f_(status); | 57 | 1.11M | } |
system_query_cache.cc:_ZN2yb3rpc13ScheduledTaskIZNS_9cqlserver16SystemQueryCache20ScheduleRefreshCacheEbE3$_0E3RunERKNS_6StatusE Line | Count | Source | 55 | 9.12k | void Run(const Status& status) override { | 56 | 9.12k | f_(status); | 57 | 9.12k | } |
Unexecuted instantiation: redis_commands.cc:_ZN2yb3rpc13ScheduledTaskIZNS_11redisserver12_GLOBAL__N_116HandleDebugSleepENS3_16LocalCommandDataEE11SleepWaiterE3RunERKNS_6StatusE permissions.cc:_ZN2yb3rpc13ScheduledTaskIZNS_6client8internal16PermissionsCache32ScheduleGetPermissionsFromMasterEbE3$_1E3RunERKNS_6StatusE Line | Count | Source | 55 | 117k | void Run(const Status& status) override { | 56 | 117k | f_(status); | 57 | 117k | } |
_ZN2yb3rpc13ScheduledTaskIZNS_6client13YBTransaction4Impl13HeartbeatDoneENS_6StatusERKNS_7tserver26UpdateTransactionRequestPBERKNS6_27UpdateTransactionResponsePBENS_17TransactionStatusERKNSt3__110shared_ptrIS3_EEEUlRKS5_E_E3RunESK_ Line | Count | Source | 55 | 275k | void Run(const Status& status) override { | 56 | 275k | f_(status); | 57 | 275k | } |
transaction_pool.cc:_ZN2yb3rpc13ScheduledTaskINSt3__16__bindIMNS_6client12_GLOBAL__N_118SingleLocalityPoolEFvRKNS_6StatusEEJPS6_RKNS2_12placeholders4__phILi1EEEEEEE3RunES9_ Line | Count | Source | 55 | 1.47k | void Run(const Status& status) override { | 56 | 1.47k | f_(status); | 57 | 1.47k | } |
periodic.cc:_ZN2yb3rpc13ScheduledTaskIZNS0_13PeriodicTimer8CallbackExE3$_0E3RunERKNS_6StatusE Line | Count | Source | 55 | 3.08M | void Run(const Status& status) override { | 56 | 3.08M | f_(status); | 57 | 3.08M | } |
_ZN2yb3rpc13ScheduledTaskINSt3__16__bindIMNS0_6PollerEFvRKNS_6StatusEEJPS4_RKNS2_12placeholders4__phILi1EEEEEEE3RunES7_ Line | Count | Source | 55 | 2.39M | void Run(const Status& status) override { | 56 | 2.39M | f_(status); | 57 | 2.39M | } |
|
58 | | private: |
59 | | F f_; |
60 | | }; |
61 | | |
62 | | template<class F> |
63 | | class ScheduledTaskWithId : public ScheduledTaskBase { |
64 | | public: |
65 | | explicit ScheduledTaskWithId(ScheduledTaskId id, const SteadyTimePoint& time, const F& f) |
66 | 296k | : ScheduledTaskBase(id, time), f_(f) {} _ZN2yb3rpc19ScheduledTaskWithIdIZNS0_20ScheduledTaskTracker8ScheduleINSt3__16__bindIMNS_9consensus13RaftConsensusEFvRKNS_6StatusEEJPS7_RKNS4_12placeholders4__phILi1EEEEEEEEvRKT_NS4_6chrono10time_pointINSN_12steady_clockENSN_8durationIxNS4_5ratioILl1ELl1000000000EEEEEEEEUlxSA_E_EC2ExRKSU_RKSV_ Line | Count | Source | 66 | 50 | : ScheduledTaskBase(id, time), f_(f) {} |
catalog_manager.cc:_ZN2yb3rpc19ScheduledTaskWithIdIZNS0_20ScheduledTaskTracker8ScheduleIZNS_6master14CatalogManager33ScheduleRefreshTablespaceInfoTaskEbE3$_3EEvRKT_NSt3__16chrono10time_pointINSB_12steady_clockENSB_8durationIxNSA_5ratioILl1ELl1000000000EEEEEEEEUlxRKNS_6StatusEE_EC2ExRKSI_RKSM_ Line | Count | Source | 66 | 946 | : ScheduledTaskBase(id, time), f_(f) {} |
catalog_manager.cc:_ZN2yb3rpc19ScheduledTaskWithIdIZNS0_20ScheduledTaskTracker8ScheduleIZNS_6master14CatalogManager26RebuildYQLSystemPartitionsEvE4$_18EEvRKT_NSt3__16chrono10time_pointINSB_12steady_clockENSB_8durationIxNSA_5ratioILl1ELl1000000000EEEEEEEEUlxRKNS_6StatusEE_EC2ExRKSI_RKSM_ Line | Count | Source | 66 | 15.8k | : ScheduledTaskBase(id, time), f_(f) {} |
_ZN2yb3rpc19ScheduledTaskWithIdIZNS0_20ScheduledTaskTracker8ScheduleIZNS_7tserver19PgClientServiceImpl4Impl28ScheduleCheckExpiredSessionsENSt3__16chrono10time_pointINS_15CoarseMonoClockENS8_8durationIxNS7_5ratioILl1ELl1000000000EEEEEEEEUlRKNS_6StatusEE_EEvRKT_NS9_INS8_12steady_clockESE_EEEUlxSI_E_EC2ExRKSO_RKSP_ Line | Count | Source | 66 | 13.8k | : ScheduledTaskBase(id, time), f_(f) {} |
_ZN2yb3rpc19ScheduledTaskWithIdIZZNS0_15ServicePoolImpl20ScheduleCheckTimeoutENSt3__16chrono10time_pointINS_15CoarseMonoClockENS4_8durationIxNS3_5ratioILl1ELl1000000000EEEEEEEENKUlvE_clEvEUlxRKNS_6StatusEE_EC2ExRKNS5_INS4_12steady_clockESA_EERKSG_ Line | Count | Source | 66 | 266k | : ScheduledTaskBase(id, time), f_(f) {} |
|
67 | | |
68 | 251k | void Run(const Status& status) override { |
69 | 251k | f_(id(), status); |
70 | 251k | } _ZN2yb3rpc19ScheduledTaskWithIdIZNS0_20ScheduledTaskTracker8ScheduleINSt3__16__bindIMNS_9consensus13RaftConsensusEFvRKNS_6StatusEEJPS7_RKNS4_12placeholders4__phILi1EEEEEEEEvRKT_NS4_6chrono10time_pointINSN_12steady_clockENSN_8durationIxNS4_5ratioILl1ELl1000000000EEEEEEEEUlxSA_E_E3RunESA_ Line | Count | Source | 68 | 50 | void Run(const Status& status) override { | 69 | 50 | f_(id(), status); | 70 | 50 | } |
catalog_manager.cc:_ZN2yb3rpc19ScheduledTaskWithIdIZNS0_20ScheduledTaskTracker8ScheduleIZNS_6master14CatalogManager33ScheduleRefreshTablespaceInfoTaskEbE3$_3EEvRKT_NSt3__16chrono10time_pointINSB_12steady_clockENSB_8durationIxNSA_5ratioILl1ELl1000000000EEEEEEEEUlxRKNS_6StatusEE_E3RunESL_ Line | Count | Source | 68 | 561 | void Run(const Status& status) override { | 69 | 561 | f_(id(), status); | 70 | 561 | } |
catalog_manager.cc:_ZN2yb3rpc19ScheduledTaskWithIdIZNS0_20ScheduledTaskTracker8ScheduleIZNS_6master14CatalogManager26RebuildYQLSystemPartitionsEvE4$_18EEvRKT_NSt3__16chrono10time_pointINSB_12steady_clockENSB_8durationIxNSA_5ratioILl1ELl1000000000EEEEEEEEUlxRKNS_6StatusEE_E3RunESL_ Line | Count | Source | 68 | 10.6k | void Run(const Status& status) override { | 69 | 10.6k | f_(id(), status); | 70 | 10.6k | } |
_ZN2yb3rpc19ScheduledTaskWithIdIZNS0_20ScheduledTaskTracker8ScheduleIZNS_7tserver19PgClientServiceImpl4Impl28ScheduleCheckExpiredSessionsENSt3__16chrono10time_pointINS_15CoarseMonoClockENS8_8durationIxNS7_5ratioILl1ELl1000000000EEEEEEEEUlRKNS_6StatusEE_EEvRKT_NS9_INS8_12steady_clockESE_EEEUlxSI_E_E3RunESI_ Line | Count | Source | 68 | 2.73k | void Run(const Status& status) override { | 69 | 2.73k | f_(id(), status); | 70 | 2.73k | } |
_ZN2yb3rpc19ScheduledTaskWithIdIZZNS0_15ServicePoolImpl20ScheduleCheckTimeoutENSt3__16chrono10time_pointINS_15CoarseMonoClockENS4_8durationIxNS3_5ratioILl1ELl1000000000EEEEEEEENKUlvE_clEvEUlxRKNS_6StatusEE_E3RunESF_ Line | Count | Source | 68 | 237k | void Run(const Status& status) override { | 69 | 237k | f_(id(), status); | 70 | 237k | } |
|
71 | | |
72 | | private: |
73 | | F f_; |
74 | | }; |
75 | | |
76 | | class Scheduler { |
77 | | public: |
78 | | explicit Scheduler(IoService* io_service); |
79 | | ~Scheduler(); |
80 | | |
81 | | template<class F> |
82 | 7.06M | ScheduledTaskId Schedule(const F& f, std::chrono::steady_clock::duration delay) { |
83 | 7.06M | return Schedule(f, std::chrono::steady_clock::now() + delay); |
84 | 7.06M | } scheduler-test.cc:_ZN2yb3rpc9Scheduler8ScheduleIZNS0_30SetPromiseValueToStatusFunctorEPNSt3__17promiseINS_6StatusEEEE3$_0EExRKT_NS3_6chrono8durationIxNS3_5ratioILl1ELl1000000000EEEEE Line | Count | Source | 82 | 2.01k | ScheduledTaskId Schedule(const F& f, std::chrono::steady_clock::duration delay) { | 83 | 2.01k | return Schedule(f, std::chrono::steady_clock::now() + delay); | 84 | 2.01k | } |
scheduler-test.cc:_ZN2yb3rpc9Scheduler8ScheduleIZZNS0_27SchedulerTest_Shutdown_Test8TestBodyEvENK3$_1clEvEUlRKNS_6StatusEE_EExRKT_NSt3__16chrono8durationIxNSC_5ratioILl1ELl1000000000EEEEE Line | Count | Source | 82 | 359 | ScheduledTaskId Schedule(const F& f, std::chrono::steady_clock::duration delay) { | 83 | 359 | return Schedule(f, std::chrono::steady_clock::now() + delay); | 84 | 359 | } |
call_home.cc:_ZN2yb3rpc9Scheduler8ScheduleIZNS_8CallHome16ScheduleCallHomeEiE3$_0EExRKT_NSt3__16chrono8durationIxNS8_5ratioILl1ELl1000000000EEEEE Line | Count | Source | 82 | 1.12M | ScheduledTaskId Schedule(const F& f, std::chrono::steady_clock::duration delay) { | 83 | 1.12M | return Schedule(f, std::chrono::steady_clock::now() + delay); | 84 | 1.12M | } |
system_query_cache.cc:_ZN2yb3rpc9Scheduler8ScheduleIZNS_9cqlserver16SystemQueryCache20ScheduleRefreshCacheEbE3$_0EExRKT_NSt3__16chrono8durationIxNS9_5ratioILl1ELl1000000000EEEEE Line | Count | Source | 82 | 12.1k | ScheduledTaskId Schedule(const F& f, std::chrono::steady_clock::duration delay) { | 83 | 12.1k | return Schedule(f, std::chrono::steady_clock::now() + delay); | 84 | 12.1k | } |
permissions.cc:_ZN2yb3rpc9Scheduler8ScheduleIZNS_6client8internal16PermissionsCache32ScheduleGetPermissionsFromMasterEbE3$_1EExRKT_NSt3__16chrono8durationIxNSA_5ratioILl1ELl1000000000EEEEE Line | Count | Source | 82 | 119k | ScheduledTaskId Schedule(const F& f, std::chrono::steady_clock::duration delay) { | 83 | 119k | return Schedule(f, std::chrono::steady_clock::now() + delay); | 84 | 119k | } |
_ZN2yb3rpc9Scheduler8ScheduleIZNS_6client13YBTransaction4Impl13HeartbeatDoneENS_6StatusERKNS_7tserver26UpdateTransactionRequestPBERKNS7_27UpdateTransactionResponsePBENS_17TransactionStatusERKNSt3__110shared_ptrIS4_EEEUlRKS6_E_EExRKT_NSF_6chrono8durationIxNSF_5ratioILl1ELl1000000000EEEEE Line | Count | Source | 82 | 279k | ScheduledTaskId Schedule(const F& f, std::chrono::steady_clock::duration delay) { | 83 | 279k | return Schedule(f, std::chrono::steady_clock::now() + delay); | 84 | 279k | } |
transaction_pool.cc:_ZN2yb3rpc9Scheduler8ScheduleINSt3__16__bindIMNS_6client12_GLOBAL__N_118SingleLocalityPoolEFvRKNS_6StatusEEJPS7_RKNS3_12placeholders4__phILi1EEEEEEEExRKT_NS3_6chrono8durationIxNS3_5ratioILl1ELl1000000000EEEEE Line | Count | Source | 82 | 2.05k | ScheduledTaskId Schedule(const F& f, std::chrono::steady_clock::duration delay) { | 83 | 2.05k | return Schedule(f, std::chrono::steady_clock::now() + delay); | 84 | 2.05k | } |
periodic.cc:_ZN2yb3rpc9Scheduler8ScheduleIZNS0_13PeriodicTimer8CallbackExE3$_0EExRKT_NSt3__16chrono8durationIxNS8_5ratioILl1ELl1000000000EEEEE Line | Count | Source | 82 | 3.13M | ScheduledTaskId Schedule(const F& f, std::chrono::steady_clock::duration delay) { | 83 | 3.13M | return Schedule(f, std::chrono::steady_clock::now() + delay); | 84 | 3.13M | } |
_ZN2yb3rpc9Scheduler8ScheduleINSt3__16__bindIMNS0_6PollerEFvRKNS_6StatusEEJPS5_RKNS3_12placeholders4__phILi1EEEEEEEExRKT_NS3_6chrono8durationIxNS3_5ratioILl1ELl1000000000EEEEE Line | Count | Source | 82 | 2.38M | ScheduledTaskId Schedule(const F& f, std::chrono::steady_clock::duration delay) { | 83 | 2.38M | return Schedule(f, std::chrono::steady_clock::now() + delay); | 84 | 2.38M | } |
|
85 | | |
86 | | template<class F> |
87 | | auto Schedule(const F& f, std::chrono::steady_clock::time_point time) -> |
88 | 7.06M | decltype(f(Status()), ScheduledTaskId()) { |
89 | 7.06M | auto id = NextId(); |
90 | 7.06M | DoSchedule(std::make_shared<ScheduledTask<F>>(id, time, f)); |
91 | 7.06M | return id; |
92 | 7.06M | } scheduler-test.cc:_ZN2yb3rpc9Scheduler8ScheduleIZNS0_30SetPromiseValueToStatusFunctorEPNSt3__17promiseINS_6StatusEEEE3$_0EEDTcmclfp_cvS5__EEcvx_EERKT_NS3_6chrono10time_pointINSD_12steady_clockENSD_8durationIxNS3_5ratioILl1ELl1000000000EEEEEEE Line | Count | Source | 88 | 2.01k | decltype(f(Status()), ScheduledTaskId()) { | 89 | 2.01k | auto id = NextId(); | 90 | 2.01k | DoSchedule(std::make_shared<ScheduledTask<F>>(id, time, f)); | 91 | 2.01k | return id; | 92 | 2.01k | } |
scheduler-test.cc:_ZN2yb3rpc9Scheduler8ScheduleIZZNS0_27SchedulerTest_Shutdown_Test8TestBodyEvENK3$_1clEvEUlRKNS_6StatusEE_EEDTcmclfp_cvS5__EEcvx_EERKT_NSt3__16chrono10time_pointINSE_12steady_clockENSE_8durationIxNSD_5ratioILl1ELl1000000000EEEEEEE Line | Count | Source | 88 | 357 | decltype(f(Status()), ScheduledTaskId()) { | 89 | 357 | auto id = NextId(); | 90 | 357 | DoSchedule(std::make_shared<ScheduledTask<F>>(id, time, f)); | 91 | 357 | return id; | 92 | 357 | } |
call_home.cc:_ZN2yb3rpc9Scheduler8ScheduleIZNS_8CallHome16ScheduleCallHomeEiE3$_0EEDTcmclfp_cvNS_6StatusE_EEcvx_EERKT_NSt3__16chrono10time_pointINSB_12steady_clockENSB_8durationIxNSA_5ratioILl1ELl1000000000EEEEEEE Line | Count | Source | 88 | 1.12M | decltype(f(Status()), ScheduledTaskId()) { | 89 | 1.12M | auto id = NextId(); | 90 | 1.12M | DoSchedule(std::make_shared<ScheduledTask<F>>(id, time, f)); | 91 | 1.12M | return id; | 92 | 1.12M | } |
system_query_cache.cc:_ZN2yb3rpc9Scheduler8ScheduleIZNS_9cqlserver16SystemQueryCache20ScheduleRefreshCacheEbE3$_0EEDTcmclfp_cvNS_6StatusE_EEcvx_EERKT_NSt3__16chrono10time_pointINSC_12steady_clockENSC_8durationIxNSB_5ratioILl1ELl1000000000EEEEEEE Line | Count | Source | 88 | 12.1k | decltype(f(Status()), ScheduledTaskId()) { | 89 | 12.1k | auto id = NextId(); | 90 | 12.1k | DoSchedule(std::make_shared<ScheduledTask<F>>(id, time, f)); | 91 | 12.1k | return id; | 92 | 12.1k | } |
Unexecuted instantiation: redis_commands.cc:_ZN2yb3rpc9Scheduler8ScheduleIZNS_11redisserver12_GLOBAL__N_116HandleDebugSleepENS4_16LocalCommandDataEE11SleepWaiterEEDTcmclfp_cvNS_6StatusE_EEcvx_EERKT_NSt3__16chrono10time_pointINSD_12steady_clockENSD_8durationIxNSC_5ratioILl1ELl1000000000EEEEEEE permissions.cc:_ZN2yb3rpc9Scheduler8ScheduleIZNS_6client8internal16PermissionsCache32ScheduleGetPermissionsFromMasterEbE3$_1EEDTcmclfp_cvNS_6StatusE_EEcvx_EERKT_NSt3__16chrono10time_pointINSD_12steady_clockENSD_8durationIxNSC_5ratioILl1ELl1000000000EEEEEEE Line | Count | Source | 88 | 119k | decltype(f(Status()), ScheduledTaskId()) { | 89 | 119k | auto id = NextId(); | 90 | 119k | DoSchedule(std::make_shared<ScheduledTask<F>>(id, time, f)); | 91 | 119k | return id; | 92 | 119k | } |
_ZN2yb3rpc9Scheduler8ScheduleIZNS_6client13YBTransaction4Impl13HeartbeatDoneENS_6StatusERKNS_7tserver26UpdateTransactionRequestPBERKNS7_27UpdateTransactionResponsePBENS_17TransactionStatusERKNSt3__110shared_ptrIS4_EEEUlRKS6_E_EEDTcmclfp_cvS6__EEcvx_EERKT_NSF_6chrono10time_pointINSR_12steady_clockENSR_8durationIxNSF_5ratioILl1ELl1000000000EEEEEEE Line | Count | Source | 88 | 279k | decltype(f(Status()), ScheduledTaskId()) { | 89 | 279k | auto id = NextId(); | 90 | 279k | DoSchedule(std::make_shared<ScheduledTask<F>>(id, time, f)); | 91 | 279k | return id; | 92 | 279k | } |
transaction_pool.cc:_ZN2yb3rpc9Scheduler8ScheduleINSt3__16__bindIMNS_6client12_GLOBAL__N_118SingleLocalityPoolEFvRKNS_6StatusEEJPS7_RKNS3_12placeholders4__phILi1EEEEEEEEDTcmclfp_cvS8__EEcvx_EERKT_NS3_6chrono10time_pointINSO_12steady_clockENSO_8durationIxNS3_5ratioILl1ELl1000000000EEEEEEE Line | Count | Source | 88 | 2.05k | decltype(f(Status()), ScheduledTaskId()) { | 89 | 2.05k | auto id = NextId(); | 90 | 2.05k | DoSchedule(std::make_shared<ScheduledTask<F>>(id, time, f)); | 91 | 2.05k | return id; | 92 | 2.05k | } |
periodic.cc:_ZN2yb3rpc9Scheduler8ScheduleIZNS0_13PeriodicTimer8CallbackExE3$_0EEDTcmclfp_cvNS_6StatusE_EEcvx_EERKT_NSt3__16chrono10time_pointINSB_12steady_clockENSB_8durationIxNSA_5ratioILl1ELl1000000000EEEEEEE Line | Count | Source | 88 | 3.14M | decltype(f(Status()), ScheduledTaskId()) { | 89 | 3.14M | auto id = NextId(); | 90 | 3.14M | DoSchedule(std::make_shared<ScheduledTask<F>>(id, time, f)); | 91 | 3.14M | return id; | 92 | 3.14M | } |
_ZN2yb3rpc9Scheduler8ScheduleINSt3__16__bindIMNS0_6PollerEFvRKNS_6StatusEEJPS5_RKNS3_12placeholders4__phILi1EEEEEEEEDTcmclfp_cvS6__EEcvx_EERKT_NS3_6chrono10time_pointINSM_12steady_clockENSM_8durationIxNS3_5ratioILl1ELl1000000000EEEEEEE Line | Count | Source | 88 | 2.38M | decltype(f(Status()), ScheduledTaskId()) { | 89 | 2.38M | auto id = NextId(); | 90 | 2.38M | DoSchedule(std::make_shared<ScheduledTask<F>>(id, time, f)); | 91 | 2.38M | return id; | 92 | 2.38M | } |
|
93 | | |
94 | | template<class F> |
95 | | auto Schedule(const F& f, std::chrono::steady_clock::time_point time) -> |
96 | 296k | decltype(f(ScheduledTaskId(), Status()), ScheduledTaskId()) { |
97 | 296k | auto id = NextId(); |
98 | 296k | DoSchedule(std::make_shared<ScheduledTaskWithId<F>>(id, time, f)); |
99 | 296k | return id; |
100 | 296k | } _ZN2yb3rpc9Scheduler8ScheduleIZNS0_20ScheduledTaskTracker8ScheduleINSt3__16__bindIMNS_9consensus13RaftConsensusEFvRKNS_6StatusEEJPS8_RKNS5_12placeholders4__phILi1EEEEEEEEvRKT_NS5_6chrono10time_pointINSO_12steady_clockENSO_8durationIxNS5_5ratioILl1ELl1000000000EEEEEEEEUlxSB_E_EEDTcmclfp_cvx_EcvS9__EEcvx_EESN_SV_ Line | Count | Source | 96 | 50 | decltype(f(ScheduledTaskId(), Status()), ScheduledTaskId()) { | 97 | 50 | auto id = NextId(); | 98 | 50 | DoSchedule(std::make_shared<ScheduledTaskWithId<F>>(id, time, f)); | 99 | 50 | return id; | 100 | 50 | } |
catalog_manager.cc:_ZN2yb3rpc9Scheduler8ScheduleIZNS0_20ScheduledTaskTracker8ScheduleIZNS_6master14CatalogManager33ScheduleRefreshTablespaceInfoTaskEbE3$_3EEvRKT_NSt3__16chrono10time_pointINSC_12steady_clockENSC_8durationIxNSB_5ratioILl1ELl1000000000EEEEEEEEUlxRKNS_6StatusEE_EEDTcmclfp_cvx_EcvSK__EEcvx_EESA_SJ_ Line | Count | Source | 96 | 946 | decltype(f(ScheduledTaskId(), Status()), ScheduledTaskId()) { | 97 | 946 | auto id = NextId(); | 98 | 946 | DoSchedule(std::make_shared<ScheduledTaskWithId<F>>(id, time, f)); | 99 | 946 | return id; | 100 | 946 | } |
catalog_manager.cc:_ZN2yb3rpc9Scheduler8ScheduleIZNS0_20ScheduledTaskTracker8ScheduleIZNS_6master14CatalogManager26RebuildYQLSystemPartitionsEvE4$_18EEvRKT_NSt3__16chrono10time_pointINSC_12steady_clockENSC_8durationIxNSB_5ratioILl1ELl1000000000EEEEEEEEUlxRKNS_6StatusEE_EEDTcmclfp_cvx_EcvSK__EEcvx_EESA_SJ_ Line | Count | Source | 96 | 15.8k | decltype(f(ScheduledTaskId(), Status()), ScheduledTaskId()) { | 97 | 15.8k | auto id = NextId(); | 98 | 15.8k | DoSchedule(std::make_shared<ScheduledTaskWithId<F>>(id, time, f)); | 99 | 15.8k | return id; | 100 | 15.8k | } |
_ZN2yb3rpc9Scheduler8ScheduleIZNS0_20ScheduledTaskTracker8ScheduleIZNS_7tserver19PgClientServiceImpl4Impl28ScheduleCheckExpiredSessionsENSt3__16chrono10time_pointINS_15CoarseMonoClockENS9_8durationIxNS8_5ratioILl1ELl1000000000EEEEEEEEUlRKNS_6StatusEE_EEvRKT_NSA_INS9_12steady_clockESF_EEEUlxSJ_E_EEDTcmclfp_cvx_EcvSH__EEcvx_EESN_SP_ Line | Count | Source | 96 | 13.8k | decltype(f(ScheduledTaskId(), Status()), ScheduledTaskId()) { | 97 | 13.8k | auto id = NextId(); | 98 | 13.8k | DoSchedule(std::make_shared<ScheduledTaskWithId<F>>(id, time, f)); | 99 | 13.8k | return id; | 100 | 13.8k | } |
_ZN2yb3rpc9Scheduler8ScheduleIZZNS0_15ServicePoolImpl20ScheduleCheckTimeoutENSt3__16chrono10time_pointINS_15CoarseMonoClockENS5_8durationIxNS4_5ratioILl1ELl1000000000EEEEEEEENKUlvE_clEvEUlxRKNS_6StatusEE_EEDTcmclfp_cvx_EcvSE__EEcvx_EERKT_NS6_INS5_12steady_clockESB_EE Line | Count | Source | 96 | 266k | decltype(f(ScheduledTaskId(), Status()), ScheduledTaskId()) { | 97 | 266k | auto id = NextId(); | 98 | 266k | DoSchedule(std::make_shared<ScheduledTaskWithId<F>>(id, time, f)); | 99 | 266k | return id; | 100 | 266k | } |
|
101 | | |
102 | | void Abort(ScheduledTaskId task_id); |
103 | | |
104 | | void Shutdown(); |
105 | | |
106 | | IoService& io_service(); |
107 | | |
108 | | private: |
109 | | ScheduledTaskId NextId(); |
110 | | |
111 | | void DoSchedule(std::shared_ptr<ScheduledTaskBase> task); |
112 | | |
113 | | class Impl; |
114 | | std::unique_ptr<Impl> impl_; |
115 | | }; |
116 | | |
117 | | class ScheduledTaskTracker { |
118 | | public: |
119 | 10.9k | ScheduledTaskTracker() = default; |
120 | | |
121 | | explicit ScheduledTaskTracker(Scheduler* scheduler); |
122 | | |
123 | 10.7k | void Bind(Scheduler* scheduler) { |
124 | 10.7k | scheduler_ = scheduler; |
125 | 10.7k | } |
126 | | |
127 | | template <class F> |
128 | 30.7k | void Schedule(const F& f, std::chrono::steady_clock::duration delay) { |
129 | 30.7k | Schedule(f, std::chrono::steady_clock::now() + delay); |
130 | 30.7k | } _ZN2yb3rpc20ScheduledTaskTracker8ScheduleINSt3__16__bindIMNS_9consensus13RaftConsensusEFvRKNS_6StatusEEJPS6_RKNS3_12placeholders4__phILi1EEEEEEEEvRKT_NS3_6chrono8durationIxNS3_5ratioILl1ELl1000000000EEEEE Line | Count | Source | 128 | 50 | void Schedule(const F& f, std::chrono::steady_clock::duration delay) { | 129 | 50 | Schedule(f, std::chrono::steady_clock::now() + delay); | 130 | 50 | } |
catalog_manager.cc:_ZN2yb3rpc20ScheduledTaskTracker8ScheduleIZNS_6master14CatalogManager33ScheduleRefreshTablespaceInfoTaskEbE3$_3EEvRKT_NSt3__16chrono8durationIxNS9_5ratioILl1ELl1000000000EEEEE Line | Count | Source | 128 | 947 | void Schedule(const F& f, std::chrono::steady_clock::duration delay) { | 129 | 947 | Schedule(f, std::chrono::steady_clock::now() + delay); | 130 | 947 | } |
catalog_manager.cc:_ZN2yb3rpc20ScheduledTaskTracker8ScheduleIZNS_6master14CatalogManager26RebuildYQLSystemPartitionsEvE4$_18EEvRKT_NSt3__16chrono8durationIxNS9_5ratioILl1ELl1000000000EEEEE Line | Count | Source | 128 | 15.9k | void Schedule(const F& f, std::chrono::steady_clock::duration delay) { | 129 | 15.9k | Schedule(f, std::chrono::steady_clock::now() + delay); | 130 | 15.9k | } |
_ZN2yb3rpc20ScheduledTaskTracker8ScheduleIZNS_7tserver19PgClientServiceImpl4Impl28ScheduleCheckExpiredSessionsENSt3__16chrono10time_pointINS_15CoarseMonoClockENS7_8durationIxNS6_5ratioILl1ELl1000000000EEEEEEEEUlRKNS_6StatusEE_EEvRKT_SD_ Line | Count | Source | 128 | 13.8k | void Schedule(const F& f, std::chrono::steady_clock::duration delay) { | 129 | 13.8k | Schedule(f, std::chrono::steady_clock::now() + delay); | 130 | 13.8k | } |
|
131 | | |
132 | | template <class F> |
133 | 30.7k | void Schedule(const F& f, std::chrono::steady_clock::time_point time) { |
134 | 30.7k | Abort(); |
135 | 30.7k | if (++num_scheduled_ < 0) { // Shutting down |
136 | 78 | --num_scheduled_; |
137 | 78 | return; |
138 | 78 | } |
139 | 30.6k | last_scheduled_task_id_ = scheduler_->Schedule( |
140 | 13.9k | [this, f](ScheduledTaskId task_id, const Status& status) { |
141 | 13.9k | last_scheduled_task_id_.compare_exchange_strong(task_id, rpc::kInvalidTaskId); |
142 | 13.9k | f(status); |
143 | 13.9k | --num_scheduled_; |
144 | 13.9k | }, time); _ZZN2yb3rpc20ScheduledTaskTracker8ScheduleINSt3__16__bindIMNS_9consensus13RaftConsensusEFvRKNS_6StatusEEJPS6_RKNS3_12placeholders4__phILi1EEEEEEEEvRKT_NS3_6chrono10time_pointINSM_12steady_clockENSM_8durationIxNS3_5ratioILl1ELl1000000000EEEEEEEENKUlxS9_E_clExS9_ Line | Count | Source | 140 | 50 | [this, f](ScheduledTaskId task_id, const Status& status) { | 141 | 50 | last_scheduled_task_id_.compare_exchange_strong(task_id, rpc::kInvalidTaskId); | 142 | 50 | f(status); | 143 | 50 | --num_scheduled_; | 144 | 50 | }, time); |
catalog_manager.cc:_ZZN2yb3rpc20ScheduledTaskTracker8ScheduleIZNS_6master14CatalogManager33ScheduleRefreshTablespaceInfoTaskEbE3$_3EEvRKT_NSt3__16chrono10time_pointINSA_12steady_clockENSA_8durationIxNS9_5ratioILl1ELl1000000000EEEEEEEENKUlxRKNS_6StatusEE_clExSK_ Line | Count | Source | 140 | 561 | [this, f](ScheduledTaskId task_id, const Status& status) { | 141 | 561 | last_scheduled_task_id_.compare_exchange_strong(task_id, rpc::kInvalidTaskId); | 142 | 561 | f(status); | 143 | 561 | --num_scheduled_; | 144 | 561 | }, time); |
catalog_manager.cc:_ZZN2yb3rpc20ScheduledTaskTracker8ScheduleIZNS_6master14CatalogManager26RebuildYQLSystemPartitionsEvE4$_18EEvRKT_NSt3__16chrono10time_pointINSA_12steady_clockENSA_8durationIxNS9_5ratioILl1ELl1000000000EEEEEEEENKUlxRKNS_6StatusEE_clExSK_ Line | Count | Source | 140 | 10.6k | [this, f](ScheduledTaskId task_id, const Status& status) { | 141 | 10.6k | last_scheduled_task_id_.compare_exchange_strong(task_id, rpc::kInvalidTaskId); | 142 | 10.6k | f(status); | 143 | 10.6k | --num_scheduled_; | 144 | 10.6k | }, time); |
_ZZN2yb3rpc20ScheduledTaskTracker8ScheduleIZNS_7tserver19PgClientServiceImpl4Impl28ScheduleCheckExpiredSessionsENSt3__16chrono10time_pointINS_15CoarseMonoClockENS7_8durationIxNS6_5ratioILl1ELl1000000000EEEEEEEEUlRKNS_6StatusEE_EEvRKT_NS8_INS7_12steady_clockESD_EEENKUlxSH_E_clExSH_ Line | Count | Source | 140 | 2.73k | [this, f](ScheduledTaskId task_id, const Status& status) { | 141 | 2.73k | last_scheduled_task_id_.compare_exchange_strong(task_id, rpc::kInvalidTaskId); | 142 | 2.73k | f(status); | 143 | 2.73k | --num_scheduled_; | 144 | 2.73k | }, time); |
|
145 | 30.6k | } _ZN2yb3rpc20ScheduledTaskTracker8ScheduleINSt3__16__bindIMNS_9consensus13RaftConsensusEFvRKNS_6StatusEEJPS6_RKNS3_12placeholders4__phILi1EEEEEEEEvRKT_NS3_6chrono10time_pointINSM_12steady_clockENSM_8durationIxNS3_5ratioILl1ELl1000000000EEEEEEE Line | Count | Source | 133 | 50 | void Schedule(const F& f, std::chrono::steady_clock::time_point time) { | 134 | 50 | Abort(); | 135 | 50 | if (++num_scheduled_ < 0) { // Shutting down | 136 | 0 | --num_scheduled_; | 137 | 0 | return; | 138 | 0 | } | 139 | 50 | last_scheduled_task_id_ = scheduler_->Schedule( | 140 | 50 | [this, f](ScheduledTaskId task_id, const Status& status) { | 141 | 50 | last_scheduled_task_id_.compare_exchange_strong(task_id, rpc::kInvalidTaskId); | 142 | 50 | f(status); | 143 | 50 | --num_scheduled_; | 144 | 50 | }, time); | 145 | 50 | } |
catalog_manager.cc:_ZN2yb3rpc20ScheduledTaskTracker8ScheduleIZNS_6master14CatalogManager33ScheduleRefreshTablespaceInfoTaskEbE3$_3EEvRKT_NSt3__16chrono10time_pointINSA_12steady_clockENSA_8durationIxNS9_5ratioILl1ELl1000000000EEEEEEE Line | Count | Source | 133 | 947 | void Schedule(const F& f, std::chrono::steady_clock::time_point time) { | 134 | 947 | Abort(); | 135 | 947 | if (++num_scheduled_ < 0) { // Shutting down | 136 | 1 | --num_scheduled_; | 137 | 1 | return; | 138 | 1 | } | 139 | 946 | last_scheduled_task_id_ = scheduler_->Schedule( | 140 | 946 | [this, f](ScheduledTaskId task_id, const Status& status) { | 141 | 946 | last_scheduled_task_id_.compare_exchange_strong(task_id, rpc::kInvalidTaskId); | 142 | 946 | f(status); | 143 | 946 | --num_scheduled_; | 144 | 946 | }, time); | 145 | 946 | } |
catalog_manager.cc:_ZN2yb3rpc20ScheduledTaskTracker8ScheduleIZNS_6master14CatalogManager26RebuildYQLSystemPartitionsEvE4$_18EEvRKT_NSt3__16chrono10time_pointINSA_12steady_clockENSA_8durationIxNS9_5ratioILl1ELl1000000000EEEEEEE Line | Count | Source | 133 | 15.9k | void Schedule(const F& f, std::chrono::steady_clock::time_point time) { | 134 | 15.9k | Abort(); | 135 | 15.9k | if (++num_scheduled_ < 0) { // Shutting down | 136 | 77 | --num_scheduled_; | 137 | 77 | return; | 138 | 77 | } | 139 | 15.8k | last_scheduled_task_id_ = scheduler_->Schedule( | 140 | 15.8k | [this, f](ScheduledTaskId task_id, const Status& status) { | 141 | 15.8k | last_scheduled_task_id_.compare_exchange_strong(task_id, rpc::kInvalidTaskId); | 142 | 15.8k | f(status); | 143 | 15.8k | --num_scheduled_; | 144 | 15.8k | }, time); | 145 | 15.8k | } |
_ZN2yb3rpc20ScheduledTaskTracker8ScheduleIZNS_7tserver19PgClientServiceImpl4Impl28ScheduleCheckExpiredSessionsENSt3__16chrono10time_pointINS_15CoarseMonoClockENS7_8durationIxNS6_5ratioILl1ELl1000000000EEEEEEEEUlRKNS_6StatusEE_EEvRKT_NS8_INS7_12steady_clockESD_EE Line | Count | Source | 133 | 13.8k | void Schedule(const F& f, std::chrono::steady_clock::time_point time) { | 134 | 13.8k | Abort(); | 135 | 13.8k | if (++num_scheduled_ < 0) { // Shutting down | 136 | 0 | --num_scheduled_; | 137 | 0 | return; | 138 | 0 | } | 139 | 13.8k | last_scheduled_task_id_ = scheduler_->Schedule( | 140 | 13.8k | [this, f](ScheduledTaskId task_id, const Status& status) { | 141 | 13.8k | last_scheduled_task_id_.compare_exchange_strong(task_id, rpc::kInvalidTaskId); | 142 | 13.8k | f(status); | 143 | 13.8k | --num_scheduled_; | 144 | 13.8k | }, time); | 145 | 13.8k | } |
|
146 | | |
147 | | void Abort(); |
148 | | |
149 | | void StartShutdown(); |
150 | | void CompleteShutdown(); |
151 | | |
152 | 160 | void Shutdown() { |
153 | 160 | StartShutdown(); |
154 | 160 | CompleteShutdown(); |
155 | 160 | } |
156 | | |
157 | | private: |
158 | | Scheduler* scheduler_ = nullptr; |
159 | | std::atomic<int64_t> num_scheduled_{0}; |
160 | | std::atomic<rpc::ScheduledTaskId> last_scheduled_task_id_{rpc::kInvalidTaskId}; |
161 | | }; |
162 | | |
163 | | } // namespace rpc |
164 | | } // namespace yb |
165 | | |
166 | | #endif // YB_RPC_SCHEDULER_H |