-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
server: write pebble log messages to storage channel #90478
Conversation
(nothing)
|
Another approach to fix the issue would be to move the log initialization code so that it sits before the That said, I'm open to moving the code around if that's deemed to be more appropriate. |
My initial thought was this was a test-only bug, but based on this bug fix, does this affect production CRDB too? If it is NOT a test-only bug, then I bet it is a regression that only affects certain CRDB versions, etc., since we use pebble logs all the time in production. Is that correct? If it is, when was the regression introduced, at least in terms of major versions? Also, want to mark this PR as fixing #90483? |
Yes, it affects production CRDB too.
It seems like this has been the case for some time. The cockroach/pkg/storage/pebble.go Lines 918 to 924 in 62175c9
|
Ah! Nice. Great find then. |
f8b77ee
to
0592cee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice 💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice 💯
This might be the fix to #72683. Can you check?
Previously, when setting up the server, the pebble engine would be initialized with Pebble's default logger. The reason for this is that the pebble initialization code calls `EnsureDefaults` on the configuration options _before_ checking if the `options.Logger` is nil/unset. At that point, it will never be unset, as `EnsureDefaults` will set the logger to `pebble.DefaultLogger` if it was not previously set. This change overwrites the pebble logger if its found to be the `DefaultLogger`. We never want to use pebble's `DefaultLogger` in CRDB as that would mean pebble would use the standard library `log` package, making every message emitted by Pebble to be treated as `INFO` level messages, regardless of severity (including `log.Fatal` calls). Related to cockroachdb#83079. Fixes cockroachdb#72683. Fixes cockroachdb#90483. Release note: None.
0592cee
to
2b7ac6c
Compare
This change does fix that issue. The log message reported there is now displayed as below. Commit and PR messages updated to reflect that.
TFTR! |
bors r=knz |
Build failed (retrying...): |
Build failed (retrying...): |
Build succeeded: |
Previously, when setting up the server, the pebble engine would be initialized with Pebble's default logger. The reason for this is that the pebble initialization code calls
EnsureDefaults
on the configuration options before checking if theoptions.Logger
is nil/unset. At that point, it will never be unset, asEnsureDefaults
will set the logger topebble.DefaultLogger
if it was not previously set.This change overwrites the pebble logger if its found to be the
DefaultLogger
. We never want to use pebble'sDefaultLogger
in CRDB as that would mean pebble would use the standard librarylog
package, making every message emitted by Pebble to be treated asINFO
level messages, regardless of severity (includinglog.Fatal
calls).Related to #83079.
Fixes #72683.
Fixes #90483.
Release note: None.