summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2014-08-12 16:18:57 -0400
committerRandolph Tan <randolph@10gen.com>2014-08-19 10:14:48 -0400
commitfe11098d32f0e002349fd2513834f6c8928fe550 (patch)
treeac7fb98c7c50742a401483e8f14c1aa7874cb5e9 /src/mongo/db
parent1c5ba979202d53a35242c941e40bfc2b4f171bf3 (diff)
downloadmongo-fe11098d32f0e002349fd2513834f6c8928fe550.tar.gz
SERVER-14657 use RangeDeleter for all migration cleanup in d_migrate.cpp
Remove last use of Helpers::removeRange in d_migrate.cpp
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/exec/delete.cpp2
-rw-r--r--src/mongo/db/exec/delete.h6
-rw-r--r--src/mongo/db/ops/delete.cpp4
-rw-r--r--src/mongo/db/ops/delete.h3
-rw-r--r--src/mongo/db/ops/delete_executor.cpp21
-rw-r--r--src/mongo/db/ops/delete_request.h6
-rw-r--r--src/mongo/db/query/get_executor.cpp7
-rw-r--r--src/mongo/db/query/get_executor.h2
8 files changed, 39 insertions, 12 deletions
diff --git a/src/mongo/db/exec/delete.cpp b/src/mongo/db/exec/delete.cpp
index 19de5a7a742..3ae6147633e 100644
--- a/src/mongo/db/exec/delete.cpp
+++ b/src/mongo/db/exec/delete.cpp
@@ -112,7 +112,7 @@ namespace mongo {
else {
bool replJustOne = true;
repl::logOp(_txn, "d", _collection->ns().ns().c_str(), deletedDoc, 0,
- &replJustOne);
+ &replJustOne, _params.fromMigrate);
}
}
diff --git a/src/mongo/db/exec/delete.h b/src/mongo/db/exec/delete.h
index 3e24375a5dc..48a783c9b85 100644
--- a/src/mongo/db/exec/delete.h
+++ b/src/mongo/db/exec/delete.h
@@ -36,7 +36,7 @@ namespace mongo {
class OperationContext;
struct DeleteStageParams {
- DeleteStageParams() : isMulti(false), shouldCallLogOp(false) { }
+ DeleteStageParams() : isMulti(false), shouldCallLogOp(false), fromMigrate(false) { }
// Should we delete all documents returned from the child (a "multi delete"), or at most one
// (a "single delete")?
@@ -44,6 +44,10 @@ namespace mongo {
// Should we write each delete to the oplog?
bool shouldCallLogOp;
+
+ // Is this delete part of a migrate operation that is essentially like a no-op
+ // when the cluster is observed by an external client.
+ bool fromMigrate;
};
/**
diff --git a/src/mongo/db/ops/delete.cpp b/src/mongo/db/ops/delete.cpp
index 38b1b2aefe3..bd50b671a14 100644
--- a/src/mongo/db/ops/delete.cpp
+++ b/src/mongo/db/ops/delete.cpp
@@ -44,13 +44,15 @@ namespace mongo {
BSONObj pattern,
bool justOne,
bool logop,
- bool god) {
+ bool god,
+ bool fromMigrate) {
NamespaceString nsString(ns);
DeleteRequest request(txn, nsString);
request.setQuery(pattern);
request.setMulti(!justOne);
request.setUpdateOpLog(logop);
request.setGod(god);
+ request.setFromMigrate(fromMigrate);
DeleteExecutor executor(&request);
return executor.execute(db);
}
diff --git a/src/mongo/db/ops/delete.h b/src/mongo/db/ops/delete.h
index f0536b63dd2..a947167f985 100644
--- a/src/mongo/db/ops/delete.h
+++ b/src/mongo/db/ops/delete.h
@@ -45,6 +45,7 @@ namespace mongo {
BSONObj pattern,
bool justOne,
bool logop = false,
- bool god = false);
+ bool god = false,
+ bool fromMigrate = false);
}
diff --git a/src/mongo/db/ops/delete_executor.cpp b/src/mongo/db/ops/delete_executor.cpp
index 607c13fc4e5..ddb0c29b025 100644
--- a/src/mongo/db/ops/delete_executor.cpp
+++ b/src/mongo/db/ops/delete_executor.cpp
@@ -115,15 +115,24 @@ namespace mongo {
PlanExecutor* rawExec;
if (_canonicalQuery.get()) {
// This is the non-idhack branch.
- uassertStatusOK(getExecutorDelete(_request->getOpCtx(), collection,
- _canonicalQuery.release(), _request->isMulti(),
- _request->shouldCallLogOp(), &rawExec));
+ uassertStatusOK(getExecutorDelete(_request->getOpCtx(),
+ collection,
+ _canonicalQuery.release(),
+ _request->isMulti(),
+ _request->shouldCallLogOp(),
+ _request->isFromMigrate(),
+ &rawExec));
}
else {
// This is the idhack branch.
- uassertStatusOK(getExecutorDelete(_request->getOpCtx(), collection, ns.ns(),
- _request->getQuery(), _request->isMulti(),
- _request->shouldCallLogOp(), &rawExec));
+ uassertStatusOK(getExecutorDelete(_request->getOpCtx(),
+ collection,
+ ns.ns(),
+ _request->getQuery(),
+ _request->isMulti(),
+ _request->shouldCallLogOp(),
+ _request->isFromMigrate(),
+ &rawExec));
}
scoped_ptr<PlanExecutor> exec(rawExec);
diff --git a/src/mongo/db/ops/delete_request.h b/src/mongo/db/ops/delete_request.h
index 3ce0a0bb9fd..53f8d13d475 100644
--- a/src/mongo/db/ops/delete_request.h
+++ b/src/mongo/db/ops/delete_request.h
@@ -44,18 +44,21 @@ namespace mongo {
_nsString(nsString),
_multi(false),
_logop(false),
- _god(false) {}
+ _god(false),
+ _fromMigrate(false) {}
void setQuery(const BSONObj& query) { _query = query; }
void setMulti(bool multi = true) { _multi = multi; }
void setUpdateOpLog(bool logop = true) { _logop = logop; }
void setGod(bool god = true) { _god = god; }
+ void setFromMigrate(bool fromMigrate = true) { _fromMigrate = fromMigrate; }
const NamespaceString& getNamespaceString() const { return _nsString; }
const BSONObj& getQuery() const { return _query; }
bool isMulti() const { return _multi; }
bool shouldCallLogOp() const { return _logop; }
bool isGod() const { return _god; }
+ bool isFromMigrate() const { return _fromMigrate; }
OperationContext* getOpCtx() const { return _txn; }
std::string toString() const;
@@ -67,6 +70,7 @@ namespace mongo {
bool _multi;
bool _logop;
bool _god;
+ bool _fromMigrate;
};
} // namespace mongo
diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp
index 29480e463db..81e33790e52 100644
--- a/src/mongo/db/query/get_executor.cpp
+++ b/src/mongo/db/query/get_executor.cpp
@@ -468,6 +468,7 @@ namespace mongo {
CanonicalQuery* rawCanonicalQuery,
bool isMulti,
bool shouldCallLogOp,
+ bool fromMigrate,
PlanExecutor** out) {
auto_ptr<CanonicalQuery> canonicalQuery(rawCanonicalQuery);
auto_ptr<WorkingSet> ws(new WorkingSet());
@@ -482,6 +483,7 @@ namespace mongo {
DeleteStageParams deleteStageParams;
deleteStageParams.isMulti = isMulti;
deleteStageParams.shouldCallLogOp = shouldCallLogOp;
+ deleteStageParams.fromMigrate = fromMigrate;
root = new DeleteStage(txn, deleteStageParams, ws.get(), collection, root);
// We must have a tree of stages in order to have a valid plan executor, but the query
// solution may be null.
@@ -496,11 +498,13 @@ namespace mongo {
const BSONObj& unparsedQuery,
bool isMulti,
bool shouldCallLogOp,
+ bool fromMigrate,
PlanExecutor** out) {
auto_ptr<WorkingSet> ws(new WorkingSet());
DeleteStageParams deleteStageParams;
deleteStageParams.isMulti = isMulti;
deleteStageParams.shouldCallLogOp = shouldCallLogOp;
+ deleteStageParams.fromMigrate = fromMigrate;
if (!collection) {
LOG(2) << "Collection " << ns << " does not exist."
<< " Using EOF stage: " << unparsedQuery.toString();
@@ -530,7 +534,8 @@ namespace mongo {
return status;
// Takes ownership of 'cq'.
- return getExecutorDelete(txn, collection, cq, isMulti, shouldCallLogOp, out);
+ return getExecutorDelete(txn, collection, cq, isMulti,
+ shouldCallLogOp, fromMigrate, out);
}
//
diff --git a/src/mongo/db/query/get_executor.h b/src/mongo/db/query/get_executor.h
index cb49007260f..bfdb53fe98b 100644
--- a/src/mongo/db/query/get_executor.h
+++ b/src/mongo/db/query/get_executor.h
@@ -144,6 +144,7 @@ namespace mongo {
CanonicalQuery* rawCanonicalQuery,
bool isMulti,
bool shouldCallLogOp,
+ bool fromMigrate,
PlanExecutor** execOut);
/**
@@ -161,6 +162,7 @@ namespace mongo {
const BSONObj& unparsedQuery,
bool isMulti,
bool shouldCallLogOp,
+ bool fromMigrate,
PlanExecutor** execOut);
//