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

exec: panic when selecting from crdb_internal.zones #38609

Closed
solongordon opened this issue Jul 2, 2019 · 0 comments · Fixed by #38787
Closed

exec: panic when selecting from crdb_internal.zones #38609

solongordon opened this issue Jul 2, 2019 · 0 comments · Fixed by #38787
Assignees
Labels
A-sql-vec SQL vectorized engine C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.

Comments

@solongordon
Copy link
Contributor

When experimental_vectorize is enabled at the cluster level, selecting from crdb_internal.zones panics.

[email protected]:65524/defaultdb> SET CLUSTER SETTING sql.defaults.experimental_vectorize = on;
SET CLUSTER SETTING

Time: 2.896ms

[email protected]:65524/defaultdb> SELECT * FROM crdb_internal.zones;
E190702 16:28:07.539314 740 sql/conn_executor.go:713  [n1,client=127.0.0.1:65526,user=root] a SQL panic has occurred while executing "SELECT * FROM crdb_internal.zones": expected *DInt, found tree.dNull
E190702 16:28:07.539387 740 util/log/crash_reporting.go:207  [n1,client=127.0.0.1:65526,user=root] a panic has occurred!
panic: expected *DInt, found tree.dNull [recovered]
	panic: panic while executing 1 statements: SELECT * FROM _._; caused by expected *DInt, found tree.dNull

goroutine 740 [running]:
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).closeWrapper(0xc000cca380, 0x75f07e0, 0xc000a11580, 0x6a95f60, 0xc0003b7340)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:727 +0x330
github.com/cockroachdb/cockroach/pkg/sql.(*Server).ServeConn.func1(0xc000cca380, 0x75f07e0, 0xc000a11580)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:440 +0x61
panic(0x6a95f60, 0xc0003b7340)
	/usr/local/Cellar/go/1.12.6/libexec/src/runtime/panic.go:522 +0x1b5
