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

Pymongo3 + some fixes #19

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

mohierf
Copy link

@mohierf mohierf commented Dec 3, 2019

Get the modifications from @Azef1 and fix the remaining problems

Azef1 and others added 2 commits December 2, 2019 08:40
Fix the broken get live logs
Improve the MongoDB collection indexes
self.db = self.conn[self.database]
self.db[self.collection].ensure_index([('host_name', pymongo.ASCENDING), ('time', pymongo.ASCENDING), ('lineno', pymongo.ASCENDING)], name='logs_idx')
self.db[self.collection].ensure_index([('time', pymongo.ASCENDING), ('lineno', pymongo.ASCENDING)], name='time_1_lineno_1')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mohierf !

If you remove this index, you will get an error like this:

OperationFailure: Executor error during find command: OperationFailed: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit.

This is due the following code, that use exactly that kind of sort by timestamp and lineno:

 File "shinken/modules/logstore-mongodb/module.py", line 312, in get_live_data_log
    dbresult = [Logline([(c,) for c in columns], [x[col] for col in columns]) for x in self.db[self.collection].find(filter_element).sort([(u'time', pymongo.ASCENDING), (u'lineno', pymongo.ASCENDING)])]

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhh, I've just realized that you have changed those lines too :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi David, I just wanted to give a try :) It looks okay despite the tests are not yet ok.

@mohierf mohierf force-pushed the pymongo3 branch 2 times, most recently from a62c679 to 699afd3 Compare December 30, 2019 11:41
@codecov-io
Copy link

codecov-io commented Dec 30, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@4c8562b). Click here to learn what that means.
The diff coverage is 73.5%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #19   +/-   ##
=========================================
  Coverage          ?   78.49%           
=========================================
  Files             ?        1           
  Lines             ?      265           
  Branches          ?        0           
=========================================
  Hits              ?      208           
  Misses            ?       57           
  Partials          ?        0
Impacted Files Coverage Δ
module/module.py 78.49% <73.5%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c8562b...66cbc1a. Read the comment docs.

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

Successfully merging this pull request may close these issues.

3 participants