Commit b2d13516 authored by Julien Muchembled's avatar Julien Muchembled

stress: better logging

- make the stress process log to stress.log
- log decisions to firewall/kill nodes
- new --backlog option
parent 7216839d
...@@ -8,7 +8,8 @@ from neo.lib import logging, protocol ...@@ -8,7 +8,8 @@ from neo.lib import logging, protocol
from neo.lib.app import BaseApplication from neo.lib.app import BaseApplication
from neo.lib.debug import register as registerLiveDebugger from neo.lib.debug import register as registerLiveDebugger
from neo.lib.exception import PrimaryFailure from neo.lib.exception import PrimaryFailure
from neo.lib.protocol import ClusterStates, NodeStates, NodeTypes, Packets from neo.lib.protocol import ClusterStates, NodeStates, NodeTypes, Packets, \
uuid_str
from neo.admin.app import Application as AdminApplication from neo.admin.app import Application as AdminApplication
from neo.admin.handler import MasterEventHandler from neo.admin.handler import MasterEventHandler
...@@ -216,6 +217,9 @@ class StressApplication(AdminApplication): ...@@ -216,6 +217,9 @@ class StressApplication(AdminApplication):
else: else:
self.failing.remove(nid) self.failing.remove(nid)
if fw or kill: if fw or kill:
logging.info('stress(fw=(%s), kill=(%s))',
','.join(map(uuid_str, fw)),
','.join(map(uuid_str, kill)))
for nid in fw: for nid in fw:
self.tcpReset(nid) self.tcpReset(nid)
if kill: if kill:
......
...@@ -324,6 +324,7 @@ class Application(StressApplication): ...@@ -324,6 +324,7 @@ class Application(StressApplication):
self.fault_probability = fault_probability self.fault_probability = fault_probability
self.restart_ratio = restart_ratio self.restart_ratio = restart_ratio
self.cluster = cluster = NEOCluster(*args, **kw) self.cluster = cluster = NEOCluster(*args, **kw)
logging.setup(os.path.join(cluster.temp_dir, 'stress.log'))
# Make the firewall also affect connections between storage nodes. # Make the firewall also affect connections between storage nodes.
StorageApplication__init__ = StorageApplication.__init__ StorageApplication__init__ = StorageApplication.__init__
def __init__(self, config): def __init__(self, config):
...@@ -591,6 +592,8 @@ def main(): ...@@ -591,6 +592,8 @@ def main():
_('-d', '--datadir', help="(default: same as unit tests)") _('-d', '--datadir', help="(default: same as unit tests)")
_('-e', '--engine', help="database engine (MySQL only)") _('-e', '--engine', help="database engine (MySQL only)")
_('-l', '--logdir', help="(default: same as --datadir)") _('-l', '--logdir', help="(default: same as --datadir)")
_('-b', '--backlog', type=int, default=16,
help="max size in MiB of logging backlog")
_('-m', '--masters', type=int, default=1) _('-m', '--masters', type=int, default=1)
_('-s', '--storages', type=int, default=8) _('-s', '--storages', type=int, default=8)
_('-p', '--partitions', type=int, default=24) _('-p', '--partitions', type=int, default=24)
...@@ -639,6 +642,9 @@ def main(): ...@@ -639,6 +642,9 @@ def main():
args = parser.parse_args() args = parser.parse_args()
if args.backlog:
logging.backlog(args.backlog<<20)
db_list = ['stress_neo%s' % x for x in xrange(args.storages)] db_list = ['stress_neo%s' % x for x in xrange(args.storages)]
if args.datadir or args.logdir: if args.datadir or args.logdir:
if args.adapter == 'SQLite': if args.adapter == 'SQLite':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment