diff options
author | hari devaraj <hari.devaraj@10gen.com> | 2016-06-17 15:53:36 -0400 |
---|---|---|
committer | Siyuan Zhou <visualzhou@gmail.com> | 2017-01-18 21:29:02 -0500 |
commit | 12ae6869bef461d9604d667df726825bcaa35e32 (patch) | |
tree | 8f6a1168a26e28bbdac2469f3b61d442728cf1d4 /jstests/replsets/drain.js | |
parent | 6f2efcb09ca00560471bce88ab725ee0cfb72403 (diff) | |
download | mongo-12ae6869bef461d9604d667df726825bcaa35e32.tar.gz |
SERVER-21432 Allowed slaveOk reads when node is in drain mode
(cherry picked from commit dd7e05dbde9f1e9554ad93cada8fb4d5dcbe11de)
Diffstat (limited to 'jstests/replsets/drain.js')
-rw-r--r-- | jstests/replsets/drain.js | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/jstests/replsets/drain.js b/jstests/replsets/drain.js index 7f170c485d9..a81d45f1d10 100644 --- a/jstests/replsets/drain.js +++ b/jstests/replsets/drain.js @@ -43,7 +43,7 @@ } assert.writeOK(bulk.execute()); jsTestLog('Number of documents inserted into collection on primary: ' + numDocuments); - assert.eq(numDocuments, primary.getDB("foo").foo.find().itcount()); + assert.eq(numDocuments, primary.getDB("foo").foo.count()); assert.soon(function() { var serverStatus = secondary.getDB('foo').serverStatus(); @@ -75,12 +75,7 @@ "find failed with unexpected error code: " + tojson(res)); // Nor should it be readable with the slaveOk bit. secondary.slaveOk = true; - res = secondary.getDB("foo").runCommand({find: "foo"}); - assert.commandFailed(res); - assert.eq(ErrorCodes.NotMasterOrSecondary, - res.code, - "find failed with unexpected error code: " + tojson(res)); - secondary.slaveOk = false; + assert.commandWorked(secondary.getDB("foo").runCommand({find: "foo"})); assert.commandFailedWithCode( secondary.adminCommand({ @@ -110,5 +105,5 @@ // Check for at least two entries. There was one prior to freezing op application on the // secondary and we cannot guarantee all writes reached the secondary's op queue prior to // shutting down the original primary. - assert.gte(primary.getDB("foo").foo.find().itcount(), 2); + assert.gte(primary.getDB("foo").foo.count(), 2); })(); |