|
In 3.2, BackgroundSync::consume may erroneously decrement the following server status metrics when BlockingQueue::blockingPop() returns an empty document:
"repl.buffer.count"
"repl.buffer.sizeBytes"
https://github.com/mongodb/mongo/blob/f98bd7d1a376ab741024d21e20e4b1b48d9a0af6/src/mongo/db/repl/bgsync.cpp#L840
|
bgsync.cpp
|
837
|
void BackgroundSync::consume() {
|
838
|
// this is just to get the op off the queue, it's been peeked at
|
839
|
// and queued for application already
|
840
|
BSONObj op = _buffer.blockingPop();
|
841
|
bufferCountGauge.decrement(1);
|
842
|
bufferSizeGauge.decrement(getSize(op));
|
843
|
}
|
https://github.com/mongodb/mongo/blob/f98bd7d1a376ab741024d21e20e4b1b48d9a0af6/src/mongo/util/queue.h#L171
|
queue.h
|
165
|
T blockingPop() {
|
166
|
stdx::unique_lock<stdx::mutex> lk(_lock);
|
167
|
_clearing = false;
|
168
|
while (_queue.empty() && !_clearing)
|
169
|
_cvNoLongerEmpty.wait(lk);
|
170
|
if (_clearing) {
|
171
|
return T{};
|
172
|
}
|
173
|
|
174
|
T t = _queue.front();
|
175
|
_queue.pop();
|
176
|
_currentSize -= _getSize(t);
|
177
|
_cvNoLongerFull.notify_one();
|
178
|
|
179
|
return t;
|
180
|
}
|
|