~ubuntu-branches/ubuntu/utopic/mongodb/utopic

« back to all changes in this revision

Viewing changes to jstests/slowNightly/sharding_multiple_collections.js

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-07-03 09:23:46 UTC
  • mfrom: (1.3.10) (44.1.14 sid)
  • Revision ID: package-import@ubuntu.com-20140703092346-c5bvt46wnzougyly
Tags: 1:2.6.3-0ubuntu1
* New upstream stable release:
  - Dropped patches, included upstream:
    + 0003-All-platforms-but-Windows-find-hash-in-std-tr1.patch
    + 0008-Use-system-libstemmer.patch
    + 0011-Use-a-signed-char-to-store-BSONType-enumerations.patch
    + 0001-SERVER-12064-Atomic-operations-for-gcc-non-Intel-arc.patch
    + 0002-SERVER-12065-Support-ARM-and-AArch64-builds.patch
  - d/p/*: Refreshed/rebased remaining patches.
  - Use system provided libyaml-cpp:
    + d/control: Add libyaml-cpp-dev to BD's.
    + d/rules: Enable --with-system-yaml option.
    + d/p/fix-yaml-detection.patch: Fix detection of libyaml-cpp library.
  - d/mongodb-server.mongodb.upstart: Sync changes from upstream.
  - d/control,mongodb-dev.*: Drop mongodb-dev package; it has no reverse
    dependencies and upstream no longer install header files.
  - d/NEWS: Point users to upstream upgrade documentation for upgrades
    from 2.4 to 2.6.
* Merge from Debian unstable.
* d/control: BD on libv8-3.14-dev to ensure that transitioning to new v8
  versions is a explicit action due to changes in behaviour in >= 3.25
  (LP: #1295723).
* d/mongodb-server.prerm: Dropped debug echo call from maintainer script
  (LP: #1294455).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// multcollections.js
2
 
 
3
 
s = new ShardingTest( "multcollections" , 2 , 1 , 1 , { chunksize : 1 }  );
4
 
 
5
 
s.adminCommand( { enablesharding : "test" } );
6
 
 
7
 
db = s.getDB( "test" )
8
 
 
9
 
N = 100000
10
 
 
11
 
S = ""
12
 
while ( S.length < 500 )
13
 
    S += "123123312312";
14
 
 
15
 
for ( i=0; i<N; i++ ){
16
 
    db.foo.insert( { _id : i , s : S } )
17
 
    db.bar.insert( { _id : i , s : S , s2 : S } )
18
 
    db.getLastError()
19
 
}
20
 
 
21
 
db.printShardingStatus()
22
 
 
23
 
function mytest( coll , i , loopNumber ){
24
 
    x = coll.find( { _id : i } ).explain();
25
 
    if ( x )
26
 
        return;
27
 
    throw "can't find " + i + " in " + coll.getName() + " on loopNumber: " + loopNumber +  " explain: " + tojson( x );
28
 
}
29
 
 
30
 
loopNumber = 0
31
 
while ( 1 ){
32
 
    for ( i=0; i<N; i++ ){
33
 
        mytest( db.foo , i , loopNumber );
34
 
        mytest( db.bar , i , loopNumber );
35
 
        if ( i % 1000 == 0 )
36
 
            print( i )
37
 
    }
38
 
    db.printShardingStatus()
39
 
    loopNumber++;
40
 
 
41
 
    if ( loopNumber == 1 ){
42
 
        s.adminCommand( { shardcollection : "test.foo" , key : { _id : 1 } } );
43
 
        s.adminCommand( { shardcollection : "test.bar" , key : { _id : 1 } } );
44
 
    }
45
 
        
46
 
    assert( loopNumber < 1000 , "taking too long" );
47
 
 
48
 
    if ( s.chunkDiff( "foo" ) < 12 && s.chunkDiff( "bar" ) < 12 )
49
 
        break
50
 
}
51
 
 
52
 
s.stop()
53