diff options
Diffstat (limited to 'src/mongo/dbtests/validate_tests.cpp')
-rw-r--r-- | src/mongo/dbtests/validate_tests.cpp | 93 |
1 files changed, 49 insertions, 44 deletions
diff --git a/src/mongo/dbtests/validate_tests.cpp b/src/mongo/dbtests/validate_tests.cpp index fe82b1c5589..308c81482d1 100644 --- a/src/mongo/dbtests/validate_tests.cpp +++ b/src/mongo/dbtests/validate_tests.cpp @@ -106,13 +106,14 @@ public: Collection* coll; RecordId id1; { + OpDebug* const nullOpDebug = nullptr; WriteUnitOfWork wunit(&_txn); ASSERT_OK(db->dropCollection(&_txn, _ns)); coll = db->createCollection(&_txn, _ns); - ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 1), true)); + ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 1), nullOpDebug, true)); id1 = coll->getCursor(&_txn)->next()->id; - ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 2), true)); + ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 2), nullOpDebug, true)); wunit.commit(); } @@ -155,12 +156,13 @@ public: Collection* coll; RecordId id1; { + OpDebug* const nullOpDebug = nullptr; WriteUnitOfWork wunit(&_txn); ASSERT_OK(db->dropCollection(&_txn, _ns)); coll = db->createCollection(&_txn, _ns); - ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 1 << "a" << 1), true)); + ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 1 << "a" << 1), nullOpDebug, true)); id1 = coll->getCursor(&_txn)->next()->id; - ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 2 << "a" << 2), true)); + ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 2 << "a" << 2), nullOpDebug, true)); wunit.commit(); } @@ -208,16 +210,17 @@ public: void run() { // Create a new collection, insert three records. Database* db = _ctx.db(); + OpDebug* const nullOpDebug = nullptr; Collection* coll; RecordId id1; { WriteUnitOfWork wunit(&_txn); ASSERT_OK(db->dropCollection(&_txn, _ns)); coll = db->createCollection(&_txn, _ns); - ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 1 << "a" << 1), true)); + ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 1 << "a" << 1), nullOpDebug, true)); id1 = coll->getCursor(&_txn)->next()->id; - ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 2 << "a" << 2), true)); - ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 3 << "b" << 3), true)); + ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 2 << "a" << 2), nullOpDebug, true)); + ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 3 << "b" << 3), nullOpDebug, true)); wunit.commit(); } @@ -239,11 +242,10 @@ public: { WriteUnitOfWork wunit(&_txn); auto doc = BSON("_id" << 1 << "a" << 9); - auto statusW = rs->updateRecord( + auto updateStatus = rs->updateRecord( &_txn, id1, doc.objdata(), doc.objsize(), /*enforceQuota*/ false, NULL); - ASSERT_OK(statusW.getStatus()); - // Assert the RecordId has not changed after an in-place update. - ASSERT_EQ(id1, statusW.getValue()); + + ASSERT_OK(updateStatus); wunit.commit(); } @@ -258,6 +260,7 @@ public: void run() { // Create a new collection, insert records {_id: 1} and {_id: 2} and check it's valid. Database* db = _ctx.db(); + OpDebug* const nullOpDebug = nullptr; Collection* coll; RecordId id1; { @@ -265,9 +268,9 @@ public: ASSERT_OK(db->dropCollection(&_txn, _ns)); coll = db->createCollection(&_txn, _ns); - ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 1), true)); + ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 1), nullOpDebug, true)); id1 = coll->getCursor(&_txn)->next()->id; - ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 2), true)); + ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 2), nullOpDebug, true)); wunit.commit(); } @@ -280,11 +283,9 @@ public: { WriteUnitOfWork wunit(&_txn); auto doc = BSON("_id" << 9); - auto statusW = rs->updateRecord( + auto updateStatus = rs->updateRecord( &_txn, id1, doc.objdata(), doc.objsize(), /*enforceQuota*/ false, NULL); - ASSERT_OK(statusW.getStatus()); - // Assert the RecordId has not changed after an in-place update. - ASSERT_EQ(id1, statusW.getValue()); + ASSERT_OK(updateStatus); wunit.commit(); } @@ -294,10 +295,9 @@ public: { WriteUnitOfWork wunit(&_txn); auto doc = BSON("_id" << 1); - auto statusW = rs->updateRecord( + auto updateStatus = rs->updateRecord( &_txn, id1, doc.objdata(), doc.objsize(), /*enforceQuota*/ false, NULL); - ASSERT_OK(statusW.getStatus()); - id1 = statusW.getValue(); + ASSERT_OK(updateStatus); wunit.commit(); } @@ -326,6 +326,7 @@ public: void run() { // Create a new collection, insert three records and check it's valid. Database* db = _ctx.db(); + OpDebug* const nullOpDebug = nullptr; Collection* coll; RecordId id1; // {a: [b: 1, c: 2]}, {a: [b: 2, c: 2]}, {a: [b: 1, c: 1]} @@ -343,10 +344,10 @@ public: coll = db->createCollection(&_txn, _ns); - ASSERT_OK(coll->insertDocument(&_txn, doc1, true)); + ASSERT_OK(coll->insertDocument(&_txn, doc1, nullOpDebug, true)); id1 = coll->getCursor(&_txn)->next()->id; - ASSERT_OK(coll->insertDocument(&_txn, doc2, true)); - ASSERT_OK(coll->insertDocument(&_txn, doc3, true)); + ASSERT_OK(coll->insertDocument(&_txn, doc2, nullOpDebug, true)); + ASSERT_OK(coll->insertDocument(&_txn, doc3, nullOpDebug, true)); wunit.commit(); } @@ -369,10 +370,9 @@ public: // Update a document's indexed field without updating the index. { WriteUnitOfWork wunit(&_txn); - auto statusW = rs->updateRecord( + auto updateStatus = rs->updateRecord( &_txn, id1, doc1_b.objdata(), doc1_b.objsize(), /*enforceQuota*/ false, NULL); - ASSERT_OK(statusW.getStatus()); - id1 = statusW.getValue(); + ASSERT_OK(updateStatus); wunit.commit(); } @@ -382,9 +382,9 @@ public: // Index validation should still be valid. { WriteUnitOfWork wunit(&_txn); - auto statusW = rs->updateRecord( + auto updateStatus = rs->updateRecord( &_txn, id1, doc1_c.objdata(), doc1_c.objsize(), /*enforceQuota*/ false, NULL); - ASSERT_OK(statusW.getStatus()); + ASSERT_OK(updateStatus); wunit.commit(); } @@ -399,6 +399,7 @@ public: void run() { // Create a new collection, insert three records and check it's valid. Database* db = _ctx.db(); + OpDebug* const nullOpDebug = nullptr; Collection* coll; RecordId id1; { @@ -406,10 +407,10 @@ public: ASSERT_OK(db->dropCollection(&_txn, _ns)); coll = db->createCollection(&_txn, _ns); - ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 1 << "a" << 1), true)); + ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 1 << "a" << 1), nullOpDebug, true)); id1 = coll->getCursor(&_txn)->next()->id; - ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 2 << "a" << 2), true)); - ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 3 << "b" << 1), true)); + ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 2 << "a" << 2), nullOpDebug, true)); + ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 3 << "b" << 1), nullOpDebug, true)); wunit.commit(); } @@ -431,9 +432,9 @@ public: { WriteUnitOfWork wunit(&_txn); auto doc = BSON("_id" << 2 << "a" << 3); - auto statusW = rs->updateRecord( + auto updateStatus = rs->updateRecord( &_txn, id1, doc.objdata(), doc.objsize(), /*enforceQuota*/ false, NULL); - ASSERT_OK(statusW.getStatus()); + ASSERT_OK(updateStatus); wunit.commit(); } @@ -448,6 +449,7 @@ public: void run() { // Create a new collection, insert two records and check it's valid. Database* db = _ctx.db(); + OpDebug* const nullOpDebug = nullptr; Collection* coll; RecordId id1; { @@ -455,9 +457,9 @@ public: ASSERT_OK(db->dropCollection(&_txn, _ns)); coll = db->createCollection(&_txn, _ns); - ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 1 << "a" << 1), true)); + ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 1 << "a" << 1), nullOpDebug, true)); id1 = coll->getCursor(&_txn)->next()->id; - ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 2 << "a" << 2), true)); + ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 2 << "a" << 2), nullOpDebug, true)); wunit.commit(); } @@ -480,9 +482,9 @@ public: { WriteUnitOfWork wunit(&_txn); auto doc = BSON("_id" << 1); - auto statusW = rs->updateRecord( + auto updateStatus = rs->updateRecord( &_txn, id1, doc.objdata(), doc.objsize(), /*enforceQuota*/ false, NULL); - ASSERT_OK(statusW.getStatus()); + ASSERT_OK(updateStatus); wunit.commit(); } @@ -497,6 +499,7 @@ public: void run() { // Create a new collection, insert five records and check it's valid. Database* db = _ctx.db(); + OpDebug* const nullOpDebug = nullptr; Collection* coll; RecordId id1; { @@ -504,12 +507,14 @@ public: ASSERT_OK(db->dropCollection(&_txn, _ns)); coll = db->createCollection(&_txn, _ns); - ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 1 << "a" << 1 << "b" << 4), true)); + ASSERT_OK(coll->insertDocument( + &_txn, BSON("_id" << 1 << "a" << 1 << "b" << 4), nullOpDebug, true)); id1 = coll->getCursor(&_txn)->next()->id; - ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 2 << "a" << 2 << "b" << 5), true)); - ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 3 << "a" << 3), true)); - ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 4 << "b" << 6), true)); - ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 5 << "c" << 7), true)); + ASSERT_OK(coll->insertDocument( + &_txn, BSON("_id" << 2 << "a" << 2 << "b" << 5), nullOpDebug, true)); + ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 3 << "a" << 3), nullOpDebug, true)); + ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 4 << "b" << 6), nullOpDebug, true)); + ASSERT_OK(coll->insertDocument(&_txn, BSON("_id" << 5 << "c" << 7), nullOpDebug, true)); wunit.commit(); } @@ -541,9 +546,9 @@ public: { WriteUnitOfWork wunit(&_txn); auto doc = BSON("_id" << 1 << "a" << 1 << "b" << 3); - auto statusW = rs->updateRecord( + auto updateStatus = rs->updateRecord( &_txn, id1, doc.objdata(), doc.objsize(), /*enforceQuota*/ false, NULL); - ASSERT_OK(statusW.getStatus()); + ASSERT_OK(updateStatus); wunit.commit(); } |