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 with crdb_internal.job_payload_type #93843

Closed
cockroach-teamcity opened this issue Dec 17, 2022 · 6 comments · Fixed by #93976
Closed

sql: internal error with crdb_internal.job_payload_type #93843

cockroach-teamcity opened this issue Dec 17, 2022 · 6 comments · Fixed by #93976
Labels
branch-master Failures and bugs on the master branch. C-test-failure Broken test (automatically or manually discovered). O-roachtest O-robot Originated from a bot. T-cdc
Milestone

Comments

@cockroach-teamcity
Copy link
Member

cockroach-teamcity commented Dec 17, 2022

roachtest.sqlsmith/setup=empty/setting=no-mutations failed with artifacts on master @ 7c8e7012b73a598f3aa1da9bbf422e833706f5d3:

test artifacts and logs in: /artifacts/sqlsmith/setup=empty/setting=no-mutations/run_1
(test_impl.go:297).Fatalf: error: pq: internal error: Payload.Type called on a payload with an unknown details type: <nil>
stmt:
SELECT
	tab_31948.col_54985 AS col_54986
FROM
	(
		VALUES
			('~1':::STRING),
			(e'h\x02\x1d\x17w\rm_':::STRING),
			(crdb_internal.job_payload_type('\x':::BYTES::BYTES)::STRING),
			(e'\x11J\x18Q0\x1a1\x7f3':::STRING),
			(NULL)
	)
		AS tab_31948 (col_54985)
WHERE
	true
LIMIT
	3:::INT8;

Parameters: ROACHTEST_cloud=gce , ROACHTEST_cpu=4 , ROACHTEST_encrypted=false , ROACHTEST_ssd=0

Help

See: roachtest README

See: How To Investigate (internal)

/cc @cockroachdb/sql-queries

This test on roachdash | Improve this report!

Jira issue: CRDB-22548

Epic CRDB-11732

@cockroach-teamcity cockroach-teamcity added branch-master Failures and bugs on the master branch. C-test-failure Broken test (automatically or manually discovered). O-roachtest O-robot Originated from a bot. labels Dec 17, 2022
@cockroach-teamcity cockroach-teamcity added this to the 23.1 milestone Dec 17, 2022
@blathers-crl blathers-crl bot added the T-sql-queries SQL Queries Team label Dec 17, 2022
@cockroach-teamcity
Copy link
Member Author

roachtest.sqlsmith/setup=empty/setting=no-mutations failed with artifacts on master @ 94e03c016955dfd64d4e15358ea92226a8f362aa:

test artifacts and logs in: /artifacts/sqlsmith/setup=empty/setting=no-mutations/run_1
(test_impl.go:297).Fatalf: error: pq: internal error: Payload.Type called on a payload with an unknown details type: <nil>
stmt:
SELECT
	tab_10122.col_17563 AS col_17565, tab_10122.col_17562 AS col_17566, tab_10123.col_17564 AS col_17567
FROM
	(
		VALUES
			(NULL, sign((5105535921149978793:::INT8::INT8 % 0:::DECIMAL::DECIMAL)::DECIMAL::DECIMAL)::DECIMAL),
			('\x6a722e682cd5':::BYTES, (-1.763317074694336166):::DECIMAL),
			('\x674b1191c7':::BYTES, 4.202197956713145345E+33:::DECIMAL),
			('\x53bebcc8b8':::BYTES, 366556149.606152052:::DECIMAL)
	)
		AS tab_10122 (col_17562, col_17563),
	(
		VALUES
			(124462430:::OID),
			(2162359986:::OID),
			(3379858315:::OID),
			(2818790268:::OID),
			(to_regprocedure(crdb_internal.job_payload_type('\x':::BYTES::BYTES)::STRING::STRING)::REGTYPE),
			(3338518712:::OID)
	)
		AS tab_10123 (col_17564)
LIMIT
	14:::INT8;

Parameters: ROACHTEST_cloud=gce , ROACHTEST_cpu=4 , ROACHTEST_encrypted=false , ROACHTEST_ssd=0

Help

See: roachtest README

See: How To Investigate (internal)

This test on roachdash | Improve this report!

@mgartner
Copy link
Collaborator

mgartner commented Dec 20, 2022

Simple reproduction:

SELECT crdb_internal.job_payload_type('\x':::BYTES);

Stack trace:

