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

Can't use debug merge-logs on logs from 20.2 unless explicitly provide flag #68278

Closed
aliher1911 opened this issue Jul 30, 2021 · 10 comments · Fixed by #68282
Closed

Can't use debug merge-logs on logs from 20.2 unless explicitly provide flag #68278

aliher1911 opened this issue Jul 30, 2021 · 10 comments · Fixed by #68282
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

Comments

@aliher1911
Copy link
Contributor

aliher1911 commented Jul 30, 2021

Describe the problem

When parsing logs from 20.2 format detector will panic unhelpfully. It requires --format crdb-v1 to be passed to proceed which is unfriendly.

To Reproduce

Try

cockroach debug merge-logs with logs 

created by cockroach-20.2 and observe

ERROR: decoding format: failed to extract log file format from the log

Expected behavior
We should stick to v1 format if detector fails maybe or provide some helpful message at least?

This change was introduced in #65633

@aliher1911 aliher1911 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. labels Jul 30, 2021
@aliher1911 aliher1911 changed the title Can't use debug merge-logs on logs from 20.2 Can't use debug merge-logs on logs from 20.2 unless explicitly provide flag Jul 30, 2021
@aliher1911
Copy link
Contributor Author

Would it work if cluster was upgraded and log format changed?

@ajwerner
Copy link
Contributor

Making this work is going to require a very small code change. The decoder has the capability to auto detect the format per file. We're just not using that.

@aliher1911
Copy link
Contributor Author

I think decoder tries to match regexp to guess format, but it fails because there's nothing like that in the logs as far as i can see.

@aliher1911 aliher1911 self-assigned this Jul 30, 2021
@ajwerner
Copy link
Contributor

These formats are so similar that it's hard to tell the difference. In the real world we should have the headers which should help us most of the time. Here's a WIP patch that does something but not enough: #68282

@ajwerner
Copy link
Contributor

I'm probably not going to look at this any more.

@aliher1911
Copy link
Contributor Author

Log parsing seems to be a rats nest if we want to cover old logs reliable where we don't have format type specifier.
I think we should just fall back to v1 parser in absence of info instead of failing. Maybe do a warning in worst case to let caller know, but it could generate alot of stderr noise.

I just created a PR to default it. Not sure if spending lots of time on it is justifiable.

@blathers-crl blathers-crl bot added the T-server-and-security DB Server & Security label Aug 2, 2021
@aliher1911
Copy link
Contributor Author

As an example, this is the beginning of log from cockroach-v20.1.17

