mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 17:10:48 +01:00
SERVER-42447 Add backtrace field to waitingforLatch
This commit is contained in:
parent
18bff834e3
commit
41da4f253c
@ -28,6 +28,13 @@ var result = getCurrentOp();
|
||||
assert(result.hasOwnProperty("waitingForLatch"));
|
||||
assert(result["waitingForLatch"].hasOwnProperty("timestamp"));
|
||||
assert(result["waitingForLatch"].hasOwnProperty("captureName"));
|
||||
assert(result["waitingForLatch"].hasOwnProperty("backtrace"));
|
||||
result["waitingForLatch"]["backtrace"].forEach(function(obj) {
|
||||
assert(obj.hasOwnProperty("addr"));
|
||||
assert(typeof obj["addr"] === "string");
|
||||
assert(obj.hasOwnProperty("path"));
|
||||
assert(typeof obj["path"] === "string");
|
||||
});
|
||||
|
||||
assert.commandWorked(
|
||||
db.adminCommand({"configureFailPoint": 'keepDiagnosticCaptureOnFailedLock', "mode": 'off'}));
|
||||
|
@ -323,14 +323,19 @@ void CurOp::reportCurrentOpForClient(OperationContext* opCtx,
|
||||
|
||||
std::shared_ptr<DiagnosticInfo> diagnostic = DiagnosticInfo::Diagnostic::get(client);
|
||||
if (diagnostic && backtraceMode) {
|
||||
// TODO: SERVER-42447 Add backtrace as bsonobj to waitingForLatch
|
||||
BSONObjBuilder waitingForLatchBuilder;
|
||||
BSONObjBuilder waitingForLatchBuilder(infoBuilder->subobjStart("waitingForLatch"));
|
||||
waitingForLatchBuilder.append("timestamp", diagnostic->getTimestamp());
|
||||
waitingForLatchBuilder.append("captureName", diagnostic->getCaptureName());
|
||||
infoBuilder->append("waitingForLatch", waitingForLatchBuilder.obj());
|
||||
{
|
||||
BSONArrayBuilder backtraceBuilder(waitingForLatchBuilder.subarrayStart("backtrace"));
|
||||
for (const auto& frame : diagnostic->makeStackTrace().frames) {
|
||||
BSONObjBuilder backtraceObj(backtraceBuilder.subobjStart());
|
||||
backtraceObj.append("addr", integerToHex(frame.instructionOffset));
|
||||
backtraceObj.append("path", frame.objectPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (MONGO_FAIL_POINT(keepDiagnosticCaptureOnFailedLock)) {
|
||||
gHangLock.lock.unlock();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user