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

Use Regular Expression for Tag Ranges

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 2.4.8
    • Fix Version/s: None
    • Component/s: Sharding
    • Labels:
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      use Contador_Noticias_UN;
      sh.enableSharding("Contador_Noticias_UN");
      db.Contador.ensureIndex(

      { NodeID: 1 }

      )
      sh.shardCollection("Contador_Noticias_UN.Contador",

      {NodeID: 1}

      );

      sh.addShardTag("Shard1", "SHARD1");
      sh.addShardTag("Shard2", "SHARD2");
      sh.addShardTag("Shard3", "SHARD3");

      sh.addTagRange( "Contador_Noticias_UN.Contador",

      { NodeID: /[0-9]*0$/ }

      ,

      { NodeID: /[0-9]*3$/ }

      ,
      "SHARD1"
      )

      sh.addTagRange( "Contador_Noticias_UN.Contador",

      { NodeID: /[0-9]*4$/ }

      ,

      { NodeID: /[0-9]*6$/ }

      ,
      "SHARD2"
      )

      sh.addTagRange( "Contador_Noticias_UN.Contador",

      { NodeID: /[0-9]*7$/ }

      ,

      { NodeID: /[0-9]*9$/ }

      ,
      "SHARD3"
      )

      Show
      use Contador_Noticias_UN; sh.enableSharding("Contador_Noticias_UN"); db.Contador.ensureIndex( { NodeID: 1 } ) sh.shardCollection("Contador_Noticias_UN.Contador", {NodeID: 1} ); sh.addShardTag("Shard1", "SHARD1"); sh.addShardTag("Shard2", "SHARD2"); sh.addShardTag("Shard3", "SHARD3"); sh.addTagRange( "Contador_Noticias_UN.Contador", { NodeID: /[0-9]*0$/ } , { NodeID: /[0-9]*3$/ } , "SHARD1" ) sh.addTagRange( "Contador_Noticias_UN.Contador", { NodeID: /[0-9]*4$/ } , { NodeID: /[0-9]*6$/ } , "SHARD2" ) sh.addTagRange( "Contador_Noticias_UN.Contador", { NodeID: /[0-9]*7$/ } , { NodeID: /[0-9]*9$/ } , "SHARD3" )

      Description

      The following ranges are not working when I try to shard a collection using the NodeID field (It does not work using NodeID as a string or number)

      sh.addTagRange( "Contador_Noticias_UN.Contador",
                      { NodeID: /[0-9]*0$/ },
                      { NodeID: /[0-9]*3$/ },
                      "SHARD1"
                    )
       
      sh.addTagRange( "Contador_Noticias_UN.Contador",
                      { NodeID: /[0-9]*4$/ },
                      { NodeID: /[0-9]*6$/ },
                      "SHARD2"
                    )
       
       
       
      sh.addTagRange( "Contador_Noticias_UN.Contador",
                      { NodeID: /[0-9]*7$/ },
                      { NodeID: /[0-9]*9$/ },
                      "SHARD3"
                    )

      This tag ranges, must divide my workload depending of the last number of the NodeID value to 3 servers identified by the tags SHARD1, SHARD2 and SHARD3.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: