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

Wrong error message when readPreference tags are invalid

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.5.4
    • Affects Version/s: None
    • Component/s: Sharding
    • Labels:
      None
    • ALL

      If I pass an array of tag sets that includes null, mongos properly detects that the tag set isn't a BSON object, but raises the wrong error anyway:

      mongos> db.sharded_collection.findOne({$query:{shard_key: 500}, $readPreference: {mode: 'secondary', tags:[{'field': 'whatever'}, null]}})
      Thu Oct 17 11:21:13.112 JavaScript execution failed: error: { "$err" : "Failed to call say, no good nodes in replset_1", "code" : 16380 } at src/mongo/shell/query.js:L128
      

      In the log:

      Thu Oct 17 11:21:13.112 [conn5] User Assertion: 16357:Tags should be a BSON object
      Thu Oct 17 11:21:13.112 [conn5] can't callLazy replica set slave :27017:  :: caused by :: 16357 Tags should be a BSON object
      Thu Oct 17 11:21:13.112 [conn5] _check : replset_1/localhost:5000,localhost:5001,localhost:5002
      Thu Oct 17 11:21:13.112 [conn5] User Assertion: 16380:Failed to call say, no good nodes in replset_1
      

      The user should see the "Tags should be a BSON object" error, not "Failed to call say, no good nodes".

            Assignee:
            randolph@mongodb.com Randolph Tan
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: