Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-21569

Improve sharded error message from majority readConcern without shard support

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.2.0-rc2
    • Component/s: Sharding
    • None
    • Sharding

      mongos> db.test.runCommand({count: "test", query: {}, readConcern: {level: "majority"}})
      {
      	"shards" : {
      		
      	},
      	"cause" : {
      		"ok" : 0,
      		"errmsg" : "Majority read concern requested, but server was not started with --enableMajorityReadConcern.",
      		"code" : 148
      	},
      	"code" : 148,
      	"ok" : 0,
      	"errmsg" : "failed on : sh01"
      }
      

      Same applies to aggregate and I imagine the others

      mongos> db.test.runCommand({count: "aggregate", pipeline: {}, readConcern: {level: "majority"}})
      {
      	"shards" : {
      		
      	},
      	"cause" : {
      		"ok" : 0,
      		"errmsg" : "Majority read concern requested, but server was not started with --enableMajorityReadConcern.",
      		"code" : 148
      	},
      	"code" : 148,
      	"ok" : 0,
      	"errmsg" : "failed on : sh01"
      }
      

      Most/all drivers only expose the "errmsg", which results in the cryptic "failed on: sh01" error message being all the users see.

      The cause.errmsg should probably overwrite the top-level errmsg similarly to how find does it:

      mongos> db.test.runCommand({find: "test", filter: {}, readConcern: {level: "majority"}})
      {
      	"ok" : 0,
      	"errmsg" : "Majority read concern requested, but server was not started with --enableMajorityReadConcern.",
      	"code" : 148
      }
      

            Assignee:
            backlog-server-sharding [DO NOT USE] Backlog - Sharding Team
            Reporter:
            bjori Hannes Magnusson
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: