Skip to content

Commit

Permalink
addressed @stennie's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinadi committed Dec 8, 2016
1 parent b183311 commit fa5e2bd
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions mtools/mlaunch/mlaunch.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ def init(self):
# Check if config replicaset is applicable to this version
current_version = self.getMongoDVersion()

# Exit with error if --csrs is set and MongoDB < 3.2.0
if self.args['csrs'] and LooseVersion(current_version) < LooseVersion("3.2.0"):
# Exit with error if --csrs is set and MongoDB < 3.1.0
if self.args['csrs'] and LooseVersion(current_version) < LooseVersion("3.1.0"):
errmsg = " \n * The '--csrs' option requires MongoDB version 3.2.0 or greater, the current version is %s.\n" % current_version
raise SystemExit(errmsg)

Expand Down Expand Up @@ -656,8 +656,8 @@ def kill(self):
matches = self._get_ports_from_args(self.args, 'running')
processes = self._get_processes()

# convert signal to int
sig = self.args.get('signal') or 15
# convert signal to int, default is SIGTERM for graceful shutdown
sig = self.args.get('signal') or 'SIGTERM'
if type(sig) == int:
pass
elif isinstance(sig, str):
Expand Down Expand Up @@ -689,16 +689,16 @@ def kill(self):


def restart(self):

# get all running processes
processes = self._get_processes()
procs = [processes[k] for k in processes.keys()]

# stop nodes via stop command
self.stop()

# there is a very brief period in which nodes are not reachable anymore, but the
# port is not torn down fully yet and an immediate start command would fail. This
# very short sleep prevents that case, and it is practically not noticable by users
time.sleep(1)

# refresh discover
self.discover()
# wait until all processes terminate
psutil.wait_procs(procs)

# start nodes again via start command
self.start()
Expand Down Expand Up @@ -1067,7 +1067,7 @@ def _filter_valid_arguments(self, arguments, binary="mongod", config=False):
line = line.lstrip()
if line.startswith('-'):
argument = line.split()[0]
# exception: don't allow --oplogSize, --storageEngine, --smallfiles, and --nojournal for config servers
# exception: don't allow unsupported config server arguments
if config and argument in ['--oplogSize', '--storageEngine', '--smallfiles', '--nojournal']:
continue
accepted_arguments.append(argument)
Expand Down Expand Up @@ -1294,13 +1294,13 @@ def _construct_sharded(self):
# start up config server(s)
config_string = []

# SCCC config servers
# SCCC config servers (MongoDB <3.3.0)
if not self.args['csrs'] and self.args['config'] >= 3:
config_names = ['config1', 'config2', 'config3']
else:
config_names = ['config']

# CSRS config servers
# CSRS config servers (MongoDB >=3.1.0)
if self.args['csrs']:
config_string.append(self._construct_config(self.dir, nextport, "configRepl", True))
else:
Expand Down

0 comments on commit fa5e2bd

Please sign in to comment.