Compare commits

...

85 Commits

Author SHA1 Message Date
Ernie Hershey
5a38be48f5 bump tools to 3.2.1 2015-12-17 17:20:43 -05:00
Scott Hernandez
6331c474ba SERVER-21930 - Restart oplog query if oplog entries are out of order
(cherry picked from commit 06ff25a41c)
(cherry picked from commit ac919e0161)
2015-12-17 16:12:21 -05:00
Scott Hernandez
db3259d651 Revert "SERVER-21930 - Restart oplog query if oplog entries are out of order"
This reverts commit 06ff25a41c.

(cherry picked from commit 9ef32d72f3)
2015-12-17 15:41:30 -05:00
Scott Hernandez
466dae32f1 SERVER-21930 - Restart oplog query if oplog entries are out of order
(cherry picked from commit 06ff25a41c)
2015-12-17 14:32:38 -05:00
Siyuan Zhou
f785174734 SERVER-21868 Shutdown may not be handled correctly in oplog application.
(cherry picked from commit ac70c5eb4d)
2015-12-17 14:23:25 -05:00
Kamran Khan
285f6dea07 SERVER-21923 Propagate ReplSetTest.awaitSecondaryNodes timeout values
Previously, the supplied timeout would not be propagated to the getPrimary
call, which could result in shorter timeouts for awaitSecondaryNodes and
initiate calls.

(cherry picked from commit c0e329b959)
2015-12-17 13:41:43 -05:00
Max Hirschhorn
27692afcd0 SERVER-21920 Use next_random_sample_size when sampling the oplog.
This allows the random cursor to account for skew in the WiredTiger
B-tree when taking samples for oplog stones.

(cherry picked from commit 4463e0366b)
2015-12-16 17:04:37 -05:00
Dan Pasette
3383181860 Import wiredtiger-wiredtiger-mongodb-3.2-rc4-75-gdecd916.tar.gz from wiredtiger branch mongodb-3.2
ref: 197eef0..decd916

48e1343 WT-2262 Have random sampling walk the tree so it isn't biased in skewed trees.
eb838c7 WT-2260 Avoid adding internal pages to the eviction queue.
a695751 WT-2258 WiredTiger preloads pages even when direct-IO is configured.
2015-12-16 13:15:46 -05:00
David Storch
a014a946bd SERVER-21772 correctly profile and log findAndModify operations
(cherry picked from commit 95c072ee0a)
2015-12-15 19:17:36 -05:00
David Storch
cc9e9ae59d SERVER-21772 remove dead method CurOp::setDbProfileLevel
(cherry picked from commit 840252b267)
2015-12-15 19:17:20 -05:00
Mark Benvenuto
c7b0652274 Revert "SERVER-20991 Change WiredTiger caching strategy on Windows"
This reverts commit 884644ac56.
2015-12-15 18:57:33 -05:00
Spencer Jackson
f994214666 SERVER-21724 Let backup role read system.profile
(cherry picked from commit 21bcf6b127)
2015-12-15 16:13:28 -05:00
Randolph Tan
42ab40b9cc SERVER-21704 JS Test single_node_config_server_smoke has race condition
(cherry picked from commit 9f8d1f830e)
2015-12-15 16:12:21 -05:00
Kamran Khan
1067ba3603 SERVER-21901 CheckReplDBHash checks wrong node when printing missing docs
(cherry picked from commit 1ef94fe109)
2015-12-15 14:24:49 -05:00
Spencer Jackson
30585ab4b4 SERVER-21890 Allow realm to be set in SSPI shell
(cherry picked from commit 4b37c81ddf)
2015-12-15 11:18:46 -05:00
Sam Kleinman
d66acd141e SERVER-21864: streamline use of expansions in package signing 2015-12-14 22:09:55 -05:00
Sam Kleinman
40022a2fb1 SERVER-21793: fix expansion script for 3.2 2015-12-14 21:15:00 -05:00
Misha Tyulenev
126cecc636 SERVER-21706 error when mapReduce outputs to config or admin db
(cherry picked from commit 3e1a3872c9)
2015-12-14 19:29:59 -05:00
Kaloian Manassiev
5770fdcdf7 SERVER-21050 Make the 'causedBy' reports more descriptive 2015-12-14 17:44:08 -05:00
Kaloian Manassiev
7468a98c83 SERVER-21050 Lower verbose WT logging 2015-12-14 17:44:07 -05:00
Kamran Khan
ecbc309ccb SERVER-21885 Make capped_truncate.js work with resmoke.py --repeat
Previously, the test assumed that a collection would not exist prior
to calling 'create' on it.  The collection is now dropped beforehand
to ensure this condition is true.

(cherry picked from commit 30d55cccf8)
2015-12-14 15:16:53 -05:00
Spencer Jackson
337faaf74a SERVER-21824 Remove kmip.js from blacklist
(cherry picked from commit e946c39948)
2015-12-14 15:00:36 -05:00
Scott Hernandez
b7e9e964c6 SERVER-21795: Do not reschedule more than one liveness timeout callback at a time
(cherry picked from commit 5ab583935e)
2015-12-14 12:36:56 -05:00
Spencer T Brody
335c1ce2d1 SERVER-21076 Add jstest for mapReduce and aggregation properly handling shard versioning
(cherry picked from commit 62f3810a0a)
2015-12-14 11:48:11 -05:00
Randolph Tan
2d853ea493 SERVER-21871 Do not run min_optime_recovery.js on ephemeralForTest storageEngine
(cherry picked from commit eb83308150)
2015-12-14 10:16:53 -05:00
Hannes Magnusson
adbb4b5fd3 SERVER-21870: Add space between "supports" and "snapshots" in error message
Signed-off-by: Ramon Fernandez <ramon@mongodb.com>

(cherry picked from commit 0d715aae5c)
2015-12-13 12:50:35 +01:00
Kaloian Manassiev
2cb657a2ae SERVER-21050 Fix broken replsetrestart1.js 2015-12-11 16:51:19 -05:00
Kaloian Manassiev
e7f86df75b SERVER-21854 Add request id to RemoteCommandRequest
Having identifier associated with each request allows us to trace requests
throughout the ASIO network threads.

This change doesn't fix the bug, but makes investigation easier.
2015-12-11 15:57:38 -05:00
David Storch
70c96afa6c SERVER-21852 fix more flakiness in kill_cursors.js
(cherry picked from commit 0ce05c7d8c)
2015-12-11 14:42:46 -05:00
Jonathan Abrahams
cdcdad5d5d SERVER-21665 Suppress tar output in jstestfuzz tasks
(cherry picked from commit 1aa857bb87)
2015-12-11 14:11:59 -05:00
Jonathan Abrahams
52a93ee85f SERVER-21768 Remove the 'numCollections' field from dbHash's response
(cherry picked from commit 9689f7e884)
2015-12-11 14:10:18 -05:00
David Storch
6670ca3ffa SERVER-21750 clean up getMore logging and profiling
--Omit ntoreturn and ntoskip from the getMore command log line.
--Add nreturned to the getMore command log line.
--Upconvert OP_GET_MORE profiler entries to match getMore cmd.

(cherry picked from commit bb7e1e539d)
2015-12-11 13:33:44 -05:00
Kaloian Manassiev
218539ae2c SERVER-21848 CSRS catalog manager should not allow batch writes greater than 1 2015-12-11 13:32:56 -05:00
Kaloian Manassiev
6745d91683 SERVER-21050 Introduce ReplSetTest.State enumeration everywhere
Makes all JS tests access the replica set member state from the class
itself instead of the object instance. Also removes some unused code.
2015-12-11 13:32:56 -05:00
Jonathan Abrahams
bb7e7fc215 SERVER-21164 Use throw instead of assert in rslib.js wait loop
(cherry picked from commit 8fef1b5e7a)
2015-12-11 11:42:26 -05:00
Charlie Swanson
fc108ae9e6 SERVER-21384 Add windows inMemory buildvariant 2015-12-11 11:16:08 -05:00
Charlie Swanson
8e5a66b3bf SERVER-21384 Enable all suites on ephemeral storage engines 2015-12-11 11:16:07 -05:00
Benety Goh
ed2df219c7 SERVER-21847 log range of oplog entries read from sync source
(cherry picked from commit 819f0b95bf)
2015-12-11 10:45:42 -05:00
Jonathan Abrahams
45d232d316 SERVER-21547 Don't apply iteration and thread multipliers to background FSM workloads
(cherry picked from commit c321e5de66)
2015-12-11 10:31:20 -05:00
Jonathan Abrahams
eca57c613d SERVER-21500 Include the name of the FSM workload in the WorkloadFailure description
(cherry picked from commit f8e7460652)
2015-12-11 09:22:49 -05:00
Ernie Hershey
d26f8791df SERVER-13370 Amazon Enterprise RPM's
(cherry picked from commit dfd50a3255)
2015-12-10 19:03:46 -05:00
Misha Tyulenev
fbda4f85b6 SERVER-21136 add basic tests for enableSharding command
(cherry picked from commit 5c651b14fe)
2015-12-10 17:21:45 -05:00
Misha Tyulenev
e882ffceeb SERVER-21132 add basic tests for moveChunk command
(cherry picked from commit 1bcf9c7e19)
2015-12-10 17:19:32 -05:00
Misha Tyulenev
e61483f604 SERVER-21137 add basic tests for movePrimary command
(cherry picked from commit a6e09d623c)
2015-12-10 17:15:54 -05:00
Misha Tyulenev
2f4d9caae5 SERVER-21133 add basic tests for mergeChunks
(cherry picked from commit 9ba880ed3d)
2015-12-10 17:13:03 -05:00
Misha Tyulenev
fa30e3f036 SERVER-21134 add basic tests for shardCollection command
(cherry picked from commit ea91373329)
2015-12-10 17:07:22 -05:00
Randolph Tan
205797cbd4 SERVER-21644 Invariant failure iter != _lockMap.end() in legacy_dist_lock_manager.cpp
(cherry picked from commit 4fd3712ce5)
2015-12-10 16:14:34 -05:00
Randolph Tan
e25bc60bbf SERVER-21849 Fix timestamp compare in min_optime_recovery.js
(cherry picked from commit ea6764dbe4)
2015-12-10 16:10:19 -05:00
Charlie Swanson
0511dffda0 SERVER-21545 Correctly roll back updating collection options
(cherry picked from commit a4d29291cc)
2015-12-10 15:41:51 -05:00
David Storch
5c25a25571 SERVER-21852 fix test issue that can cause kill_cursors.js to fail under master/slave
(cherry picked from commit aa77f50235)
2015-12-10 15:11:48 -05:00
David Storch
5c7573d23a SERVER-21786 increase test coverage of the s/query directory
Fills in gaps in coverage discovered with code coverage analysis.

(cherry picked from commit 09126c5f0e)
2015-12-10 13:45:48 -05:00
Benety Goh
71f40809ee SERVER-21248 get_replication_info_helper.js should not assume all insert ops will happen in the same second
(cherry picked from commit a4cb164174)
2015-12-10 13:37:33 -05:00
Benety Goh
2c20582a12 SERVER-21248 additional failover test cases per test plan
(cherry picked from commit b0a6137a79)
2015-12-10 13:37:33 -05:00
Benety Goh
f4fb80e4a9 SERVER-21248 added checks to election_timing.js to ensure failovers complete on time.
(cherry picked from commit 0d5338a32b)
2015-12-10 13:37:33 -05:00
Benety Goh
d68ab71b6d SERVER-21248 speed up shell test function responsible for mongo program shutdown
(cherry picked from commit 35c86a4912)
2015-12-10 13:37:33 -05:00
Judah Schvimer
9c1b2e0b9c SERVER-21214 Dump config server data when the sharded concurrency suites fail 2015-12-10 13:22:40 -05:00
Jonathan Abrahams
f5bdb26566 SERVER-21516 Remove dbStats command from readConcern testing override
(cherry picked from commit f1b5088e9e)
2015-12-10 12:15:12 -05:00
Jonathan Abrahams
3e32d7c455 SERVER-21450 - enableMajorityReadConcern in MongoRunner to unblacklist aggregation_read_concern_majority overrride
(cherry picked from commit 56cd81631a)
2015-12-10 11:11:11 -05:00
Randolph Tan
b7e9ffa4eb SERVER-20824 Test for sharding state recovery
(cherry picked from commit 2a39a1d5b1)
2015-12-10 10:21:47 -05:00
Jason Rassi
ee352bdaaf SERVER-21602 Use 'cursorTimeoutMillis' flag in cursor_timeout.js
Reduces this test's execution time from ~17 minutes to <30 seconds.

(cherry picked from commit 181cdbf26a)
2015-12-09 16:15:45 -05:00
David Storch
d22ad6c935 SERVER-21824 temporarily disable kmip.js
(cherry picked from commit d1224336fa)
2015-12-09 14:58:25 -05:00
Andy Schwerin
f7e4eb5f50 SERVER-21382 Remove unused _id-extracting out parameter from Collection::deleteDocument 2015-12-09 13:53:44 -05:00
Jonathan Reams
886453786c SERVER-21796 fix startup_log.js for new versioning scheme
(cherry picked from commit 8aaaa8fe56)
2015-12-09 12:04:34 -05:00
Randolph Tan
6a8dc1be90 SERVER-21135 Add more basic tests for sharded implicit database creation
(cherry picked from commit 0ec5ef6940)
2015-12-09 11:56:09 -05:00
Randolph Tan
0dd27a3602 SERVER-21139 Add more basic tests for drop collection
(cherry picked from commit e90ba97c1a)
2015-12-09 11:55:21 -05:00
Randolph Tan
037404ae30 SERVER-21138 Add more basic tests for dropDatabase
(cherry picked from commit 96b181211f)
2015-12-09 11:55:06 -05:00
Randolph Tan
f5ef0ed466 SERVER-21586 Update comments on failing tests
(cherry picked from commit 79bdc9e040)
2015-12-09 11:54:35 -05:00
David Storch
5e4187605f SERVER-21600 add integration test for killCursors command
(cherry picked from commit 9f8ec07dd7)
2015-12-09 11:06:06 -05:00
David Storch
fcd3517820 SERVER-21637 add a test for 3.2 shell / 3.0 server find compatibility
(cherry picked from commit 711ee0acc5)
2015-12-09 11:05:50 -05:00
David Storch
66e7122b55 SERVER-21638 log when an idle mongos cursor times out at the default logLevel
(cherry picked from commit f1d167a505)
2015-12-09 11:05:32 -05:00
Sam Kleinman
6f7ab0c4fc SERVER-21737: remove deprecated release process from evergreen configuration
(cherry picked from commit 295b65caf8)
2015-12-08 19:52:45 -05:00
dalyd
f3c89e6192 SERVER-21426:Add writeConcern support to benchRun
(cherry picked from commit 00ab4b4758)
2015-12-08 13:50:02 -05:00
Kaloian Manassiev
621babeb2e SERVER-21050 Catalog manager retry should consider write error details
The catalog manager's automated error retry logic should also look into
the write error details, which are not considered by the lower-level retry
logic in ShardRegistry.
2015-12-08 13:15:31 -05:00
Kaloian Manassiev
3b469c0e56 SERVER-21050 Make dist lock timeouts uniform
This change makes the dist lock acquisition timeouts to be uniform across
all users and sets the default to be 5 seconds (which is the maximum that
we have been using so far).
2015-12-08 13:15:07 -05:00
Kaloian Manassiev
b306a90872 SERVER-21366 Periodically yield when applying migration deletions 2015-12-08 13:15:06 -05:00
Kaloian Manassiev
c078dc37a9 SERVER-21050 Cleanup ReplSetTest
This is just a cleanup work to hide some of the private state of
ReplSetTest so it is easier to encapsulate and add new logic. Also enables
strict mode.
2015-12-08 13:15:06 -05:00
Eric Milkie
d4396cda27 SERVER-21667 do not set lastop on clients used by replication on secondaries
(cherry picked from commit 4f24dc58f4)
2015-12-08 13:09:15 -05:00
Jonathan Abrahams
610c753e1d SERVER-21714 Increase replSetTest.initiate() timeout for FSM tests
(cherry picked from commit fbb8433c21)
2015-12-08 11:35:39 -05:00
Chung-Yen Chang
b22456cd6c SERVER-21725: enable perf script move 2015-12-08 11:24:12 -05:00
Jonathan Abrahams
29c6a904b1 SERVER-21719 Add initiateTimeout rsOption for ShardingTest 2015-12-08 11:24:12 -05:00
matt dannenberg
b339d3de4e SERVER-21752 remove parallelization of jobs in slow2_WT to avoid out of memory error 2015-12-08 11:24:12 -05:00
matt dannenberg
573080105a SERVER-21752 reduce number of jobs for slow2_WT to avoid out of memory error 2015-12-08 11:24:11 -05:00
Chung-Yen Chang
58da08a83c SERVER-21725: yml changes for script moves 2015-12-08 11:24:11 -05:00
Sam Kleinman
4e39f9a466 SERVER-21793: update evergreen configuration for new 3.2 branch 2015-12-08 10:39:37 -05:00
Ernie Hershey
0d9b08b7e0 SERVER-21781 Improve packaging nightly logic 2015-12-08 10:39:23 -05:00
315 changed files with 5439 additions and 2898 deletions

View File

@@ -50,8 +50,8 @@ if not version_parts:
exit(1)
if version_parts[0]:
print "suffix: latest"
print "src_suffix: latest"
print "suffix: v3.2-latest"
print "src_suffix: v3.2-latest"
else:
print "suffix: {0}".format(version_line)
print "src_suffix: r{0}".format(version_line)

View File