ERROR: internal error: Payload.Type called on a payload with an unknown details type: <nil>
SQLSTATE: XX000
DETAIL: stack trace:
github.com/cockroachdb/cockroach/pkg/jobs/jobspb/pkg/jobs/jobspb/wrap.go:140: DetailsType()
github.com/cockroachdb/cockroach/pkg/jobs/jobspb/pkg/jobs/jobspb/wrap.go:73: Type()
github.com/cockroachdb/cockroach/pkg/sql/sem/builtins/builtins.go:4095: 1()
github.com/cockroachdb/cockroach/pkg/sql/sem/builtins/builtins.go:4107: 2()
github.com/cockroachdb/cockroach/pkg/sql/sem/eval/expr.go:479: EvalFuncExpr()
github.com/cockroachdb/cockroach/bazel-out/darwin-fastbuild/bin/pkg/sql/sem/tree/eval_expr_generated.go:276: Eval()
github.com/cockroachdb/cockroach/pkg/sql/sem/eval/expr.go:26: Expr()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/fold_constants_funcs.go:675: FoldFunction()
github.com/cockroachdb/cockroach/bazel-out/darwin-fastbuild/bin/pkg/sql/opt/norm/factory.og.go:20095: ConstructFunction()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/scalar.go:560: buildFunction()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/scalar.go:333: buildScalar()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/project.go:181: buildProjectionList()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:1087: buildSelectClause()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:1006: buildSelectStmtWithoutParens()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:975: func1()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/with.go:117: processWiths()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:974: buildSelect()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:305: buildStmt()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:252: buildStmtAtRoot()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:226: Build()
github.com/cockroachdb/cockroach/pkg/sql/plan_opt.go:570: buildExecMemo()
github.com/cockroachdb/cockroach/pkg/sql/plan_opt.go:237: makeOptimizerPlan()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:1518: makeExecPlan()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:1125: dispatchToExecutionEngine()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:737: execStmtInOpenState()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:130: func1()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:2514: execWithProfiling()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:129: execStmt()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1955: func1()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1960: execCmd()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1878: run()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:834: ServeConn()

@mgartner
Copy link
Collaborator

@jayshrivastava it looks like you recently added the job_payload_type builtin. Do you mind fixing this?

@blathers-crl blathers-crl bot added the T-cdc label Dec 20, 2022
@blathers-crl
Copy link

blathers-crl bot commented Dec 20, 2022

cc @cockroachdb/cdc

@mgartner mgartner changed the title roachtest: sqlsmith/setup=empty/setting=no-mutations failed sql: internal error with crdb_internal.job_payload_type Dec 20, 2022
@jayshrivastava
Copy link
Contributor

Ack

@jayshrivastava
Copy link
Contributor

Just put up #93976

craig bot pushed a commit that referenced this issue Dec 20, 2022
90009: util/intsets: use new intsets.Sparse implementation for util.FastIntSet r=mgartner a=mgartner

#### util: move FastIntSet to new pkg/util/intsets

Release note: None

#### intsets: rename FastIntSet to Fast

Release note: None

#### intsets: move bitmap into a separate file

Release note: None

#### intsets: add Sparse and use it in Fast

This commit replaces usages of the Sparse type in
golang.org/x/tools/container/intsets with a new `intsets.Sparse` type.
The new type is inspired by the `x/tools` type, but differs in several
ways:

  1. The new `Sparse` type provides a smaller API than the `x/tools`
     `Sparse` type, only containing the methods required by
     `intsets.Fast`.
  2. The new `Sparse` type is implemented as a singly-linked list of
     blocks rather than a circular, doubly-linked list.
  3. The new `Sparse` type reuses the `bitmap` type used in
     `intsets.Fast`. As a result, each block can store up to 128
     integers instead of 256.

This simpler implementation yields a performance boost in query
optimization of some types of queries.

Release note: None

#### intsets: do not shift values in Fast.large

Previously, `intsets.Fast` shifted values by 128 when storing them in
`Fast.large` to minimize allocations within `Fast.large` (see the
deleted comments in the diff). Now that `intsets.Sparse`'s uses
blocks with 128-bit bitmaps instead of 256-bit bitmaps, this shift no
longer provides any benefit, so it has been removed.

Release note: None

Epic: None


93974: roachtest: query only primary index in SHOW RANGES r=erikgrinaker a=pavelkalinnikov

The semantics of SHOW RANGES has changed in 5604fea, it now includes ranges of the secondary indicies. This change fixes the query to only request ranges of the primary index, to support the original assertion.

Fixes #93703
Release note: None

93976: sqlsmith: add crdb_internal.job_payload_type to blocklist r=jayshrivastava a=jayshrivastava

Previously, we would test the `crdb_internal.job_payload_type` builtin function with random values. Since this function unmarshals a `jobspb.Payload`, calling it with random bytes will always produce an error. We do not need to test this function under the smither.

Epic: none
Fixes: #93843

Release note: None

Co-authored-by: Marcus Gartner <[email protected]>
Co-authored-by: Pavel Kalinnikov <[email protected]>
Co-authored-by: Jayant Shrivastava <[email protected]>
@craig craig bot closed this as completed in f20c0b7 Dec 20, 2022
@exalate-issue-sync exalate-issue-sync bot removed the T-sql-queries SQL Queries Team label Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch-master Failures and bugs on the master branch. C-test-failure Broken test (automatically or manually discovered). O-roachtest O-robot Originated from a bot. T-cdc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants