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

log: replace a panic with an error in debug merge-logs #69018

Merged
merged 1 commit into from
Sep 2, 2021

Conversation

cameronnunez
Copy link
Contributor

@cameronnunez cameronnunez commented Aug 16, 2021

Related issue: #68278

Release justification: bug fix

Release note (bug fix): Users would receive a panic message when the log parser
fails to extract log file formats. This has been replaced with a helpful
error message.

@cameronnunez cameronnunez added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. A-logging In and around the logging infrastructure. T-server-and-security DB Server & Security labels Aug 16, 2021
@cameronnunez cameronnunez requested a review from ajwerner August 16, 2021 21:49
@cameronnunez cameronnunez requested review from a team as code owners August 16, 2021 21:49
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@cameronnunez cameronnunez removed request for a team August 16, 2021 21:50
Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @cameronnunez)

@cameronnunez cameronnunez force-pushed the panic-debug-merge-logs branch from 859de4e to 3d2f573 Compare August 17, 2021 15:41
Copy link
Contributor

@knz knz left a comment

Choose a reason for hiding this comment

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

nice

@knz
Copy link
Contributor

knz commented Aug 17, 2021

a unit test wouldn't hurt though

@knz
Copy link
Contributor

knz commented Aug 17, 2021

for this you can create a new Example_xxx test in debug_merge_logs_test.go. You can take inspiration from node_test.go.

@cameronnunez cameronnunez force-pushed the panic-debug-merge-logs branch from 4d6e54d to 171f831 Compare August 18, 2021 17:06
@cameronnunez
Copy link
Contributor Author

@ajwerner mind taking a quick look at this Example test I threw up? The test isn't passing for some reason. No output.

--- FAIL: Example_format_error (0.01s)
got:
debug merge-logs /var/folders/k4/z4qfgyt11lbf01lqjpp8fc6h0000gq/T/1022529215
want:
debug merge-logs .
ERROR: decoding format: failed to extract log file format from the log

@knz
Copy link
Contributor

knz commented Aug 19, 2021

I have tried to run the command manually (from the command line) on the test data.
The command succeeds without error! So it is not surprising that the test does not pass...

This means that the logic is not yet ready. In fact, I don't see any kind of error being handled properly (e.g. disk read errors are probably not handled properly either). This needs to be looked at first.

In general, before you build a test, try running the command manually! There's nothing better than the human eye to give confidence that something works as expected.

@knz
Copy link
Contributor

knz commented Aug 19, 2021

Actually now if I run the cockroach debug merge-log on any log file, even one that contains data, I do not see any output any more.

@knz
Copy link
Contributor

knz commented Aug 19, 2021

I stand corrected! the problem is that merge-logs only recognizes file names that follow the particular file name structure. Let's rename the file in the test.

@knz
Copy link
Contributor

knz commented Aug 19, 2021

here you are: cameronnunez#2

merge-log only accepts file names with a particular structure. That's why the output was empty.

(Arguably it's poor UX that the command terminates without telling you that no files were processed. This could be improved too. Just not in this PR)

@knz
Copy link
Contributor

knz commented Aug 19, 2021

don't forget to squash before merging

@cameronnunez cameronnunez force-pushed the panic-debug-merge-logs branch from 394b320 to ed02a5b Compare August 23, 2021 17:49
@cameronnunez cameronnunez requested a review from a team as a code owner August 23, 2021 17:49
@cameronnunez cameronnunez requested a review from a team August 23, 2021 17:49
@cameronnunez cameronnunez requested a review from a team as a code owner August 23, 2021 17:49
@cameronnunez cameronnunez requested review from tbg and removed request for a team August 23, 2021 17:49
@cameronnunez cameronnunez force-pushed the panic-debug-merge-logs branch from ed02a5b to 6caf95b Compare August 23, 2021 17:50
@cameronnunez cameronnunez removed request for a team and tbg August 24, 2021 14:12
@cameronnunez cameronnunez force-pushed the panic-debug-merge-logs branch 6 times, most recently from 13a61da to ff5cb0c Compare August 26, 2021 18:40
@knz
Copy link
Contributor

knz commented Aug 26, 2021

this is ready to merge I think?

@cameronnunez
Copy link
Contributor Author

this is ready to merge I think?

@knz CI was failing – had to add a release justification. Should I see if CI passes or go ahead and merge?

@knz
Copy link
Contributor

knz commented Aug 26, 2021

let's wait for github CI to be green, you're right. then merge after that

@cameronnunez cameronnunez force-pushed the panic-debug-merge-logs branch from ff5cb0c to 20c361f Compare August 26, 2021 20:32
@knz
Copy link
Contributor

knz commented Aug 30, 2021

What's remaining to do with this PR?

@cameronnunez
Copy link
Contributor Author

cameronnunez commented Aug 30, 2021

What's remaining to do with this PR?

For some reason, the test is failing with this output:

got:
debug merge-logs testdata/merge_logs_v1/missing_format/*
I210801 21:05:59.364923 1 :70 ⋮ [‹×›] ‹×›
I210801 21:05:59.364923 1 :70 ⋮ [‹×›] ‹×›
I210801 21:05:59.364923 1 :70 ⋮ ‹×›
want:
debug merge-logs testdata/merge_logs_v1/missing_format/*
ERROR: decoding format: failed to extract log file format from the log

@cameronnunez cameronnunez force-pushed the panic-debug-merge-logs branch 4 times, most recently from cdaafed to 9a94e8d Compare September 1, 2021 22:47
@knz
Copy link
Contributor

knz commented Sep 2, 2021

I think this is good now. :shipit:

nit: I think our release note parser prefers when the release justification comes above the release note.

@cameronnunez cameronnunez force-pushed the panic-debug-merge-logs branch from 9a94e8d to 3b0c4bd Compare September 2, 2021 15:33
Release justification: bug fix

Release note (bug fix): Users would receive a panic message when the log parser
fails to extract log file formats. This has been replaced with a helpful
error message.
@cameronnunez cameronnunez force-pushed the panic-debug-merge-logs branch from 3b0c4bd to a5caea6 Compare September 2, 2021 15:35
@cameronnunez
Copy link
Contributor Author

bors r=ajwerner,knz,otan

@craig
Copy link
Contributor

craig bot commented Sep 2, 2021

Build succeeded:

@craig craig bot merged commit 0dc7f4b into cockroachdb:master Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-logging In and around the logging infrastructure. C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-server-and-security DB Server & Security
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants