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

Single shard query hits multiple shard if it includes end of chunk range

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.0.5
    • Component/s: Sharding
    • Labels:
      None
    • ALL
    • Hide
      1. Query db.sessions4.find({r: "gce-us-east1", u: {$lt: "UxOVavlFZXtKRL5MnB+1uQ=="}}).limit(2).explain()
      2. It will show that it needs to query both shards

      But if you instead remove one character from the u field:

      db.sessions4.find({r: "gce-us-east1", u: {$lt: "UxOVavlFZXtKRL5MnB+1uQ="}}).limit(2).explain()

      It will show that it only needs to query 1 shard

      Show
      Query db.sessions4.find({r: "gce-us-east1", u: {$lt: "UxOVavlFZXtKRL5MnB+1uQ=="}}).limit(2).explain() It will show that it needs to query both shards But if you instead remove one character from the u field: db.sessions4.find({r: "gce-us-east1", u: {$lt: "UxOVavlFZXtKRL5MnB+1uQ="}}).limit(2).explain() It will show that it only needs to query 1 shard

      I have a sharded collection on r,u and the following chunks:

      { "r" : "gce-us-east1", "u" : "UwAbyt9D6Zo1qlfk0XptAQ==" } -->> \{ "r" : "gce-us-east1", "u" : "Uwa+Dw0ZrJLFb7mVj/GykQ==" } on : sessions_gce_us_east1_2 Timestamp(2075, 0)
      { "r" : "gce-us-east1", "u" : "Uwa+Dw0ZrJLFb7mVj/GykQ==" } -->> \{ "r" : "gce-us-east1", "u" : "UxOVavlFZXtKRL5MnB+1uQ==" } on : sessions_gce_us_east1_2 Timestamp(2076, 0)
      { "r" : "gce-us-east1", "u" : "UxOVavlFZXtKRL5MnB+1uQ==" } -->> \{ "r" : "gce-us-east1", "u" : "UypBVrgDwfPLcNfvhz8okw==" } on : sessions_gce_us_east1 Timestamp(1, 13711)
      { "r" : "gce-us-east1", "u" : "UypBVrgDwfPLcNfvhz8okw==" } -->> \{ "r" : "gce-us-east1", "u" : "V+DYS8SwGMnenYmNyvNQsA==" } on : sessions_gce_us_east1 Timestamp(1, 13712)
      

       

      If I do a query that involves {u: "UxOVavlFZXtKRL5MnB+1uQ=="} then it will hit both shards even though it only needs to hit sessions_gce_us_east1_2.

            Assignee:
            daniel.hatcher@mongodb.com Danny Hatcher (Inactive)
            Reporter:
            james@getadmiral.com James Hartig
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: