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

$listLocalSessions returns no results when executed on nonexistent database via mongos

    XMLWordPrintableJSON

Details

    • Sharding NYC
    • ALL

    Description

      In sharded deployments, executing a database-level aggregation with the $listLocalSessions pipeline stage only returns any results when it is executed against databases that exist. In replica sets, the aggregation always returns results regardless of the underlying database. This seems to be an issue going all the way back to 3.6.

      repro:

      Sharded Cluster:

      mongos> const pipeline = [ { "$listLocalSessions": {} } ];
      mongos> const session = db.getMongo().startSession()
      mongos> db.aggregate(pipeline)
      mongos> db.test.insertOne({})
      {
      	"acknowledged" : true,
      	"insertedId" : ObjectId("5fcea6daecc15f1160586098")
      }
      mongos> db.aggregate(pipeline)
      { "_id" : { "id" : UUID("dbbab220-cbbc-44c2-a5e8-da85418e626e"), "uid" : BinData(0,"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=") }, "lastUse" : ISODate("2020-12-07T22:04:13.112Z") }
      

      Replica Set:

      phil:PRIMARY> const pipeline = [ { "$listLocalSessions": {} } ];
      phil:PRIMARY> const session = db.getMongo().startSession()
      phil:PRIMARY> db.aggregate(pipeline)
      { "_id" : { "id" : UUID("3c98e3dc-066e-444e-b85a-736eb0e8075f"), "uid" : BinData(0,"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=") }, "lastUse" : ISODate("2020-12-07T22:06:07.505Z") }
      { "_id" : { "id" : UUID("1479a5ac-f981-4a37-a5fe-e4a70c81d144"), "uid" : BinData(0,"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=") }, "lastUse" : ISODate("2020-12-07T22:05:42.545Z") }
      
      

      (I've assigned this to the sharding backlog because I'm required to provide one, though I'm not sure if that's the correct place. Sorry in advance if it isn't.)

      Attachments

        Activity

          People

            backlog-server-sharding-nyc [DO NOT USE] Backlog - Sharding NYC
            patrick.freed@mongodb.com Patrick Freed
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: