Compare commits
85 Commits
techbelle-
...
r3.2.1-rc0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a38be48f5 | ||
|
|
6331c474ba | ||
|
|
db3259d651 | ||
|
|
466dae32f1 | ||
|
|
f785174734 | ||
|
|
285f6dea07 | ||
|
|
27692afcd0 | ||
|
|
3383181860 | ||
|
|
a014a946bd | ||
|
|
cc9e9ae59d | ||
|
|
c7b0652274 | ||
|
|
f994214666 | ||
|
|
42ab40b9cc | ||
|
|
1067ba3603 | ||
|
|
30585ab4b4 | ||
|
|
d66acd141e | ||
|
|
40022a2fb1 | ||
|
|
126cecc636 | ||
|
|
5770fdcdf7 | ||
|
|
7468a98c83 | ||
|
|
ecbc309ccb | ||
|
|
337faaf74a | ||
|
|
b7e9e964c6 | ||
|
|
335c1ce2d1 | ||
|
|
2d853ea493 | ||
|
|
adbb4b5fd3 | ||
|
|
2cb657a2ae | ||
|
|
e7f86df75b | ||
|
|
70c96afa6c | ||
|
|
cdcdad5d5d | ||
|
|
52a93ee85f | ||
|
|
6670ca3ffa | ||
|
|
218539ae2c | ||
|
|
6745d91683 | ||
|
|
bb7e7fc215 | ||
|
|
fc108ae9e6 | ||
|
|
8e5a66b3bf | ||
|
|
ed2df219c7 | ||
|
|
45d232d316 | ||
|
|
eca57c613d | ||
|
|
d26f8791df | ||
|
|
fbda4f85b6 | ||
|
|
e882ffceeb | ||
|
|
e61483f604 | ||
|
|
2f4d9caae5 | ||
|
|
fa30e3f036 | ||
|
|
205797cbd4 | ||
|
|
e25bc60bbf | ||
|
|
0511dffda0 | ||
|
|
5c25a25571 | ||
|
|
5c7573d23a | ||
|
|
71f40809ee | ||
|
|
2c20582a12 | ||
|
|
f4fb80e4a9 | ||
|
|
d68ab71b6d | ||
|
|
9c1b2e0b9c | ||
|
|
f5bdb26566 | ||
|
|
3e32d7c455 | ||
|
|
b7e9ffa4eb | ||
|
|
ee352bdaaf | ||
|
|
d22ad6c935 | ||
|
|
f7e4eb5f50 | ||
|
|
886453786c | ||
|
|
6a8dc1be90 | ||
|
|
0dd27a3602 | ||
|
|
037404ae30 | ||
|
|
f5ef0ed466 | ||
|
|
5e4187605f | ||
|
|
fcd3517820 | ||
|
|
66e7122b55 | ||
|
|
6f7ab0c4fc | ||
|
|
f3c89e6192 | ||
|
|
621babeb2e | ||
|
|
3b469c0e56 | ||
|
|
b306a90872 | ||
|
|
c078dc37a9 | ||
|
|
d4396cda27 | ||
|
|
610c753e1d | ||
|
|
b22456cd6c | ||
|
|
29c6a904b1 | ||
|
|
b339d3de4e | ||
|
|
573080105a | ||
|
|
58da08a83c | ||
|
|
4e39f9a466 | ||
|
|
0d9b08b7e0 |
@@ -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)
|
||||
|
||||
@@ -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?")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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: ''
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
68
etc/perf.yml
68
etc/perf.yml
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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: ""});
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ function ClusterSpawnHelper(clusterType, startWithAuth) {
|
||||
else {
|
||||
replSetTest.awaitReplication();
|
||||
}
|
||||
this.conn = replSetTest.getMaster();
|
||||
this.conn = replSetTest.getPrimary();
|
||||
this.connString = replSetTest.getURL();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
23
jstests/core/collmod_bad_spec.js
Normal file
23
jstests/core/collmod_bad_spec.js
Normal 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);
|
||||
})();
|
||||
@@ -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);
|
||||
})();
|
||||
|
||||
@@ -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);
|
||||
|
||||
155
jstests/core/kill_cursors.js
Normal file
155
jstests/core/kill_cursors.js
Normal 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();
|
||||
}
|
||||
}
|
||||
})();
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
21
jstests/core/single_batch.js
Normal file
21
jstests/core/single_batch.js
Normal 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);
|
||||
})();
|
||||
@@ -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");
|
||||
|
||||
@@ -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}}));
|
||||
|
||||
@@ -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" });
|
||||
|
||||
@@ -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() {
|
||||
|
||||
|
||||
@@ -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" );
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,6 @@
|
||||
// These are reading commands that support majority readConcern.
|
||||
var commandsToForceReadConcern = [
|
||||
"count",
|
||||
"dbStats",
|
||||
"distinct",
|
||||
"find",
|
||||
"geoNear",
|
||||
|
||||
@@ -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";
|
||||
|
||||
39
jstests/multiVersion/readmode_compatibility.js
Normal file
39
jstests/multiVersion/readmode_compatibility.js
Normal 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());
|
||||
})();
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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});
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
})();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.");
|
||||
|
||||
|
||||
@@ -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 })
|
||||
|
||||
|
||||
@@ -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() );
|
||||
|
||||
|
||||
@@ -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];
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
|
||||
@@ -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},
|
||||
|
||||
@@ -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: " +
|
||||
|
||||
@@ -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();
|
||||
|
||||
}());
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
})();
|
||||
|
||||
|
||||
})();
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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" });
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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"];
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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"});
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
52
jstests/replsets/oplog_term.js
Normal file
52
jstests/replsets/oplog_term.js
Normal 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));
|
||||
})();
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
43
jstests/replsets/priority_takeover_cascading_priorities.js
Normal file
43
jstests/replsets/priority_takeover_cascading_priorities.js
Normal 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.
|
||||
})();
|
||||
@@ -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);
|
||||
})();
|
||||
@@ -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'
|
||||
);
|
||||
|
||||
})();
|
||||
@@ -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.
|
||||
|
||||
98
jstests/replsets/reconfig_without_increased_queues.js
Normal file
98
jstests/replsets/reconfig_without_increased_queues.js
Normal 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();
|
||||
}());
|
||||
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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 });
|
||||
|
||||
@@ -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
Reference in New Issue
Block a user