summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/catalog/database.cpp2
-rw-r--r--src/mongo/dbtests/rollbacktests.cpp12
2 files changed, 8 insertions, 6 deletions
diff --git a/src/mongo/db/catalog/database.cpp b/src/mongo/db/catalog/database.cpp
index 9e24afd5ffb..23fdfb84e95 100644
--- a/src/mongo/db/catalog/database.cpp
+++ b/src/mongo/db/catalog/database.cpp
@@ -475,8 +475,8 @@ Status Database::renameCollection(OperationContext* txn,
Top::get(txn->getClient()->getServiceContext()).collectionDropped(fromNS.toString());
}
- txn->recoveryUnit()->registerChange(new AddCollectionChange(txn, this, toNS));
Status s = _dbEntry->renameCollection(txn, fromNS, toNS, stayTemp);
+ txn->recoveryUnit()->registerChange(new AddCollectionChange(txn, this, toNS));
_collections[toNS] = _getOrCreateCollectionInstance(txn, toNS);
return s;
}
diff --git a/src/mongo/dbtests/rollbacktests.cpp b/src/mongo/dbtests/rollbacktests.cpp
index b842eb5a9bc..300d3f46aed 100644
--- a/src/mongo/dbtests/rollbacktests.cpp
+++ b/src/mongo/dbtests/rollbacktests.cpp
@@ -216,7 +216,7 @@ public:
}
};
-template <bool rollback, bool defaultIndexes>
+template <bool rollback, bool defaultIndexes, bool capped>
class RenameCollection {
public:
void run() {
@@ -236,7 +236,8 @@ public:
WriteUnitOfWork uow(&txn);
ASSERT(!collectionExists(&ctx, source.ns()));
ASSERT(!collectionExists(&ctx, target.ns()));
- ASSERT_OK(userCreateNS(&txn, ctx.db(), source.ns(), BSONObj(), defaultIndexes));
+ auto options = capped ? BSON("capped" << true << "size" << 1000) : BSONObj();
+ ASSERT_OK(userCreateNS(&txn, ctx.db(), source.ns(), options, defaultIndexes));
uow.commit();
}
ASSERT(collectionExists(&ctx, source.ns()));
@@ -263,7 +264,7 @@ public:
}
};
-template <bool rollback, bool defaultIndexes>
+template <bool rollback, bool defaultIndexes, bool capped>
class RenameDropTargetCollection {
public:
void run() {
@@ -288,8 +289,9 @@ public:
WriteUnitOfWork uow(&txn);
ASSERT(!collectionExists(&ctx, source.ns()));
ASSERT(!collectionExists(&ctx, target.ns()));
- ASSERT_OK(userCreateNS(&txn, ctx.db(), source.ns(), BSONObj(), defaultIndexes));
- ASSERT_OK(userCreateNS(&txn, ctx.db(), target.ns(), BSONObj(), defaultIndexes));
+ auto options = capped ? BSON("capped" << true << "size" << 1000) : BSONObj();
+ ASSERT_OK(userCreateNS(&txn, ctx.db(), source.ns(), options, defaultIndexes));
+ ASSERT_OK(userCreateNS(&txn, ctx.db(), target.ns(), options, defaultIndexes));
insertRecord(&txn, source, sourceDoc);
insertRecord(&txn, target, targetDoc);