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

roachtest: sqlsmith/setup=rand-tables/setting=no-ddl failed #66708

Closed
cockroach-teamcity opened this issue Jun 22, 2021 · 7 comments · Fixed by #66885
Closed

roachtest: sqlsmith/setup=rand-tables/setting=no-ddl failed #66708

cockroach-teamcity opened this issue Jun 22, 2021 · 7 comments · Fixed by #66885
Assignees
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. release-blocker Indicates a release-blocker. Use with branch-release-2x.x label to denote which branch is blocked.

Comments

@cockroach-teamcity
Copy link
Member

roachtest.sqlsmith/setup=rand-tables/setting=no-ddl failed with artifacts on master @ 19865dd4d29e87212f36b237aaaf543a7d9d55f5:

The test failed on branch=master, cloud=gce:
test artifacts and logs in: /home/agent/work/.go/src/github.com/cockroachdb/cockroach/artifacts/sqlsmith/setup=rand-tables/setting=no-ddl/run_1
	sqlsmith.go:214,sqlsmith.go:250,test_runner.go:757: error: pq: internal error: unexpected error from the vectorized engine: interface conversion: coldata.Column is coldata.Int64s, not coldata.Int16s
		stmt:
		UPDATE
			defaultdb.public.table3 AS tab_138963
		SET
			col3_3
				= (
					WITH
						with_46012 (col_276718)
							AS (
								SELECT
									*
								FROM
									(
										VALUES
											(NULL),
											('eb502661-a8a8-4e0b-b6cc-1291afbd638f':::UUID),
											('843994d0-c6a4-422c-b976-bb379f09a67a':::UUID),
											('3dfb7d43-44c8-4a3d-95a3-bed1e021f109':::UUID),
											(NULL)
									)
										AS tab_138964 (col_276718)
							)
					SELECT
						tab_138963.col3_7 AS col_276719
					FROM
						with_46012 AS cte_ref_13472, with_46012 AS cte_ref_13473
					WHERE
						true
					LIMIT
						1:::INT8
				)
		ORDER BY
			tab_138963.col3_5 DESC, tab_138963.col3_1
		LIMIT
			35:::INT8;
Reproduce

To reproduce, try:

# From https://go.crdb.dev/p/roachstress, perhaps edited lightly.
caffeinate ./roachstress.sh sqlsmith/setup=rand-tables/setting=no-ddl

/cc @cockroachdb/sql-queries

This test on roachdash | Improve this report!

@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. release-blocker Indicates a release-blocker. Use with branch-release-2x.x label to denote which branch is blocked. labels Jun 22, 2021
@rytaft
Copy link
Collaborator

rytaft commented Jun 22, 2021

This looks similar to #66306. It seems like a similar issue may still be lurking somewhere....

Confirmed that I can reproduce by running the output of the sqlsmith.log from the test artifacts

@rytaft
Copy link
Collaborator

rytaft commented Jun 22, 2021

[email protected]:26257/defaultdb> UPDATE
                        defaultdb.public.table3 AS tab_138963
                SET
                        col3_3
                                = (
                                        WITH
                                                with_46012 (col_276718)
                                                        AS (
                                                                SELECT
                                                                        *
                                                                FROM
                                                                        (
                                                                                VALUES
                                                                                        (NULL),
                                                                                        ('eb502661-a8a8-4e0b-b6cc-1291afbd638f':::UUID),
                                                                                        ('843994d0-c6a4-422c-b976-bb379f09a67a':::UUID),
                                                                                        ('3dfb7d43-44c8-4a3d-95a3-bed1e021f109':::UUID),
                                                                                        (NULL)
                                                                        )
                                                                                AS tab_138964 (col_276718)
                                                        )
                                        SELECT
                                                tab_138963.col3_7 AS col_276719
                                        FROM
                                                with_46012 AS cte_ref_13472, with_46012 AS cte_ref_13473
                                        WHERE
                                                true
                                        LIMIT
                                                1:::INT8
                                )
                ORDER BY
                        tab_138963.col3_5 DESC, tab_138963.col3_1
                LIMIT
                        35:::INT8;
ERROR: internal error: unexpected error from the vectorized engine: interface conversion: coldata.Column is coldata.Int64s, not coldata.Int16s
SQLSTATE: XX000
DETAIL: stack trace:
github.com/cockroachdb/cockroach/pkg/sql/colexecerror/error.go:88: func1()
runtime/panic.go:965: gopanic()
runtime/iface.go:261: panicdottypeE()
github.com/cockroachdb/cockroach/pkg/col/coldata/vec.go:237: Int16()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecbase/cast.eg.go:2460: func1()
github.com/cockroachdb/cockroach/pkg/sql/colmem/allocator.go:302: PerformOperation()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecbase/cast.eg.go:2458: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecutils/operator.go:137: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecproj/proj_non_const_ops.eg.go:5674: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecutils/operator.go:137: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecbase/cast.eg.go:2450: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecutils/operator.go:137: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecproj/proj_const_right_ops.eg.go:5294: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecbase/simple_project.go:125: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecutils/operator.go:137: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecbase/cast.eg.go:3564: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecutils/operator.go:137: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecbase/cast.eg.go:3564: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecbase/simple_project.go:125: Next()
github.com/cockroachdb/cockroach/pkg/sql/colflow/panic_injector.go:70: Next()
github.com/cockroachdb/cockroach/pkg/sql/colflow/stats.go:98: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexecop/operator.go:368: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecutils/operator.go:204: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/and_or_projection.eg.go:190: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecutils/operator.go:204: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/and_or_projection.eg.go:190: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecutils/operator.go:204: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/and_or_projection.eg.go:190: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecutils/operator.go:204: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/and_or_projection.eg.go:190: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecutils/operator.go:204: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/and_or_projection.eg.go:190: Next()

