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

Allow findAndModify and delete one to target by query instead of extracted shard key

    XMLWordPrintable

Details

    • Improvement
    • Status: Backlog
    • Major - P3
    • Resolution: Unresolved
    • None
    • None
    • Sharding

    Description

      findAndModify and delete with justOne=true must be targeted to a single shard which they check by extracting a shard key from their query and targeting the chunk that owns that key. This is done through ShardKeyPattern::extractShardKeyFromQuery() which requires a simple query that will exactly match some value, e.g. {skey: 5} or {skey; {$eq: 5}}. More complex queries that don't produce an exact match, but can still be targeted to a single shard are currently rejected.

      This could be improved by changing findAndModify and delete to target using ChunkManager::getShardIdsForQuery(), which returns the shards that own ranges that overlap with the shard key index bounds generated by the query (after checking for an exact shard key match first), and throwing if more than one shard is targeted. This is already how an update is targeted by its query .

      Attachments

        Issue Links

          Activity

            People

              backlog-server-sharding-nyc Backlog - Sharding NYC
              jack.mulrow@mongodb.com Jack Mulrow
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: