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

Add EventLogging option #1035

Merged
merged 6 commits into from
Sep 18, 2019
Merged

Add EventLogging option #1035

merged 6 commits into from
Sep 18, 2019

Conversation

mjgarton
Copy link
Contributor

@mjgarton mjgarton commented Sep 15, 2019

This introduces an option to disable or enable trace.EventLog logging of
events. For backwards compatability this defaults to true.

The reason for making this configurable is that under some workloads the
cost of event logging is significant and so can cause performance
issues.

Fixes #938


This change is Reviewable

This introduces an option to disable or enable trace.EventLog logging of
events.  For backwards compatability this defaults to true.

The reason for making this configurable is that under some workloads the
cost of event logging is significant and so can cause performance
issues.

Fixes #938
Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

✅ A review job has been created and sent to the PullRequest network.


@mjgarton you can click here to see the review status or cancel the code review job.

@CLAassistant
Copy link

CLAassistant commented Sep 15, 2019

CLA assistant check
All committers have signed the CLA.

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

This code is not passing AppVeyor build due to invalid checksum - https://ci.appveyor.com/project/manishrjain/badger/builds/27425337.

You may need to fix it by merging in the latest version of master.

Had a question in-line but otherwise looks good to me.


Reviewed with ❤️ by PullRequest

nil_event_log.go Outdated
noEventLog trace.EventLog = nilEventLog{}
)

type nilEventLog struct{}
Copy link

Choose a reason for hiding this comment

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

What is the need for this struct to be a part of the repo, and why is it the default?

Copy link
Contributor

@jarifibrahim jarifibrahim left a comment

Choose a reason for hiding this comment

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

:lgtm: @mjgarton Thanks for ensuring the changes are backward compatible. The AppVeyor build is broken and I'm working on fixing it. This PR shouldn't get blocked on it.

Reviewed 3 of 3 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ashish-goswami, @manishrjain, and @mjgarton)

nil_event_log.go Outdated Show resolved Hide resolved
@ashish-goswami
Copy link
Contributor

This also applies the event logging config option to the value log.
value.go Outdated Show resolved Hide resolved
Remove the additional eventLogging parameter because it's already
available as db.opts.
It is going to need to be used from there and elsewhere, so move into
`y`
The option to enable/disable event logging now also works for
watermarks, which was previously missed.
@mjgarton
Copy link
Contributor Author

mjgarton commented Sep 18, 2019

I missed another event logger in y/watermark.go so I need to add that. I'll push some changes soon.

EDIT: pushed now.

@mjgarton
Copy link
Contributor Author

Please advise whether y was the right place to put the null event logging code. It isn't quite clear to me what the scope of the y package is supposed to be and I didn't find it documented.


func (nel nilEventLog) Errorf(format string, a ...interface{}) {}

func (nel nilEventLog) Finish() {}
Copy link
Contributor

Choose a reason for hiding this comment

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

You might want to implement SetMaxEvents function also. As it is used below.
https://github.com/dgraph-io/badger/blob/c6681c181835f3846b859d6b546e5da8d9f86ea9/levels.go#L845

Copy link
Contributor

@jarifibrahim jarifibrahim left a comment

Choose a reason for hiding this comment

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

@mjgarton Having the null event logger in y package should be ok. We keep some common functions and helper methods in the y package.

Reviewed 1 of 3 files at r3, 5 of 5 files at r4.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @ashish-goswami, @manishrjain, and @mjgarton)


y/event_log.go, line 31 at r4 (raw file):

Previously, ashish-goswami (Ashish Goswami) wrote…

You might want to implement SetMaxEvents function also. As it is used below.
https://github.com/dgraph-io/badger/blob/c6681c181835f3846b859d6b546e5da8d9f86ea9/levels.go#L845

The elog in this context is trace.Trace type and not trace.EventLog. We don't need to make this change in this PR. We can do it separately.

@jarifibrahim jarifibrahim merged commit 75c6a44 into hypermodeinc:master Sep 18, 2019
@jarifibrahim
Copy link
Contributor

Thank you for fixing this @mjgarton 🎉

@mjgarton mjgarton deleted the optional_event_logging branch September 18, 2019 10:39
jarifibrahim pushed a commit that referenced this pull request Mar 12, 2020
This introduces an option to disable or enable trace.EventLog logging of
events.  For backward compatibility this defaults to true.

The reason for making this configurable is that under some workloads the
cost of event logging is significant and so can cause performance
issues.

Fixes #938

(cherry picked from commit 75c6a44)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

make event logging configurable
4 participants