github.com/cockroachdb/cockroach/pkg/sql/sem/tree.MustBeDInt(0x75f7d60, 0x9707c20, 0x9707c20)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/sem/tree/datum.go:617 +0xd9
github.com/cockroachdb/cockroach/pkg/sql.(*planner).getAllNames(0xc000cca6d0, 0x75f08a0, 0xc0014fa600, 0x10, 0x400e999, 0xc001692f90)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/crdb_internal.go:1835 +0x16f
github.com/cockroachdb/cockroach/pkg/sql.glob..func53(0x75f08a0, 0xc0014fa600, 0xc000cca6d0, 0xc00041ab20, 0xc00175dc20, 0xc00175dbd0, 0xc000630001)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/crdb_internal.go:1866 +0x5d
github.com/cockroachdb/cockroach/pkg/sql.virtualDefEntry.getPlanInfo.func1(0x75f08a0, 0xc0014fa600, 0xc000cca6d0, 0x6dd8709, 0x9, 0xc0002da5c0, 0xc00063a0a0, 0xc0007290e0, 0x100)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/virtual_schema.go:272 +0x38e
github.com/cockroachdb/cockroach/pkg/sql.(*execFactory).ConstructVirtualScan.func1(0x75f08a0, 0xc0014fa600, 0xc000cca6d0, 0x1, 0xc0014fa5d0, 0x0, 0x0)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt_exec_factory.go:135 +0x5e
github.com/cockroachdb/cockroach/pkg/sql.(*delayedNode).startExec(0xc001515840, 0x75f08a0, 0xc0014fa600, 0xc001862800, 0xc000cca6d0, 0x1, 0xc0011a5b30)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/delayed.go:58 +0x57
github.com/cockroachdb/cockroach/pkg/sql.startExec.func2(0x6de271b, 0xd, 0x75f1d60, 0xc001515840, 0xc0000b1bc0, 0xc0011a5b40)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/plan.go:497 +0x55
github.com/cockroachdb/cockroach/pkg/sql.(*planVisitor).visitInternal.func1(0xc00179b7a0, 0x6de271b, 0xd, 0x75f1d60, 0xc001515840)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/walk.go:142 +0x5d
github.com/cockroachdb/cockroach/pkg/sql.(*planVisitor).visitInternal(0xc00179b7a0, 0x75f1d60, 0xc001515840, 0x6de271b, 0xd)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/walk.go:624 +0x2a8
github.com/cockroachdb/cockroach/pkg/sql.(*planVisitor).visit(0xc00179b7a0, 0x75f1d60, 0xc001515840, 0x0, 0x60)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/walk.go:109 +0x8d
github.com/cockroachdb/cockroach/pkg/sql.walkPlan(...)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/walk.go:73
github.com/cockroachdb/cockroach/pkg/sql.startExec(0x75f08a0, 0xc0014fa600, 0xc001862800, 0xc000cca6d0, 0x75f1d60, 0xc001515840, 0x75abfe0, 0x970a660)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/plan.go:500 +0x286
github.com/cockroachdb/cockroach/pkg/sql.(*planNodeToRowSource).Start(0xc000634500, 0x75f08a0, 0xc0014fa600, 0x970a660, 0x68ac3a0)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/plan_node_to_row_source.go:117 +0xd6
github.com/cockroachdb/cockroach/pkg/sql/distsqlrun.(*ProcessorBase).Run(0xc000634500, 0x75f08a0, 0xc0014fa600)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/distsqlrun/processors.go:792 +0x52
github.com/cockroachdb/cockroach/pkg/sql/distsqlrun.(*Flow).Run(0xc00000cd20, 0x75f08a0, 0xc0014fa600, 0x6f49358, 0x0, 0x0)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/distsqlrun/flow.go:654 +0x1f2
github.com/cockroachdb/cockroach/pkg/sql.(*DistSQLPlanner).Run(0xc0001eafc0, 0xc00179b6e0, 0xc001675710, 0xc0011a68b0, 0xc00092e2c0, 0xc000cca7a8, 0x0)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/distsql_running.go:296 +0x35c
github.com/cockroachdb/cockroach/pkg/sql.(*DistSQLPlanner).PlanAndRun(0xc0001eafc0, 0x75f08a0, 0xc0014fa420, 0xc000cca7a8, 0xc00179b6e0, 0xc001675710, 0x75f1d60, 0xc001515840, 0xc00092e2c0)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/distsql_running.go:860 +0x208
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execWithDistSQLEngine(0xc000cca380, 0x75f08a0, 0xc0014fa420, 0xc000cca6d0, 0x3, 0xbb92940, 0xc000443d90, 0xc0011a6b00, 0x0, 0x0, ...)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:902 +0x370
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).dispatchToExecutionEngine(0xc000cca380, 0x75f08a0, 0xc0014fa420, 0xc000cca6d0, 0xbb92940, 0xc000443d90, 0x0, 0x0)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:734 +0x6e5
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execStmtInOpenState(0xc000cca380, 0x75f08a0, 0xc0014fa420, 0x75f5ca0, 0xc0018610c0, 0xc0008d6170, 0x21, 0x0, 0x1, 0x0, ...)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:417 +0xb64
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execStmt(0xc000cca380, 0x75f08a0, 0xc0014fa420, 0x75f5ca0, 0xc0018610c0, 0xc0008d6170, 0x21, 0x0, 0x1, 0x0, ...)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:99 +0x4ec
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execCmd(0xc000cca380, 0x75f07e0, 0xc001515740, 0x0, 0x0)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1204 +0x1ab0
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).run(0xc000cca380, 0x75f07e0, 0xc000a11580, 0xc000507540, 0x5400, 0x15000, 0xc0005075d8, 0xc0002c98a0, 0x0, 0x0)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1140 +0x1a3
github.com/cockroachdb/cockroach/pkg/sql.(*Server).ServeConn(0xc0001b9b00, 0x75f07e0, 0xc000a11580, 0xc000cca380, 0x5400, 0x15000, 0xc0005075d8, 0xc0002c98a0, 0x0, 0x0)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:442 +0xce
github.com/cockroachdb/cockroach/pkg/sql/pgwire.(*conn).processCommandsAsync.func1(0xc000347d39, 0xc0003091e0, 0x75f07e0, 0xc000a11580, 0xc0002c98a0, 0xc0001b9b00, 0xc000b9e000, 0x75f4220, 0xc0003091c0, 0xc001020300, ...)
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/pgwire/conn.go:580 +0x21c
created by github.com/cockroachdb/cockroach/pkg/sql/pgwire.(*conn).processCommandsAsync
	/Users/solon/go/src/github.com/cockroachdb/cockroach/pkg/sql/pgwire/conn.go:509 +0x17b
@solongordon solongordon added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. A-sql-vec SQL vectorized engine labels Jul 2, 2019
@solongordon solongordon self-assigned this Jul 2, 2019
craig bot pushed a commit that referenced this issue Jul 12, 2019
38787: row: bugfixes to cfetcher r=jordanlewis a=jordanlewis

Fixes #38755.
Fixes #38611.
Fixes #38609.

Two bugfixes to the cfetcher.
- row: teach cfetcher about missing sentinel kvs
System tables are special in that they might be missing their "sentinel
kv": the kv that's marked as column family 0. Previously, cfetcher
assumed that a sentinel kv would always exist. This led to the inability
of decoding system tables correctly.
Now, if the table being read has more than one column family, we always
actively decode the column family id from the first key in a row to make
sure we know what values will be available in the kv.

- row: cfetcher bugfix to unique idxs w/ nulls
Previously, the cfetcher misbehaved when decoding unique secondary
indexes that had null values in one or more of their index columns. This
was because the encoding of the "extra columns" in a unique index (the
columns that are in the primary index but missing from the secondary) is
performed using the key encoding, not the value encoding, and the key
decoding routines in the cfetcher hadn't been taught to keep track of
which needed columns hadn't been seen in the current row yet.
This commit corrects the problem by teaching the key decoding routine to
optionally remove the decoded keys from the set of unseen column values
so far.

Release note: None

Co-authored-by: Jordan Lewis <[email protected]>
@craig craig bot closed this as completed in #38787 Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-vec SQL vectorized engine C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants