Permalink
Browse files

Revert "SERVER-38191 Enforce restriction on namespace for failpoints …

…in write_ops"

This reverts commit 587ad0e.
  • Loading branch information...
nzolnierzmdb committed Jan 12, 2019
1 parent 587ad0e commit d19bd0c883a338e4f443399c928700381c682e32
@@ -45,20 +45,11 @@
// use the 'maxTimeNeverTimeOut' failpoint to ensure that the operation does not
// prematurely time out.
const maxTimeMS = 1000 * 2;

const kFailPointName =
mode == "replaceDocuments" ? "hangDuringBatchUpdate" : "hangDuringBatchInsert";
// Enable a failPoint so that the write will hang.
let failpointCommand = {
configureFailPoint: failPointName,
mode: "alwaysOn",
data: {nss: kDBName + "." + kDestCollName}
};

// For mode "replaceCollection", the namespace of the writes will be to a temp namespace so
// remove the restriction on nss.
if (mode == "replaceCollection")
delete failpointCommand.data;

assert.commandWorked(connToHang.getDB("admin").runCommand(failpointCommand));
assert.commandWorked(connToHang.getDB("admin").runCommand(
{configureFailPoint: failPointName, mode: "alwaysOn"}));

// Make sure we don't run out of time before the failpoint is hit.
assert.commandWorked(connToHang.getDB("admin").runCommand(
@@ -159,13 +159,11 @@
// the inserts or updates.
testEpochChangeDuringAgg({
outSpec: {to: target.getName(), mode: "insertDocuments"},
failpoint: "hangDuringBatchInsert",
failpointData: {nss: target.getFullName()}
failpoint: "hangDuringBatchInsert"
});
testEpochChangeDuringAgg({
outSpec: {to: target.getName(), mode: "replaceDocuments"},
failpoint: "hangDuringBatchUpdate",
failpointData: {nss: target.getFullName()}
failpoint: "hangDuringBatchUpdate"
});

st.stop();
@@ -49,19 +49,12 @@ void CurOpFailpointHelpers::waitWhileFailPointEnabled(FailPoint* failPoint,
OperationContext* opCtx,
const std::string& curOpMsg,
const std::function<void(void)>& whileWaiting,
bool checkForInterrupt,
boost::optional<NamespaceString> nss) {

bool checkForInterrupt) {
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))) {
@@ -55,7 +55,6 @@ class CurOpFailpointHelpers {
OperationContext* opCtx,
const std::string& curOpMsg,
const std::function<void(void)>& whileWaiting = nullptr,
bool checkForInterrupt = false,
boost::optional<NamespaceString> nss = boost::none);
bool checkForInterrupt = false);
};
}
@@ -355,14 +355,12 @@ bool insertBatchAndHandleErrors(OperationContext* opCtx,
&hangDuringBatchInsert,
opCtx,
"hangDuringBatchInsert",
[wholeOp]() {
log()
<< "batch insert - hangDuringBatchInsert fail point enabled for namespace "
<< wholeOp.getNamespace() << ". Blocking "
"until fail point is disabled.";
[]() {
log() << "batch insert - hangDuringBatchInsert fail point enabled. Blocking "
"until fail point is disabled.";
},
true, // Check for interrupt periodically.
wholeOp.getNamespace());
true // Check for interrupt periodically.
);

if (MONGO_FAIL_POINT(failAllInserts)) {
uasserted(ErrorCodes::InternalError, "failAllInserts failpoint active!");
@@ -570,18 +568,11 @@ static SingleWriteResult performSingleUpdateOp(OperationContext* opCtx,

boost::optional<AutoGetCollection> collection;
while (true) {
const auto checkForInterrupt = false;
CurOpFailpointHelpers::waitWhileFailPointEnabled(
&hangDuringBatchUpdate,
opCtx,
"hangDuringBatchUpdate",
[ns]() {
log() << "batch update - hangDuringBatchUpdate fail point enabled for nss " << ns
<< ". Blocking until "
&hangDuringBatchUpdate, opCtx, "hangDuringBatchUpdate", [opCtx]() {
log() << "batch update - hangDuringBatchUpdate fail point enabled. Blocking until "
"fail point is disabled.";
},
checkForInterrupt,
ns);
});

if (MONGO_FAIL_POINT(failAllUpdates)) {
uasserted(ErrorCodes::InternalError, "failAllUpdates failpoint active!");

0 comments on commit d19bd0c

Please sign in to comment.