Skip to content

Commit

Permalink
rueckstiess#707 Log slow checkpoints Fixes - 2
Browse files Browse the repository at this point in the history
  • Loading branch information
savinay-vijay committed Jul 5, 2019
1 parent e82db38 commit 90d7d11
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
5 changes: 2 additions & 3 deletions mtools/mplotqueries/mplotqueries.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ def __init__(self):
# SERVER-16176 - checkpoints argument has been added to the existing group
self.argparser.add_argument('--checkpoints',
action='store_true', default=None,
help=("display the slow transactions "
"with checkpoints"))
help=("Display the slow WiredTiger checkpoints "))
self.legend = None

# progress bar
Expand Down Expand Up @@ -205,7 +204,7 @@ def parse_logevents(self):

for i, logevent in enumerate(logfile):

# find the checkpoint values
# SERVER-16176 - Logging of slow checkpoints
if self.args['checkpoints'] and not re.search("Checkpoint took", logevent.line_str):
continue
# adjust times if --optime-start is enabled
Expand Down
10 changes: 5 additions & 5 deletions mtools/test/test_mplotqueries.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class TestMPlotQueries(object):

def setup(self):
"""Startup method to create mloginfo tool."""
"""Startup method to create mplotqueries tool."""
self.tool = MPlotQueriesTool()
self._test_init()

Expand All @@ -26,10 +26,10 @@ def _test_init(self, filename='mongod_225.log'):
self.logfile_path = os.path.join(os.path.dirname(mtools.__file__),'test/logfiles/', filename)
self.logfile = LogFile(open(self.logfile_path, 'rb'))

def test_checkpoints(self):
# different logfile for oplogs
logfile_oplog = "mtools/test/logfiles/mongod.log"
self.tool.run('%s --checkpoints' % logfile_oplog)
def test_checkpoints(self, filename='mongod.log'):
# different logfile for the slow Checkpoints
self.logfile_path = os.path.join(os.path.dirname(mtools.__file__), 'test/logfiles/', filename)
self.tool.run('%s --checkpoints' % self.logfile_path)
output = sys.stdout.getvalue()
lines = output.splitlines()
assert any(map(lambda line: 'SCATTER plot' in line, lines))
6 changes: 3 additions & 3 deletions mtools/util/logevent.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ def duration(self):
self.line_str)
if matchobj:
self._duration = int(matchobj.group(1))
# SERVER-16176 log the checkpoints
# SERVER-16176 - Logging of slow checkpoints
elif "Checkpoint" in self.line_str:
self._duration = int(line_str[line_str.find("Checkpoint took") + len("Checkpoint took"): -20]) * 1000

groups = re.search("Checkpoint took ([\d]+) seconds to complete.", self.line_str)
self._duration = int(groups.group(1)) * 1000
return self._duration

@property
Expand Down

0 comments on commit 90d7d11

Please sign in to comment.