Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logevent.py duration function fails when log line includes WTCheckpointThread #762

Closed
niccottrell opened this issue Dec 31, 2019 · 5 comments

Comments

@niccottrell
Copy link

Expected behavior

Log lines like the following should not crash duraiton:

2019-12-26T14:00:19.539+0000 I  STORAGE  [WTCheckpointThread] WiredTiger message read timestamp (1577368819,3971) less than the oldest timestamp (1577368819,4078) 

Steps to reproduce the actual/current behavior

mplotqueries fails with:

all last):
  File "/Users/nic/anaconda3/bin/mplotqueries", line 10, in <module>
    sys.exit(main())
  File "/Users/nic/anaconda3/lib/python3.7/site-packages/mtools/mplotqueries/mplotqueries.py", line 714, in main
    tool.run()
  File "/Users/nic/anaconda3/lib/python3.7/site-packages/mtools/mplotqueries/mplotqueries.py", line 146, in run
    self.parse_logevents()
  File "/Users/nic/anaconda3/lib/python3.7/site-packages/mtools/mplotqueries/mplotqueries.py", line 256, in parse_logevents
    if self.plot_instance.accept_line(logevent):
  File "/Users/nic/anaconda3/lib/python3.7/site-packages/mtools/mplotqueries/plottypes/scatter_type.py", line 59, in accept_line
    return getattr(logevent, self.field) is not None
  File "/Users/nic/anaconda3/lib/python3.7/site-packages/mtools/util/logevent.py", line 222, in duration
    self._duration = int(groups.group(1)) * 1000
AttributeError: 'NoneType' object has no attribute 'group'

Environment

Software Version
mtools 1.6.0
@niccottrell
Copy link
Author

I believe https://github.com/rueckstiess/mtools/blob/develop/mtools/util/logevent.py#L218 should be

 elif "Checkpoint" in self.line_str:
                matchobj = re.search("Checkpoint took ([\d]+) seconds to complete", self.line_str)
                if matchobj is not None:
                    self._duration = int(matchobj.group(1)) * 1000
``

@sommeric
Copy link

sommeric commented Dec 31, 2019

I recommend changing to:

elif "Checkpoint took" in self.line_str:

to exclude the undesired line, even if the "not None" line is also added to catch anything else that's unexpected.

@niccottrell
Copy link
Author

In fact every instance of if X: on a result from re.search(...)should probably be changed to if X is not None:

@stennie
Copy link
Collaborator

stennie commented Dec 31, 2019

Dupe of #757; fix will be included in 1.6.1

@stennie stennie closed this as completed Dec 31, 2019
@stennie
Copy link
Collaborator

stennie commented Dec 31, 2019

@sommeric

I recommend changing to:

elif "Checkpoint took" in self.line_str:

to exclude the undesired line, even if the "not None" line is also added to catch anything else that's unexpected.

Good suggestion, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants