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

distsqlpb,importccl: fix a regression in IMPORT #35944

Merged
merged 1 commit into from
Mar 19, 2019

Conversation

knz
Copy link
Contributor

@knz knz commented Mar 19, 2019

Fixes #35943.

This patch ensures that the full error message (pre-unwrap) is
included for errors that flow out of distsql process towards the
gateway.

This is important because some other internal mechanisms inside
CockroachDB are expecting to see the prefixes introduced by
errors.Wrap to decide other things (a bad idea, but not fixable in the
short term), for example see issue #35942.

Release note: None

This patch ensures that the full error message (pre-unwrap) is
included for errors that flow out of distsql process towards the
gateway.

This is important because some other internal mechanisms inside
CockroachDB are expecting to see the prefixes introduced by
errors.Wrap to decide other things (a bad idea, but not fixable in the
short term), for example see issue cockroachdb#35942.

Release note: None
@knz knz assigned bobvawter and tbg Mar 19, 2019
@knz knz requested a review from a team March 19, 2019 14:50
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@RaduBerinde
Copy link
Member

LGTM

@RaduBerinde
Copy link
Member

CI failure is a lint OOM.
bors r+

craig bot pushed a commit that referenced this pull request Mar 19, 2019
35912: roachtest: begin the release qualification roachtest whitelist r=nvanbenschoten a=danhhz

Starting with `tpcc/nodes=3/w=max` for now so I can get the teamcity
plumbing done. This test verifies that running our claimed max TPCC
warehouses works. The max depends on the hardware configuration:
currently 1450 on a 3-node GCE n1-standard-1 cluster or 2200 on a 3-node
AWS c5d.4xlarge cluster.

Release note: None

35915: sql: do not create stats on inverted index columns r=rytaft a=rytaft

This commit fixes an issue in which the default columns for
`CREATE STATISTICS` included inverted index columns. Since we
cannot create statistics on JSON columns, running automatic
statistics on a table with an inverted index resulted in the
error "unable to encode table key: *tree.DJSON". This commit
fixes the issue by skipping over inverted indexes when
determining the default columns for `CREATE STATISTICS`.

Fixes #35764

Release note (bug fix): Fixed an error that occurred when
creating statistics on tables with an inverted index.

35944: distsqlpb,importccl: fix a regression in IMPORT r=RaduBerinde a=knz

Fixes #35943.

This patch ensures that the full error message (pre-unwrap) is
included for errors that flow out of distsql process towards the
gateway.

This is important because some other internal mechanisms inside
CockroachDB are expecting to see the prefixes introduced by
errors.Wrap to decide other things (a bad idea, but not fixable in the
short term), for example see issue #35942.

Release note: None

Co-authored-by: Daniel Harrison <[email protected]>
Co-authored-by: Rebecca Taft <[email protected]>
Co-authored-by: Raphael 'kena' Poss <[email protected]>
@craig
Copy link
Contributor

craig bot commented Mar 19, 2019

Build succeeded

@craig craig bot merged commit 475cb15 into cockroachdb:master Mar 19, 2019
knz added a commit to knz/cockroach that referenced this pull request Mar 19, 2019
Pursuant to cockroachdb#35937, cockroachdb#35944 and the discussion on cockroachdb#35854, I am
realizing that there were folk under us working under two conflicting
set of assumptions:

- some prefer their error types unchanged, so as to be able to use
  type assertions to detect certain things (e.g. retry errors).
- some prefer to use `errors.Wrap` or `pgerror.Wrap` liberally,
  so as to decorate errors with useful information to troubleshoot
  problems when they arise.

The problem to solve is that `errors.Wrap` and alike change the type
of errors. The folk who do not like this, or simply did not know about
this, have historically written code that did not take this into
account.

I came to this realization following a comment from Andrei on
issue cockroachdb#35854. Then I ran the following command:

`git grep -n '[eE]rr\.(\*' pkg/sql|grep -v '_test.go:'`

to find all occurrences of type casts on error objects.

Then I added the missing calls to `errors.Cause()` so that the type
casts become more robust again, even in the presence of more generous
uses of `errors.Wrap` and `pgerror.Wrap`.

Release note: None
@knz knz deleted the 20190319-fix-import branch March 20, 2019 06:42
knz added a commit to knz/cockroach that referenced this pull request Mar 20, 2019
Pursuant to cockroachdb#35937, cockroachdb#35944 and the discussion on cockroachdb#35854, I am
realizing that there were folk under us working under two conflicting
set of assumptions:

- some prefer their error types unchanged, so as to be able to use
  type assertions to detect certain things (e.g. retry errors).
- some prefer to use `errors.Wrap` or `pgerror.Wrap` liberally,
  so as to decorate errors with useful information to troubleshoot
  problems when they arise.

The problem to solve is that `errors.Wrap` and alike change the type
of errors. The folk who do not like this, or simply did not know about
this, have historically written code that did not take this into
account.

I came to this realization following a comment from Andrei on
issue cockroachdb#35854. Then I ran the following command:

`git grep -n '[eE]rr\.(\*' pkg/sql|grep -v '_test.go:'`

to find all occurrences of type casts on error objects.

Then I added the missing calls to `errors.Cause()` so that the type
casts become more robust again, even in the presence of more generous
uses of `errors.Wrap` and `pgerror.Wrap`.

Release note: None
craig bot pushed a commit that referenced this pull request Mar 20, 2019
35962: sql: ensure errors are unwrapped before their type is tested r=knz a=knz

Informs  #35854.

Pursuant to #35937, #35944 and the discussion on #35854, I am
realizing that there were folk under us working under two conflicting
set of assumptions:

- some prefer their error types unchanged, so as to be able to use
  type assertions to detect certain things (e.g. retry errors).
- some prefer to use `errors.Wrap` or `pgerror.Wrap` liberally,
  so as to decorate errors with useful information to troubleshoot
  problems when they arise.

The problem to solve is that `errors.Wrap` and alike change the type
of errors. The folk who do not like this, or simply did not know about
this, have historically written code that did not take this into
account.

I came to this realization following a comment from Andrei on
issue #35854. Then I ran the following command:

`git grep -n '[eE]rr\.(\*' pkg/{sql,ccl}|grep -v '_test.go:'`

to find all occurrences of type casts on error objects.

Then I added the missing calls to `errors.Cause()` so that the type
casts become more robust again, even in the presence of more generous
uses of `errors.Wrap` and `pgerror.Wrap`.

Release note: None

Co-authored-by: Raphael 'kena' Poss <[email protected]>
knz added a commit to knz/cockroach that referenced this pull request Mar 22, 2019
Pursuant to cockroachdb#35937, cockroachdb#35944 and the discussion on cockroachdb#35854, I am
realizing that there were folk under us working under two conflicting
set of assumptions:

- some prefer their error types unchanged, so as to be able to use
  type assertions to detect certain things (e.g. retry errors).
- some prefer to use `errors.Wrap` or `pgerror.Wrap` liberally,
  so as to decorate errors with useful information to troubleshoot
  problems when they arise.

The problem to solve is that `errors.Wrap` and alike change the type
of errors. The folk who do not like this, or simply did not know about
this, have historically written code that did not take this into
account.

I came to this realization following a comment from Andrei on
issue cockroachdb#35854. Then I ran the following command:

`git grep -n '[eE]rr\.(\*' pkg/sql|grep -v '_test.go:'`

to find all occurrences of type casts on error objects.

Then I added the missing calls to `errors.Cause()` so that the type
casts become more robust again, even in the presence of more generous
uses of `errors.Wrap` and `pgerror.Wrap`.

Release note: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

importccl: failure in TestImportCSVStmt/primary-key-dup
5 participants