diff options
author | David Storch <david.storch@10gen.com> | 2015-07-07 17:53:55 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2015-07-08 10:34:31 -0400 |
commit | dd3c12c2e331cd423319278e751ba38b7c5437ef (patch) | |
tree | 5f2c34a0bd2af83a43e687432ee2cb8b008bb360 | |
parent | 332781c598c51e19001e05727679901a94c7fe27 (diff) | |
download | mongo-dd3c12c2e331cd423319278e751ba38b7c5437ef.tar.gz |
SERVER-2454 fix resync.js test to handle collection scan dying due to its position in a capped collection being deleted
-rwxr-xr-x | jstests/replsets/resync.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/jstests/replsets/resync.js b/jstests/replsets/resync.js index af75d8bb813..49eb570a318 100755 --- a/jstests/replsets/resync.js +++ b/jstests/replsets/resync.js @@ -39,7 +39,18 @@ function hasCycled() { var oplog = a_conn.getDB("local").oplog.rs; - return oplog.find( { "o.x" : 1 } ).sort( { $natural : 1 } ).limit(10).itcount() == 0; + try { + // Collection scan to determine if the oplog entry from the first insert has been + // deleted yet. + return oplog.find( { "o.x" : 1 } ).sort( { $natural : 1 } ).limit(10).itcount() == 0; + } + catch (except) { + // An error is expected in the case that capped deletions blow away the position of the + // collection scan during a yield. In this case, we just try again. + var errorRegex = /CappedPositionLost/; + assert(errorRegex.test(except.message)); + return hasCycled(); + } } // Make sure the oplog has rolled over on the primary and secondary that is up, |