[SERVER-53264] $listLocalSessions returns no results when executed on nonexistent database via mongos Created: 07/Dec/20  Updated: 06/Dec/22  Resolved: 18/Mar/21

Status: Closed
Project: Core Server
Component/s: Aggregation Framework, Sharding
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Patrick Freed Assignee: [DO NOT USE] Backlog - Sharding NYC
Resolution: Won't Fix Votes: 0
Labels: sharding-wfbf-day
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Sharding NYC
Operating System: ALL
Participants:

 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.)



 Comments   
Comment by Ratika Gandhi [ 18/Mar/21 ]

There is a workaround that users can run the command on any existing database to get the right answer on sharded clusters so we are closing as won't fix. 

Generated at Thu Feb 08 05:30:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.