4747#include " mongo/db/repl/replication_coordinator_mock.h"
4848#include " mongo/db/s/op_observer_sharding_impl.h"
4949#include " mongo/dbtests/dbtests.h"
50+ #include " mongo/logger/logger.h"
5051#include " mongo/transport/transport_layer_asio.h"
5152#include " mongo/util/log.h"
5253
5354using namespace mongo ::repl;
5455
5556namespace ReplTests {
5657
58+ using mongo::logger::globalLogDomain;
59+ using mongo::logger::LogComponent;
60+ using mongo::logger::LogSeverity;
5761using std::endl;
5862using std::string;
5963using std::stringstream;
@@ -258,25 +262,6 @@ class Base {
258262 }
259263 }
260264 }
261- void printAll (const char * ns) {
262- Lock::GlobalWrite lk (&_opCtx);
263- OldClientContext ctx (&_opCtx, ns);
264- NamespaceString nss (ns);
265-
266- Database* db = ctx.db ();
267- Collection* coll = CollectionCatalog::get (&_opCtx).lookupCollectionByNamespace (nss);
268- if (!coll) {
269- WriteUnitOfWork wunit (&_opCtx);
270- coll = db->createCollection (&_opCtx, nss);
271- wunit.commit ();
272- }
273-
274- auto cursor = coll->getCursor (&_opCtx);
275- ::mongo::log () << "all for " << ns << endl;
276- while (auto record = cursor->next ()) {
277- ::mongo::log () << record->data.releaseToBson() << endl;
278- }
279- }
280265 // These deletes don't get logged.
281266 void deleteAll (const char * ns) const {
282267 ::mongo::writeConflictRetry (&_opCtx, " deleteAll" , ns, [&] {
@@ -1312,11 +1297,22 @@ class ReplayArrayFieldNotAppended : public Base {
13121297
13131298class DeleteOpIsIdBased : public Base {
13141299public:
1300+ DeleteOpIsIdBased () : _oldSeverity(globalLogDomain()->getMinimumLogSeverity ()) {
1301+ // TODO (SERVER-43399): This is temporary to help diagnose a rare failure.
1302+ globalLogDomain ()->setMinimumLoggedSeverity (LogComponent::kDefault , LogSeverity::Debug (2 ));
1303+ }
1304+
1305+ ~DeleteOpIsIdBased () {
1306+ globalLogDomain ()->setMinimumLoggedSeverity (LogComponent::kDefault , _oldSeverity);
1307+ }
1308+
13151309 void run () {
13161310 // Replication is not supported by mobile SE.
13171311 if (mongo::storageGlobalParams.engine == " mobile" ) {
13181312 return ;
13191313 }
1314+
1315+ // These inserts don't write oplog entries.
13201316 insert (BSON (" _id" << 0 << " a" << 10 ));
13211317 insert (BSON (" _id" << 1 << " a" << 11 ));
13221318 insert (BSON (" _id" << 3 << " a" << 10 ));
@@ -1325,12 +1321,16 @@ class DeleteOpIsIdBased : public Base {
13251321 insert (BSON (" _id" << 0 << " a" << 11 ));
13261322 insert (BSON (" _id" << 2 << " a" << 10 ));
13271323 insert (BSON (" _id" << 3 << " a" << 10 ));
1328-
1324+ // Now the collection has _ids 0, 1, 2, 3. Apply the delete oplog entries for _id 0 and 3.
13291325 applyAllOperations ();
1326+ // _id 1 and 2 remain.
13301327 ASSERT_EQUALS (2U , _client.count (nss (), BSONObj ()));
13311328 ASSERT (!one (BSON (" _id" << 1 )).isEmpty ());
13321329 ASSERT (!one (BSON (" _id" << 2 )).isEmpty ());
13331330 }
1331+
1332+ private:
1333+ LogSeverity _oldSeverity;
13341334};
13351335
13361336class All : public OldStyleSuiteSpecification {
0 commit comments