summaryrefslogtreecommitdiff
path: root/jstests/replsets/rollback3.js
diff options
context:
space:
mode:
authorKristina Chodorow <kristina@10gen.com>2010-10-07 17:24:42 -0400
committerKristina Chodorow <kristina@10gen.com>2010-10-07 17:25:06 -0400
commit9ac87ee8431481be11edac0b2c5a674c34d6f505 (patch)
tree815bbd98c3dbf1e4d7cf9b76da0f32893a8dd615 /jstests/replsets/rollback3.js
parent7f4f43d8671b8d2d334a1118b3d7a566f3d6624c (diff)
downloadmongo-9ac87ee8431481be11edac0b2c5a674c34d6f505.tar.gz
added reconnect function
Diffstat (limited to 'jstests/replsets/rollback3.js')
-rwxr-xr-xjstests/replsets/rollback3.js32
1 files changed, 23 insertions, 9 deletions
diff --git a/jstests/replsets/rollback3.js b/jstests/replsets/rollback3.js
index e9cb9a209ef..50bda7497d1 100755
--- a/jstests/replsets/rollback3.js
+++ b/jstests/replsets/rollback3.js
@@ -188,21 +188,20 @@ doTest = function (signal) {
wait(function () { return b.bar.count() == a.bar.count(); });
A.runCommand({ replSetTest: 1, blind: true });
- wait(function () { return B.isMaster().ismaster; });
+ reconnect(a,b);
+ wait(function () { try { return B.isMaster().ismaster; } catch(e) { return false; } });
doItemsToRollBack(b);
// a should not have the new data as it was in blind state.
B.runCommand({ replSetTest: 1, blind: true });
- try {
- A.runCommand({ replSetTest: 1, blind: false });
- }
- catch(e) {
- print(e);
- }
+ reconnect(a,b);
+
+ A.runCommand({ replSetTest: 1, blind: false });
+ reconnect(a,b);
wait(function () { try { return !B.isMaster().ismaster; } catch(e) { return false; } });
- wait(function () { return A.isMaster().ismaster; });
+ wait(function () { try { return A.isMaster().ismaster; } catch(e) { return false; } });
assert(a.bar.count() >= 1, "count check");
doWritesToKeep2(a);
@@ -213,6 +212,7 @@ doTest = function (signal) {
// bring B back online
// as A is primary, B will roll back and then catch up
B.runCommand({ replSetTest: 1, blind: false });
+ reconnect(a,b);
wait(function () { return B.isMaster().ismaster || B.isMaster().secondary; });
@@ -224,7 +224,21 @@ doTest = function (signal) {
pause("rollback3.js SUCCESS");
replTest.stopSet(signal);
-}
+};
+
+
+var reconnect = function(a,b) {
+ wait(function() {
+ try {
+ a.bar.stats();
+ b.bar.stats();
+ return true;
+ } catch(e) {
+ print(e);
+ return false;
+ }
+ });
+};
print("rollback3.js");
doTest( 15 );