summaryrefslogtreecommitdiff
path: root/jstests/replsets/cloneDb.js
diff options
context:
space:
mode:
authorKristina <kristina@10gen.com>2011-05-12 17:23:38 -0400
committerKristina <kristina@10gen.com>2011-05-12 17:23:59 -0400
commitb0aa8ca91e274e186ac89923842e35a44593b7f1 (patch)
tree48f20835e6e7bcedb222ba33203faba39576c189 /jstests/replsets/cloneDb.js
parent225227e8e217efc9757d89fd8d54f395926946d4 (diff)
downloadmongo-b0aa8ca91e274e186ac89923842e35a44593b7f1.tar.gz
debugging clone.js
Diffstat (limited to 'jstests/replsets/cloneDb.js')
-rw-r--r--jstests/replsets/cloneDb.js18
1 files changed, 10 insertions, 8 deletions
diff --git a/jstests/replsets/cloneDb.js b/jstests/replsets/cloneDb.js
index 6d2d0f30f61..2519c09b42b 100644
--- a/jstests/replsets/cloneDb.js
+++ b/jstests/replsets/cloneDb.js
@@ -6,34 +6,36 @@ doTest = function( signal ) {
var N = 2000
- // ~1KB string
+ print("~1KB string");
var Text = ''
for (var i = 0; i < 40; i++)
Text += 'abcdefghijklmnopqrstuvwxyz'
- // Create replica set
+ print("Create replica set");
var repset = new ReplicaSet ('testSet', 3) .begin()
var master = repset.getMaster()
var db1 = master.getDB('test')
- // Insert data
+ print("Insert data");
for (var i = 0; i < N; i++) {
db1['foo'].insert({x: i, text: Text})
db1.getLastError(2) // wait to be copied to at least one secondary
}
- // Create single server
+ print("Create single server");
var solo = new Server ('singleTarget')
var soloConn = solo.begin()
+ soloConn.getDB("admin").runCommand({setParameter:1,logLevel:5});
+
var db2 = soloConn.getDB('test')
- // Clone db from replica set to single server
+ print("Clone db from replica set to single server");
db2.cloneDatabase (repset.getURL())
- // Confirm clone worked
+ print("Confirm clone worked");
assert.eq (Text, db2['foo'] .findOne({x: N-1}) ['text'], 'cloneDatabase failed (test1)')
- // Now test the reverse direction
+ print("Now test the reverse direction");
db1 = master.getDB('test2')
db2 = soloConn.getDB('test2')
for (var i = 0; i < N; i++) {
@@ -43,7 +45,7 @@ doTest = function( signal ) {
db1.cloneDatabase (solo.host())
assert.eq (Text, db2['foo'] .findOne({x: N-1}) ['text'], 'cloneDatabase failed (test2)')
- // Shut down replica set and single server
+ print("Shut down replica set and single server");
solo.end()
repset.stopSet( signal )
}