summaryrefslogtreecommitdiff
path: root/src/mongo/db/dbhelpers.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2014-04-29 17:56:56 -0400
committerMathias Stearn <mathias@10gen.com>2014-04-30 10:49:28 -0400
commitd747c572cbb9b6d39a64ccdc39dbb6de79c7c654 (patch)
treeea9df0a4f06a044b80cb8f05e814124262937b69 /src/mongo/db/dbhelpers.cpp
parent36370def1e19eed5fcabd468253c5be0d2b22366 (diff)
downloadmongo-d747c572cbb9b6d39a64ccdc39dbb6de79c7c654.tar.gz
SERVER-13643 Plumb TransactionExperiment through dbhelpers
Diffstat (limited to 'src/mongo/db/dbhelpers.cpp')
-rw-r--r--src/mongo/db/dbhelpers.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp
index eab2ba0864e..9517636e004 100644
--- a/src/mongo/db/dbhelpers.cpp
+++ b/src/mongo/db/dbhelpers.cpp
@@ -60,8 +60,11 @@ namespace mongo {
const BSONObj reverseNaturalObj = BSON( "$natural" << -1 );
- void Helpers::ensureIndex(Collection* collection,
- BSONObj keyPattern, bool unique, const char *name) {
+ void Helpers::ensureIndex(TransactionExperiment* txn,
+ Collection* collection,
+ BSONObj keyPattern,
+ bool unique,
+ const char *name) {
BSONObjBuilder b;
b.append("name", name);
b.append("ns", collection->ns());
@@ -213,14 +216,16 @@ namespace mongo {
return Runner::RUNNER_ADVANCED == state;
}
- void Helpers::upsert( const string& ns , const BSONObj& o, bool fromMigrate ) {
+ void Helpers::upsert( TransactionExperiment* txn,
+ const string& ns,
+ const BSONObj& o,
+ bool fromMigrate ) {
BSONElement e = o["_id"];
verify( e.type() );
BSONObj id = e.wrap();
OpDebug debug;
Client::Context context(ns);
- DurTransaction txn; // XXX
const NamespaceString requestNs(ns);
UpdateRequest request(requestNs);
@@ -233,13 +238,12 @@ namespace mongo {
UpdateLifecycleImpl updateLifecycle(true, requestNs);
request.setLifecycle(&updateLifecycle);
- update(&txn, request, &debug);
+ update(txn, request, &debug);
}
- void Helpers::putSingleton(const char *ns, BSONObj obj) {
+ void Helpers::putSingleton(TransactionExperiment* txn, const char *ns, BSONObj obj) {
OpDebug debug;
Client::Context context(ns);
- DurTransaction txn; // XXX
const NamespaceString requestNs(ns);
UpdateRequest request(requestNs);
@@ -250,15 +254,14 @@ namespace mongo {
UpdateLifecycleImpl updateLifecycle(true, requestNs);
request.setLifecycle(&updateLifecycle);
- update(&txn, request, &debug);
+ update(txn, request, &debug);
context.getClient()->curop()->done();
}
- void Helpers::putSingletonGod(const char *ns, BSONObj obj, bool logTheOp) {
+ void Helpers::putSingletonGod(TransactionExperiment* txn, const char *ns, BSONObj obj, bool logTheOp) {
OpDebug debug;
Client::Context context(ns);
- DurTransaction txn; // XXX
const NamespaceString requestNs(ns);
UpdateRequest request(requestNs);
@@ -268,7 +271,7 @@ namespace mongo {
request.setUpsert();
request.setUpdateOpLog(logTheOp);
- update(&txn, request, &debug);
+ update(txn, request, &debug);
context.getClient()->curop()->done();
}
@@ -549,10 +552,9 @@ namespace mongo {
}
- void Helpers::emptyCollection(const char *ns) {
+ void Helpers::emptyCollection(TransactionExperiment* txn, const char *ns) {
Client::Context context(ns);
- DurTransaction txn; // XXX
- deleteObjects(&txn, ns, BSONObj(), false);
+ deleteObjects(txn, ns, BSONObj(), false);
}
Helpers::RemoveSaver::RemoveSaver( const string& a , const string& b , const string& why)