@@ -45,7 +45,7 @@ import urlparse
DEFAULT_ARCHES=["x86_64"]
# Made up names for the flavors of distribution we package for.
DISTROS=["suse", "debian","redhat","ubuntu"]
DISTROS=["suse", "debian","redhat","ubuntu","amazon"]
class Spec(object):
@@ -54,8 +54,10 @@ class Spec(object):
self.gitspec = gitspec
self.rel = rel
# Nightly version numbers can be in the form: 3.0.7-pre-, or 3.0.7-5-g3b67ac
#
def is_nightly(self):
return bool(re.search("-$", self.version()))
return bool(re.search("-$", self.version())) or bool(re.search("\d-\d+-g[0-9a-f]+$", self.version()))
def is_rc(self):
return bool(re.search("-rc\d+$", self.version()))
@@ -109,7 +111,7 @@ class Spec(object):
# our upstream version too).
if re.search("^(debian|ubuntu)", distro.name()):
return re.sub("-", "~", self.ver)
elif re.search("(suse|redhat|fedora|centos)", distro.name()):
elif re.search("(suse|redhat|fedora|centos|amazon)", distro.name()):
return re.sub("-.*", "", self.ver)
else:
raise Exception("BUG: unsupported platform?")
@@ -133,7 +135,7 @@ class Distro(object):
def archname(self, arch):
if re.search("^(debian|ubuntu)", self.n):
return "i386" if arch.endswith("86") else "amd64"
elif re.search("^(suse|centos|redhat|fedora)", self.n):
elif re.search("^(suse|centos|redhat|fedora|amazon)", self.n):
return "i686" if arch.endswith("86") else "x86_64"
else:
raise Exception("BUG: unsupported platform?")
@@ -182,7 +184,7 @@ class Distro(object):
if re.search("^(debian|ubuntu)", self.n):
return "repo/apt/%s/dists/%s/mongodb-enterprise/%s/%s/binary-%s/" % (self.n, self.repo_os_version(build_os), repo_directory, self.repo_component(), self.archname(arch))
elif re.search("(redhat|fedora|centos)", self.n):
elif re.search("(redhat|fedora|centos|amazon)", self.n):
return "repo/yum/%s/%s/mongodb-enterprise/%s/%s/RPMS/" % (self.n, self.repo_os_version(build_os), repo_directory, self.archname(arch))
elif re.search("(suse)", self.n):
return "repo/zypper/%s/%s/mongodb-enterprise/%s/%s/RPMS/" % (self.n, self.repo_os_version(build_os), repo_directory, self.archname(arch))
@@ -202,11 +204,13 @@ class Distro(object):
def repo_os_version(self, build_os):
"""Return an OS version suitable for package repo directory
naming - e.g. 5, 6 or 7 for redhat/centos, "precise," "wheezy," etc.
for Ubuntu/Debian, 11 for suse"""
for Ubuntu/Debian, 11 for suse, "2013.03" for amazon"""
if self.n == 'suse':
return re.sub(r'^suse(\d+)$', r'\1', build_os)
if self.n == 'redhat':
return re.sub(r'^rhel(\d).*$', r'\1', build_os)
if self.n == 'amazon':
return "2013.03"
elif self.n == 'ubuntu':
if build_os == 'ubuntu1204':
return "precise"
@@ -225,7 +229,7 @@ class Distro(object):
def make_pkg(self, build_os, arch, spec, srcdir):
if re.search("^(debian|ubuntu)", self.n):
return packager.make_deb(self, build_os, arch, spec, srcdir)
elif re.search("^(suse|centos|redhat|fedora)", self.n):
elif re.search("^(suse|centos|redhat|fedora|amazon)", self.n):
return packager.make_rpm(self, build_os, arch, spec, srcdir)
else:
raise Exception("BUG: unsupported platform?")
@@ -239,6 +243,8 @@ class Distro(object):
return [ "suse11", "suse12" ]
if re.search("(redhat|fedora|centos)", self.n):
return [ "rhel70", "rhel62", "rhel57" ]
elif self.n == 'amazon':
return [ "amazon" ]
elif self.n == 'ubuntu':
return [ "ubuntu1204", "ubuntu1404" ]
elif self.n == 'debian':
@@ -250,7 +256,10 @@ class Distro(object):
"""Return the release distribution to use in the rpm - "el5" for rhel 5.x,
"el6" for rhel 6.x, return anything else unchanged"""
return re.sub(r'^rh(el\d).*$', r'\1', build_os)
if self.n == 'amazon':
return 'amzn1'
else:
return re.sub(r'^rh(el\d).*$', r'\1', build_os)
def main(argv):
@@ -359,7 +368,7 @@ def make_package(distro, build_os, arch, spec, srcdir):
def make_repo(repodir, distro, build_os, spec):
if re.search("(debian|ubuntu)", repodir):
make_deb_repo(repodir, distro, build_os, spec)
elif re.search("(suse|centos|redhat|fedora)", repodir):
elif re.search("(suse|centos|redhat|fedora|amazon)", repodir):
packager.make_rpm_repo(repodir)
else:
raise Exception("BUG: unsupported platform?")

View File

@@ -54,8 +54,10 @@ class Spec(object):
self.gitspec = gitspec
self.rel = rel
# Nightly version numbers can be in the form: 3.0.7-pre-, or 3.0.7-5-g3b67ac
#
def is_nightly(self):
return bool(re.search("-$", self.version()))
return bool(re.search("-$", self.version())) or bool(re.search("\d-\d+-g[0-9a-f]+$", self.version()))
def is_rc(self):
return bool(re.search("-rc\d+$", self.version()))
@@ -93,10 +95,10 @@ class Spec(object):
else:
corenum = 1
# RC's
if re.search("-rc\d+$", self.version()):
if self.is_rc():
return "0.%s.%s" % (corenum, re.sub('.*-','',self.version()))
# Nightlies
elif re.search("-$", self.version()):
elif self.is_nightly():
return "0.%s.%s" % (corenum, time.strftime("%Y%m%d"))
else:
return str(corenum)

View File

@@ -4,21 +4,17 @@ selector:
- jstests/aggregation/*.js
- jstests/aggregation/bugs/*.js
exclude_files:
# mongod needs to start with the enableMajorityReadConcern flag. Tests that
# start their own mongods will fail (ShardingTest, ReplSetTest, MongoRunner).
- jstests/aggregation/bugs/server6118.js # Uses ShardingTest.
- jstests/aggregation/bugs/server6179.js # Uses ShardingTest.
- jstests/aggregation/bugs/server7781.js # Uses ShardingTest.
- jstests/aggregation/bugs/server18198.js # Uses a mocked mongo client to test read preference.
- jstests/aggregation/bugs/server19095.js # Uses ShardingTest.
- jstests/aggregation/mongos_slaveok.js # Uses ShardingTest.
- jstests/aggregation/testshard1.js # Uses ShardingTest.
- jstests/aggregation/testSlave.js # Starts ReplSetTest.
- jstests/aggregation/mongos_slaveok.js # Majority read on secondary requires afterOpTime.
- jstests/aggregation/testSlave.js # Majority read on secondary requires afterOpTime.
executor:
js_test:
config:
shell_options:
global_vars:
TestData:
enableMajorityReadConcern: ''
eval: "var testingReplication = true; load('jstests/libs/override_methods/set_majority_read_and_write_concerns.js');"
readMode: commands
hooks:

View File

@@ -6,6 +6,9 @@ selector:
- jstests/replsets/config_server_checks.js
- jstests/replsets/last_op_visible.js
- jstests/replsets/oplog_truncated_on_recovery.js
- jstests/replsets/priority_takeover_cascading_priorities.js
- jstests/replsets/priority_takeover_one_node_higher_priority.js
- jstests/replsets/priority_takeover_two_nodes_equal_priority.js
- jstests/replsets/read_committed*.js
- jstests/replsets/read_majority_two_arbs.js
# The combination of new bridges and PV0 can lead to an improper spanning tree in sync2.js.

View File

@@ -2,44 +2,56 @@ selector:
js_test:
roots:
- jstests/sharding/*.js
- jstests/sharding/sync_cluster_config/*.js
exclude_files:
# The following tests fails because a certain command or functionality is not supported in v3.0
# version of mongos:
- jstests/sharding/csrs_upgrade.js
- jstests/sharding/csrs_upgrade_during_migrate.js
- jstests/sharding/find_getmore_cmd.js
# explain format changed. In v3.0, read pref is inside explain sub document. In master,
# it is on top level.
# The following tests fail because explain format changed. In v3.0, read pref is inside
# explain sub document. In v3.2, it is on top level. See SERVER-21660.
- jstests/sharding/auth_slaveok_routing.js
- jstests/sharding/explain_read_pref.js
- jstests/sharding/read_pref.js
# This is testing latest mongos options
# This is testing latest mongos options.
- jstests/sharding/sharding_options.js
# This tests the new sharding section in server status.
- jstests/sharding/server_status.js
# v3.0 does not support explain on findAndModify.
- jstests/sharding/explain_find_and_modify_sharded.js
# Tests new functionality added to the printShardingStatus shell helper.
- jstests/sharding/printShardingStatus.js
# v3.2 responds with a new error code (just errmsg in v3.0).
- jstests/sharding/drop_configdb.js
# v3.2 has new fields, "DBClient (Global)" and "NetworkInterfaceASIO (Sharding)".
- jstests/sharding/conn_pool_stats.js
# v3.2 returns a named ErrorCode, whereas v3.0 returns a uassert location.
- jstests/sharding/movePrimary1.js
# v3.0 responds with $err, v3.2 returns err code for inprog and killop.
- jstests/sharding/auth.js
# The following tests fails because of bugs in v3.0 that were already fixed in v3.2:
- jstests/sharding/index1.js # SERVER-17915, fixed in v3.1.3
- jstests/sharding/zero_shard_version.js # SERVER-20530, fixed in v3.1.9
- jstests/sharding/unowned_doc_filtering.js # SERVER-19608, fixed in v3.1.8
- jstests/sharding/addshard2.js # SERVER-17231, fixed in v3.1.1
- jstests/sharding/all_config_servers_blackholed_from_mongos.js # SERVER-21293, fixed in v3.2.0-rc4
- jstests/sharding/features1.js # SERVER-21193, fixed in v3.2.0-rc3
- jstests/sharding/find_and_modify_after_multi_write.js # SERVER-20407, backported to v3.0.8
- jstests/sharding/index1.js # SERVER-17915, fixed in v3.1.3
- jstests/sharding/listDatabases.js # SERVER-21193, fixed in v3.2.0-rc3
- jstests/sharding/all_config_servers_blackholed_from_mongos.js # SERVER-21293, 3.2.0-rc4
- jstests/sharding/query_config.js # SERVER-11877, fixed in v3.1.8
- jstests/sharding/read_does_not_create_namespaces.js # SERVER-17723, fixed in v3.1.2
- jstests/sharding/startup_with_all_configs_down.js # SERVER-21215, fixed in v3.2.0-rc4
- jstests/sharding/unowned_doc_filtering.js # SERVER-19608, fixed in v3.1.8
- jstests/sharding/zero_shard_version.js # SERVER-20530, fixed in v3.1.9
- jstests/sharding/drop_sharded_db.js # SERVER-17723, fixed in v3.1.2
- jstests/sharding/implicit_db_creation.js # SERVER-17723, fixed in v3.1.2
# TODO: Investigate why these are failing:
- jstests/sharding/find_and_modify_after_multi_write.js
- jstests/sharding/explain_find_and_modify_sharded.js
- jstests/sharding/printShardingStatus.js
- jstests/sharding/rename.js
- jstests/sharding/drop_configdb.js
- jstests/sharding/query_config.js
- jstests/sharding/explain_read_pref.js
- jstests/sharding/conn_pool_stats.js
- jstests/sharding/read_does_not_create_namespaces.js
- jstests/sharding/movePrimary1.js
- jstests/sharding/addshard2.js
- jstests/sharding/all_config_hosts_down.js # possibly caused by SERVER-21215?
- jstests/sharding/auth.js
- jstests/sharding/auth_slaveok_routing.js
- jstests/sharding/startup_with_all_configs_down.js
# The following tests fail because of known bugs:
- jstests/sharding/sync_cluster_config/sync6.js # SERVER-21660
- jstests/sharding/move_primary_basic.js # SERVER-21851
- jstests/sharding/enable_sharding_basic.js # SERVER-21853
executor:
js_test:
@@ -47,6 +59,7 @@ executor:
shell_options:
global_vars:
TestData:
useLegacyReplicationProtocol: true
useLegacyConfigServers: true
mongosBinVersion: 'last-stable'
nodb: ''

View File

@@ -364,9 +364,9 @@ class CheckReplDBHash(CustomBehavior):
# 'sb' already describes which collections are missing where.
for coll_name in missing_on_primary:
CheckReplDBHash._dump_all_documents(primary_db, coll_name, sb)
for coll_name in missing_on_secondary:
CheckReplDBHash._dump_all_documents(secondary_db, coll_name, sb)
for coll_name in missing_on_secondary:
CheckReplDBHash._dump_all_documents(primary_db, coll_name, sb)
return
for coll_name in primary_coll_names & secondary_coll_names:

View File

@@ -86,6 +86,7 @@ variables:
- osx
- &packaging_variants
- enterprise-linux-64-amazon-ami
- enterprise-rhel-57-64-bit
- enterprise-rhel-62-64-bit
- enterprise-rhel-70-64-bit
@@ -115,7 +116,7 @@ functions:
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: mongodb-mongo-master/${build_variant}/${revision}/artifacts/${build_id}.tgz
remote_file: mongodb-mongo-v3.2/${build_variant}/${revision}/artifacts/${build_id}.tgz
bucket: mciuploads
extract_to: src
@@ -124,7 +125,7 @@ functions:
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: mongodb-mongo-master/${build_variant}/${revision}/binaries/mongo-${build_id}.${ext|tgz}
remote_file: mongodb-mongo-v3.2/${build_variant}/${revision}/binaries/mongo-${build_id}.${ext|tgz}
bucket: mciuploads
local_file: src/mongo-binaries.tgz
@@ -138,7 +139,7 @@ functions:
"get buildnumber" : &get_buildnumber
command: keyval.inc
params:
key: "${build_variant}_master"
key: "${build_variant}_v3.2"
destination: "builder_num"
"setup credentials" : &setup_credentials
@@ -161,7 +162,7 @@ functions:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: src/mongo-debugsymbols.tgz
remote_file: mongodb-mongo-master/${build_variant}/${revision}/debugsymbols/debugsymbols-${build_id}.${ext|tgz}
remote_file: mongodb-mongo-v3.2/${build_variant}/${revision}/debugsymbols/debugsymbols-${build_id}.${ext|tgz}
bucket: mciuploads
permissions: public-read
content_type: ${content_type|application/x-gzip}
@@ -173,7 +174,7 @@ functions:
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: mongodb-mongo-master/${build_variant}/${revision}/debugsymbols/debugsymbols-${build_id}.${ext|tgz}
remote_file: mongodb-mongo-v3.2/${build_variant}/${revision}/debugsymbols/debugsymbols-${build_id}.${ext|tgz}
bucket: mciuploads
local_file: src/mongo-debugsymbols.tgz
build_variants:
@@ -212,7 +213,7 @@ functions:
set -o igncr
fi;
git checkout r3.2.0-rc5
git checkout r3.2.1
. ./${set_tools_gopath|set_gopath.sh}
# In RHEL 5.5, /usr/bin/ld can't handle --build-id parameters, so
@@ -282,42 +283,6 @@ functions:
${path_prefix} ${asan_symbolizer} ${enable_lsan} ${rlp_environment} ${python|python} buildscripts/resmoke.py ${resmoke_args} $extra_args ${test_flags} --log=buildlogger --reportFile=report.json
"setup release credentials":
command: shell.exec
params:
silent: true
script: |
cat <<EOF > ~/.mongodb-jira.yaml
jira:
username: ${release_jira_username}
password: ${release_jira_password}
url: https://jira.mongodb.org/
EOF
"cleanup release credentials":
command: shell.exec
params:
script: |
rm -f ~/.mongodb-jira.yaml
"clone kernel-tools repo":
command: shell.exec
params:
script: |
git clone git@github.com:10gen/kernel-tools.git
"setup kernel-tools virtualenv":
command: shell.exec
params:
script: |
set -o errexit
set -o verbose
cd kernel-tools/releases/release_tickets/
virtualenv --system-site-packages venv-release
. venv-release/bin/activate
pip install --retries 30 --timeout 30 jira==0.16 requests==2.7.0
"run jstestfuzz":
- command: shell.exec
params:
@@ -330,7 +295,7 @@ functions:
if [ "Windows_NT" != "$OS" ]; then
curl --silent --max-time 600 http://boxes.10gen.com/build/node-v0.12.7-linux-x64.tar.gz --output node.tar.gz
${decompress} node.tar.gz
${decompress} node.tar.gz > /dev/null
fi
cp mongodb*/bin/mongod .
@@ -396,7 +361,7 @@ functions:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: jstests.tgz
remote_file: mongodb-mongo-master/${build_variant}/${revision}/jstestfuzz/${task_id}-${execution}.tgz
remote_file: mongodb-mongo-v3.2/${build_variant}/${revision}/jstestfuzz/${task_id}-${execution}.tgz
bucket: mciuploads
permissions: public-read
content_type: ${content_type|application/x-gzip}
@@ -444,7 +409,7 @@ post:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: mongo-coredumps.tgz
remote_file: mongodb-mongo-master/${build_variant}/${revision}/coredumps/mongo-coredumps-${build_id}-${task_name}-${execution}.tgz
remote_file: mongodb-mongo-v3.2/${build_variant}/${revision}/coredumps/mongo-coredumps-${build_id}-${task_name}-${execution}.tgz
bucket: mciuploads
permissions: public-read
content_type: ${content_type|application/x-gzip}
@@ -554,7 +519,7 @@ tasks:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: src/mongodb-binaries.tgz
remote_file: mongodb-mongo-master/${build_variant}/${revision}/binaries/mongo-${build_id}.${ext|tgz}
remote_file: mongodb-mongo-v3.2/${build_variant}/${revision}/binaries/mongo-${build_id}.${ext|tgz}
bucket: mciuploads
permissions: public-read
content_type: ${content_type|application/x-gzip}
@@ -564,7 +529,7 @@ tasks:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: artifacts.tgz
remote_file: mongodb-mongo-master/${build_variant}/${revision}/artifacts/${build_id}.tgz
remote_file: mongodb-mongo-v3.2/${build_variant}/${revision}/artifacts/${build_id}.tgz
bucket: mciuploads
permissions: public-read
content_type: application/tar
@@ -574,7 +539,7 @@ tasks:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: src/mongodb-unittests.tgz
remote_file: mongodb-mongo-master/${build_variant}/${revision}/unittests/${build_id}.tgz
remote_file: mongodb-mongo-v3.2/${build_variant}/${revision}/unittests/${build_id}.tgz
bucket: mciuploads
permissions: public-read
content_type: ${content_type|application/x-gzip}
@@ -585,7 +550,7 @@ tasks:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: src/distsrc.${ext|tgz}
remote_file: mongodb-mongo-master/${build_variant}/${revision}/sources/mongo-src-${build_id}.${ext|tgz}
remote_file: mongodb-mongo-v3.2/${build_variant}/${revision}/sources/mongo-src-${build_id}.${ext|tgz}
bucket: mciuploads
permissions: public-read
content_type: ${content_type|application/x-gzip}
@@ -670,7 +635,7 @@ tasks:
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: mongodb-mongo-master/${build_variant}/${revision}/unittests/${build_id}.tgz
remote_file: mongodb-mongo-v3.2/${build_variant}/${revision}/unittests/${build_id}.tgz
bucket: mciuploads
extract_to: src
- func: "run tests"
@@ -1026,6 +991,15 @@ tasks:
resmoke_args: --suites=core --storageEngine=mmapv1
run_multiple_jobs: true
- <<: *task_template
name: jsCore_inMem
commands:
- func: "do setup"
- func: "run tests"
vars:
resmoke_args: --suites=core --storageEngine=inMemory
run_multiple_jobs: true
- <<: *task_template
name: jsCore_WT
commands:
@@ -1112,15 +1086,6 @@ tasks:
resmoke_args: --suites=core_op_query --storageEngine=wiredTiger
run_multiple_jobs: true
- <<: *task_template
name: ephemeralForTest
commands:
- func: "do setup"
- func: "run tests"
vars:
resmoke_args: --suites=core --storageEngine=ephemeralForTest
run_multiple_jobs: true
- <<: *task_template
name: jsCore_small_oplog
depends_on:
@@ -1282,7 +1247,8 @@ tasks:
- func: "run tests"
vars:
resmoke_args: --suites=slow2 --storageEngine=wiredTiger
run_multiple_jobs: true
# No parallelization of jobs due to memory constraints and WiredTiger cache size.
run_multiple_jobs: false
- <<: *task_template
name: sharded_collections_jscore_passthrough
@@ -1724,7 +1690,7 @@ tasks:
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: mongodb-mongo-master/${build_variant}/${revision}/sources/mongo-src-${build_id}.${ext|tgz}
remote_file: mongodb-mongo-v3.2/${build_variant}/${revision}/sources/mongo-src-${build_id}.${ext|tgz}
bucket: mciuploads
local_file: src/distsrc.${ext|tgz}
build_variants: [ linux-64, windows-64-2k8 ]
@@ -1738,7 +1704,7 @@ tasks:
silent: true
script: |
set -o errexit
echo "${signing_auth_token}" > signing_auth_token
echo "${signing_auth_token_32}" > signing_auth_token
- command: shell.exec
params:
working_dir: src
@@ -1752,19 +1718,19 @@ tasks:
mv distsrc.${ext|tgz} mongodb-src-${src_suffix}.${ext|tar.gz} || true
/usr/bin/find build/ -type f | grep msi$ | xargs -I original_filename cp original_filename mongodb-win32-${push_arch}-${suffix}.msi || true
notary-client.py --key-name "${signing_key_name}" --auth-token-file ${workdir}/src/signing_auth_token --comment "Evergreen Automatic Signing ${revision} - ${build_variant} - ${branch_name}" --notary-url http://notary-service.build.10gen.cc:5000 --skip-missing mongodb-${push_name}-${push_arch}-${suffix}.${ext|tgz} mongodb-${push_name}-${push_arch}-debugsymbols-${suffix}.${ext|tgz} mongodb-win32-${push_arch}-${suffix}.msi mongodb-src-${src_suffix}.${ext|tar.gz}
notary-client.py --key-name "server-3.2" --auth-token-file ${workdir}/src/signing_auth_token --comment "Evergreen Automatic Signing ${revision} - ${build_variant} - ${branch_name}" --notary-url http://notary-service.build.10gen.cc:5000 --skip-missing mongodb-${push_name}-${push_arch}-${suffix}.${ext|tgz} mongodb-${push_name}-${push_arch}-debugsymbols-${suffix}.${ext|tgz} mongodb-win32-${push_arch}-${suffix}.msi mongodb-src-${src_suffix}.${ext|tar.gz}
if [ "${has_packages|}" = "true" ] ; then
for rpm in $(find repo/ -name \*.rpm) ; do
pushd $(dirname $rpm)
# Use --package-file-suffix "" to overwrite existing RPM's instead of saving new "-signed.rpm" RPM files
#
notary-client.py --key-name "${signing_key_name}" --auth-token-file ${workdir}/src/signing_auth_token --comment "Evergreen Automatic Signing ${revision} - ${build_variant} - ${branch_name}" --notary-url http://notary-service.build.10gen.cc:5000 --archive-file-ext gpg --outputs sig --package-file-suffix "" $(basename $rpm)
notary-client.py --key-name "server-3.2" --auth-token-file ${workdir}/src/signing_auth_token --comment "Evergreen Automatic Signing ${revision} - ${build_variant} - ${branch_name}" --notary-url http://notary-service.build.10gen.cc:5000 --archive-file-ext gpg --outputs sig --package-file-suffix "" $(basename $rpm)
popd
done
for release_file in $(find repo/ -name Release) ; do
pushd $(dirname $release_file)
notary-client.py --key-name "${signing_key_name}" --auth-token-file ${workdir}/src/signing_auth_token --comment "Evergreen Automatic Signing ${revision} - ${build_variant} - ${branch_name}" --notary-url http://notary-service.build.10gen.cc:5000 --outputs sig Release
notary-client.py --key-name "server-3.2" --auth-token-file ${workdir}/src/signing_auth_token --comment "Evergreen Automatic Signing ${revision} - ${build_variant} - ${branch_name}" --notary-url http://notary-service.build.10gen.cc:5000 --outputs sig Release
popd
done
fi
@@ -2116,51 +2082,6 @@ tasks:
'destination': {'path': '${push_path}/mongodb-win32-${push_arch}-${suffix}-signed.msi.md5', 'bucket': '${push_bucket}'},
'build_variants': ['enterprise-windows-64', 'windows-64', 'windows-64-2k8', 'windows-64-2k8-ssl', 'windows-32'], }
- name: jira_versions
patchable: false
depends_on:
- name: push
variant: linux-64
stepback: false
commands:
- func: "clone kernel-tools repo"
- func: "setup release credentials"
- func: "setup kernel-tools virtualenv"
- command: shell.exec
params:
working_dir: "kernel-tools/releases/release_tickets"
script: |
set -o errexit
set -o verbose
. venv-release/bin/activate
python release_fixversion.py ${version}
python create_fixversion.py ${version}
python make_ticket.py --execute --version ${version} --ticket deploy
- func: "cleanup release credentials"
- name: docs_ticket
patchable: false
depends_on:
- name: push
variant: "*"
stepback: false
commands:
- func: "clone kernel-tools repo"
- func: "setup release credentials"
- func: "setup kernel-tools virtualenv"
- command: shell.exec
working_dir: "kernel-tools/releases/release_tickets"
params:
script: |
set -o errexit
set -o verbose
. venv-release/bin/activate
python make_ticket.py --execute --version ${version} --assignee ${release_notes_maintainer} --ticket docs
- func: "cleanup release credentials"
#######################################
# Modules #
@@ -2171,12 +2092,12 @@ modules:
- name: enterprise
repo: git@github.com:10gen/mongo-enterprise-modules.git
prefix: src/mongo/db/modules
branch: master
branch: v3.2
- name: rocksdb
repo: git@github.com:mongodb-partners/mongo-rocks.git
prefix: src/mongo/db/modules
branch: master
branch: v3.2
#######################################
# Buildvariants #
@@ -2238,7 +2159,6 @@ buildvariants:
- name: sharding_gle_auth_basics_passthrough_WT
- name: sharding_gle_auth_basics_passthrough_write_cmd
- name: sharding_gle_auth_basics_passthrough_write_cmd_WT
- name: ephemeralForTest
- name: jsCore
- name: jsCore_WT
- name: jsCore_auth
@@ -2754,7 +2674,7 @@ buildvariants:
num_jobs_available: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
has_packages: true
packager_script: packager.py
packager_script: packager-enterprise.py
packager_distro: amazon
tasks:
- name: compile
@@ -2829,6 +2749,9 @@ buildvariants:
compile_flags: --ssl MONGO_DISTMOD=amazon -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
num_jobs_available: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
has_packages: true
packager_script: packager.py
packager_distro: amazon
tasks:
- name: compile
distros:
@@ -3295,6 +3218,55 @@ buildvariants:
distros:
- rhel55-test
- name: enterprise-windows-64-inmem
display_name: Enterprise Windows (inMemory)
modules:
- enterprise
run_on:
- windows-64-vs2013-test
expansions:
tooltags: "-tags 'ssl sasl'"
exe: ".exe"
gorootvars: 'PATH="/cygdrive/c/mingw-w64/x86_64-4.9.1-posix-seh-rt_v3-rev1/mingw64/bin:/cygdrive/c/sasl/:$PATH"'
push_path: win32
push_bucket: downloads.10gen.com
push_name: win32
push_arch: x86_64-enterprise-windows-64
msi_target: msi
content_type: application/zip
compile_flags: --release --ssl MONGO_DISTMOD=windows-64 CPPPATH="c:/openssl/include c:/sasl/include c:/snmp/include" LIBPATH="c:/openssl/lib c:/sasl/lib c:/snmp/lib" -j$(grep -c ^processor /proc/cpuinfo) --dynamic-windows --win-version-min=ws08r2 VARIANT_DIR=win32
num_jobs_available: 1
test_flags: --continueOnFailure --storageEngine=inMemory --excludeWithAnyTags=requires_persistence
ext: zip
tasks:
- name: compile
distros:
- windows-64-vs2013-compile
- name: audit
- name: audit_WT
- name: auth_audit
- name: dbtest
- name: concurrency
distros:
- windows-64-vs2013-compile # Some workloads require a lot of memory, use a bigger machine for this suite.
- name: concurrency_replication
- name: concurrency_sharded
- name: jsCore
- name: jsCore_auth
- name: jsCore_small_oplog
- name: jsCore_small_oplog_rs
- name: jstestfuzz
- name: jstestfuzz_replication_WT
- name: jstestfuzz_sharded_WT
- name: replicasets_auth
- name: sasl
- name: sharding_auth
- name: sharding_auth_audit_WT
- name: snmp
- name: ssl
- name: sslSpecial
- name: unittests
- name: windows-64-2k8-ssl
display_name: SSL Windows 2008R2
modules: ~
@@ -4890,42 +4862,68 @@ buildvariants:
- name: compile
distros:
- rhel62-build
- name: aggregation
- name: dbtest
- name: failpoints
- name: failpoints_auth
- name: jsCore
- name: jsCore_auth
- name: jsCore_compatibility
- name: jsCore_small_oplog
- name: jsCore_small_oplog_rs
- name: jstestfuzz_WT
- name: jstestfuzz_replication_WT
- name: jstestfuzz_sharded_WT
- name: aggregation_WT
- name: aggregation_auth
- name: aggregation_read_concern_majority_passthrough_WT
- name: audit
- name: auth
- name: auth_audit
- name: bulk_gle_passthrough
- name: noPassthrough
- name: noPassthroughWithMongod
- name: parallel
- name: parallel_compatibility
- name: concurrency
distros:
- rhel62-build # Some workloads require a lot of memory, use a bigger machine for this suite.
- name: concurrency_replication
- name: concurrency_sharded
- name: dbtest
- name: failpoints
- name: failpoints_auth
- name: gle_auth
- name: gle_auth_basics_passthrough
- name: gle_auth_basics_passthrough_write_cmd
- name: gle_auth_write_cmd
- name: integration_tests_replset
- name: integration_tests_standalone
- name: jsCore
- name: jsCore_WT
- name: jsCore_auth
- name: jsCore_compatibility
- name: jsCore_op_query
- name: jsCore_small_oplog
- name: jsCore_small_oplog_rs
- name: jstestfuzz_WT
- name: jstestfuzz_replication_WT
- name: jstestfuzz_sharded_WT
- name: mongosTest
- name: noPassthrough
- name: noPassthroughWithMongod
- name: parallel
- name: parallel_compatibility
- name: read_concern_majority_passthrough_WT
- name: replicasets_WT
- name: replicasets_auth
- name: replicasets_legacy
- name: replication_WT
- name: replication_auth
- name: rlp
- name: sasl
- name: sharded_collections_jscore_passthrough
- name: sharding
- name: sharding_auth
- name: sharding_auth_audit_WT
- name: sharding_gle_auth_basics_passthrough
- name: sharding_gle_auth_basics_passthrough_write_cmd
- name: sharding_jscore_passthrough
- name: sharding_jscore_passthrough_wire_ops_WT
- name: sharding_legacy
- name: sharding_legacy_op_query_WT
- name: sharding_op_query_WT
- name: slow1
# - name: slow2
- name: sharding_jscore_passthrough
- name: slow2
- name: snmp
- name: ssl
- name: sslSpecial
- name: tool
- name: unittests
- name: linux-64-ephemeralForTest
display_name: Linux (ephemeralForTest)
@@ -4944,28 +4942,44 @@ buildvariants:
- name: compile
distros:
- rhel55
- name: aggregation
- name: aggregation_WT
- name: aggregation_auth
- name: auth
- name: concurrency
distros:
- rhel62-build # Some workloads require a lot of memory, use a bigger machine for this suite.
- name: concurrency_replication
- name: concurrency_sharded
- name: dbtest
- name: failpoints
- name: failpoints_auth
- name: gle_auth
- name: gle_auth_write_cmd
- name: gle_auth_basics_passthrough
- name: gle_auth_basics_passthrough_write_cmd
- name: httpinterface
- name: integration_tests_standalone
- name: integration_tests_replset
- name: sharding_gle_auth_basics_passthrough
- name: sharding_gle_auth_basics_passthrough_write_cmd
- name: jsCore
- name: jsCore_WT
- name: jsCore_auth
- name: jsCore_op_query
- name: jsCore_compatibility
- name: jsCore_small_oplog
- name: jsCore_small_oplog_rs
- name: jstestfuzz_WT
- name: jstestfuzz_replication_WT
- name: jstestfuzz_sharded_WT
- name: mongosTest
- name: noPassthrough
- name: noPassthroughWithMongod
- name: bulk_gle_passthrough
- name: noPassthrough
- name: noPassthroughWithMongod
- name: parallel
- name: parallel_compatibility
- name: concurrency
distros:
- rhel62-build # Some workloads require a lot of memory, use a bigger machine for this suite.
- name: concurrency_replication
- name: concurrency_sharded
- name: replicasets_WT
- name: replicasets_auth
- name: replicasets_legacy
@@ -4977,8 +4991,12 @@ buildvariants:
- name: sharding_legacy_op_query_WT
- name: sharding_op_query_WT
- name: slow1
# - name: slow2
- name: slow2
- name: sharded_collections_jscore_passthrough
- name: sharding_jscore_passthrough
- name: sharding_jscore_passthrough_wire_ops_WT
- name: tool
- name: unittests
- name: ubuntu1404-rocksdb
display_name: Ubuntu 14.04 (RocksDB)
@@ -5096,6 +5114,7 @@ buildvariants:
- name: integration_tests_replset
- name: jsCore
- name: jsCore_WT
- name: jsCore_inMem
- name: jsCore_auth
- name: jsCore_compatibility
- name: jsCore_compatibility_WT
@@ -5105,7 +5124,6 @@ buildvariants:
- name: jsCore_small_oplog_rs_WT
- name: mmap
- name: mongosTest
- name: multiversion
- name: noPassthrough
- name: noPassthroughWithMongod
- name: noPassthroughWithMongod_WT
@@ -5268,12 +5286,3 @@ buildvariants:
- name: push
distros:
- rhel55-test
- name: release
display_name: ~~ Release Process
modules: ~
run_on:
- ubuntu1404-docker
tasks:
- name: jira_versions
- name: docs_ticket

View File

@@ -178,7 +178,7 @@ functions:
script: |
set -o errexit
set -o verbose
python -u ../dsi/bin/post_run_check.py --rev ${revision} -f history.json -t tags.json --refTag 3.0.6-Baseline --overrideFile ../dsi/bin/longevity_override.json --project_id mongo-longevity --task_name ${task_name} --variant ${build_variant}
python -u ../dsi/analysis/post_run_check.py --rev ${revision} -f history.json -t tags.json --refTag 3.0.6-Baseline --overrideFile ../dsi/analysis/longevity_override.json --project_id mongo-longevity --task_name ${task_name} --variant ${build_variant}
tasks:

View File

@@ -27,6 +27,13 @@ post:
- command: shell.cleanup
functions:
"download analysis scripts":
- command: shell.exec
params:
script: |
set -v
rm -rf ./dsi
git clone git@github.com:10gen/dsi.git
"start server":
- command: shell.exec
params:
@@ -78,13 +85,6 @@ functions:
./mongo --eval "if(db.isMaster().isreplicaset){rs.initiate(); assert.soon(function(){return db.isMaster().ismaster}, 'no primary')}"
echo "MONGOD STARTED."
"compare":
- command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: perf/${version_id}/${revision}/compare.py-${version_id}
bucket: mciuploads
local_file: src/compare.py
- command: json.get
params:
task: ${compare_task}
@@ -106,22 +106,8 @@ functions:
set -o verbose
virtualenv ./venv
source ./venv/bin/activate
python compare.py -b stand.json -c node.json -t ${threshold}
python ../dsi/analysis/compare.py -b stand.json -c node.json -t ${threshold}
"analyze":
- command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: perf/${version_id}/${revision}/perf_regression_check.py-${version_id}
bucket: mciuploads
local_file: src/perf_regression_check.py
- command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: perf/${version_id}/${revision}/override.json-${version_id}
bucket: mciuploads
local_file: src/override.json
- command: shell.exec
params:
working_dir: src
@@ -150,7 +136,7 @@ functions:
set -o errexit
set -o verbose
source ./venv/bin/activate
python perf_regression_check.py -f history.json --rev ${revision} -t tags.json --refTag 3.0.6-Baseline --overrideFile override.json --variant ${build_variant} --threshold 0.10 --threadThreshold 0.15
python ../dsi/analysis/perf_regression_check.py -f history.json --rev ${revision} -t tags.json --refTag 3.0.6-Baseline --overrideFile ../dsi/analysis/perf_override.json --variant ${build_variant} --threshold 0.10 --threadThreshold 0.15
"run perf tests":
- command: shell.exec
params:
@@ -214,16 +200,6 @@ tasks:
permissions: public-read
content_type: ${content_type|application/octet-stream}
display_name: mongo
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: src/buildscripts/perf_regression_check.py
remote_file: perf/${version_id}/${revision}/perf_regression_check.py-${version_id}
bucket: mciuploads
permissions: public-read
content_type: ${content_type|application/octet-stream}
display_name: perf_regression_check.py
- command: s3.put
params:
aws_key: ${aws_key}
@@ -257,6 +233,7 @@ tasks:
includeFilter2 : "core regression"
excludeFilter : "single_threaded"
threads : "1 2 4 8"
- func: "download analysis scripts"
- func: "analyze"
- name: where
depends_on:
@@ -270,6 +247,7 @@ tasks:
includeFilter2 : "core regression"
excludeFilter : "single_threaded"
threads : "1 2 4 8"
- func: "download analysis scripts"
- func: "analyze"
- name: update
depends_on:
@@ -283,6 +261,7 @@ tasks:
includeFilter2 : "core regression"
excludeFilter : "single_threaded"
threads : "1 2 4 8"
- func: "download analysis scripts"
- func: "analyze"
- name: insert
depends_on:
@@ -296,6 +275,7 @@ tasks:
includeFilter2 : "core regression"
excludeFilter : "single_threaded"
threads : "1 2 4 8"
- func: "download analysis scripts"
- func: "analyze"
- name: geo
depends_on:
@@ -309,6 +289,7 @@ tasks:
includeFilter2 : "core regression"
excludeFilter : "single_threaded"
threads : "1 2 4 8"
- func: "download analysis scripts"
- func: "analyze"
- name: misc
depends_on:
@@ -322,6 +303,7 @@ tasks:
includeFilter2 : "core regression"
excludeFilter : "single_threaded"
threads : "1 2 4 8"
- func: "download analysis scripts"
- func: "analyze"
- name: singleThreaded
depends_on:
@@ -335,6 +317,7 @@ tasks:
includeFilter2 : "core regression"
excludeFilter : "none"
threads : "1"
- func: "download analysis scripts"
- func: "analyze"
- name: singleThreaded-wt-repl-comp
depends_on:
@@ -347,6 +330,7 @@ tasks:
variant : linux-wt-repl
status : "*"
commands:
- func: "download analysis scripts"
- func: "compare"
vars:
compare_task : "singleThreaded"
@@ -364,6 +348,7 @@ tasks:
variant : linux-wt-repl
status : "*"
commands:
- func: "download analysis scripts"
- func: "compare"
vars:
compare_task : "insert"
@@ -381,6 +366,7 @@ tasks:
variant : linux-wt-repl
status : "*"
commands:
- func: "download analysis scripts"
- func: "compare"
vars:
compare_task : "update"
@@ -398,6 +384,7 @@ tasks:
variant : linux-wt-repl
status : "*"
commands:
- func: "download analysis scripts"
- func: "compare"
vars:
compare_task : "misc"
@@ -415,6 +402,7 @@ tasks:
variant : linux-mmap-standalone
status : "*"
commands:
- func: "download analysis scripts"
- func: "compare"
vars:
compare_task : "singleThreaded"
@@ -432,6 +420,7 @@ tasks:
variant : linux-mmap-standalone
status : "*"
commands:
- func: "download analysis scripts"
- func: "compare"
vars:
compare_task : "query"
@@ -449,6 +438,7 @@ tasks:
variant : linux-mmap-standalone
status : "*"
commands:
- func: "download analysis scripts"
- func: "compare"
vars:
compare_task : "where"
@@ -466,6 +456,7 @@ tasks:
variant : linux-mmap-standalone
status : "*"
commands:
- func: "download analysis scripts"
- func: "compare"
vars:
compare_task : "geo"
@@ -483,6 +474,7 @@ tasks:
variant : linux-mmap-standalone
status : "*"
commands:
- func: "download analysis scripts"
- func: "compare"
vars:
compare_task : "insert"
@@ -500,6 +492,7 @@ tasks:
variant : linux-mmap-standalone
status : "*"
commands:
- func: "download analysis scripts"
- func: "compare"
vars:
compare_task : "update"
@@ -517,6 +510,7 @@ tasks:
variant : linux-mmap-standalone
status : "*"
commands:
- func: "download analysis scripts"
- func: "compare"
vars:
compare_task : "misc"
@@ -534,6 +528,7 @@ tasks:
variant : linux-mmap-repl
status : "*"
commands:
- func: "download analysis scripts"
- func: "compare"
vars:
compare_task : "singleThreaded"
@@ -551,6 +546,7 @@ tasks:
variant : linux-mmap-repl
status : "*"
commands:
- func: "download analysis scripts"
- func: "compare"
vars:
compare_task : "insert"
@@ -568,6 +564,7 @@ tasks:
variant : linux-mmap-repl
status : "*"
commands:
- func: "download analysis scripts"
- func: "compare"
vars:
compare_task : "update"
@@ -585,6 +582,7 @@ tasks:
variant : linux-mmap-repl
status : "*"
commands:
- func: "download analysis scripts"
- func: "compare"
vars:
compare_task : "misc"
@@ -602,6 +600,7 @@ tasks:
variant : linux-mmap-repl
status : "*"
commands:
- func: "download analysis scripts"
- func: "compare"
vars:
compare_task : "singleThreaded"
@@ -619,6 +618,7 @@ tasks:
variant : linux-mmap-repl
status : "*"
commands:
- func: "download analysis scripts"
- func: "compare"
vars:
compare_task : "insert"
@@ -636,6 +636,7 @@ tasks:
variant : linux-mmap-repl
status : "*"
commands:
- func: "download analysis scripts"
- func: "compare"
vars:
compare_task : "update"
@@ -653,6 +654,7 @@ tasks:
variant : linux-mmap-repl
status : "*"
commands:
- func: "download analysis scripts"
- func: "compare"
vars:
compare_task : "misc"

View File

@@ -35,7 +35,7 @@ functions:
# checkout dsi code
params:
script: |
set -e
set -e
set -v
git clone git@github.com:10gen/dsi.git
cd dsi
@@ -219,21 +219,23 @@ functions:
script: |
set -o errexit
set -o verbose
python -u ../dsi/bin/post_run_check.py --rev ${revision} -f history.json -t tags.json --refTag 3.0.6-Baseline --overrideFile ../dsi/bin/override.json --project_id sys-perf --task_name ${task_name} --variant ${build_variant}
python -u ../dsi/analysis/post_run_check.py --rev ${revision} -f history.json -t tags.json --refTag 3.0.6-Baseline --overrideFile ../dsi/analysis/system_perf_override.json --project_id sys-perf --task_name ${task_name} --variant ${build_variant}
"compare":
- command: shell.exec
params:
script: |
rm -rf ./*
script: |
set -o verbose
rm -rf ./src
mkdir src
- command: s3.get
- command: shell.exec
# checkout dsi code
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: dsi/${revision}/compare.py
bucket: mciuploads
local_file: src/compare.py
script: |
set -e
set -v
rm -rf ./dsi
git clone git@github.com:10gen/dsi.git
- command: json.get
params:
task: ${compare_task}
@@ -253,7 +255,7 @@ functions:
script: |
set -o errexit
set -o verbose
python -u compare.py -b standalone.json -c oplog.json -t ${threshold}
python -u ../dsi/analysis/compare.py -b standalone.json -c oplog.json -t ${threshold}
@@ -293,16 +295,6 @@ tasks:
permissions: public-read
content_type: ${content_type|application/x-gzip}
display_name: mongodb.tar.gz
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: src/buildscripts/compare.py
remote_file: dsi/${revision}/compare.py
bucket: mciuploads
permissions: public-read
content_type: ${content_type|application/octet-stream}
display_name: compare.py
# The industry_benchmarks_WT task runs the "bring up cluster" task and is

View File

@@ -1,4 +1,7 @@
// Test the db.auth() shell helper.
//
// This test requires users to persist across a restart.
// @tags: [requires_persistence]
var conn = MongoRunner.runMongod({ smallfiles: ""});

View File

@@ -60,7 +60,7 @@ function ClusterSpawnHelper(clusterType, startWithAuth) {
else {
replSetTest.awaitReplication();
}
this.conn = replSetTest.getMaster();
this.conn = replSetTest.getPrimary();
this.connString = replSetTest.getURL();
}
else {

View File

@@ -2031,6 +2031,7 @@ var authCommandsLib = {
{
runOnDb: firstDbName,
roles: {
backup: 1,
dbAdmin: 1,
dbAdminAnyDatabase: 1,
dbOwner: 1,
@@ -2047,6 +2048,7 @@ var authCommandsLib = {
{
runOnDb: secondDbName,
roles: {
backup: 1,
dbAdminAnyDatabase: 1,
clusterMonitor: 1,
clusterAdmin: 1,

View File

@@ -1,4 +1,7 @@
// MapReduce executed by a read-only user when --auth enabled should only be able to use inline mode. Other modes require writing to an output collection which is not allowed. SERVER-3345
//
// This test requires users to persist across a restart.
// @tags: [requires_persistence]
baseName = "jstests_mr_auth";
dbName = "test";

View File

@@ -1,8 +1,11 @@
/*
/**
* Regression test for SERVER-4892.
*
* Verify that a client can delete cursors that it creates, when mongod is running with "auth"
* enabled.
*
* This test requires users to persist across a restart.
* @tags: [requires_persistence]
*/
var baseName = 'jstests_auth_server4892';

View File

@@ -95,7 +95,7 @@ m0.getDB("db1").createRole({
rstest.add();
rstest.reInitiate();
rstest.getMaster().getDB("db1").createRole({
rstest.getPrimary().getDB("db1").createRole({
role: "r3",
roles: [ "r1", "r2" ],
privileges: [
@@ -116,8 +116,8 @@ rstest.nodes.forEach(function (node) {
});
// Verify that updating roles propagates.
rstest.getMaster().getDB("db1").revokeRolesFromRole("r1", [ "read" ], { w: 2 });
rstest.getMaster().getDB("db1").grantRolesToRole("r1", [ "dbAdmin" ], { w: 2 });
rstest.getPrimary().getDB("db1").revokeRolesFromRole("r1", [ "read" ], { w: 2 });
rstest.getPrimary().getDB("db1").grantRolesToRole("r1", [ "dbAdmin" ], { w: 2 });
rstest.nodes.forEach(function (node) {
var role = node.getDB("db1").getRole("r1");
assert.eq(1, role.roles.length, node);
@@ -125,7 +125,7 @@ rstest.nodes.forEach(function (node) {
});
// Verify that dropping roles propagates.
rstest.getMaster().getDB("db1").dropRole("r2", { w: 2});
rstest.getPrimary().getDB("db1").dropRole("r2", { w: 2});
rstest.nodes.forEach(function (node) {
assert.eq(null, node.getDB("db1").getRole("r2"));
var role = node.getDB("db1").getRole("r3");
@@ -137,8 +137,8 @@ rstest.nodes.forEach(function (node) {
});
// Verify that dropping the admin database propagates.
assert.commandWorked(rstest.getMaster().getDB("admin").dropDatabase());
assert.commandWorked(rstest.getMaster().getDB("admin").getLastErrorObj(2));
assert.commandWorked(rstest.getPrimary().getDB("admin").dropDatabase());
assert.commandWorked(rstest.getPrimary().getDB("admin").getLastErrorObj(2));
rstest.nodes.forEach(function (node) {
var roles = node.getDB("db1").getRoles();
assert.eq(0, roles.length, node);
@@ -146,7 +146,7 @@ rstest.nodes.forEach(function (node) {
// Verify that applyOps commands propagate.
// NOTE: This section of the test depends on the oplog and roles schemas.
assert.commandWorked(rstest.getMaster().getDB("admin").runCommand({ applyOps: [
assert.commandWorked(rstest.getPrimary().getDB("admin").runCommand({ applyOps: [
{
op: "c",
ns: "admin.$cmd",
@@ -214,7 +214,7 @@ assert.commandWorked(rstest.getMaster().getDB("admin").runCommand({ applyOps: [
}
] }));
assert.commandWorked(rstest.getMaster().getDB("admin").getLastErrorObj(2));
assert.commandWorked(rstest.getPrimary().getDB("admin").getLastErrorObj(2));
rstest.nodes.forEach(function (node) {
var role = node.getDB("db1").getRole("t1");
assert.eq(1, role.roles.length, node);

View File

@@ -102,6 +102,7 @@ var Cluster = function(options) {
var st;
var initialized = false;
var clusterStartTime;
var _conns = {
mongos: [],
@@ -119,6 +120,7 @@ var Cluster = function(options) {
this.setup = function setup() {
var verbosityLevel = 0;
const REPL_SET_INITIATE_TIMEOUT_MS = 5 * 60 * 1000;
if (initialized) {
throw new Error('cluster has already been initialized');
@@ -144,6 +146,11 @@ var Cluster = function(options) {
oplogSize: 1024,
verbose: verbosityLevel
};
shardConfig.rsOptions = {
// Specify a longer timeout for replSetInitiate, to ensure that
// slow hardware has sufficient time for file pre-allocation.
initiateTimeout: REPL_SET_INITIATE_TIMEOUT_MS,
}
}
st = new ShardingTest(shardConfig);
@@ -196,8 +203,10 @@ var Cluster = function(options) {
var rst = new ReplSetTest(replSetConfig);
rst.startSet();
// Send the replSetInitiate command and wait for initiation
rst.initiate();
// Send the replSetInitiate command and wait for initialization, with an increased
// timeout. This should provide sufficient time for slow hardware, where files may need
// to be pre-allocated.
rst.initiate(null, null, REPL_SET_INITIATE_TIMEOUT_MS);
rst.awaitSecondaryNodes();
conn = rst.getPrimary();
@@ -238,6 +247,7 @@ var Cluster = function(options) {
}
initialized = true;
clusterStartTime = new Date();
options.setupFunctions.mongod.forEach(this.executeOnMongodNodes);
if (options.sharded) {
@@ -254,10 +264,8 @@ var Cluster = function(options) {
};
this.executeOnMongodNodes = function executeOnMongodNodes(fn) {
if (!initialized) {
throw new Error('cluster must be initialized before functions can be executed ' +
'against it');
}
assert(initialized, 'cluster must be initialized first');
if (!fn || typeof(fn) !== 'function' || fn.length !== 1) {
throw new Error('mongod function must be a function that takes a db as an argument');
}
@@ -267,10 +275,8 @@ var Cluster = function(options) {
};
this.executeOnMongosNodes = function executeOnMongosNodes(fn) {
if (!initialized) {
throw new Error('cluster must be initialized before functions can be executed ' +
'against it');
}
assert(initialized, 'cluster must be initialized first');
if (!fn || typeof(fn) !== 'function' || fn.length !== 1) {
throw new Error('mongos function must be a function that takes a db as an argument');
}
@@ -280,21 +286,17 @@ var Cluster = function(options) {
};
this.teardown = function teardown() {
assert(initialized, 'cluster must be initialized first');
options.teardownFunctions.mongod.forEach(this.executeOnMongodNodes);
};
this.getDB = function getDB(dbName) {
if (!initialized) {
throw new Error('cluster has not been initialized yet');
}
assert(initialized, 'cluster must be initialized first');
return conn.getDB(dbName);
};
this.getHost = function getHost() {
if (!initialized) {
throw new Error('cluster has not been initialized yet');
}
assert(initialized, 'cluster must be initialized first');
// Alternate mongos connections for sharded clusters
if (this.isSharded()) {
@@ -317,6 +319,7 @@ var Cluster = function(options) {
};
this.shardCollection = function shardCollection() {
assert(initialized, 'cluster must be initialized first');
assert(this.isSharded(), 'cluster is not sharded');
st.shardColl.apply(st, arguments);
};
@@ -350,6 +353,8 @@ var Cluster = function(options) {
// }
// }
this.getSerializedCluster = function getSerializedCluster() {
assert(initialized, 'cluster must be initialized first');
// TODO: Add support for non-sharded clusters.
if (!this.isSharded()) {
return '';
@@ -397,11 +402,13 @@ var Cluster = function(options) {
}
this.startBalancer = function startBalancer() {
assert(initialized, 'cluster must be initialized first');
assert(this.isSharded(), 'cluster is not sharded');
st.startBalancer();
};
this.stopBalancer = function stopBalancer() {
assert(initialized, 'cluster must be initialized first');
assert(this.isSharded(), 'cluster is not sharded');
st.stopBalancer();
};
@@ -411,6 +418,7 @@ var Cluster = function(options) {
};
this.awaitReplication = function awaitReplication(message) {
assert(initialized, 'cluster must be initialized first');
if (this.isReplication()) {
var wc = {
writeConcern: {
@@ -463,8 +471,8 @@ var Cluster = function(options) {
hashes.slaves.forEach(function(slaveHashes) {
assert.commandWorked(slaveHashes);
assert.eq(masterHashes.numCollections,
slaveHashes.numCollections,
assert.eq(masterHashes.collections.length,
slaveHashes.collections.length,
message + ' dbHash number of collections in db ' +
dbInfo.name + ' ' + tojson(hashes));
@@ -492,6 +500,35 @@ var Cluster = function(options) {
}, this);
}, this);
};
this.recordConfigServerData = function recordConfigServerData(configServer) {
assert(initialized, 'cluster must be initialized first');
assert(this.isSharded(), 'cluster is not sharded');
var data = {};
var configDB = configServer.getDB('config');
// We record the contents of the 'lockpings' and 'locks' collections to make it easier to
// debug issues with distributed locks in the sharded cluster.
data.lockpings = configDB.lockpings.find({ ping: { $gte: clusterStartTime } }).toArray();
// We suppress some fields from the result set to reduce the amount of data recorded.
data.locks = configDB.locks.find({ when: { $gte: clusterStartTime } },
{ process: 0, ts: 0 }).toArray();
return data;
};
this.recordAllConfigServerData = function recordAllConfigServerData() {
assert(initialized, 'cluster must be initialized first');
assert(this.isSharded(), 'cluster is not sharded');
var data = {};
st._configServers.forEach(config =>
(data[config.host] = this.recordConfigServerData(config)));
return data;
};
};
/**

View File

@@ -258,13 +258,13 @@ var runner = (function() {
}
}
function WorkloadFailure(err, stack, kind) {
function WorkloadFailure(err, stack, header) {
this.err = err;
this.stack = stack;
this.kind = kind;
this.header = header;
this.format = function format() {
return this.kind + '\n' + this.err + '\n\n' + this.stack;
return this.header + '\n' + this.err + '\n\n' + this.stack;
};
}
@@ -396,13 +396,15 @@ var runner = (function() {
}
}
function loadWorkloadContext(workloads, context, executionOptions) {
function loadWorkloadContext(workloads, context, executionOptions, applyMultipliers) {
workloads.forEach(function(workload) {
load(workload); // for $config
assert.neq('undefined', typeof $config, '$config was not defined by ' + workload);
context[workload] = { config: parseConfig($config) };
context[workload].config.iterations *= executionOptions.iterationMultiplier;
context[workload].config.threadCount *= executionOptions.threadMultiplier;
if (applyMultipliers) {
context[workload].config.iterations *= executionOptions.iterationMultiplier;
context[workload].config.threadCount *= executionOptions.threadMultiplier;
}
});
}
@@ -422,7 +424,7 @@ var runner = (function() {
jsTest.log('End of schedule');
}
function cleanupWorkload(workload, context, cluster, errors, kind, dbHashBlacklist) {
function cleanupWorkload(workload, context, cluster, errors, header, dbHashBlacklist) {
// Returns true if the workload's teardown succeeds and false if the workload's
// teardown fails.
@@ -435,22 +437,47 @@ var runner = (function() {
cluster.checkDbHashes(dbHashBlacklist, 'before workload teardown');
} catch (e) {
errors.push(new WorkloadFailure(e.toString(), e.stack,
kind + ' checking consistency on secondaries'));
header + ' checking consistency on secondaries'));
return false;
}
try {
teardownWorkload(workload, context, cluster);
} catch (e) {
errors.push(new WorkloadFailure(e.toString(), e.stack, kind + ' Teardown'));
errors.push(new WorkloadFailure(e.toString(), e.stack, header + ' Teardown'));
return false;
}
return true;
}
function runWorkloadGroup(threadMgr, workloads, context, cluster, clusterOptions,
executionMode, executionOptions, errors, maxAllowedThreads,
dbHashBlacklist) {
function recordConfigServerData(cluster, workloads, configServerData, errors) {
const CONFIG_DATA_LENGTH = 3;
if (cluster.isSharded()) {
var newData;
try {
newData = cluster.recordAllConfigServerData();
} catch (e) {
var failureType = 'Config Server Data Collection';
errors.push(new WorkloadFailure(e.toString(), e.stack, failureType));
return;
}
newData.previousWorkloads = workloads;
newData.time = (new Date()).toISOString();
configServerData.push(newData);
// Limit the amount of data recorded to avoid logging too much info when a test
// fails.
while (configServerData.length > CONFIG_DATA_LENGTH) {
configServerData.shift();
}
}
}
function runWorkloadGroup(threadMgr, workloads, context, cluster, clusterOptions, executionMode,
executionOptions, errors, maxAllowedThreads, dbHashBlacklist,
configServerData) {
var cleanup = [];
var teardownFailed = false;
var startTime = Date.now(); // Initialize in case setupWorkload fails below.
@@ -488,7 +515,7 @@ var runner = (function() {
// Threads must be joined before destruction, so do this
// even in the presence of exceptions.
errors.push(...threadMgr.joinAll().map(e =>
new WorkloadFailure(e.err, e.stack, 'Foreground')));
new WorkloadFailure(e.err, e.stack, 'Foreground ' + e.workloads.join(' '))));
}
} finally {
// Call each foreground workload's teardown function. After all teardowns have completed
@@ -501,6 +528,8 @@ var runner = (function() {
totalTime = Date.now() - startTime;
jsTest.log('Workload(s) completed in ' + totalTime + ' ms: ' +
workloads.join(' '));
recordConfigServerData(cluster, workloads, configServerData, errors);
}
// Only drop the collections/databases if all the workloads ran successfully.
@@ -556,12 +585,13 @@ var runner = (function() {
globalAssertLevel = assertLevel;
var context = {};
loadWorkloadContext(workloads, context, executionOptions);
loadWorkloadContext(workloads, context, executionOptions, true /* applyMultipliers */);
var threadMgr = new ThreadManager(clusterOptions, executionMode);
var bgContext = {};
var bgWorkloads = executionOptions.backgroundWorkloads;
loadWorkloadContext(bgWorkloads, bgContext, executionOptions);
loadWorkloadContext(bgWorkloads, bgContext, executionOptions,
false /* applyMultipliers */);
var bgThreadMgr = new ThreadManager(clusterOptions, { composed: false });
var cluster = new Cluster(clusterOptions);
@@ -591,6 +621,7 @@ var runner = (function() {
Random.setRandomSeed(clusterOptions.seed);
var bgCleanup = [];
var errors = [];
var configServerData = [];
try {
prepareCollections(bgWorkloads, bgContext, cluster, clusterOptions, executionOptions);
@@ -637,15 +668,15 @@ var runner = (function() {
});
// Run the next group of workloads in the schedule.
runWorkloadGroup(threadMgr, workloads, groupContext, cluster,
clusterOptions, executionMode, executionOptions,
errors, maxAllowedThreads, dbHashBlacklist);
runWorkloadGroup(threadMgr, workloads, groupContext, cluster, clusterOptions,
executionMode, executionOptions, errors, maxAllowedThreads,
dbHashBlacklist, configServerData);
});
} finally {
// Set a flag so background threads know to terminate.
bgThreadMgr.markAllForTermination();
errors.push(...bgThreadMgr.joinAll().map(e =>
new WorkloadFailure(e.err, e.stack, 'Background')));
new WorkloadFailure(e.err, e.stack, 'Background ' + e.workloads.join(' '))));
}
} finally {
try {
@@ -660,7 +691,13 @@ var runner = (function() {
// the foreground and background workloads. IterationEnd errors are ignored because
// they are thrown when the background workloads are instructed by the thread
// manager to terminate.
throwError(errors.filter(e => (e.err.startsWith('IterationEnd:') === false)));
var workloadErrors = errors.filter(e => !e.err.startsWith('IterationEnd:'));
if (cluster.isSharded() && workloadErrors.length) {
jsTest.log('Config Server Data:\n' + tojsononeline(configServerData));
}
throwError(workloadErrors);
} finally {
cluster.teardown();
}

View File

@@ -105,7 +105,7 @@ var workerThread = (function() {
return { ok: 1 };
} catch(e) {
args.errorLatch.countDown();
return { ok: 0, err: e.toString(), stack: e.stack };
return { ok: 0, err: e.toString(), stack: e.stack, workloads: workloads };
}
} finally {
// Avoid retention of connection object

View File

@@ -0,0 +1,23 @@
// This is a regression test for SERVER-21545.
//
// Tests that a collMod with a bad specification does not cause any changes, and does not crash the
// server.
(function() {
"use strict";
var collName = "collModBadSpec";
var coll = db.getCollection(collName);
coll.drop();
assert.commandWorked(db.createCollection(collName));
// Get the original collection options for the collection.
var originalResult = db.getCollectionInfos({name: collName});
// Issue an invalid command.
assert.commandFailed(coll.runCommand("collMod", {validationLevel: "off", unknownField: "x"}));
// Make sure the options are unchanged.
var newResult = db.getCollectionInfos({name: collName});
assert.eq(originalResult, newResult);
})();

View File

@@ -90,4 +90,7 @@
assert.eq(cmdRes.cursor.id, NumberLong(0));
assert.eq(cmdRes.cursor.ns, coll.getFullName());
assert.eq(cmdRes.cursor.firstBatch.length, 10);
// Error on invalid collection name.
assert.commandFailedWithCode(db.runCommand({find: ""}), ErrorCodes.InvalidNamespace);
})();

View File

@@ -54,15 +54,24 @@
assert.eq(countA, getUsageCount("a_1"));
// Confirm index stats tick on findAndModify().
var res = db.runCommand({findAndModify: colName,
query: {a: 1},
update: {$set: {d: 1}},
// Confirm index stats tick on findAndModify() update.
var res = db.runCommand({findAndModify: colName,
query: {a: 1},
update: {$set: {d: 1}},
'new': true});
assert.commandWorked(res);
countA++;
assert.eq(countA, getUsageCount("a_1"));
// Confirm index stats tick on findAndModify() delete.
res = db.runCommand({findAndModify: colName,
query: {a: 2},
remove: true});
assert.commandWorked(res);
countA++;
assert.eq(countA, getUsageCount("a_1"));
assert.writeOK(col.insert(res.value));
// Confirm index stats tick on distinct().
res = db.runCommand({distinct: colName, key: "b", query: {b: 1}});
assert.commandWorked(res);

View File

@@ -0,0 +1,155 @@
// Test the killCursors command.
(function() {
'use strict';
var cmdRes;
var cursor;
var cursorId;
var coll = db.jstest_killcursors;
coll.drop();
for (var i = 0; i < 10; i++) {
assert.writeOK(coll.insert({_id: i}));
}
// killCursors command should fail if the collection name is not a string.
cmdRes = db.runCommand({
killCursors: {foo: "bad collection param"},
cursors: [NumberLong(123), NumberLong(456)]
});
assert.commandFailedWithCode(cmdRes, ErrorCodes.FailedToParse);
// killCursors command should fail if the cursors parameter is not an array.
cmdRes = db.runCommand({
killCursors: coll.getName(),
cursors: {a: NumberLong(123), b: NumberLong(456)}
});
assert.commandFailedWithCode(cmdRes, ErrorCodes.FailedToParse);
// killCursors command should fail if the cursors parameter is an empty array.
cmdRes = db.runCommand({
killCursors: coll.getName(),
cursors: []
});
assert.commandFailedWithCode(cmdRes, ErrorCodes.BadValue);
// killCursors command should report cursors as not found if the collection does not exist.
cmdRes = db.runCommand({
killCursors: "non-existent-collection",
cursors: [NumberLong(123), NumberLong(456)]
});
assert.commandWorked(cmdRes);
assert.eq(cmdRes.cursorsKilled, []);
assert.eq(cmdRes.cursorsNotFound, [NumberLong(123), NumberLong(456)]);
assert.eq(cmdRes.cursorsAlive, []);
assert.eq(cmdRes.cursorsUnknown, []);
// killCursors command should report non-existent cursors as "not found".
cmdRes = db.runCommand({
killCursors: coll.getName(),
cursors: [NumberLong(123), NumberLong(456)]
});
assert.commandWorked(cmdRes);
assert.eq(cmdRes.cursorsKilled, []);
assert.eq(cmdRes.cursorsNotFound, [NumberLong(123), NumberLong(456)]);
assert.eq(cmdRes.cursorsAlive, []);
assert.eq(cmdRes.cursorsUnknown, []);
// Test a case where one cursors exists and is killed but the other does not exist.
cmdRes = db.runCommand({find: coll.getName(), batchSize: 2});
assert.commandWorked(cmdRes);
cursorId = cmdRes.cursor.id;
assert.neq(cursorId, NumberLong(0));
cmdRes = db.runCommand({
killCursors: coll.getName(),
cursors: [NumberLong(123), cursorId]
});
assert.commandWorked(cmdRes);
assert.eq(cmdRes.cursorsKilled, [cursorId]);
assert.eq(cmdRes.cursorsNotFound, [NumberLong(123)]);
assert.eq(cmdRes.cursorsAlive, []);
assert.eq(cmdRes.cursorsUnknown, []);
// Test killing a noTimeout cursor.
cmdRes = db.runCommand({find: coll.getName(), batchSize: 2, noCursorTimeout: true});
assert.commandWorked(cmdRes);
cursorId = cmdRes.cursor.id;
assert.neq(cursorId, NumberLong(0));
cmdRes = db.runCommand({
killCursors: coll.getName(),
cursors: [NumberLong(123), cursorId]
});
assert.commandWorked(cmdRes);
assert.eq(cmdRes.cursorsKilled, [cursorId]);
assert.eq(cmdRes.cursorsNotFound, [NumberLong(123)]);
assert.eq(cmdRes.cursorsAlive, []);
assert.eq(cmdRes.cursorsUnknown, []);
// Test killing a pinned cursor. Since cursors are generally pinned for short periods of time
// while result batches are generated, this requires some special machinery to keep a cursor
// permanently pinned.
var failpointName = "keepCursorPinnedDuringGetMore";
var cleanup;
try {
// Enable a failpoint to ensure that the cursor remains pinned.
assert.commandWorked(db.adminCommand({
configureFailPoint: failpointName,
mode: "alwaysOn"
}));
cmdRes = db.runCommand({find: coll.getName(), batchSize: 2});
assert.commandWorked(cmdRes);
cursorId = cmdRes.cursor.id;
assert.neq(cursorId, NumberLong(0));
cmdRes = db.runCommand({isMaster: 1});
assert.commandWorked(cmdRes);
var isMongos = (cmdRes.msg === "isdbgrid");
// Pin the cursor during a getMore.
var code = 'db.runCommand({getMore: ' + cursorId.toString() +
', collection: "' + coll.getName() + '"});'
cleanup = startParallelShell(code);
// Sleep to make it more likely that the cursor will be pinned.
sleep(2000);
// Attempt to kill the cursor. In order to avoid flakiness, we do not assume that the cursor
// is already pinned (although generally it will be).
//
// Currently, pinned cursors that are targeted by a killCursors operation are kept alive on
// mongod but are killed on mongos (see SERVER-21710).
cmdRes = db.runCommand({
killCursors: coll.getName(),
cursors: [NumberLong(123), cursorId]
});
assert.commandWorked(cmdRes);
assert.eq(cmdRes.cursorsNotFound, [NumberLong(123)]);
assert.eq(cmdRes.cursorsUnknown, []);
if (isMongos) {
assert.eq(cmdRes.cursorsKilled, [cursorId]);
assert.eq(cmdRes.cursorsAlive, []);
}
else {
// If the cursor has already been pinned it will be left alive; otherwise it will be
// killed.
if (cmdRes.cursorsAlive.length === 1) {
assert.eq(cmdRes.cursorsKilled, []);
assert.eq(cmdRes.cursorsAlive, [cursorId]);
}
else {
assert.eq(cmdRes.cursorsKilled, [cursorId]);
assert.eq(cmdRes.cursorsAlive, []);
}
}
} finally {
assert.commandWorked(db.adminCommand({configureFailPoint: failpointName, mode: "off"}));
if (cleanup) {
cleanup();
}
}
})();

View File

@@ -157,6 +157,20 @@ try {
assert.eq(lastOp.op, "getmore");
assert.eq(lastOp.ns, coll.getFullName());
// getMore entry created by iterating the cursor should have the same format, regardless of
// readMode.
coll.find().batchSize(3).itcount();
lastOp = getLastOp();
assert.eq(lastOp.op, "getmore");
assert.eq(lastOp.ns, coll.getFullName());
assert("getMore" in lastOp.query);
assert.eq(lastOp.query.getMore, lastOp.cursorid);
assert.eq(lastOp.query.collection, coll.getName());
assert.eq(lastOp.query.batchSize, 3)
assert.eq(lastOp.cursorExhausted, true)
assert.eq(lastOp.nreturned, 2);
assert("responseLength" in lastOp);
// Ensure that special $-prefixed OP_QUERY options like $hint and $returnKey get added to the
// profiler entry correctly.
coll.find().hint({_id: 1}).itcount();
@@ -191,6 +205,100 @@ try {
lastOp = getLastOp();
assert.eq(lastOp.query.snapshot, true);
// Tests for profiling findAndModify.
coll.drop();
for (var i = 0; i < 3; i++) {
assert.writeOK(coll.insert({_id: i, a: i}));
}
// Update as findAndModify.
assert.eq({_id: 2, a: 2}, coll.findAndModify({query: {a: 2}, update: {$inc: {b: 1}}}));
lastOp = getLastOp();
assert.eq(lastOp.op, "command");
assert.eq(lastOp.ns, coll.getFullName());
assert.eq(lastOp.command.query, {a: 2});
assert.eq(lastOp.command.update, {$inc: {b: 1}});
assert.eq(lastOp.updateobj, {$inc: {b: 1}});
assert.eq(lastOp.keysExamined, 0);
assert.eq(lastOp.docsExamined, 3);
assert.eq(lastOp.nMatched, 1);
assert.eq(lastOp.nModified, 1);
// Delete as findAndModify.
assert.eq({_id: 2, a: 2, b: 1}, coll.findAndModify({query: {a: 2}, remove: true}));
lastOp = getLastOp();
assert.eq(lastOp.op, "command");
assert.eq(lastOp.ns, coll.getFullName());
assert.eq(lastOp.command.query, {a: 2});
assert.eq(lastOp.command.remove, true);
assert(!("updateobj" in lastOp));
assert.eq(lastOp.ndeleted, 1);
// Update with {upsert: true} as findAndModify.
assert.eq({_id: 2, a: 2, b: 1}, coll.findAndModify({
query: {_id: 2, a: 2},
update: {$inc: {b: 1}},
upsert: true,
new: true
}));
lastOp = getLastOp();
assert.eq(lastOp.op, "command");
assert.eq(lastOp.ns, coll.getFullName());
assert.eq(lastOp.command.query, {_id: 2, a: 2});
assert.eq(lastOp.command.update, {$inc: {b: 1}});
assert.eq(lastOp.command.upsert, true);
assert.eq(lastOp.command.new, true);
assert.eq(lastOp.updateobj, {$inc: {b: 1}});
assert.eq(lastOp.keysExamined, 0);
assert.eq(lastOp.docsExamined, 0);
assert.eq(lastOp.nMatched, 1);
assert.eq(lastOp.nModified, 1);
assert.eq(lastOp.upsert, true);
// Idhack update as findAndModify.
assert.eq({_id: 2, a: 2, b: 1}, coll.findAndModify({
query: {_id: 2},
update: {$inc: {b: 1}}
}));
lastOp = getLastOp();
assert.eq(lastOp.keysExamined, 1);
assert.eq(lastOp.docsExamined, 1);
assert.eq(lastOp.nMatched, 1);
assert.eq(lastOp.nModified, 1);
// Update as findAndModify with projection.
assert.eq({a: 2}, coll.findAndModify({
query: {a: 2},
update: {$inc: {b: 1}},
fields: {_id: 0, a: 1}
}));
lastOp = getLastOp();
assert.eq(lastOp.op, "command");
assert.eq(lastOp.ns, coll.getFullName());
assert.eq(lastOp.command.query, {a: 2});
assert.eq(lastOp.command.update, {$inc: {b: 1}});
assert.eq(lastOp.command.fields, {_id: 0, a: 1});
assert.eq(lastOp.updateobj, {$inc: {b: 1}});
assert.eq(lastOp.keysExamined, 0);
assert.eq(lastOp.docsExamined, 3);
assert.eq(lastOp.nMatched, 1);
assert.eq(lastOp.nModified, 1);
// Delete as findAndModify with projection.
assert.eq({a: 2}, coll.findAndModify({
query: {a: 2},
remove: true,
fields: {_id: 0, a: 1}
}));
lastOp = getLastOp();
assert.eq(lastOp.op, "command");
assert.eq(lastOp.ns, coll.getFullName());
assert.eq(lastOp.command.query, {a: 2});
assert.eq(lastOp.command.remove, true);
assert.eq(lastOp.command.fields, {_id: 0, a: 1});
assert(!("updateobj" in lastOp));
assert.eq(lastOp.ndeleted, 1);
db.setProfilingLevel(0);
db.system.profile.drop();
}

View File

@@ -0,0 +1,21 @@
// Test the "single batch" semantics of negative limit.
(function() {
'use strict';
var coll = db.jstests_single_batch;
coll.drop();
// Approximately 1 MB.
var padding = new Array(1024 * 1024).join("x");
// Insert ~10 MB of data.
for (var i = 0; i < 10; i++) {
assert.writeOK(coll.insert({_id: i, padding: padding}));
}
// The limit is 8, but we should end up with fewer documents since 8 docs won't fit in a single
// 4 MB batch.
var numResults = coll.find().limit(-8).itcount();
assert.lt(numResults, 8);
assert.gt(numResults, 0);
})();

View File

@@ -62,9 +62,10 @@ assert.eq(buildinfo, latestStartUpLog.buildinfo, "buildinfo doesn't match that f
// Test version and version Array
var version = latestStartUpLog.buildinfo.version.split('-')[0];
var versionArray = latestStartUpLog.buildinfo.versionArray;
var versionArrayCleaned = [];
// Only create a string with 2 dots (2.5.5, not 2.5.5.0)
for (var i = 0; i < (versionArray.length - 1); i++) if (versionArray[i] >= 0) { versionArrayCleaned.push(versionArray[i]); }
var versionArrayCleaned = versionArray.slice(0, 3);
if (versionArray[3] == -100) {
versionArrayCleaned[2] -= 1;
}
assert.eq(serverStatus.version, latestStartUpLog.buildinfo.version, "Mongo version doesn't match that from ServerStatus");
assert.eq(version, versionArrayCleaned.join('.'), "version doesn't match that from the versionArray");

View File

@@ -5,7 +5,7 @@ var replTest = new ReplSetTest({name: name, oplogSize: 1, nodes: 3,
settings: {chainingAllowed: false}});
var nodes = replTest.startSet();
replTest.initiate();
var master = replTest.getMaster();
var master = replTest.getPrimary();
var mdb = master.getDB("test");
// synchronize replication
@@ -49,7 +49,7 @@ assert.eq(gle.wtimeout, null);
// take a node down and GLE for more nodes than are up
replTest.stop(2);
master = replTest.getMaster();
master = replTest.getPrimary();
mdb = master.getDB("test");
// do w:2 write so secondary is caught up before calling {gle w:3}.
assert.writeOK(mdb.foo.insert({_id: "3"}, {writeConcern: {w: 2, wtimeout:30000}}));

View File

@@ -1,6 +1,9 @@
//
// Tests the use of the wOpTime option in getLastError
//
// This test requires fsync to lock the secondary, so cannot be run on storage engines which do not
// support the command.
// @tags: [requires_fsync]
var rst = new ReplSetTest({ nodes : 2 });
rst.startSet();
@@ -18,7 +21,7 @@ assert.eq( null, gleObj.err );
var opTimeBeforeFailure = gleObj.lastOp;
// Lock the secondary
secondary.getDB("admin").fsyncLock();
assert.commandWorked(secondary.getDB("admin").fsyncLock());
// Insert a doc and replicate it to the primary only
coll.insert({ some : "doc" });

View File

@@ -1,5 +1,9 @@
// Tests of sharded GLE enforcing write concern against operations in a cluster
// Basic sharded GLE operation is tested elsewhere.
//
// This test asserts that a journaled write to a mongod running with --nojournal should be rejected,
// so cannot be run on the ephemeralForTest storage engine, as it accepts all journaled writes.
// @tags: [SERVER-21420]
(function() {

View File

@@ -1,4 +1,8 @@
// TODO: remove test after we deprecate SyncClusterConnection
//
// This test involves restarting a standalone shard, so cannot be run on ephemeral storage engines.
// A restarted standalone will lose all data when using an ephemeral storage engine.
// @tags: [requires_persistence]
var test = new SyncCCTest( "sync1" );

View File

@@ -17,10 +17,17 @@
}
var c1, c2, c3;
c1 = MongoRunner.runMongod({configsvr: "", port: 27019, replSet: "csrs"});
// The config servers must support readConcern: majority to be run as a replica set, so
// explicitly set storage engine to wiredTiger.
c1 = MongoRunner.runMongod({
configsvr: "",
port: 27019,
replSet: "csrs",
storageEngine: "wiredTiger"
});
assert.commandWorked(c1.adminCommand("replSetInitiate"));
c2 = MongoRunner.runMongod({configsvr: ""});
c3 = MongoRunner.runMongod({configsvr: ""});
c2 = MongoRunner.runMongod({configsvr: "", storageEngine: "wiredTiger"});
c3 = MongoRunner.runMongod({configsvr: "", storageEngine: "wiredTiger"});
var configstrs = [
getHostPart(c1.host) + "," + c2.host + "," + c3.host,

View File

@@ -197,8 +197,10 @@ function configureMigrateFailPoint( shardConnection, stepNumber, mode ) {
// Wait for moveChunk to reach a step (1 through 6).
//
function waitForMigrateStep( shardConnection, stepNumber ) {
var searchString = 'step ' + stepNumber,
admin = shardConnection.getDB( 'admin' );
var migrateThreadPrefix = 'migrateThread-';
var searchStringPrefix = 'step ' + stepNumber;
var admin = shardConnection.getDB('admin');
assert( stepNumber >= 1);
assert( stepNumber <= 5 );
@@ -214,8 +216,8 @@ function waitForMigrateStep( shardConnection, stepNumber ) {
var in_progress = admin.currentOp(true).inprog;
for ( var i = 0; i < in_progress.length; ++i ) {
var op = in_progress[i];
if ( op.desc && op.desc === 'migrateThread' ) {
return op.msg.startsWith( searchString );
if (op.desc && op.desc.startsWith(migrateThreadPrefix)) {
return op.msg.startsWith(searchStringPrefix);
}
}

View File

@@ -11,7 +11,7 @@ var ElectionTimingTest = function(opts) {
// The config is set to two electable nodes since we use waitForMemberState
// to wait for the electable secondary to become primary.
this.nodes = [
this.nodes = opts.nodes || [
{},
{},
{rsConfig: {arbiterOnly: true}}
@@ -32,6 +32,9 @@ var ElectionTimingTest = function(opts) {
// A function that triggers election, default is to kill the mongod process.
this.electionTrigger = opts.electionTrigger || this.stopPrimary;
// A function that waits for new primary to be elected.
this.waitForNewPrimary = opts.waitForNewPrimary || this.waitForNewPrimary;
// A function that cleans up after the election trigger.
this.testReset = opts.testReset || this.stopPrimaryReset;
@@ -80,6 +83,10 @@ ElectionTimingTest.prototype._runTimingTest = function() {
var coll = primary.getCollection(collectionName);
var secondary = this.rst.getSecondary();
this.electionTimeoutLimitMillis =
ElectionTimingTest.calculateElectionTimeoutLimitMillis(primary);
jsTestLog('Election timeout limit: ' + this.electionTimeoutLimitMillis + ' ms');
for (var i = 0; i < 100; i++) {
assert.writeOK(coll.insert({_id: i,
x: i * 3,
@@ -107,21 +114,13 @@ ElectionTimingTest.prototype._runTimingTest = function() {
// Wait for the electable secondary to become primary.
try {
assert.commandWorked(
secondary.adminCommand({
replSetTest: 1,
waitForMemberState: this.rst.PRIMARY,
timeoutMillis: 60 * 1000
}),
"node " + secondary.host + " failed to become primary"
);
this.waitForNewPrimary(this.rst, secondary);
} catch (e) {
// If we didn"t find a primary, save the error, break so this
// ReplSetTest is stopped. We can"t continue from a flaky state.
this.testErrors.push({testRun: run,
cycle: cycle,
status: "waitForMemberState(PRIMARY) failed: " +
secondary.host,
status: "new primary not elected",
error: e});
break;
}
@@ -190,3 +189,44 @@ ElectionTimingTest.prototype.stepDownPrimaryReset = function() {
sleep(this.stepDownGuardTime * 1000);
};
ElectionTimingTest.prototype.waitForNewPrimary = function(rst, secondary) {
assert.commandWorked(
secondary.adminCommand({
replSetTest: 1,
waitForMemberState: ReplSetTest.State.PRIMARY,
timeoutMillis: 60 * 1000
}),
"node " + secondary.host + " failed to become primary"
);
};
/**
* Calculates upper limit for actual failover time in milliseconds.
*/
ElectionTimingTest.calculateElectionTimeoutLimitMillis = function(primary) {
var configResult = assert.commandWorked(primary.adminCommand({replSetGetConfig: 1}));
var config = configResult.config;
// Protocol version is 0 if missing from config.
var protocolVersion = config.hasOwnProperty("protocolVersion") ? config.protocolVersion : 0;
var electionTimeoutMillis = 0;
var electionTimeoutOffsetLimitFraction = 0;
if (protocolVersion == 0) {
electionTimeoutMillis = 30000; // from TopologyCoordinatorImpl::VoteLease::leaseTime
electionTimeoutOffsetLimitFraction = 0;
} else {
electionTimeoutMillis = config.settings.electionTimeoutMillis;
var getParameterResult = assert.commandWorked(primary.adminCommand({
getParameter: 1,
replElectionTimeoutOffsetLimitFraction: 1,
}));
electionTimeoutOffsetLimitFraction =
getParameterResult.replElectionTimeoutOffsetLimitFraction;
}
var assertSoonIntervalMillis = 200; // from assert.js
var applierDrainWaitMillis = 1000; // from SyncTail::tryPopAndWaitForMore()
var electionTimeoutLimitMillis =
(1 + electionTimeoutOffsetLimitFraction) * electionTimeoutMillis +
applierDrainWaitMillis +
assertSoonIntervalMillis;
return electionTimeoutLimitMillis;
}

View File

@@ -59,7 +59,6 @@
// These are reading commands that support majority readConcern.
var commandsToForceReadConcern = [
"count",
"dbStats",
"distinct",
"find",
"geoNear",

View File

@@ -1,22 +1,18 @@
/**
* The ParallelTester class is used to test more than one test concurrently
*/
if ( typeof _threadInject != "undefined" ){
//print( "fork() available!" );
if (typeof _threadInject != "undefined") {
Thread = function(){
this.init.apply( this, arguments );
}
_threadInject( Thread.prototype );
ScopedThread = function() {
this.init.apply( this, arguments );
}
ScopedThread.prototype = new Thread( function() {} );
_scopedThreadInject( ScopedThread.prototype );
fork = function() {
var t = new Thread( function() {} );
Thread.apply( t, arguments );
@@ -29,7 +25,7 @@ if ( typeof _threadInject != "undefined" ){
if (host == undefined) host = db.getMongo().host;
this.events = new Array( me, collectionName, host );
}
EventGenerator.prototype._add = function( action ) {
this.events.push( [ Random.genExp( this.mean ), action ] );
}
@@ -160,6 +156,9 @@ if ( typeof _threadInject != "undefined" ){
// This overwrites MinKey/MaxKey's singleton which breaks
// any other test that uses MinKey/MaxKey
"type6.js",
// Assumes that other tests are not creating cursors.
"kill_cursors.js",
] );
var parallelFilesDir = "jstests/core";

View File

@@ -0,0 +1,39 @@
// Ensure that the latest version of the shell (with no particular readMode set) can issue find
// operations against a 3.0 server. The shell should read the wire version and fall back to "legacy"
// readMode.
(function() {
'use strict';
var conn30 = MongoRunner.runMongod({binVersion: '3.0'});
assert.neq(conn30, null, 'unable to start 3.0 mongod');
// Force writeMode to "commands" so that we can check the results of write operations.
conn30.forceWriteMode('commands');
// Forcing the readMode to "compatibility" and then asking for the readMode should cause the
// shell to resolve the readMode to "legacy".
conn30.forceReadMode('compatibility');
assert.eq('legacy', conn30.readMode());
var testDB = conn30.getDB('test');
var coll = testDB.readmode_compatibility;
coll.drop();
for (var i = 0; i < 5; i++) {
assert.writeOK(coll.insert({_id: i}));
}
// Use a batchSize of 2 to ensure that we exercise both find and getMore.
conn30.forceReadMode('compatibility');
assert.eq(5, coll.find().batchSize(2).itcount());
assert.eq('legacy', conn30._readMode);
MongoRunner.stopMongod(conn30);
// With the latest version of mongod, forcing the readMode to "compatibility" and then asking
// for the readMode should cause the shell to resolve the readMode to "commands".
var connLatest = MongoRunner.runMongod({});
assert.neq(connLatest, null, 'unable to start 3.2 mongod');
connLatest.forceReadMode('compatibility');
assert.eq('commands', connLatest.readMode());
})();

View File

@@ -255,7 +255,7 @@
}
// Wait up to 60 seconds until restarted node is in state secondary
rst.waitForState(rst.getSecondaries(), rst.SECONDARY, 60 * 1000);
rst.waitForState(rst.getSecondaries(), ReplSetTest.State.SECONDARY, 60 * 1000);
// Add new hidden node to replSetTest
var hiddenCfg = {
@@ -289,7 +289,9 @@
' failed to reconfigure replSet ' + tojson(rsConfig));
// Wait up to 60 seconds until the new hidden node is in state RECOVERING.
rst.waitForState(rst.nodes[numNodes], [rst.RECOVERING, rst.SECONDARY], 60 * 1000);
rst.waitForState(rst.nodes[numNodes],
[ReplSetTest.State.RECOVERING, ReplSetTest.State.SECONDARY],
60 * 1000);
// Stop CRUD client and FSM client.
assert(checkProgram(crudPid), testName + ' CRUD client was not running at end of test');
@@ -298,7 +300,7 @@
stopMongoProgramByPid(fsmPid);
// Wait up to 60 seconds until the new hidden node is in state SECONDARY.
rst.waitForState(rst.nodes[numNodes], rst.SECONDARY, 60 * 1000);
rst.waitForState(rst.nodes[numNodes], ReplSetTest.State.SECONDARY, 60 * 1000);
// Stop set.
rst.stopSet();

View File

@@ -78,7 +78,9 @@ replTest.reInitiate(awaitTimeout * 2);
secondary.setSlaveOk();
// Wait for the secondary to get ReplSetInitiate command.
replTest.waitForState(secondary,
[replTest.STARTUP_2, replTest.RECOVERING, replTest.SECONDARY],
[ReplSetTest.State.STARTUP_2,
ReplSetTest.State.RECOVERING,
ReplSetTest.State.SECONDARY],
60 * 1000);
// This fail point will cause the first intial sync to fail, and leave an op in the buffer to

View File

@@ -9,7 +9,7 @@ var host = getHostName();
var nodes = replTest.startSet();
replTest.initiate();
var master = replTest.getMaster();
var master = replTest.getPrimary();
var mdb = master.getDB("foo");
print("1: initial insert");

View File

@@ -30,7 +30,7 @@ replTest.initiate({_id : name, members : [
{_id : 2, host : host+":"+replTest.ports[2], arbiterOnly : true}
]});
var slaves = replTest.liveNodes.slaves;
var master = replTest.getMaster();
var master = replTest.getPrimary();
var masterId = replTest.getNodeId(master);
var slave = slaves[0];
var slaveId = replTest.getNodeId(slave);
@@ -62,7 +62,7 @@ print("6: start up slave");
replTest.restart(slaveId);
print("7: writes on former slave")
master = replTest.getMaster();
master = replTest.getPrimary();
mdb1 = master.getDB("foo");
mdb1.foo.save({a:1002});

View File

@@ -40,7 +40,7 @@ else {
config.members[0].priority = 1;
replTest.initiate(config);
var masterDB = replTest.getMaster().getDB("test");
var masterDB = replTest.getPrimary().getDB("test");
var secondary1 = replTest.liveNodes.slaves[0];
jsTestLog("add some data to collection foo");

View File

@@ -16,7 +16,7 @@
return benchRun(benchArgs);
}
function testInsert(writeCmd) {
function testInsert(writeCmd, wc) {
coll.drop();
var docs = [];
@@ -26,7 +26,8 @@
var res = executeBenchRun([{ns: coll.getFullName(),
op: "insert",
doc: docs,
writeCmd: writeCmd}]);
writeCmd: writeCmd,
writeConcern : wc}]);
assert.gt(coll.count(), 0);
assert.eq(coll.findOne({}, {_id:0}), docs[0]);
@@ -60,8 +61,10 @@
assert.gt(res.findOne, 0, tojson(res));
}
testInsert(false);
testInsert(true);
testInsert(false, {});
testInsert(true, {"writeConcern" : {"w" : "majority"}});
testInsert(true, {"writeConcern" : {"w" : 1, "j": false}});
testInsert(true, {"writeConcern" : {"j" : true}});
testFind(false);
testFind(true);
testFindOne(false);

View File

@@ -39,10 +39,13 @@
"captrunc didn't return an error for a nonexistent collection");
// It is an error to run the captrunc command on a non-capped collection.
assert.commandWorked(db.runCommand({ create: "noncapped", capped: false }));
var collName = "noncapped";
db[collName].drop();
assert.commandWorked(db.runCommand({ create: collName, capped: false }));
for (var j = 1; j <= 10; j++) {
assert.writeOK(db.noncapped.insert({x:j}));
assert.writeOK(db[collName].insert({x:j}));
}
assert.commandFailed(db.runCommand({ captrunc: "noncapped", n: 5 }),
assert.commandFailed(db.runCommand({ captrunc: collName, n: 5 }),
"captrunc didn't return an error for a non-capped collection");
})();

View File

@@ -27,7 +27,7 @@ replTest.initiate({"_id" : "bgIndex",
{"_id" : 1, "host" : nodes[1]},
{"_id" : 2, "host" : nodes[2], "arbiterOnly" : true}]});
var master = replTest.getMaster();
var master = replTest.getPrimary();
var second = replTest.getSecondary();
var masterId = replTest.getNodeId(master);

View File

@@ -44,7 +44,7 @@ replTest.initiate({"_id" : "bgIndex",
{"_id" : 1, "host" : nodes[1]},
{"_id" : 2, "host" : nodes[2], "arbiterOnly" : true}]});
var master = replTest.getMaster();
var master = replTest.getPrimary();
var second = replTest.getSecondary();
var masterDB = master.getDB(dbname);

View File

@@ -27,7 +27,7 @@ replTest.initiate({"_id" : "bgIndex",
{"_id" : 1, "host" : nodes[1]},
{"_id" : 2, "host" : nodes[2], "arbiterOnly" : true}]});
var master = replTest.getMaster();
var master = replTest.getPrimary();
var second = replTest.getSecondary();
var secondId = replTest.getNodeId(second);

View File

@@ -53,7 +53,7 @@
{"_id" : 1, "host" : nodenames[1]},
{"_id" : 2, "host" : nodenames[2], arbiterOnly: true}]});
var master = replTest.getMaster();
var master = replTest.getPrimary();
var second = replTest.getSecondary();
var secondId = replTest.getNodeId(second);

View File

@@ -26,7 +26,7 @@ var replSet1 = shardingTest.rs0;
var replSet2 = shardingTest.rs1;
jsTest.log("Adding data to our first replica set");
var repset1DB = replSet1.getMaster().getDB(testDBName);
var repset1DB = replSet1.getPrimary().getDB(testDBName);
for (var i = 1; i <= numDocs; i++) {
repset1DB[testCollName].insert({ x : i });
}
@@ -48,13 +48,13 @@ jsTest.log("Adding replSet2 as second shard");
mongosConn.adminCommand({ addshard : replSet2.getURL() });
mongosConn.getDB('admin').printShardingStatus();
printjson(replSet2.getMaster().getDBs());
printjson(replSet2.getPrimary().getDBs());
jsTest.log("Moving test db from replSet1 to replSet2");
assert.commandWorked(mongosConn.getDB('admin').runCommand({ moveprimary: testDBName,
to: replSet2.getURL() }));
mongosConn.getDB('admin').printShardingStatus();
printjson(replSet2.getMaster().getDBs());
printjson(replSet2.getPrimary().getDBs());
assert.eq(testDB.getSiblingDB("config").databases.findOne({ "_id" : testDBName }).primary,
replSet2.name, "Failed to change primary shard for unsharded database.");

View File

@@ -21,7 +21,7 @@ coll.findOne()
var sadmin = shard.getDB( "admin" )
assert.throws(function() { sadmin.runCommand({ replSetStepDown : 3000, force : true }); });
st.rs0.getMaster();
st.rs0.getPrimary();
mongosA.getDB("admin").runCommand({ setParameter : 1, traceExceptions : true })

View File

@@ -12,7 +12,7 @@ replTest.initiate({_id : name, members :
replTest.awaitReplication();
var master = replTest.getMaster();
var master = replTest.getPrimary();
var db = master.getDB( "test" );
printjson( rs.status() );

View File

@@ -14,7 +14,7 @@ var rt = new ReplSetTest( { name : "ttl_repl" , nodes: 2 } );
// setup set
var nodes = rt.startSet();
rt.initiate();
var master = rt.getMaster();
var master = rt.getPrimary();
rt.awaitSecondaryNodes();
var slave1 = rt.liveNodes.slaves[0];

View File

@@ -6,7 +6,7 @@ var rt = new ReplSetTest( { name : "ttl_repl" , nodes: 2 } );
// setup set
var nodes = rt.startSet();
rt.initiate();
var master = rt.getMaster();
var master = rt.getPrimary();
rt.awaitSecondaryNodes();
var slave1 = rt.getSecondary();

View File

@@ -25,7 +25,7 @@
var nodes = replTest.startSet();
replTest.initiate();
var master = replTest.getMaster();
var master = replTest.getPrimary();
var mTest = master.getDB("test");
var mLocal = master.getDB("local");
var mMinvalid = mLocal["replset.minvalid"];
@@ -39,7 +39,7 @@
// Write op
assert.writeOK(mTest.foo.save({}, {writeConcern: {w: 3}}));
replTest.waitForState(slave, replTest.SECONDARY, 30000);
replTest.waitForState(slave, ReplSetTest.State.SECONDARY, 30000);
assert.writeOK(mTest.foo.save({}, {writeConcern: {w: 3}}));
// Set minvalid to something far in the future for the current primary, to simulate recovery.
@@ -63,10 +63,10 @@
jsTest.log("restart primary");
replTest.restart(master);
printjson(sLocal.adminCommand("isMaster"));
replTest.waitForState(master, replTest.RECOVERING, 90000);
replTest.waitForState(master, ReplSetTest.State.RECOVERING, 90000);
// Slave is now master... so do a write to get a minvalid entry on the secondary.
assert.writeOK(replTest.getMaster().getDB("test").foo.save({}, {writeConcern: {w: 3}}));
assert.writeOK(replTest.getPrimary().getDB("test").foo.save({}, {writeConcern: {w: 3}}));
assert.soon(function() {
var mv;

View File

@@ -59,7 +59,7 @@ result = m.getDB("admin").runCommand({replSetInitiate : rs.getReplSetConfig()});
assert.eq(result.ok, 1, "couldn't initiate: "+tojson(result));
m.getDB('admin').logout(); // In case this node doesn't become primary, make sure its not auth'd
var master = rs.getMaster();
var master = rs.getPrimary();
rs.awaitSecondaryNodes();
var mId = rs.getNodeId(master);
var slave = rs.liveNodes.slaves[0];
@@ -107,7 +107,7 @@ assert.writeOK(bulk.execute({ w: 3, wtimeout: 60000 }));
print("fail over");
rs.stop(mId);
master = rs.getMaster();
master = rs.getPrimary();
print("add some more data 1");
master.getDB("test").auth("bar", "baz");
@@ -119,7 +119,7 @@ assert.writeOK(bulk.execute({ w: 2 }));
print("resync");
rs.restart(mId, {"keyFile" : key1_600});
master = rs.getMaster();
master = rs.getPrimary();
print("add some more data 2");
bulk = master.getDB("test").foo.initializeUnorderedBulkOp();
@@ -146,7 +146,7 @@ try {
catch (e) {
print("error: "+e);
}
master = rs.getMaster();
master = rs.getPrimary();
master.getDB("admin").auth("foo", "bar");

View File

@@ -5,18 +5,18 @@
var testInvalidAuthStates = function() {
print("check that 0 is in recovering");
rs.waitForState(rs.nodes[0], rs.RECOVERING);
rs.waitForState(rs.nodes[0], ReplSetTest.State.RECOVERING);
print("shut down 1, 0 still in recovering.");
rs.stop(1);
sleep(5);
rs.waitForState(rs.nodes[0], rs.RECOVERING);
rs.waitForState(rs.nodes[0], ReplSetTest.State.RECOVERING);
print("shut down 2, 0 becomes a secondary.");
rs.stop(2);
rs.waitForState(rs.nodes[0], rs.SECONDARY);
rs.waitForState(rs.nodes[0], ReplSetTest.State.SECONDARY);
rs.restart(1, {"keyFile" : key1});
rs.restart(2, {"keyFile" : key1});
@@ -39,7 +39,7 @@ rs.initiate({ "_id" : name,
{"_id" : 2, "host" : hostnames[2], priority: 0}
]});
var master = rs.getMaster();
var master = rs.getPrimary();
print("add an admin user");
master.getDB("admin").createUser({user: "foo", pwd: "bar", roles: jsTest.adminUserRoles},

View File

@@ -19,13 +19,13 @@
rs.startSet();
rs.initiate();
master = rs.getMaster();
master = rs.getPrimary();
jsTest.log("adding user");
master.getDB("admin").createUser({user: "foo", pwd: "bar", roles: jsTest.adminUserRoles},
{w: 2, wtimeout: 30000});
var safeInsert = function() {
master = rs.getMaster();
master = rs.getPrimary();
master.getDB("admin").auth("foo", "bar");
assert.writeOK(master.getDB("foo").bar.insert({ x: 1 }));
};
@@ -44,7 +44,7 @@
jsTest.log("write stuff to 0&2");
rs.stop(1);
master = rs.getMaster();
master = rs.getPrimary();
master.getDB("admin").auth("foo", "bar");
master.getDB("foo").bar.drop();
jsTest.log("last op: " +

View File

@@ -1,12 +1,14 @@
// Test that you can still authenticate a replset connection to a RS with no primary (SERVER-6665).
(function () {
'use strict';
var NODE_COUNT = 3;
var rs = new ReplSetTest({"nodes" : NODE_COUNT, keyFile : "jstests/libs/key1"});
var nodes = rs.startSet();
rs.initiate();
// Add user
var master = rs.getMaster();
var master = rs.getPrimary();
master.getDB("admin").createUser({user: "admin", pwd: "pwd", roles: ["root"]}, {w: NODE_COUNT});
// Can authenticate replset connection when whole set is up.
@@ -17,7 +19,7 @@ assert.writeOK(conn.getDB('admin').foo.insert({a:1}, { writeConcern: { w: NODE_C
// Make sure there is no primary
rs.stop(0);
rs.stop(1);
rs.waitForState(nodes[2], rs.SECONDARY);
rs.waitForState(nodes[2], ReplSetTest.State.SECONDARY);
// Make sure you can still authenticate a replset connection with no primary
var conn2 = new Mongo(rs.getURL());
@@ -26,4 +28,5 @@ assert(conn2.getDB('admin').auth({user:'admin', pwd:'pwd', mechanism:"SCRAM-SHA-
assert.eq(1, conn2.getDB('admin').foo.findOne().a);
rs.stopSet();
}());

View File

@@ -15,7 +15,7 @@
replTest.initiate(config);
var master = replTest.getMaster().getDB(name);
var master = replTest.getPrimary().getDB(name);
var slaveConns = replTest.liveNodes.slaves;
var slave = [];
for (var i in slaveConns) {

View File

@@ -18,9 +18,9 @@ var nodes = replTest.startSet();
// This will wait for initiation
replTest.initiate();
// Call getMaster to return a reference to the node that's been
// Call getPrimary to return a reference to the node that's been
// elected master
var master = replTest.getMaster();
var master = replTest.getPrimary();
// wait for secondaries to be up, since we'll be reading from them
replTest.awaitSecondaryNodes();
@@ -28,7 +28,7 @@ replTest.awaitSecondaryNodes();
var slave1 = replTest.liveNodes.slaves[0];
var slave2 = replTest.liveNodes.slaves[1];
// Calling getMaster made available the liveNodes structure,
// Calling getPrimary made available the liveNodes structure,
// which looks like this:
// liveNodes = {master: masterNode, slaves: [slave1, slave2] }
printjson( replTest.liveNodes );

View File

@@ -8,7 +8,7 @@
replTest.startSet();
replTest.initiate();
var master = replTest.getMaster();
var master = replTest.getPrimary();
var slave = replTest.liveNodes.slaves[0];
var dbName = "db";

View File

@@ -18,7 +18,7 @@
{_id: 4, host: nodes[4].host, priority: 0},
],
});
replTest.waitForState(nodes[0], replTest.PRIMARY, 60 * 1000);
replTest.waitForState(nodes[0], ReplSetTest.State.PRIMARY, 60 * 1000);
var primary = replTest.getPrimary();
replTest.awaitReplication();

View File

@@ -21,7 +21,7 @@ if (jsTest.options().keyFile) {
var replTest = new ReplSetTest({name: 'testSet', nodes: 3});
replTest.startSet();
replTest.initiate();
var master = replTest.getMaster();
var master = replTest.getPrimary();
var secondary = replTest.liveNodes.slaves[0];
var masterDB = master.getDB(replsetDBName);
masterDB.dropDatabase();

View File

@@ -33,7 +33,7 @@ try {
} catch (e) {
// expected since we close all connections after going into REMOVED
}
expectState(rst, rst.REMOVED);
expectState(rst, ReplSetTest.State.REMOVED);
rst.stopSet();
})();
@@ -51,8 +51,8 @@ var conf = rst.getReplSetConfig();
conf.configsvr = true;
assert.commandWorked(rst.nodes[0].adminCommand({replSetInitiate: conf}));
rst.getMaster();
expectState(rst, rst.PRIMARY);
rst.getPrimary();
expectState(rst, ReplSetTest.State.PRIMARY);
rst.stopSet();
})();
@@ -71,10 +71,10 @@ var conf = rst.getReplSetConfig();
conf.configsvr = true;
assert.commandWorked(rst.nodes[0].adminCommand({replSetInitiate: conf}));
rst.getMaster();
expectState(rst, rst.PRIMARY);
rst.getPrimary();
expectState(rst, ReplSetTest.State.PRIMARY);
var conf = rst.getMaster().getDB('local').system.replset.findOne();
var conf = rst.getPrimary().getDB('local').system.replset.findOne();
assert(conf.configsvr, tojson(conf));
rst.stopSet();
@@ -93,8 +93,8 @@ var rst = new ReplSetTest({name: "configrs6",
rst.startSet();
assert.commandWorked(rst.nodes[0].adminCommand({replSetInitiate: 1}));
rst.getMaster();
expectState(rst, rst.PRIMARY);
rst.getPrimary();
expectState(rst, ReplSetTest.State.PRIMARY);
rst.stopSet();
})();
@@ -111,8 +111,8 @@ rst.startSet();
var conf = rst.getReplSetConfig();
assert.commandWorked(rst.nodes[0].adminCommand({replSetInitiate: conf}));
rst.getMaster();
expectState(rst, rst.PRIMARY);
rst.getPrimary();
expectState(rst, ReplSetTest.State.PRIMARY);
assert.throws(function() {
rst.restart(0, {configsvr: ""});
});
@@ -135,8 +135,8 @@ var conf = rst.getReplSetConfig();
conf.configsvr = true;
assert.commandWorked(rst.nodes[0].adminCommand({replSetInitiate: conf}));
rst.getMaster();
expectState(rst, rst.PRIMARY);
rst.getPrimary();
expectState(rst, ReplSetTest.State.PRIMARY);
var node = rst.nodes[0];
var options = node.savedOptions;
@@ -150,5 +150,4 @@ assert.eq(null, conn, "Mongod should have failed to start, but didn't");
rst.stopSet();
})();
})();

View File

@@ -8,7 +8,7 @@
replTest.startSet();
replTest.initiate();
var primary = replTest.getMaster();
var primary = replTest.getPrimary();
var secondary = replTest.liveNodes.slaves[0];
var sourceDBName = 'copydb-repl-test-source';

View File

@@ -58,7 +58,7 @@
primary.getDB("admin").shutdownServer({force:true});
var electionTimeout = (isPV0 ? 60 : 20 ) * 1000; // Timeout in milliseconds
replSet.waitForState(secondary, replSet.PRIMARY, electionTimeout);
replSet.waitForState(secondary, ReplSetTest.State.PRIMARY, electionTimeout);
// Ensure new primary is not yet writable
jsTestLog('New primary should not be writable yet');

View File

@@ -6,7 +6,7 @@
var nodes = rt.startSet();
rt.initiate();
var master = rt.getMaster();
var master = rt.getPrimary();
var ml = master.getDB( 'local' );
var threw = false;

View File

@@ -23,8 +23,8 @@
// In PV1, a voter writes the last vote to disk before granting the vote,
// so it cannot vote while fsync locked in PV1. Use PV0 explicitly here.
protocolVersion: 0});
replTest.waitForState(replTest.nodes[0], replTest.PRIMARY, 60 * 1000);
var master = replTest.getMaster();
replTest.waitForState(replTest.nodes[0], ReplSetTest.State.PRIMARY, 60 * 1000);
var master = replTest.getPrimary();
// do a write
assert.writeOK(master.getDB("foo").bar.insert({x:1}, {writeConcern: {w: 3}}));
@@ -37,7 +37,7 @@
// take down master
replTest.stop(0);
replTest.waitForState(slave, replTest.PRIMARY, 90*1000);
replTest.waitForState(slave, ReplSetTest.State.PRIMARY, 90*1000);
locked.getDB("admin").fsyncUnlock();
replTest.stopSet();

View File

@@ -36,6 +36,40 @@
settings: {electionTimeoutMillis: 1500}
},
{
name: "testV1StepDown",
description: "protocolVersion 1, primary is stepped down",
protocolVersion: 1,
testRuns: 1,
testCycles: 5,
electionTrigger: ElectionTimingTest.prototype.stepDownPrimary,
testReset: ElectionTimingTest.prototype.stepDownPrimaryReset,
},
{
name: "testV1StepDown1500",
description: "protocolVersion 1, primary is stepped down",
protocolVersion: 1,
testRuns: 1,
testCycles: 5,
electionTrigger: ElectionTimingTest.prototype.stepDownPrimary,
testReset: ElectionTimingTest.prototype.stepDownPrimaryReset,
// The settings object is merged into the replset config settings object.
settings: {electionTimeoutMillis: 1500}
},
{
name: "testV1StepDownLargeCluster",
description: "protocolVersion 1, primary is stepped down, 7 electable nodes",
protocolVersion: 1,
nodes: 7,
testRuns: 1,
testCycles: 5,
electionTrigger: ElectionTimingTest.prototype.stepDownPrimary,
testReset: function() {},
waitForNewPrimary : function(rst, secondary) { rst.getPrimary(); }
},
{
name: "testV0Stop",
description: "protocolVersion 0, primary is stopped",
@@ -56,11 +90,14 @@
testSetup: function() {sleep(30 * 1000);},
electionTrigger: ElectionTimingTest.prototype.stepDownPrimary,
testReset: ElectionTimingTest.prototype.stepDownPrimaryReset
} ];
},
];
testCases.forEach(function (tc) {
var testRun = new ElectionTimingTest(tc);
tc.testResults = testRun.testResults;
tc.electionTimeoutLimitMillis = testRun.electionTimeoutLimitMillis;
if (testRun.testErrors.length) {
// Stop tests if we encounter an error.
@@ -85,9 +122,19 @@
var resAvg = Array.avg(allResults);
var resMin = Math.min(...allResults);
var resMax = Math.max(...allResults);
var resStdDev = Array.stdDev(allResults);
jsTestLog("Results: " + tc.name +
" Average over " + allResults.length + " runs: " + resAvg +
" Min: " + resMin + " Max: " + resMax);
" Min: " + resMin + " Max: " + resMax +
" Limit: " + tc.electionTimeoutLimitMillis/1000 +
" StdDev: " + resStdDev.toFixed(4));
allResults.forEach(function(failoverElapsedMillis) {
assert.lte(failoverElapsedMillis, tc.electionTimeoutLimitMillis/1000,
tc.name + ': failover (' + failoverElapsedMillis + ' sec) took too long. limit: ' +
tc.electionTimeoutLimitMillis/1000 + ' sec');
});
});
jsTestLog("Tests completed in: " + (Date.now() - testStart) / 1000 + " seconds");

View File

@@ -12,7 +12,7 @@ print("Start replica set with two nodes");
var replTest = new ReplSetTest({name: name, nodes: 2});
var nodes = replTest.startSet();
replTest.initiate();
var primary = replTest.getMaster();
var primary = replTest.getPrimary();
// Insert a document and let it sync to the secondary.
print("Initial sync");

View File

@@ -31,7 +31,7 @@ var replTest = new ReplSetTest({name: 'testSet', nodes: 2, oplogSize: 5});
var nodes = replTest.startSet();
// This will wait for initiation
replTest.initiate();
var master = replTest.getMaster();
var master = replTest.getPrimary();
var ret = master.getDB("admin").fsyncLock();
if (!ret.ok) {
@@ -48,7 +48,7 @@ for(var i=0; i<docNum; i++) {
waitForAllMembers(master.getDB("foo"));
replTest.awaitReplication();
// Calling getMaster also makes available the liveNodes structure, which looks like this:
// Calling getPrimary also makes available the liveNodes structure, which looks like this:
// liveNodes = {master: masterNode, slaves: [slave1, slave2] }
var slaves = replTest.liveNodes.slaves;
slaves[0].setSlaveOk();

View File

@@ -19,8 +19,8 @@
assert.eq(50, replInfo.logSizeMB, replInfoString);
assert.lt(0, replInfo.usedMB, replInfoString);
assert.lt(0, replInfo.timeDiff, replInfoString);
assert.eq(0, replInfo.timeDiffHours, replInfoString);
assert.lte(0, replInfo.timeDiff, replInfoString);
assert.lte(0, replInfo.timeDiffHours, replInfoString);
// Just make sure the following fields exist since it would be hard to predict their values
assert(replInfo.tFirst, replInfoString);
assert(replInfo.tLast, replInfoString);

View File

@@ -18,9 +18,9 @@ doTest = function( signal ) {
// This will wait for initiation
replTest.initiate();
// Call getMaster to return a reference to the node that's been
// Call getPrimary to return a reference to the node that's been
// elected master.
var master = replTest.getMaster();
var master = replTest.getPrimary();
// save some records
var len = 100

View File

@@ -39,7 +39,7 @@ replTest.initiate({"_id" : "fgIndex",
{"_id" : 1, "host" : nodes[1]},
{"_id" : 2, "host" : nodes[2], "arbiterOnly" : true}]});
var master = replTest.getMaster();
var master = replTest.getPrimary();
var second = replTest.getSecondary();
var masterDB = master.getDB('fgIndexSec');
var secondDB = second.getDB('fgIndexSec');

View File

@@ -24,7 +24,7 @@ if (conns[0].getDB('test').serverBuildInfo().bits !== 32) {
{"_id" : 1, "host" : nodes[1]},
{"_id" : 2, "host" : nodes[2], "arbiterOnly" : true}]});
var master = replTest.getMaster();
var master = replTest.getPrimary();
var second = replTest.getSecondary();
var secondId = replTest.getNodeId(second);

View File

@@ -26,7 +26,7 @@ var replTest = new ReplSetTest({name: basename,
var conns = replTest.startSet();
replTest.initiate();
var master = replTest.getMaster();
var master = replTest.getPrimary();
var foo = master.getDB("foo");
var admin = master.getDB("admin");
@@ -82,7 +82,8 @@ wait(function() {
(config3 && config3.version == config.version);
});
replTest.waitForState(slave2, [replTest.SECONDARY, replTest.RECOVERING], 60 * 1000);
replTest.waitForState(
slave2, [ReplSetTest.State.SECONDARY, ReplSetTest.State.RECOVERING], 60 * 1000);
print("7. Kill the secondary in the middle of syncing");
replTest.stop(slave1);
@@ -90,15 +91,15 @@ replTest.stop(slave1);
print("8. Eventually the new node should become a secondary");
print("if initial sync has started, this will cause it to fail and sleep for 5 minutes");
replTest.waitForState(slave2, replTest.SECONDARY, 60 * 1000);
replTest.waitForState(slave2, ReplSetTest.State.SECONDARY, 60 * 1000);
print("9. Bring the secondary back up");
replTest.start(slave1, {}, true);
reconnect(slave1);
replTest.waitForState(slave1, [replTest.PRIMARY, replTest.SECONDARY], 60 * 1000);
replTest.waitForState(slave1, [ReplSetTest.State.PRIMARY, ReplSetTest.State.SECONDARY], 60 * 1000);
print("10. Insert some stuff");
master = replTest.getMaster();
master = replTest.getPrimary();
bulk = foo.bar.initializeUnorderedBulkOp();
for (var i = 0; i < 100; i++) {
bulk.insert({ date: new Date(), x: i, str: "all the talk on the market" });

View File

@@ -25,7 +25,7 @@ var replTest = new ReplSetTest( {name: basename, nodes: 2} );
var conns = replTest.startSet();
replTest.initiate();
var master = replTest.getMaster();
var master = replTest.getPrimary();
var origMaster = master;
var foo = master.getDB("foo");
var admin = master.getDB("admin");

View File

@@ -27,7 +27,7 @@ replTest.initiate({
]
});
var master = replTest.getMaster();
var master = replTest.getPrimary();
print("Initial sync");
master.getDB("foo").bar.baz.insert({x:1});
@@ -48,7 +48,7 @@ assert(!result.secondary, tojson(result));
print("bring 0 back up");
replTest.restart(0);
print("0 should become primary");
master = replTest.getMaster();
master = replTest.getPrimary();
print("now 1 should be able to initial sync");
assert.soon(function() {

View File

@@ -8,7 +8,7 @@ replTest = new ReplSetTest( {name: basename, nodes: 1} );
replTest.startSet();
replTest.initiate();
m = replTest.getMaster();
m = replTest.getPrimary();
md = m.getDB("d");
mc = m.getDB("d")["c"];

View File

@@ -116,7 +116,7 @@ var agreeOnPrimaryAndSetVersion = function( setVersion ) {
return true;
}
var master = replTest.getMaster();
var master = replTest.getPrimary();
assert.soon( function() { return agreeOnPrimaryAndSetVersion( 1 ); },
"Nodes did not initiate in less than a minute", 60000 );
@@ -199,7 +199,7 @@ catch(e) {
print(e);
}
master = replTest.getMaster();
master = replTest.getPrimary();
assert.soon( function() { return agreeOnPrimaryAndSetVersion( 2 ); },
"Nodes did not sync in less than a minute", 60000 );

View File

@@ -5,10 +5,10 @@ var conns = replTest.startSet({ verbose: 1 });
var config = replTest.getReplSetConfig();
config.members[0].priority = 2;
replTest.initiate(config);
replTest.waitForState(replTest.nodes[0], replTest.PRIMARY, 60000);
replTest.waitForState(replTest.nodes[0], ReplSetTest.State.PRIMARY, 60000);
// Make sure we have a master
var master = replTest.getMaster();
var master = replTest.getPrimary();
for (i = 0; i < 20; i++) {
master.getDB("bar").foo.insert({x:1,y:i,abc:123,str:"foo bar baz"});

View File

@@ -15,9 +15,9 @@
// This will wait for initiation
replTest.initiate();
// Call getMaster to return a reference to the node that's been
// Call getPrimary to return a reference to the node that's been
// elected master.
var master = replTest.getMaster();
var master = replTest.getPrimary();
// save some records
var len = 100

View File

@@ -18,7 +18,7 @@
{ "_id": 2, "host": nodes[2], priority: 0 }],
});
var master = replTest.getMaster();
var master = replTest.getPrimary();
master.getDB("foo").bar.save({a: 1});
replTest.awaitReplication();
var slaves = replTest.liveNodes.slaves;

View File

@@ -20,13 +20,13 @@ replTest.initiate(
}
);
var master = replTest.getMaster();
var master = replTest.getPrimary();
replTest.awaitReplication();
var breakNetwork = function() {
nodes[0].disconnect(nodes[2]);
master = replTest.getMaster();
master = replTest.getPrimary();
};
var checkNoChaining = function() {

View File

@@ -9,7 +9,7 @@
var replTest = new ReplSetTest( { nodes: 1, oplogSize:2, nodeOptions: {smallfiles:""}} );
var nodes = replTest.startSet();
replTest.initiate();
var master = replTest.getMaster();
var master = replTest.getPrimary();
var coll = master.getDB("o").fake;
var cdb = coll.getDB();

View File

@@ -0,0 +1,52 @@
// Term counter should be present in oplog entries under protocol version 1 but should be absent
// protocol version 0.
(function () {
'use strict';
load('jstests/replsets/rslib.js');
var name = 'oplog_term';
var replSet = new ReplSetTest({name: name, nodes: 1, protocolVersion: 0});
replSet.startSet();
replSet.initiate();
replSet.waitForState(replSet.nodes[0], ReplSetTest.State.PRIMARY, 5 * 1000);
// Protocol version 0 - 'term' field should be absent from oplog entry.
var primary = replSet.getPrimary();
var collection = primary.getDB('test').getCollection(name);
assert.writeOK(collection.save({_id: 1}));
var oplogEntry = getLatestOp(primary);
assert(oplogEntry, 'unexpected empty oplog');
assert.eq(collection.getFullName(), oplogEntry.ns,
'unexpected namespace in oplog entry: ' + tojson(oplogEntry));
assert.eq(1, oplogEntry.o._id,
'oplog entry does not refer to most recently inserted document: ' +
tojson(oplogEntry));
assert(!oplogEntry.hasOwnProperty('t'),
'oplog entry must not contain term: ' + tojson(oplogEntry));
// Protocol version 1 - 'term' field should present in oplog entry.
var config = assert.commandWorked(primary.adminCommand({replSetGetConfig: 1})).config;
config.protocolVersion = 1;
config.version++;
assert.commandWorked(primary.adminCommand({replSetReconfig: config}));
replSet.waitForState(replSet.nodes[0], ReplSetTest.State.PRIMARY, 5 * 1000);
primary = replSet.getPrimary();
collection = primary.getDB('test').getCollection(name);
assert.writeOK(collection.save({_id: 2}));
oplogEntry = getLatestOp(primary);
assert(oplogEntry, 'unexpected empty oplog');
assert.eq(collection.getFullName(), oplogEntry.ns,
'unexpected namespace in oplog entry: ' + tojson(oplogEntry));
assert.eq(2, oplogEntry.o._id,
'oplog entry does not refer to most recently inserted document: ' +
tojson(oplogEntry));
assert(oplogEntry.hasOwnProperty('t'),
'oplog entry must contain term: ' + tojson(oplogEntry));
var status = assert.commandWorked(primary.adminCommand({replSetGetStatus:1}));
assert.eq(status.term, oplogEntry.t,
'term in oplog entry does not match term in status: ' + tojson(oplogEntry));
})();

View File

@@ -36,7 +36,7 @@
var nodes = replTest.startSet();
replTest.initiate();
var master = replTest.getMaster();
var master = replTest.getPrimary();
var testDB = master.getDB("test");
var localDB = master.getDB("local");
var minvalidColl = localDB["replset.minvalid"];
@@ -103,7 +103,7 @@
log(assert.commandWorked(localDB.adminCommand("replSetGetStatus")));
log("restart primary");
replTest.restart(master);
replTest.waitForState(master, replTest.RECOVERING, 90000);
replTest.waitForState(master, ReplSetTest.State.RECOVERING, 90000);
assert.soon(function() {
var mv;

View File

@@ -32,7 +32,7 @@ var replTest = new ReplSetTest( { name : "replStatus" , nodes: 3, oplogSize: 1 }
replTest.startSet();
replTest.initiate();
var master = replTest.getMaster();
var master = replTest.getPrimary();
replTest.awaitReplication();
replTest.awaitSecondaryNodes();

View File

@@ -10,7 +10,7 @@ replTest.initiate({"_id" : name,
{"_id" : 1, "host" : nodes[1]}
]});
var primary = replTest.getMaster().getDB(name);
var primary = replTest.getPrimary().getDB(name);
var secondary = replTest.liveNodes.slaves[0].getDB(name);
// populate the collection

View File

@@ -81,7 +81,7 @@ print("Start replica set with two nodes");
var replTest = new ReplSetTest({name: name, nodes: 2});
var nodes = replTest.startSet();
replTest.initiate();
var primary = replTest.getMaster();
var primary = replTest.getPrimary();
// Insert a document and let it sync to the secondary.
print("Initial sync");

View File

@@ -0,0 +1,43 @@
// Multiple voting members with varying levels of priority.
// 5-node replica set with priorities 5, 4, 3, 2 and 1 (default).
// Start replica set. Ensure that highest priority node becomes primary eventually.
// Shut down the primary and confirm that the next highest priority node becomes primary.
// Repeat until 3 nodes are left standing.
(function () {
'use strict';
load('jstests/replsets/rslib.js');
var name = 'priority_takeover_cascading_priorities';
var replSet = new ReplSetTest({name: name, nodes: [
{rsConfig: {priority: 5}},
{rsConfig: {priority: 4}},
{rsConfig: {priority: 3}},
{rsConfig: {priority: 2}},
{rsConfig: {priority: 1}},
]});
replSet.startSet();
replSet.initiate();
var waitForPrimary = function(i) {
// Refresh connections to nodes.
replSet.status();
assert.commandWorked(
replSet.nodes[i].adminCommand({
replSetTest: 1,
waitForMemberState: ReplSetTest.State.PRIMARY,
timeoutMillis: 60 * 1000,
}),
'node ' + i + ' ' + replSet.nodes[i].host + ' failed to become primary'
);
};
waitForPrimary(0);
replSet.stop(0);
waitForPrimary(1);
replSet.stop(1);
waitForPrimary(2);
// Cannot stop any more nodes because we will not have a majority.
})();

View File

@@ -0,0 +1,37 @@
// Priority (1 member with non-default priority).
// 3-node replica set - one arbiter and two electable nodes with different priorities.
// Wait for replica set to stabilize with higher priority node as primary.
// Step down high priority node. Wait for the lower priority electable node to become primary.
// Eventually high priority node will run a priority takeover election to become primary.
(function () {
'use strict';
load('jstests/replsets/rslib.js');
var name = 'priority_takeover_one_node_higher_priority';
var replSet = new ReplSetTest({name: name, nodes: [
{rsConfig: {priority: 3}},
{},
{rsConfig: {arbiterOnly: true}},
]});
replSet.startSet();
replSet.initiate();
replSet.waitForState(replSet.nodes[0], ReplSetTest.State.PRIMARY, 60 * 1000);
var primary = replSet.getPrimary();
// Primary should step down long enough for election to occur on secondary.
var config = assert.commandWorked(primary.adminCommand({replSetGetConfig: 1})).config;
var electionTimeoutMillis = config.settings.electionTimeoutMillis;
var stepDownGuardMillis = electionTimeoutMillis * 2;
var stepDownException = assert.throws(function() {
primary.adminCommand({replSetStepDown: stepDownGuardMillis / 1000});
});
assert.neq(-1, tojson(stepDownException).indexOf('error doing query'),
'replSetStepDown did not disconnect client');
// Step down primary and wait for node 1 to be promoted to primary.
replSet.waitForState(replSet.nodes[1], ReplSetTest.State.PRIMARY, 60 * 1000);
// Eventually node 0 will stand for election again because it has a higher priorty.
replSet.waitForState(replSet.nodes[0], ReplSetTest.State.PRIMARY, stepDownGuardMillis + 60 * 1000);
})();

View File

@@ -0,0 +1,48 @@
// 2 nodes with non-default priority.
// 3-node replica set with priorities 3, 3 and 1 (default)
// Start replica set. Ensure that highest priority node becomes primary eventually.
// Shut down the primary and confirm that the next highest priority node becomes primary.
// Repeat until 2 nodes are left standing.
load('jstests/replsets/rslib.js');
(function () {
'use strict';
var name = 'priority_takeover_two_nodes_equal_priority';
var replSet = new ReplSetTest({name: name, nodes: [
{rsConfig: {priority: 3}},
{rsConfig: {priority: 3}},
{},
]});
replSet.startSet();
replSet.initiate();
var primary = replSet.getPrimary();
var primaryIndex = -1;
replSet.nodes.find(function(node, index, array) {
if (primary.host == node.host) {
primaryIndex = index;
return true;
}
return false;
});
assert.neq(-1, primaryIndex,
'expected one of the nodes with priority 3 to become primary');
replSet.stop(primaryIndex);
var newPrimaryIndex = primaryIndex === 0 ? 1 : 0;
// Refresh connections to nodes.
replSet.status();
assert.commandWorked(
replSet.nodes[newPrimaryIndex].adminCommand({
replSetTest: 1,
waitForMemberState: ReplSetTest.State.PRIMARY,
timeoutMillis: 60 * 1000,
}),
'node ' + newPrimaryIndex + ' ' + replSet.nodes[newPrimaryIndex].host +
' failed to become primary'
);
})();

View File

@@ -18,7 +18,7 @@ conf.members[2].priority = 0;
rst.initiate(conf);
rst.awaitSecondaryNodes();
var primary = rst.getMaster();
var primary = rst.getPrimary();
var primaryColl = primary.getDB("test").coll;
// Set verbosity for replication on all nodes.

View File

@@ -0,0 +1,98 @@
/*
* Test which configures various configs (hidden/priorities/no-chaining) that replExec queues
* stay at reasonable/stable levels after repeated reconfigs/stepdowns
*/
(function () {
"use strict";
var numNodes = 5;
var maxQueueSizeExpected = 7;
var replTest = new ReplSetTest({ name: 'testSet', nodes: numNodes });
var nodes = replTest.startSet();
replTest.initiate();
var primary = replTest.getPrimary();
var testQueues = function() {
/* Example stats under executor
"counters" : {
"eventCreated" : 2,
"eventWait" : 2,
"cancels" : 17,
"waits" : 490,
"scheduledNetCmd" : 90,
"scheduledDBWork" : 2,
"scheduledXclWork" : 0,
"scheduledWorkAt" : 120,
"scheduledWork" : 494,
"schedulingFailures" : 0
},
"queues" : {
"networkInProgress" : 0,
"dbWorkInProgress" : 0,
"exclusiveInProgress" : 0,
"sleepers" : 3,
"ready" : 0,
"free" : 4
},
*/
assert.soon(function() {
primary = replTest.getPrimary();
var stats = replTest.nodes.map(m => m.getDB("admin").serverStatus());
try {
stats.forEach(s => {
var executorStats = s.metrics.repl.executor;
printjson(s.host);
printjson(executorStats);
var queues = executorStats.queues;
assert.lt(queues.sleepers, maxQueueSizeExpected, "sleepers");
assert.lt(queues.ready, maxQueueSizeExpected, "ready");
assert.lt(queues.networkInProgress, maxQueueSizeExpected, "networkInProgress");
});
} catch (e) {
return false;
}
return true;
}, "queues too high", 13 * 1000 /*13 secs*/); // what we are looking for has a 10s timeout.
}
var reconfig = function(newConfig) {
newConfig.version += 1;
try {
assert.commandWorked(replTest.getPrimary().adminCommand({replSetReconfig: newConfig}));
}
catch (e) {
if (tojson(e).indexOf("error doing query: failed") < 0) {
throw e;
}
}
}
replTest.awaitSecondaryNodes();
// ** Setup different priorities
var c = replTest.conf();
c.members[0].priority = 99;
c.members[1].priority = 2;
c.members[2].priority = 0;
reconfig(c);
for(var i=0;i<50;i++) {
reconfig(c);
testQueues();
}
// ** Setup different priorities
var c = replTest.conf();
c.members[2].hidden = true;
c.members[3].priority = 1000;
c.members[4].priority = 1000;
reconfig(c);
for(var i=0;i<50;i++) {
reconfig(c);
testQueues();
}
replTest.stopSet();
}());

View File

@@ -4,7 +4,7 @@ var nodes = replTest.startSet();
replTest.initiate();
var master = replTest.getMaster();
var master = replTest.getPrimary();
replTest.awaitSecondaryNodes()
var slaves = replTest.liveNodes.slaves;

View File

@@ -16,7 +16,7 @@ print("Start set with two nodes");
var replTest = new ReplSetTest( {name: name, nodes: 2} );
var nodes = replTest.startSet();
replTest.initiate();
var master = replTest.getMaster();
var master = replTest.getPrimary();
var secondary = replTest.getSecondary();
print("Initial sync");
@@ -79,7 +79,7 @@ assert.soon(function() { try {
} catch (e) {
return false;
} });
master = replTest.getMaster();
master = replTest.getPrimary();
printjson(master.getDB("admin").runCommand({replSetGetStatus:1}));
var newConfig = master.getDB("local").system.replset.findOne();
print("newConfig: " + tojson(newConfig));

View File

@@ -25,9 +25,9 @@ var doTest = function( signal ) {
// This will wait for initiation
replTest.initiate();
// Call getMaster to return a reference to the node that's been
// Call getPrimary to return a reference to the node that's been
// elected master.
var master = replTest.getMaster();
var master = replTest.getPrimary();
var isPV1 = (replTest.getConfigFromPrimary().protocolVersion == 1);
if (isPV1) {
@@ -36,7 +36,7 @@ var doTest = function( signal ) {
assert.eq("new primary", oplog_entry["o"]["msg"]);
assert.eq("n", oplog_entry["op"]);
}
// Calling getMaster also makes available the liveNodes structure,
// Calling getPrimary also makes available the liveNodes structure,
// which looks like this:
// liveNodes = {master: masterNode,
// slaves: [slave1, slave2]
@@ -68,7 +68,7 @@ var doTest = function( signal ) {
replTest.stop( master_id );
// Now let's see who the new master is:
var new_master = replTest.getMaster();
var new_master = replTest.getPrimary();
// Is the new master the same as the old master?
var new_master_id = replTest.getNodeId( new_master );
@@ -104,7 +104,7 @@ var doTest = function( signal ) {
});
// And that both slave nodes have all the updates
new_master = replTest.getMaster();
new_master = replTest.getPrimary();
assert.eq( 1000 , new_master.getDB( "bar" ).runCommand( { count:"bar"} ).n , "assumption 2");
replTest.awaitSecondaryNodes();
replTest.awaitReplication();
@@ -119,7 +119,7 @@ var doTest = function( signal ) {
});
// last error
master = replTest.getMaster();
master = replTest.getPrimary();
slaves = replTest.liveNodes.slaves;
printjson(replTest.liveNodes);

View File

@@ -18,9 +18,9 @@ doTest = function (signal) {
var testDB = "repl-test";
// Call getMaster to return a reference to the node that's been
// Call getPrimary to return a reference to the node that's been
// elected master.
var master = replTest.getMaster();
var master = replTest.getPrimary();
// Wait for replication to a single node
master.getDB(testDB).bar.insert({ n: 1 });

View File

@@ -15,7 +15,7 @@ var doTest = function (signal) {
replTest.initiate();
// Get master node
var master = replTest.getMaster();
var master = replTest.getPrimary();
// Write some data to master
// NOTE: this test fails unless we write some data.
@@ -35,7 +35,7 @@ var doTest = function (signal) {
print(phase++);
try {
var new_master = replTest.getMaster();
var new_master = replTest.getPrimary();
}
catch (err) {
throw ("Could not elect new master before timeout.");

Some files were not shown because too many files have changed in this diff Show More