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

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

    • Sharding EMEA
    • Sharding EMEA 2023-05-15, Sharding EMEA 2023-05-29

      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?

        1. steps-2-to-3.js
          4 kB
          Nic Cottrell

            Assignee:
            pol.pinol@mongodb.com Pol Pinol
            Reporter:
            nicholas.cottrell@mongodb.com Nic Cottrell
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: