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

investigate lack of type bracketing in shard selection code

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Sharding
    • None

      Many indexed queries are bracketed by data type. For example the index bounds for { a:

      { $gt:0 }

      } are

      	"indexBounds" : {
      		"a" : [
      			[
      				0,
      				1.7976931348623157e+308
      			]
      		]
      	},
      

      The max value of a we will scan is 1.7976931348623157e+308, not maxKey. When determining which shards a query should be sent to, though, we do not perform type bracketing. The queryutil code implements a special mode that disables bracketing just for this case. It would be helpful to understand why type bracketing is disabled.

          void ChunkManager::getShardsForQuery( set<Shard>& shards , const BSONObj& query ) const {
              OrRangeGenerator org(_ns.c_str(), query, false);
      

      (The 'false' argument disables type bracketing.)

            Assignee:
            siyuan.zhou@mongodb.com Siyuan Zhou
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: