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

sql: internal error when CFetcher reads from an index with unneeded unsupported type #42994

Closed
yuzefovich opened this issue Dec 5, 2019 · 0 comments · Fixed by #42999
Closed
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-sqlsmith

Comments

@yuzefovich
Copy link
Member

The repro (on current master):

create table t (a int primary key, b bit, index i (a, b));
insert into t values (1, 1::BIT);
set vectorize_row_count_threshold = 0;
select a from t@i;

results in

ERROR: internal error: unsupported type bit
SQLSTATE: XX000
DETAIL: stack trace:
github.com/cockroachdb/cockroach/pkg/sql/colencoding/key_encoding.go:250: decodeTableKeyToCol()
github.com/cockroachdb/cockroach/pkg/sql/colencoding/key_encoding.go:158: DecodeKeyValsToCols()
github.com/cockroachdb/cockroach/pkg/sql/colencoding/key_encoding.go:106: DecodeIndexKeyToCols()
github.com/cockroachdb/cockroach/pkg/sql/colexec/cfetcher.go:635: nextBatch()
github.com/cockroachdb/cockroach/pkg/sql/colexec/cfetcher.go:563: nextAdapter()
github.com/cockroachdb/cockroach/pkg/sql/colexec/allocator.go:90: performOperation()
github.com/cockroachdb/cockroach/pkg/sql/colexec/cfetcher.go:555: NextBatch()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colbatch_scan.go:68: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/cancel_checker.go:47: Next()
...
@yuzefovich yuzefovich added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-sqlsmith labels Dec 5, 2019
rohany added a commit to rohany/cockroach that referenced this issue Dec 5, 2019
…led type

Fixes cockroachdb#42994.

Indexed columns are always decoded by the fetcher, even if they are unneeded.
This PR adds the check to cfetcher initialization to error out if an indexed
column is of an unneeded type.

Release note (bug fix): Fixed a bug where scanning an index of an unsupported
type with the vectorized engine would lead to an internal error.
craig bot pushed a commit that referenced this issue Dec 5, 2019
42250: storage/engine: introduce a datadriven framework to run MVCC tests r=itsbilal,petermattis a=knz

Previously MVCC tests were hand-coded in Go.
This was making it hard(er) to introduce new tests or modify existing
tests.

This commit improves upon this situation by introducing a new
datadriven test, `TestMVCCHistories`, which runs MVCC
tests written using a DSL:

```
begin_txn      t=<name> [ts=<int>[,<int>]]
remove_txn     t=<name>
resolve_intent t=<name> k=<key> [status=<txnstatus>]
restart_txn    t=<name>
update_txn     t=<name> t2=<name>
step_txn       t=<name> [n=<int>]
advance_txn    t=<name> ts=<int>[,<int>]
txn_status     t=<name> status=<txnstatus>

check_intent   k=<key> [none]

put       [t=<name>] [ts=<int>[,<int>]] [resolve] k=<key> v=<string> [raw]
cput      [t=<name>] [ts=<int>[,<int>]] [resolve] k=<key> v=<string> [raw] [cond=<string>]
increment [t=<name>] [ts=<int>[,<int>]] [resolve] k=<key> [inc=<val>]
del       [t=<name>] [ts=<int>[,<int>]] [resolve] k=<key>
get       [t=<name>] [ts=<int>[,<int>]] [resolve] k=<key> [inconsistent] [tombstones]
scan      [t=<name>] [ts=<int>[,<int>]] [resolve] k=<key> [end=<key>] [inconsistent] [tombstones] [reverse]

merge     [ts=<int>[,<int>]] k=<key> v=<string> [raw]

clear_range    k=<key> end=<key>
```

Where `<key>` can be a simple string, or a string
prefixed by the following characters:

- `=foo` means exactly key `foo`
- `+foo` means `Key(foo).Next()`
- `-foo` means `Key(foo).PrefixEnd()`

Additionally, the pseudo-command `with` enables sharing
a group of arguments between multiple commands, for example:

```
with t=A
   begin_txn
   with k=a
     put v=b
     resolve_intent
```

Release note: None

42999: colexec: cfetcher errors on setup when indexed column contains unhandled type r=yuzefovich a=rohany

Fixes #42994.

Indexed columns are always decoded by the fetcher, even if they are unneeded.
This PR adds the check to cfetcher initialization to error out if an indexed
column is of an unneeded type.

Release note (bug fix): Fixed a bug where scanning an index of an unsupported
type with the vectorized engine would lead to an internal error.

Co-authored-by: Raphael 'kena' Poss <[email protected]>
Co-authored-by: Rohan Yadav <[email protected]>
@craig craig bot closed this as completed in e6e9f0b Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-sqlsmith
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants