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

release-2.1: sql: capture and report internal/assertion errors #31272

Merged
merged 1 commit into from Oct 11, 2018

Conversation

Projects
None yet
3 participants
@knz
Member

knz commented Oct 11, 2018

Backport 1/1 commits from #31261.

/cc @cockroachdb/release


Requested by @petermattis. Desired by @awoods187. Inspired by @tschottdorf.

sql: capture internal/assertion errors
Prior to this patch, assertion/internal errors were "merely" reported
to the client with pg error code CodeInternalError and nothing would
happen further. This was causing 2 problems:

- it was unclear for the user what to do with this information.
- the occurrences were not further collected and could not be used to
  track bugs automatically.

This patch improves the situation as follows:

- a new constructor `pgerror.NewAssertionErrorf` is introduced, which:
  - gives a hint to the user about submitting the error as a bug with
    details.
  - populates the InternalCommand with a shortened stack trace.

- the new constructor is used instead of
  `pgerror.NewErrorf(pgerror.CodeInternalError` throughout the SQL
  layer.

- the reporting mechanism now detects CodeInternalError errors,
  collects then reports them with other node statistics.

Before:

```
root@127.0.0.1:56399/defaultdb> select crdb_internal.force_assertion_error('woo');
pq: crdb_internal.force_assertion_error(): programming error: woo
```

After:

```
root@127.0.0.1:63733/defaultdb> select crdb_internal.force_Assertion_error('woo');
pq: crdb_internal.force_assertion_error(): programming error: woo
DETAIL: builtins.go:2805,eval.go:3547,expr.go:194,processors.go:378,processors.go:745,values.go:125,base.go:170,processors.go:768,flow.go:596,distsql_running.go:261,distsql_running.go:768,conn_executor_exec.go:983,conn_executor_exec.go:825,conn_executor_exec.go:403,conn_executor_exec.go:95,conn_executor.go:1189,conn_executor.go:466,conn.go:309
HINT: You have encountered an error inside CockroachDB. Don't worry! Your data is likely safe.

Please report this error with details at:
    https://github.com/cockroachdb/cockroach/issues/new/choose
or
    support@cockroachlabs.com

Thank you!
```

Release note (sql change): CockroachDB will now hint that internal
errors should be reported as bugs by users. Additionally, internal
errors are now collected internally and submitted (anonymized) with
other node statistics when statistic collection is enabled.

@knz knz requested review from dt and jordanlewis Oct 11, 2018

@knz knz requested review from cockroachdb/core-prs as code owners Oct 11, 2018

@cockroach-teamcity

This comment has been minimized.

Show comment
Hide comment
@cockroach-teamcity

cockroach-teamcity Oct 11, 2018

Member

This change is Reviewable

Member

cockroach-teamcity commented Oct 11, 2018

This change is Reviewable

@dt

dt approved these changes Oct 11, 2018

@knz knz merged commit 92ef8d7 into cockroachdb:release-2.1 Oct 11, 2018

2 checks passed

GitHub CI (Cockroach) TeamCity build finished
Details
license/cla Contributor License Agreement is signed.
Details

@knz knz deleted the knz:backport2.1-31261 branch Oct 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment