diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-09-01 15:59:19 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-09-01 15:59:19 -0400 |
commit | 7c11076e7334c6420d33f9d442f7eb3ddba4f4d4 (patch) | |
tree | d1aadc32e7f628f4d2fbe4c45fab3ececa40c81b /jstests | |
parent | 184870bf95a09ae696d0c1e2326d5145186b1170 (diff) | |
download | mongo-7c11076e7334c6420d33f9d442f7eb3ddba4f4d4.tar.gz |
can't shard system namespaces
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/sharding/features1.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/jstests/sharding/features1.js b/jstests/sharding/features1.js new file mode 100644 index 00000000000..a44f58da105 --- /dev/null +++ b/jstests/sharding/features1.js @@ -0,0 +1,40 @@ +// features1.js + +s = new ShardingTest( "features1" , 2 , 1 , 1 ); + +s.adminCommand( { enablesharding : "test" } ); + +// ---- can't shard system namespaces ---- + +assert( ! s.admin.runCommand( { shardcollection : "test.system.blah" , key : { num : 1 } } ).ok , "shard system namespace" ); + +// ---- setup test.foo ----- + +s.adminCommand( { shardcollection : "test.foo" , key : { num : 1 } } ); + +db = s.getDB( "test" ); + +a = s._connections[0].getDB( "test" ); +b = s._connections[1].getDB( "test" ); + +s.adminCommand( { split : "test.foo" , middle : { num : 10 } } ); +s.adminCommand( { movechunk : "test.foo" , find : { num : 20 } , to : s.getOther( s.getServer( "test" ) ).name } ); + +db.foo.save( { num : 5 } ); +db.foo.save( { num : 15 } ); + +s.sync(); + +// ---- make sure shard key index is everywhere ---- + +assert.eq( 2 , a.foo.getIndexKeys().length , "a index 1" ); +assert.eq( 2 , b.foo.getIndexKeys().length , "b index 1" ); + +// ---- make sure if you add an index it goes everywhere ------ + +db.foo.ensureIndex( { x : 1 } ); + +//assert.eq( 3 , a.foo.getIndexKeys().length , "a index 2" ); +//assert.eq( 3 , b.foo.getIndexKeys().length , "b index 2" ); + +s.stop() |