HINT: You have encountered an unexpected error.

Please check the public issue tracker to check whether this problem is
already tracked. If you cannot find it there, please report the error
with details by creating a new issue.

If you would rather not post publicly, please contact us directly
using the support form.

We appreciate your feedback.
[email protected]:26257/defaultdb> 

@cockroach-teamcity
Copy link
Member Author

roachtest.sqlsmith/setup=rand-tables/setting=no-ddl failed with artifacts on master @ 95028269160e0bfa2b94477238e72670bf780e9d:

The test failed on branch=master, cloud=gce:
test artifacts and logs in: /home/agent/work/.go/src/github.com/cockroachdb/cockroach/artifacts/sqlsmith/setup=rand-tables/setting=no-ddl/run_1
	sqlsmith.go:225,sqlsmith.go:250,test_runner.go:757: Failed generating a query Caught error runtime error: index out of range [0] with length 0
Reproduce

To reproduce, try:

# From https://go.crdb.dev/p/roachstress, perhaps edited lightly.
caffeinate ./roachstress.sh sqlsmith/setup=rand-tables/setting=no-ddl

/cc @cockroachdb/sql-queries

This test on roachdash | Improve this report!

@cucaroach
Copy link
Contributor

reduction sql:

CREATE TABLE table3 (
	col3_0
		REGPROC,
	col3_2
		OID,
	col3_3
		INT2,
	col3_4
		INT2,
	col3_5
		OID,
	col3_7
		INT2 AS (col3_4 + col3_3) VIRTUAL
);

INSERT
INTO
	table3 (col3_2, col3_4, col3_5, col3_0)
VALUES
	(0, 0, 0, 0);

UPDATE
	table3 AS tab_138963
SET
	col3_3
		= (
			WITH
				with_46012 (col_276718)
					AS (
						SELECT
							*
						FROM
							(
								VALUES
									(NULL),
									(
										'eb502661-a8a8-4e0b-b6cc-1291afbd638f':::UUID
									),
									(
										'843994d0-c6a4-422c-b976-bb379f09a67a':::UUID
									),
									(
										'3dfb7d43-44c8-4a3d-95a3-bed1e021f109':::UUID
									),
									(NULL)
							)
								AS tab_138964 (col_276718)
					)
			SELECT
				tab_138963.col3_7
			FROM
				with_46012 AS cte_ref_13472, with_46012
			WHERE
				true
			LIMIT
				1
		);

@michae2
Copy link
Collaborator

michae2 commented Jun 24, 2021

Tiny bit simpler:

create table t (a int2, b int2, c int2 as (a + b) virtual);
insert into t values (0, 0);
update t set a = (with cte as (select 1:::int8) select t.c from cte limit 1);

This did not hit the panic:

update t set a = c;

@cucaroach
Copy link
Contributor

Nice, thanks @michae2 !

craig bot pushed a commit that referenced this issue Jun 28, 2021
66845: storage: add Reader method to pin iterators at current engine state r=sumeerbhola a=sumeerbhola

This is relevant for read evaluation cases where we want to release
latches before evaluation. The new Reader.PinEngineStateForIterators
method would be called before releasing latches.

This pinning does not apply to iterators with timestamp hints,
similar to how ConsistentIterators does not apply to them. So
this does not help ExportRequest evaluation for incremental backups.
To address this we would want a guarantee from the caller that the
timestamp hints will not change for the lifetime of the Reader that
is making a promise of ConsistentIterators.

Informs #55461,#66485

Release note: None

66885: sql: add ReType to resolveAndRequireType to fix vector engine panic r=cucaroach a=cucaroach

Fixes #66708

The vector engine needs exact type coercion, specifically when piping
computed column values into downstream operators.  Without this fix
the computed column was left as an int64 instead of cast back to the
required int16 type.

Exposed by sqlsmith, kudos to @michae2 for the reduce help

Release note: None

Co-authored-by: sumeerbhola <[email protected]>
Co-authored-by: Tommy Reilly <[email protected]>
cucaroach added a commit to cucaroach/cockroach that referenced this issue Jun 28, 2021
Fixes cockroachdb#66708

The vector engine needs exact type coercion, specifically when piping
computed column values into downstream operators.  Without this fix
the computed column was left as an int64 instead of cast back to the
required int16 type.

Exposed by sqlsmith, kudos to @michae2 for the review help

Release note: None
@craig craig bot closed this as completed in 394c407 Jun 28, 2021
cucaroach added a commit to cucaroach/cockroach that referenced this issue Jun 28, 2021
Fixes cockroachdb#66708

The vector engine needs exact type coercion, specifically when piping
computed column values into downstream operators.  Without this fix
the computed column was left as an int64 instead of cast back to the
required int16 type.

Exposed by sqlsmith, kudos to @michae2 for the review help

Release note: None
@cucaroach
Copy link
Contributor

Since this came from sqlsmith and has not been seen in the wild and we aren't sure about the ramifications of the extra casting this change introduces @RaduBerinde thinks we don't need to backport this, at least not as is.

@mgartner mgartner moved this to Done in SQL Queries Jul 24, 2023
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. release-blocker Indicates a release-blocker. Use with branch-release-2x.x label to denote which branch is blocked.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants