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

removeTagRange returns {ok: 1} even as it ignores matching range

    XMLWordPrintable

Details

    Description

      I have attached a reproduction of a 3.4 sharded cluster moving from 2 to three shards with ranges in place.

      This has a compound shard key:

      sh.shardCollection("trev.historicTrackingEvent", {platformVehicleIdentifier: 1, triggerTime: 1})
      

      This works:

      sh.addTagRange("trev.historicTrackingEvent",
            { platformVehicleIdentifier: MinKey},
            { platformVehicleIdentifier: "8" },
            "A" // Zone A
      );
      

      and defaults triggerTime to MinKey

      However,

      sh.removeTagRange("trev.historicTrackingEvent",
         { platformVehicleIdentifier: MinKey},
          { platformVehicleIdentifier: "8" },
           "A"  
       );
      

      gives

      {ok:1}

      but leaves the config in config.tags.

      It needs to be changed to the following with explicit triggerTime values:

      sh.removeTagRange("trev.historicTrackingEvent",
       		{ platformVehicleIdentifier: MinKey, triggerTime: MinKey},
          { platformVehicleIdentifier: "8" , triggerTime: MinKey},
           "A" // Zone A
       );
      

      This was quite confusing and hard to troubleshoot. Perhaps sh.removeTagRange should return ok:0 when no tags match, and/or include a message? And/or use the same logic as in sh.addTagRange to default the second field to MinKey?

      Attachments

        Activity

          People

            backlog-server-sharding-emea Backlog - Sharding EMEA
            nicholas.cottrell@mongodb.com Nic Cottrell
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: