Skip to content

Commit 8b32d75

Browse files
ajdavisevergreen
authored andcommitted
SERVER-43399 Log more in DeleteOpIsIdBased test
Also clean up unused function in repltests.cpp.
1 parent 71fd21e commit 8b32d75

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ void WiredTigerOplogManager::waitForAllEarlierOplogWritesToBeVisible(
140140
currentLatestVisibleTimestamp = newLatestVisibleTimestamp;
141141
RecordId latestVisible = RecordId(currentLatestVisibleTimestamp);
142142
if (latestVisible < waitingFor) {
143-
LOG(2) << "Operation is waiting for " << waitingFor << "; latestVisible is "
144-
<< Timestamp(currentLatestVisibleTimestamp);
143+
LOG(2) << "Operation is waiting for " << Timestamp(waitingFor.repr())
144+
<< "; latestVisible is " << Timestamp(currentLatestVisibleTimestamp);
145145
}
146146
return latestVisible >= waitingFor;
147147
});

src/mongo/dbtests/repltests.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,17 @@
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

5354
using namespace mongo::repl;
5455

5556
namespace ReplTests {
5657

58+
using mongo::logger::globalLogDomain;
59+
using mongo::logger::LogComponent;
60+
using mongo::logger::LogSeverity;
5761
using std::endl;
5862
using std::string;
5963
using 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

13131298
class DeleteOpIsIdBased : public Base {
13141299
public:
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

13361336
class All : public OldStyleSuiteSpecification {

0 commit comments

Comments
 (0)