summaryrefslogtreecommitdiff
path: root/src/mongo/db/curop_failpoint_helpers.cpp
diff options
context:
space:
mode:
authorNick Zolnierz <nicholas.zolnierz@mongodb.com>2019-01-11 18:22:37 -0500
committerNick Zolnierz <nicholas.zolnierz@mongodb.com>2019-01-11 18:27:35 -0500
commit587ad0e175cb501e378f4aeaf37199dbb28dd011 (patch)
treef3ffab15d358d9ef9559e570ce26e9da14ea376f /src/mongo/db/curop_failpoint_helpers.cpp
parent1006d88b7522a11ed34ba1a751678ea7f7637754 (diff)
downloadmongo-587ad0e175cb501e378f4aeaf37199dbb28dd011.tar.gz
SERVER-38191 Enforce restriction on namespace for failpoints in write_ops
Diffstat (limited to 'src/mongo/db/curop_failpoint_helpers.cpp')
-rw-r--r--src/mongo/db/curop_failpoint_helpers.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mongo/db/curop_failpoint_helpers.cpp b/src/mongo/db/curop_failpoint_helpers.cpp
index 4df9311cc6d..fb78284f6f8 100644
--- a/src/mongo/db/curop_failpoint_helpers.cpp
+++ b/src/mongo/db/curop_failpoint_helpers.cpp
@@ -49,12 +49,19 @@ void CurOpFailpointHelpers::waitWhileFailPointEnabled(FailPoint* failPoint,
OperationContext* opCtx,
const std::string& curOpMsg,
const std::function<void(void)>& whileWaiting,
- bool checkForInterrupt) {
+ bool checkForInterrupt,
+ boost::optional<NamespaceString> nss) {
+
invariant(failPoint);
MONGO_FAIL_POINT_BLOCK((*failPoint), options) {
+ const BSONObj& data = options.getData();
+ StringData fpNss = data.getStringField("nss");
+ if (nss && !fpNss.empty() && fpNss != nss.get().toString()) {
+ return;
+ }
+
auto origCurOpMsg = updateCurOpMsg(opCtx, curOpMsg);
- const BSONObj& data = options.getData();
const bool shouldCheckForInterrupt =
checkForInterrupt || data["shouldCheckForInterrupt"].booleanSafe();
while (MONGO_FAIL_POINT((*failPoint))) {