[SERVER-8278] getLastError returns replicatedTo which is different than value of "w" Created: 22/Jan/13  Updated: 11/Jul/16  Resolved: 07/Feb/13

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: 2.3.2
Fix Version/s: 2.4.0-rc1

Type: Bug Priority: Major - P3
Reporter: Asya Kamsky Assignee: Kristina Chodorow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-8263 getLastError returns hosts replicated... Closed
related to SERVER-7681 Report majority number in ReplSetGetS... Closed
Operating System: ALL
Participants:

 Description   

When getlasterror is called with w:3 the number 3 represents the total number of nodes that have the write when getlasterror returns null err.

However, implementation of SERVER-4073 returns just replicatedTo members, omitting the primary which also has the write.

Aside from it being difficult to later track if application logs have the full writeResult but no information about which node was primary (and also has the write) it also feels unintuitive.

I think it would be less confusing to end user if w:3 returns a structure with writtenTo: [node list] that on success is greater-than or equal the "w" value and on failure or timeout writtenTo.length will be shorter than "w".

Here's an example:

{
	"updatedExisting" : true,
	"n" : 1,
	"lastOp" : {
		"t" : 1358883684000,
		"i" : 1
	},
	"connectionId" : 1,
	"wtimeout" : true,
	"waited" : 2000,
	"replicatedTo" : [ ],
	"err" : "timeout",
	"ok" : 1
}



 Comments   
Comment by auto [ 07/Feb/13 ]

Author:

{u'date': u'2013-02-07T21:37:59Z', u'email': u'kristina@10gen.com', u'name': u'Kristina'}

Message: SERVER-8278 Change replicatedTo to writtenTo and add primary to list
Branch: master
https://github.com/mongodb/mongo/commit/1ea40396c4f6ce9679c336d6c948b11b059cbec2

Comment by Scott Hernandez (Inactive) [ 22/Jan/13 ]

Remember that w might be a string (getLsstErrorMode) and set of tags so this logic isn't nec. useful. But it would be good to have the replicatedInfo array be a list of embedded docs including tags if w != number.

Generated at Thu Feb 08 03:17:00 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.