summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2011-09-06 23:41:54 -0400
committerMathias Stearn <mathias@10gen.com>2011-09-06 23:46:18 -0400
commit6362013e418bd0ed854ef6d623e07b44ba2f6b3c (patch)
treeafd08f45dd428c129471a18cbff4ba0044fffab7
parent41f0781429225f979cdd2b19e09ca696729860f5 (diff)
downloadmongo-6362013e418bd0ed854ef6d623e07b44ba2f6b3c.tar.gz
Queries for rollback objects need SlaveOk bit SERVER-3650
-rw-r--r--db/repl/rs_rollback.cpp2
-rw-r--r--jstests/replsets/rollback4.js19
2 files changed, 14 insertions, 7 deletions
diff --git a/db/repl/rs_rollback.cpp b/db/repl/rs_rollback.cpp
index cce5c091074..f012e6577a8 100644
--- a/db/repl/rs_rollback.cpp
+++ b/db/repl/rs_rollback.cpp
@@ -341,7 +341,7 @@ namespace mongo {
{
/* TODO : slow. lots of round trips. */
n++;
- bo good= them->findOne(d.ns, d._id.wrap()).getOwned();
+ bo good= them->findOne(d.ns, d._id.wrap(), NULL, QueryOption_SlaveOk).getOwned();
totSize += good.objsize();
uassert( 13410, "replSet too much data to roll back", totSize < 300 * 1024 * 1024 );
diff --git a/jstests/replsets/rollback4.js b/jstests/replsets/rollback4.js
index b88c0424d85..f4de94132d9 100644
--- a/jstests/replsets/rollback4.js
+++ b/jstests/replsets/rollback4.js
@@ -1,4 +1,4 @@
-if (0) { // disabled due to SERVER-3650
+if (1) { // SERVER-3650
var num = 7;
var host = getHostName();
@@ -45,25 +45,26 @@ replTest.partition(2,5)
replTest.partition(2,6)
printjson({endPartition: new Date()});
-var gotOneThrough = false
+var gotThrough = 0
try {
while (true){
mColl.insert({})
- out = master.adminCommand({getLastError:1});
+ out = master.adminCommand({getLastError:1, w:3});
if (out.err)
break;
- gotOneThrough = true;
+ gotThrough++;
}
}
catch (e) {
print("caught exception");
}
+printjson({gotThrough: gotThrough});
printjson({cantWriteOldPrimary: new Date()});
printjson(master.adminCommand("replSetGetStatus"));
-assert(gotOneThrough, "gotOneThrough");
+assert(gotThrough > 0, "gotOneThrough");
sleep(5*1000); // make sure new seconds field in opTime
@@ -78,6 +79,8 @@ m2Coll.insert(sentinel);
printjson(master2.adminCommand({getLastError:1, w:4, wtimeout:30*1000}));
printjson(master2.adminCommand("replSetGetStatus"));
+m2Coll.insert({}); // this shouldn't be necessary but the next GLE doesn't work without it
+
printjson({startUnPartition: new Date()});
replTest.unPartition(0,3)
replTest.unPartition(0,4)
@@ -93,10 +96,14 @@ replTest.unPartition(2,5)
replTest.unPartition(2,6)
printjson({endUnPartition: new Date()});
-m2Coll.insert({}); // this shouldn't be necessary but the next line doesn't work without it
printjson(master2.adminCommand({getLastError:1, w:7, wtimeout:30*1000}));
printjson(master2.adminCommand("replSetGetStatus"));
+assert.soon(function() {return master.adminCommand('isMaster').ismaster},
+ "Node 0 back to primary",
+ 60*1000/*needs to be longer than LeaseTime*/);
+printjson(master.adminCommand("replSetGetStatus"));
+
// make sure old master rolled back to new master
assert.eq(m2Coll.count(sentinel), 1, "check sentinal on node 6");
assert.eq(mColl.count(sentinel), 1, "check sentinal on node 0");