0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

SERVER-55045 Add additional logging for resume_after_against_oplog.js

This commit is contained in:
Samy Lanka 2021-03-15 16:01:41 +00:00 committed by Evergreen Agent
parent 2250938b17
commit e902405b80
2 changed files with 19 additions and 3 deletions

View File

@ -8,7 +8,10 @@
(function() {
"use strict";
const rst = new ReplSetTest({nodes: 1});
const rst = new ReplSetTest({
nodes: 1,
nodeOptions: {setParameter: {logComponentVerbosity: tojson({command: 2, query: 5})}}
});
rst.startSet();
rst.initiate();
@ -239,7 +242,10 @@ jsTestLog("Running tailable query on the oplog with no results");
assert.eq(timestampCmp(resumeToken2.ts, resumeToken1.ts), 0);
// Insert dummy data so the next getMore should have a higher resume token.
assert.commandWorked(node.getDB(dbName).getCollection(collName + "_other").insert({dummy: 1}));
const latestOpTime = assert
.commandWorked(node.getDB(dbName).runCommand(
{insert: collName + "_other", documents: [{dummy: 1}]}))
.opTime;
jsTest.log("Run another tailable getMore with no results");
const resGetMore2 = assert.commandWorked(
@ -249,7 +255,11 @@ jsTestLog("Running tailable query on the oplog with no results");
// Resume token should be greater than the last getMore's.
const resumeToken3 = assertExpectedResumeTokenFormat(resGetMore2);
assert.eq(timestampCmp(resumeToken3.ts, resumeToken2.ts), 1);
assert.eq(timestampCmp(resumeToken3.ts, resumeToken2.ts), 1, tojson({
currentResumeToken: resumeToken3,
lastResumeToken: resumeToken2,
latestOpTime: latestOpTime
}));
// Kill the tailable cursor.
assert.commandWorked(localDb.runCommand({killCursors: "oplog.rs", cursors: [cursorId]}));

View File

@ -223,6 +223,12 @@ void CollectionScan::setLatestOplogEntryTimestamp(const Record& record) {
"but found a result without a valid 'ts' field: "
<< record.data.toBson().toString(),
tsElem.type() == BSONType::bsonTimestamp);
LOGV2_DEBUG(550450,
5,
"Setting _latestOplogEntryTimestamp to the max of the timestamp of the current "
"latest oplog entry and the timestamp of the current record",
"latestOplogEntryTimestamp"_attr = _latestOplogEntryTimestamp,
"currentRecordTimestamp"_attr = tsElem.timestamp());
_latestOplogEntryTimestamp = std::max(_latestOplogEntryTimestamp, tsElem.timestamp());
}