I210801 21:05:59.364923 1 util/log/sync_buffer.go:70  [config] file created at: 2021/08/01 21:05:59
I210801 21:05:59.364923 1 util/log/sync_buffer.go:70  [config] running on machine: Olegs-MacBook-Pro
I210801 21:05:59.364923 1 util/log/sync_buffer.go:70  [config] binary: CockroachDB CCL v20.1.17 (x86_64-apple-darwin14, built 2021/05/17 16:30:22,
I210801 21:05:59.364923 1 util/log/sync_buffer.go:70  [config] arguments: [./cockroach start]
I210801 21:05:59.364923 1 util/log/sync_buffer.go:70  line format: [IWEF]yymmdd hh:mm:ss.uuuuuu goid file:line msg utf8=✓
I210801 21:05:59.364921 1 cli/start.go:1051  logging to directory /Users/ali/Projects/LogExamples/cockroach-v20.1.17.darwin-10.9-amd64/cockroach-da

if I run

cockroach debug merge-logs .

I get

panic: decoding format: failed to extract log file format from the log

goroutine 14 [running]:
github.com/cockroachdb/cockroach/pkg/cli.(*fileLogStream).open(0xc000f78360, 0xc000f78360)
	/Users/ali/go/src/github.com/cockroachdb/cockroach/pkg/cli/debug_merge_logs.go:503 +0x385
github.com/cockroachdb/cockroach/pkg/cli.(*fileLogStream).peek(0xc000f78360, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/ali/go/src/github.com/cockroachdb/cockroach/pkg/cli/debug_merge_logs.go:512 +0x5c5
github.com/cockroachdb/cockroach/pkg/cli.newFileLogStream(0xc001892900, 0x7f, 0xc0004c6320, 0xc00028dbc0, 0xc, 0xc, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/ali/go/src/github.com/cockroachdb/cockroach/pkg/cli/debug_merge_logs.go:477 +0x126
github.com/cockroachdb/cockroach/pkg/cli.newMergedStream.func1.1(0x0, 0x0)
	/Users/ali/go/src/github.com/cockroachdb/cockroach/pkg/cli/debug_merge_logs.go:217 +0x1c5
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc000d90300, 0xc000379d80)
	/Users/ali/go/src/github.com/cockroachdb/cockroach/vendor/golang.org/x/sync/errgroup/errgroup.go:57 +0x59
created by golang.org/x/sync/errgroup.(*Group).Go
	/Users/ali/go/src/github.com/cockroachdb/cockroach/vendor/golang.org/x/sync/errgroup/errgroup.go:54 +0x66

I tried that with all major versions and 21.1.? has

log format (utf8=✓): crdb-v2

which would let it pass beyond panic.

@ajwerner
Copy link
Contributor

ajwerner commented Aug 2, 2021

While defaulting to v1 would help, it's not great. The patch in #68282 does a bit more. Importantly it'll allow v2 to be used when using date offsets.

@piyush-singh
Copy link

cc @cameronnunez when you get back we should take a look at this

@cameronnunez
Copy link
Contributor

cameronnunez commented Aug 4, 2021

Log parsing seems to be a rats nest if we want to cover old logs reliable where we don't have format type specifier.

Yes, older logs do not have log format specification in the headers. This was introduced with #66096.

I think we should just fall back to v1 parser in absence of info instead of failing.

I think this makes sense as a short term solution if we need to look over old logs for users and upgrading is not desired. We will probably want to go back to failing after some time since having logs with format specification is desirable, and v2 is currently the main file format, not v1.

However, one thing to take note of is that older logs can be v2 formatted without a format specifier at the top of the log, so then defaulting to v1 is bad in this situation.

craig bot pushed a commit that referenced this issue Sep 2, 2021
67936: backupccl: set a low GC TTL on the temporary system tables r=pbardea a=pbardea

Cluster restore creates a temporary system table to hold system table
data before transactionally writing it to the real system tables. This
table is only persisted during the lifetime of the restore and is
dropped at the end of the restore. It should be GC'd quickly since it's
of no use after the restore finishes.

Release note (bug fix): Ensure that auxilary tables used during cluster
restore are GC'd quickly afterwards.

69018: log: replace a panic with an error in debug merge-logs r=ajwerner,knz,otan a=cameronnunez

Related issue: [#68278](#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.

69607: kvserver: Run one ScanInterleavedIntents per store concurrently r=dt a=itsbilal

Currently, lock table migration related requests (Barrier,
ScanInterleavedIntents, PushTxn, ResolveIntent), are only run
with a concurrency of 4 regardless of the size of the cluster.

This change increases that to 4 * numNodes, and adds a new
mechanism to limit the ScanInterleavedIntents on the receiver
side to 1 per store. This throttle is applied before latches
are grabbed. Only ScanInterleavedIntents needs to be
rate-limited as it's by far the heaviest component in
the separated intents migrations.

Release justification: Category 2, low-risk update to new functionality
Release note: None.

Co-authored-by: Paul Bardea <[email protected]>
Co-authored-by: Cameron Nunez <[email protected]>
Co-authored-by: Bilal Akhtar <[email protected]>
@cameronnunez cameronnunez linked a pull request Sep 2, 2021 that will close this issue
cameronnunez pushed a commit to ajwerner/cockroach that referenced this issue Sep 9, 2021
Fixes cockroachdb#68278.

Log parsers require the flag --format when parsing older logs (because
they do not contain format specification). With this patch, this is no longer
a requirement as the log format is now inferred based on the structure of
the log if no log format specification exists.

Release justification: bug fix

Release note (bug fix): The debug merge-logs command no longer returns an
error when the log decoder attempts to parse older logs.
cameronnunez pushed a commit to ajwerner/cockroach that referenced this issue Sep 13, 2021
Fixes cockroachdb#68278.

Log parsers require the flag --format when parsing older logs (because
they do not contain format specification). With this patch, this is no longer
a requirement as the log format is now inferred based on the structure of
the log if no log format specification exists.

Release justification: bug fix

Release note (bug fix): The debug merge-logs command no longer returns an
error when the log decoder attempts to parse older logs.
cameronnunez pushed a commit to ajwerner/cockroach that referenced this issue Sep 14, 2021
Fixes cockroachdb#68278.

Log parsers require the flag --format when parsing older logs (because
they do not contain format specification). With this patch, this is no longer
a requirement as the log format is now inferred based on the structure of
the log if no log format specification exists.

Release justification: bug fix

Release note (bug fix): The debug merge-logs command no longer returns an
error when the log decoder attempts to parse older logs.
craig bot pushed a commit that referenced this issue Sep 15, 2021
68282: cli,log: allow use of `debug merge-logs` on older logs r=knz a=ajwerner

Fixes [#68278](#68278).

Log parsers require the flag `--format` when parsing older logs (because 
they do not contain format specification). With this patch, this is no longer 
a requirement as the log format is now inferred based on the structure of 
the log if no log format specification exists.

Release justification: bug fix

Release note (bug fix): The debug merge-logs command no longer returns an error 
when the log decoder attempts to parse older logs.

69903: importccl: add support for IMPORT INTO RBR table r=arulajmani,ajstorm,dt a=adityamaru

This change overrides the `default_to_database_primary_region`
and `gateway_region` to always return the primary region of the
database of the table being imported into. This allows for
IMPORT INTO an RBR table.

To ensure that the import is idempotent across resumptions, we cache
the primary region of the database being imported into, during planning.
This information is store in the job details and flow spec to be used
when evaluating the relevant default expr/computed column.

Since IMPORT is a job, it does not have an associated session data
and so it cannot rely on the planners' implementation of the regional
operator. This change also implements the relevant methods in the
`importRegionOperator` to allow resolution of the primary region
of the database being imported into.

Fixes: #69616

Release note (sql change): IMPORT INTO regional by row tables
is supported.

Release justification: fixes for high-priority or high-severity bugs in existing functionality

70150: server: fix TestAdminAPIJobs failure r=knz a=adityamaru

This change sorts the expected job IDs before ensuring
that they are equal.

Fixes: #69401

Release note: None

70226: changefeedccl: updated retryable error warning message r=wongio123 a=wongio123

Retryable error warning message contained the word "error"
Confusing to users because warning message had the word "error" in it
Prefaced warning message with "WARNING"

Release note (enterprise change): updated retyable error warning message to begin with "WARNING"

Closes #69677 

70229: [CRDB-9016] ui: fix drag to zoom on custom charts r=Santamaura a=Santamaura

This PR addresses the issue where a user creates a custom chart and selects an area to zoom into which leaves the grey highlight after the graph zooms in. This was due to the history prop not being passed into the linegraph component and caused an error to throw when updating the url params. This was resolved by passing in the history to propagate to the
linegraph component.

Release note (ui change): fix drag to zoom on custom charts

https://user-images.githubusercontent.com/17861665/133342585-d7b37e9b-7eb8-4a48-b2c5-814fed62556a.mp4



70262: ui: add column selector to transation page r=maryliag a=maryliag

Add column selector to Transaction Page

Fixes #70148

<img width="414" alt="Screen Shot 2021-09-15 at 11 28 56 AM" src="https://user-images.githubusercontent.com/1017486/133463202-7ed7ac3a-9614-4101-ad76-8f431defe688.png">


Release justification: Category 4
Release note (ui change): Add column selector to transaction page

70268: clusterversion: remove Start21_1 (no longer applicable) r=irfansharif a=irfansharif

Fixes #65200. The last remaining 21.1 version (V21_1) can be removed as
part of #69828.

Release note: None

Co-authored-by: Andrew Werner <[email protected]>
Co-authored-by: Aditya Maru <[email protected]>
Co-authored-by: Alex Wong <[email protected]>
Co-authored-by: Santamaura <[email protected]>
Co-authored-by: Marylia Gutierrez <[email protected]>
Co-authored-by: irfan sharif <[email protected]>
@craig craig bot closed this as completed in 68ef2d0 Sep 15, 2021
dhartunian pushed a commit to dhartunian/cockroach that referenced this issue Jul 2, 2022
Fixes cockroachdb#68278.

Log parsers require the flag --format when parsing older logs (because
they do not contain format specification). With this patch, this is no longer
a requirement as the log format is now inferred based on the structure of
the log if no log format specification exists.

Release justification: bug fix

Release note (bug fix): The debug merge-logs command no longer returns an
error when the log decoder attempts to parse older logs.

Co-authored-by: Cameron Nunez <[email protected]>
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
4 participants