[SERVER-8555] getlasterror on sharded cluster does not merge writtenTo field to the top level. Created: 13/Feb/13  Updated: 07/Mar/14  Resolved: 07/Mar/14

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

Type: Bug Priority: Major - P3
Reporter: Asya Kamsky Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Operating System: ALL
Participants:

 Description   

When doing a multi-write to a sharded cluster through mongos and more than one shard executes the write, GLE's writtenTo field is not populated on the top level of returned document.

Example:

{
	"shards" : [
		"st1-rs0/asyasmacbook.local:31100,asyasmacbook.local:31101,asyasmacbook.local:31102",
		"st1-rs1/asyasmacbook.local:31200,asyasmacbook.local:31201,asyasmacbook.local:31202"
	],
	"shardRawGLE" : {
		"st1-rs0/asyasmacbook.local:31100,asyasmacbook.local:31101,asyasmacbook.local:31102" : {
			"updatedExisting" : true,
			"n" : 2,
			"lastOp" : {
				"t" : 1360786163000,
				"i" : 3
			},
			"connectionId" : 21,
			"writtenTo" : [
				{
					"_id" : 0,
					"host" : "asyasmacbook.local:31100"
				},
				{
					"_id" : 1,
					"host" : "asyasmacbook.local:31101"
				},
				{
					"_id" : 2,
					"host" : "asyasmacbook.local:31102"
				}
			],
			"wtime" : 1,
			"err" : null,
			"ok" : 1
		},
		"st1-rs1/asyasmacbook.local:31200,asyasmacbook.local:31201,asyasmacbook.local:31202" : {
			"updatedExisting" : true,
			"n" : 2,
			"lastOp" : {
				"t" : 1360786163000,
				"i" : 2
			},
			"connectionId" : 19,
			"writtenTo" : [
				{
					"_id" : 0,
					"host" : "asyasmacbook.local:31200"
				},
				{
					"_id" : 1,
					"host" : "asyasmacbook.local:31201"
				},
				{
					"_id" : 2,
					"host" : "asyasmacbook.local:31202"
				}
			],
			"wtime" : 0,
			"err" : null,
			"ok" : 1
		}
	},
	"n" : 4,
	"updatedExisting" : true,
	"err" : null,
	"ok" : 1
}

You can see that two updates in each shard merged into "n:4" at the top level, but writtenTo: is not in the top level at all.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 16/Feb/13 ]

I think the real feature would be adding an option to say on a subsequent read "read a secondary i know it was written to"
Not sure that makes sense though

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