@@ -105,11 +105,24 @@ HeartbeatThread::~HeartbeatThread() { shutdown(); }
105
105
106
106
class HeartbeatBackgroundJob {
107
107
std::shared_ptr<HeartbeatThread> _heartbeatThread;
108
+ double _startTime;
109
+ std::string _schedulerInfo;
108
110
public:
109
- explicit HeartbeatBackgroundJob (std::shared_ptr<HeartbeatThread> hbt)
110
- : _heartbeatThread(hbt) {}
111
+ explicit HeartbeatBackgroundJob (std::shared_ptr<HeartbeatThread> hbt,
112
+ double startTime)
113
+ : _heartbeatThread(hbt), _startTime(startTime) {
114
+ _schedulerInfo = SchedulerFeature::SCHEDULER->infoStatus ();
115
+ }
111
116
112
117
void operator ()() {
118
+ double now = TRI_microtime ();
119
+ if (now > _startTime + 5.0 ) {
120
+ LOG_TOPIC (ERR, Logger::HEARTBEAT) << " ALARM: Scheduling background job "
121
+ " took " << now - _startTime
122
+ << " seconds, scheduler info at schedule time: " << _schedulerInfo
123
+ << " , scheduler info now: "
124
+ << SchedulerFeature::SCHEDULER->infoStatus ();
125
+ }
113
126
_heartbeatThread->runBackgroundJob ();
114
127
}
115
128
};
@@ -138,7 +151,8 @@ void HeartbeatThread::runBackgroundJob() {
138
151
jobNr = ++_backgroundJobsPosted;
139
152
LOG_TOPIC (DEBUG, Logger::HEARTBEAT) << " dispatching sync tail " << jobNr;
140
153
_launchAnotherBackgroundJob = false ;
141
- _ioService->post (HeartbeatBackgroundJob (shared_from_this ()));
154
+ _ioService->post (HeartbeatBackgroundJob (shared_from_this (),
155
+ TRI_microtime ()));
142
156
} else {
143
157
_backgroundJobScheduledOrRunning = false ;
144
158
_launchAnotherBackgroundJob = false ;
@@ -790,7 +804,7 @@ void HeartbeatThread::syncDBServerStatusQuo() {
790
804
uint64_t jobNr = ++_backgroundJobsPosted;
791
805
LOG_TOPIC (DEBUG, Logger::HEARTBEAT) << " dispatching sync " << jobNr;
792
806
_backgroundJobScheduledOrRunning = true ;
793
- _ioService->post (HeartbeatBackgroundJob (shared_from_this ()));
807
+ _ioService->post (HeartbeatBackgroundJob (shared_from_this (), TRI_microtime () ));
794
808
}
795
809
796
810
// //////////////////////////////////////////////////////////////////////////////
0 commit comments