[SERVER-37171] Inability to read own writes after they were acknowledged Created: 17/Sep/18  Updated: 27/Oct/23  Resolved: 17/Sep/18

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Vesselina Ratcheva (Inactive) Assignee: Backlog - Replication Team
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Replication
Operating System: ALL
Steps To Reproduce:

Repro for #1:

(function() {
 
function getOplogLastApplied(node) {
 return node.getDB("local").oplog.rs.find().sort(\{$natural: -1})[0]["ts"];
 }
 
let rst = ReplSetTest(\{name: "funWithWrites", nodes: 2});
 rst.startSet();
 rst.initiate();
 
rst.awaitNodesAgreeOnPrimary();
 let primary = rst.getPrimary();
 let secondary = rst.getSecondary();
 
let primaryBefore = getOplogLastApplied(primary);
 let secondaryBefore = getOplogLastApplied(secondary);
 
assert.eq(primaryBefore, secondaryBefore);
 
assert.writeOK(primary.getDB("test").w2write.insert(\{"a": 1}, \{w: 2}));
 
let primaryAfter = getOplogLastApplied(primary);
 let secondaryAfter = getOplogLastApplied(secondary);
 
print("ts before write: " + primaryBefore);
 print("ts after write: " + primaryAfter);
 
// Can fail
 assert.eq(primaryAfter, secondaryAfter);
 
})();

Repro for #2:

(function() {
 
function getCommittedOptimeFromPrimary(primary) {
 return assert.commandWorked(primary.adminCommand(\{replSetGetStatus: 1}))
 .optimes.lastCommittedOpTime.ts;
 }
 
let rst = ReplSetTest(\{name: "funWithWrites", nodes: 2});
 rst.startSet();
 rst.initiate();
 
rst.awaitNodesAgreeOnPrimary();
 let primary = rst.getPrimary();
 let secondary = rst.getSecondary();
 
let commitedBefore = getCommittedOptimeFromPrimary(primary);
 print("committed optime before write: " + commitedBefore);
 
assert.writeOK(primary.getDB("test").w2write.insert(\{"a": 1}, \{w: 'majority'}));
 
let committedAfter = getCommittedOptimeFromPrimary(primary);
 
// Can fail
 assert.neq(commitedBefore, committedAfter);
 
})();

Sprint: Repl 2018-10-08
Participants:

 Description   

#1: One such scenario is the following: we issue a w:2 write, it gets confirmed, then we do a direct find on the secondary oplog, but are unable to observe the write.

 #2: A different but possibly related scenario is issuing a w:majority write, then calling ReplSetGetStatus on the primary and not observing the commit point advance.

Both of these can be observed with no other writes happening in the system (e.g. no-op writer turned off).



 Comments   
Comment by Vesselina Ratcheva (Inactive) [ 17/Sep/18 ]

Confirmed that what I was observing was only  due to user error on my part. Closing this ticket.

Comment by William Schultz (Inactive) [ 17/Sep/18 ]

Question: Is the write concern ignored when specified as

{w: "majority"}

as opposed to

{writeConcern: {w:"majority"}}

Generated at Thu Feb 08 04:45:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.