SERVER-98720: Add missing redact() calls to query logs (#33192)

GitOrigin-RevId: be2ab84df04dd10fcecc8efd8f4e0c5e7640dec8
This commit is contained in:
HanaPearlman 2025-03-07 17:06:07 -05:00 committed by MongoDB Bot
parent 64beac1126
commit f4184f18fe
11 changed files with 17 additions and 16 deletions

View File

@ -299,7 +299,7 @@ public:
"Plan executor error during distinct command",
"error"_attr = exception.toStatus(),
"stats"_attr = redact(stats),
"cmd"_attr = cmdObj);
"cmd"_attr = redact(cmdObj));
exception.addContext("Executor error during distinct command");
throw;

View File

@ -670,7 +670,7 @@ public:
"Plan executor error during find command",
"error"_attr = exception.toStatus(),
"stats"_attr = redact(stats),
"cmd"_attr = cmdObj);
"cmd"_attr = redact(cmdObj));
exception.addContext("Executor error during find command");
throw;

View File

@ -439,7 +439,7 @@ public:
"getMore command executor error",
"error"_attr = exception.toStatus(),
"stats"_attr = redact(stats),
"cmd"_attr = cmd.toBSON({}));
"cmd"_attr = redact(cmd.toBSON({})));
exception.addContext("Executor error during getMore");
throw;

View File

@ -229,7 +229,7 @@ bool handleCursorCommand(OperationContext* opCtx,
"Aggregate command executor error",
"error"_attr = exception.toStatus(),
"stats"_attr = redact(stats),
"cmd"_attr = cmdObj);
"cmd"_attr = redact(cmdObj));
exception.addContext("PlanExecutor error during aggregation");
throw;

View File

@ -420,7 +420,8 @@ std::unique_ptr<PlanStage> ClassicStageBuilder::build(const QuerySolutionNode* r
case STAGE_SENTINEL:
case STAGE_COLUMN_IXSCAN:
case STAGE_UPDATE: {
LOGV2_WARNING(4615604, "Can't build exec tree for node", "node"_attr = *root);
LOGV2_WARNING(
4615604, "Can't build exec tree for node", "node"_attr = redact(root->toString()));
}
}

View File

@ -180,7 +180,7 @@ void ExpressionMapping::S2CellIdsToIntervals(const std::vector<S2CellId>& interv
if (!oilOut->isValidFor(1)) {
LOGV2(6029801,
"invalid OrderedIntervalList",
"orderedIntervalList"_attr = oilOut->toString(false));
"orderedIntervalList"_attr = redact(oilOut->toString(false)));
MONGO_UNREACHABLE;
}
}
@ -229,7 +229,7 @@ void ExpressionMapping::S2CellIdsToIntervalsWithParents(const std::vector<S2Cell
if (!oilOut->isValidFor(1)) {
LOGV2(6029802,
"invalid OrderedIntervalList",
"orderedIntervalList"_attr = oilOut->toString(false));
"orderedIntervalList"_attr = redact(oilOut->toString(false)));
MONGO_UNREACHABLE;
}
}

View File

@ -382,7 +382,7 @@ unique_ptr<MatchExpression> PlanEnumerator::getNext() {
tagForSort(tree.get());
_root->resetTag();
LOGV2_DEBUG(20943, 5, "Enumerator: memo just before moving", "memo"_attr = dumpMemo());
LOGV2_DEBUG(20943, 5, "Enumerator: memo just before moving", "memo"_attr = redact(dumpMemo()));
_done = nextMemo(memoIDForNode(_root));
return tree;
}

View File

@ -137,8 +137,8 @@ StatusWith<std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>> make(
LOGV2_DEBUG(4822860,
5,
"SBE plan",
"slots"_attr = data.debugString(),
"stages"_attr = sbe::DebugPrinter{}.print(*rootStage));
"slots"_attr = redact(data.debugString()),
"stages"_attr = redact(sbe::DebugPrinter{}.print(*rootStage)));
return {{new PlanExecutorSBE(
opCtx,
@ -165,8 +165,8 @@ StatusWith<std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>> make(
LOGV2_DEBUG(4822861,
5,
"SBE plan",
"slots"_attr = candidates.winner().data.debugString(),
"stages"_attr = sbe::DebugPrinter{}.print(*candidates.winner().root));
"slots"_attr = redact(candidates.winner().data.debugString()),
"stages"_attr = redact(sbe::DebugPrinter{}.print(*candidates.winner().root)));
return {{new PlanExecutorSBE(opCtx,
std::move(cq),

View File

@ -633,7 +633,7 @@ bool QueryPlannerIXSelect::_compatible(const BSONElement& keyPatternElt,
} else {
LOGV2_WARNING(20954,
"Unknown indexing for given node and field",
"node"_attr = node->debugString(),
"node"_attr = redact(node->debugString()),
"field"_attr = keyPatternElt.toString());
verify(0);
}

View File

@ -318,7 +318,7 @@ void registerRequest(OperationContext* opCtx,
"Error encountered when creating the Query Stats store key. Metrics will not "
"be collected for this command",
"status"_attr = status,
"command"_attr = cmdObj);
"command"_attr = redact(cmdObj));
if (kDebugBuild || internalQueryStatsErrorsAreCommandFatal.load()) {
// uassert rather than tassert so that we avoid creating fatal failures on queries that
// were going to fail anyway, but trigger the error here first. A query that ONLY fails

View File

@ -1073,8 +1073,8 @@ IndexIntervals makeIntervalsFromIndexBounds(const IndexBounds& bounds,
LOGV2_DEBUG(4742906,
5,
"Generated interval [lowKey, highKey]",
"lowKey"_attr = lowKey,
"highKey"_attr = highKey);
"lowKey"_attr = redact(lowKey),
"highKey"_attr = redact(highKey));
// Note that 'makeKeyFromBSONKeyForSeek()' is intended to compute the "start" key for an
// index scan. The logic for computing a "discriminator" for an "end" key is reversed, which
// is why we use 'makeKeyStringFromBSONKey()' to manually specify the discriminator for the