[SERVER-12971] Use Regular Expression for Tag Ranges Created: 28/Feb/14  Updated: 10/Dec/14  Resolved: 02/Jun/14

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.4.8
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Jairo Perez Assignee: Ramon Fernandez Marina
Resolution: Done Votes: 0
Labels: sharding
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-9527 create shard tag ranges for name spac... Open
Operating System: ALL
Steps To Reproduce:

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"
)

Participants:

 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.



 Comments   
Comment by Ramon Fernandez Marina [ 02/Jun/14 ]

jjperez@cadena-capriles.com, we're resolving this ticket after Eliot's answer. Someone already requested this feature in SERVER-9527, so any progress will be logged there.

Comment by Eliot Horowitz (Inactive) [ 28/Feb/14 ]

Tag ranges can't use regexes right now, you have to specify the actual min and max keys.

Generated at Thu Feb 08 03:30:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.