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

« back to all changes in this revision

Viewing changes to jstests/dbhash.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
 
 
2
 
a = db.dbhasha;
3
 
b = db.dbhashb;
4
 
 
5
 
a.drop();
6
 
b.drop();
7
 
 
8
 
// debug SERVER-761
9
 
db.getCollectionNames().forEach( function( x ) { 
10
 
                                v = db[ x ].validate();
11
 
                                if ( !v.valid ) {
12
 
                                    print( x );
13
 
                                    printjson( v );
14
 
                                }
15
 
                                } );
16
 
 
17
 
function dbhash( mydb ) {
18
 
    var ret = mydb.runCommand( "dbhash" );
19
 
    assert.commandWorked( ret, "dbhash failure" );
20
 
    return ret;
21
 
}
22
 
 
23
 
function gh( coll , mydb ){
24
 
    if ( ! mydb ) mydb = db;
25
 
    var x = dbhash( mydb ).collections[coll.getName()];
26
 
    if ( ! x )
27
 
        return "";
28
 
    return x;
29
 
}
30
 
 
31
 
function dbh( mydb ){
32
 
    return dbhash( mydb ).md5;
33
 
}
34
 
 
35
 
assert.eq( gh( a ) , gh( b ) , "A1" );
36
 
 
37
 
a.insert( { _id : 5 } );
38
 
assert.neq( gh( a ) , gh( b ) , "A2" );
39
 
 
40
 
b.insert( { _id : 5 } );
41
 
assert.eq( gh( a ) , gh( b ) , "A3" );
42
 
 
43
 
dba = db.getSisterDB( "dbhasha" );
44
 
dbb = db.getSisterDB( "dbhashb" );
45
 
 
46
 
dba.dropDatabase();
47
 
dbb.dropDatabase();
48
 
 
49
 
assert.eq( gh( dba.foo , dba ) , gh( dbb.foo , dbb ) , "B1" );
50
 
assert.eq( dbh( dba ) , dbh( dbb ) , "C1" );
51
 
 
52
 
dba.foo.insert( { _id : 5 } );
53
 
assert.neq( gh( dba.foo , dba ) , gh( dbb.foo , dbb ) , "B2" );
54
 
assert.neq( dbh( dba ) , dbh( dbb ) , "C2" );
55
 
 
56
 
dbb.foo.insert( { _id : 5 } );
57
 
assert.eq( gh( dba.foo , dba ) , gh( dbb.foo , dbb ) , "B3" );
58
 
assert.eq( dbh( dba ) , dbh( dbb ) , "C3" );