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

mongos aggregate() incorrectly returns empty results before shards are connected

    • Type: Icon: Bug Bug
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Labels:
      None
    • Query Optimization
    • ALL
    • Query Optimization 2021-04-05, Query Optimization 2021-04-19, Query Optimization 2021-05-03, Query Optimization 2021-05-17, Query Optimization 2021-05-31, Query Optimization 2021-06-14, Query Optimization 2021-06-28, Query Optimization 2021-07-12, Query Optimization 2021-07-26, QO 2021-09-06, Query Optimization 2021-08-09, QO 2021-09-20, QO 2021-10-04, QO 2021-10-18, QO 2021-11-01, QO 2021-11-15, QO 2021-11-29, QO 2021-12-13, QO 2021-12-27, QO 2022-01-10, QO 2022-01-24, QO 2022-02-07, QO 2022-02-21, QO 2022-03-07, QO 2022-03-21, QO 2021-08-23, QO 2022-04-04, QO 2022-04-18, QO 2022-05-02, QO 2022-05-16, QO 2022-05-30, QO 2022-06-13, QO 2022-06-27, QO 2022-07-11

      When getting "routing info" for a sharded query, mongos will return an empty result set if there are no shards connected. See here.

      This includes the case where the data is owned by the config servers.

      Repro:

       Start CSRS:

      ./mongod --configsvr --replSet csrs --dbpath ~/data/ --bind_ip localhost --port 20001 

      Run rs.initiate()

      ./mongo --port 20001
      > rs.initiate()
      

      Start mongos, connect it to the config server.

      ./mongos --configdb csrs/localhost:20001 --bind_ip localhost --port 20002
      

      Connect to mongos and run a find() query followed by an equivalent aggregation.

      ./mongo --port 20002
      > use config
      > db.mongos.find()
      // Returns something
      > db.mongos.aggregate([])
      // Takes the path linked to earlier. Returns nothing.
      

       

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            ian.boros@mongodb.com Ian Boros
            Votes:
            0 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: