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

opt: crash found while running hibernate test suite - index out of range #27016

Closed
BramGruneir opened this issue Jun 27, 2018 · 3 comments · Fixed by #27053
Closed

opt: crash found while running hibernate test suite - index out of range #27016

BramGruneir opened this issue Jun 27, 2018 · 3 comments · Fixed by #27053
Assignees
Labels
A-sql-optimizer SQL logical planning and optimizations. A-tools-hibernate Issues that pertain to Hibernate integration. C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. C-test-failure Broken test (automatically or manually discovered).

Comments

@BramGruneir
Copy link
Member

BramGruneir commented Jun 27, 2018

Hibernate test org.hibernate.test.joinedsubclass.JoinedSubclassTest.testJoinedSubclass crashes the new optimizer.

Here's the relevant logs with --vmodule=conn_executor=2 enabled.

Let me know if there's anything else you need.

I180627 14:36:53.589573 3555 sql/conn_executor.go:1050  [n1,client=127.0.0.1:59536,user=root] [Open pos:198] executing PrepareStmt: SELECT person0_.person_id AS person_i1_2_, person0_.version AS version2_2_, person0_.name AS name3_2_, person0_.sex AS sex4_2_, person0_.height_centimeters / 2.54E0 AS height_c5_2_, person0_.address AS address6_2_, person0_.zip AS zip7_2_, person0_.country AS country8_2_, person0_1_.title AS title2_0_, person0_1_.salary AS salary3_0_, person0_1_.pwd_expiry_weeks * 7.0E0 AS pwd_expi4_0_, person0_1_.manager AS manager5_0_, person0_2_.comments AS comments2_1_, person0_2_.salesperson AS salesper3_1_, CASE WHEN person0_1_.person_id IS NOT NULL THEN 1 WHEN person0_2_.person_id IS NOT NULL THEN 2 WHEN person0_.person_id IS NOT NULL THEN 0 END AS clazz_ FROM jperson AS person0_ LEFT JOIN jemployee AS person0_1_ ON person0_.person_id = person0_1_.person_id LEFT JOIN jmanager AS person0_2_ ON person0_.person_id = person0_2_.person_id WHERE person0_.zip = '30306'
I180627 14:36:53.590202 154 storage/replica_proposal.go:202  [n1,s1,r1092/1:/Table/110{7-8}] new range lease repl=(n1,s1):1 seq=7 start=1530110146.359716559,0 epo=6 pro=1530110213.588780787,0 following repl=(n1,s1):1 seq=6 start=1530031975.037054445,0 epo=5 pro=1530033413.067933499,0
I180627 14:36:53.590475 3555 sql/conn_executor.go:1050  [n1,client=127.0.0.1:59536,user=root] [Open pos:199] executing BindStmt: ""->""
I180627 14:36:53.590487 3555 sql/conn_executor.go:1050  [n1,client=127.0.0.1:59536,user=root] [Open pos:200] executing Describe: ""
I180627 14:36:53.590505 3555 sql/conn_executor.go:1050  [n1,client=127.0.0.1:59536,user=root] [Open pos:201] executing ExecPortal name: ""
I180627 14:36:53.590512 3555 sql/conn_executor.go:1093  [n1,client=127.0.0.1:59536,user=root] portal resolved to: SELECT person0_.person_id AS person_i1_2_, person0_.version AS version2_2_, person0_.name AS name3_2_, person0_.sex AS sex4_2_, person0_.height_centimeters / 2.54E0 AS height_c5_2_, person0_.address AS address6_2_, person0_.zip AS zip7_2_, person0_.country AS country8_2_, person0_1_.title AS title2_0_, person0_1_.salary AS salary3_0_, person0_1_.pwd_expiry_weeks * 7.0E0 AS pwd_expi4_0_, person0_1_.manager AS manager5_0_, person0_2_.comments AS comments2_1_, person0_2_.salesperson AS salesper3_1_, CASE WHEN person0_1_.person_id IS NOT NULL THEN 1 WHEN person0_2_.person_id IS NOT NULL THEN 2 WHEN person0_.person_id IS NOT NULL THEN 0 END AS clazz_ FROM jperson AS person0_ LEFT JOIN jemployee AS person0_1_ ON person0_.person_id = person0_1_.person_id LEFT JOIN jmanager AS person0_2_ ON person0_.person_id = person0_2_.person_id WHERE person0_.zip = '30306'
I180627 14:36:53.591571 3555 sql/conn_executor.go:1050  [n1,client=127.0.0.1:59536,user=root] [Open pos:202] executing Sync
I180627 14:36:53.608640 3555 sql/conn_executor.go:1050  [n1,client=127.0.0.1:59536,user=root] [Open pos:203] executing PrepareStmt: SELECT this_.person_id AS person_i1_2_0_, this_.version AS version2_2_0_, this_.name AS name3_2_0_, this_.sex AS sex4_2_0_, this_.height_centimeters / 2.54E0 AS height_c5_2_0_, this_.address AS address6_2_0_, this_.zip AS zip7_2_0_, this_.country AS country8_2_0_, this_1_.title AS title2_0_0_, this_1_.salary AS salary3_0_0_, this_1_.pwd_expiry_weeks * 7.0E0 AS pwd_expi4_0_0_, this_1_.manager AS manager5_0_0_, this_2_.comments AS comments2_1_0_, this_2_.salesperson AS salesper3_1_0_, CASE WHEN this_1_.person_id IS NOT NULL THEN 1 WHEN this_2_.person_id IS NOT NULL THEN 2 WHEN this_.person_id IS NOT NULL THEN 0 END AS clazz_0_ FROM jperson AS this_ LEFT JOIN jemployee AS this_1_ ON this_.person_id = this_1_.person_id LEFT JOIN jmanager AS this_2_ ON this_.person_id = this_2_.person_id WHERE (this_.address, this_.zip, this_.country) IN (($1, $2, $3), ($4, $5, $6))
E180627 14:36:53.609534 3555 sql/conn_executor.go:655  [n1,client=127.0.0.1:59536,user=root] a SQL panic has occurred while executing "SELECT this_.person_id AS person_i1_2_0_, this_.version AS version2_2_0_, this_.name AS name3_2_0_, this_.sex AS sex4_2_0_, this_.height_centimeters / 2.54E0 AS height_c5_2_0_, this_.address AS address6_2_0_, this_.zip AS zip7_2_0_, this_.country AS country8_2_0_, this_1_.title AS title2_0_0_, this_1_.salary AS salary3_0_0_, this_1_.pwd_expiry_weeks * 7.0E0 AS pwd_expi4_0_0_, this_1_.manager AS manager5_0_0_, this_2_.comments AS comments2_1_0_, this_2_.salesperson AS salesper3_1_0_, CASE WHEN th [...]": runtime error: index out of range
I180627 14:36:53.609560 3555 sql/conn_executor.go:675  [n1,client=127.0.0.1:59536,user=root] finishing connExecutor
E180627 14:36:53.609770 3555 util/log/crash_reporting.go:203  [n1,client=127.0.0.1:59536,user=root] a panic has occurred!
E180627 14:36:53.627041 3555 util/log/crash_reporting.go:477  [n1,client=127.0.0.1:59536,user=root] Reported as error 17d90a5dcb7d4679accb467cc6cabcaf
panic: runtime error: index out of range [recovered]
	panic: runtime error: index out of range [recovered]
	panic: panic while executing 1 statements: SELECT _._ AS _, _._ AS _, _._ AS _, _._ AS _, _._ / _ AS _, _._ AS _, _._ AS _, _._ AS _, _._ AS _, _._ AS _, _._ * _ AS _, _._ AS _, _._ AS _, _._ AS _, CASE WHEN _._ IS NOT _ THEN _ WHEN _._ IS NOT _ THEN _ WHEN _._ IS NOT _ THEN _ END AS _ FROM _ AS _ LEFT JOIN _ AS _ ON _._ = _._ LEFT JOIN _ AS _ ON _._ = _._ WHERE (_._, _._, _._) IN (($1, $2, $3), ($4, $5, $6)); caused by runtime error: index out of range

goroutine 3555 [running]:
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).closeWrapper(0xc426024000, 0x66befa0, 0xc4259a5c40, 0x5ee1080, 0x79b41c0)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:669 +0x36f
github.com/cockroachdb/cockroach/pkg/sql.(*Server).ServeConn.func1(0xc426024000, 0x66befa0, 0xc4259a5c40)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:411 +0x61
panic(0x5ee1080, 0x79b41c0)
	/Users/bram/go1.10/src/runtime/panic.go:502 +0x229
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).Build.func1(0xc425fceff8)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:124 +0x99
panic(0x5ee1080, 0x79b41c0)
	/Users/bram/go1.10/src/runtime/panic.go:502 +0x229
github.com/cockroachdb/cockroach/pkg/sql/opt/constraint.(*Columns).Init(...)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/constraint/columns.go:40
github.com/cockroachdb/cockroach/pkg/sql/opt/memo.(*constraintsBuilder).buildConstraintForTupleIn(0xc425fce738, 0xc426f9c120, 0xffff00370000001a, 0xc426f9c120, 0xffff002900000019)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/memo/constraint_builder.go:225 +0xd3f
github.com/cockroachdb/cockroach/pkg/sql/opt/memo.(*constraintsBuilder).buildConstraints(0xc425fce738, 0xc426f9c120, 0xffff00370000001a, 0xc426f9c120, 0xffff002d0000001a)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/memo/constraint_builder.go:408 +0x4d0
github.com/cockroachdb/cockroach/pkg/sql/opt/memo.(*constraintsBuilder).getConstraints(0xc425fce738, 0xc426f9c120, 0xffff00370000001a, 0xc426f9c120, 0xffff00370000001a)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/memo/constraint_builder.go:351 +0xac
github.com/cockroachdb/cockroach/pkg/sql/opt/memo.(*constraintsBuilder).buildConstraints(0xc425fce738, 0xc426f9c120, 0xffff002d0000001b, 0xc425105a40, 0x400b576)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/memo/constraint_builder.go:381 +0xef
github.com/cockroachdb/cockroach/pkg/sql/opt/memo.(*logicalPropsBuilder).buildScalarProps(0xc425fce878, 0xc426f9c120, 0xffff002d0000001b, 0xc426f9c120, 0xffff002d0000001b)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/memo/logical_props_builder.go:933 +0x24e
github.com/cockroachdb/cockroach/pkg/sql/opt/memo.(*logicalPropsBuilder).buildProps(0xc425fce878, 0xc426f9c120, 0xffff002d0000001b, 0xffff002d0000001b, 0x20)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/memo/logical_props_builder.go:48 +0xbe
github.com/cockroachdb/cockroach/pkg/sql/opt/memo.(*Memo).MemoizeNormExpr(0xc426f9c120, 0xc4260244c0, 0xe0000002d, 0x1, 0x5cd38f0)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/memo/memo.go:275 +0x2e3
github.com/cockroachdb/cockroach/pkg/sql/opt/norm.(*Factory).onConstruct(0xc426c42360, 0xe0000002d, 0x1, 0x7a519a0)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.go:158 +0x45
github.com/cockroachdb/cockroach/pkg/sql/opt/norm.(*Factory).ConstructFilters(0xc426c42360, 0x10000000e, 0x1)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.og.go:4117 +0x959
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).buildFrom(0xc427a72690, 0xc426c36120, 0xc4296cd380, 0xc4261ce0c0, 0xd0891e0)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:356 +0x511
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).buildSelectClause(0xc427a72690, 0xc42892d050, 0x0, 0x0, 0x0, 0xc4261ce0c0, 0xc4261cc101)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:275 +0x53
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).buildSelect(0xc427a72690, 0xc428925540, 0xc4261ce0c0, 0xc427a72690)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:233 +0x19e
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).buildStmt(0xc427a72690, 0x66c1820, 0xc428925540, 0xc4261ce0c0, 0x1)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:172 +0xf4
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).Build(0xc427a72690, 0xc400000000, 0x0, 0x0, 0x0)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:129 +0xab
github.com/cockroachdb/cockroach/pkg/sql.(*planner).makeOptimizerPlan(0xc426024430, 0x66bf060, 0xc426775e90, 0x66c1820, 0xc428925540, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/plan.go:365 +0x24e
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).prepare.func1(0xc426024000, 0x66bf060, 0xc426775e90, 0xc4261ca000, 0xc426c36000, 0xc426c42090, 0x66c1820, 0xc428925540, 0x0, 0x0, ...)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:213 +0x5f9
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).prepare(0xc426024000, 0x66bf060, 0xc426775e90, 0x66c1820, 0xc428925540, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:239 +0x310
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).addPreparedStmt(0xc426024000, 0x66bf060, 0xc426775e90, 0xc427e936c2, 0x0, 0x66c1820, 0xc428925540, 0x0, 0x0, 0x0, ...)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:123 +0xe1
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execPrepare(0xc426024000, 0x66bf060, 0xc426775e90, 0xc427e936c2, 0x0, 0x66c1820, 0xc428925540, 0xc426c36000, 0xc4278853e0, 0x6, ...)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:56 +0x15e
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).run(0xc426024000, 0x66befa0, 0xc4259a5c40, 0xc4294dea30, 0x0, 0x0)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1138 +0x2a15
github.com/cockroachdb/cockroach/pkg/sql.(*Server).ServeConn(0xc420a5b600, 0x66befa0, 0xc4259a5c40, 0xc42a615017, 0x12, 0xc42a615009, 0x4, 0x0, 0x0, 0x66a3be0, ...)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:413 +0x1bb
github.com/cockroachdb/cockroach/pkg/sql/pgwire.(*conn).serveImpl.func3(0xc420a5b600, 0x66befa0, 0xc4259a5c40, 0xc425dc8000, 0x5400, 0x15000, 0xc420757800, 0xc4294dea30, 0xc4294dea20, 0xc426bee1a0, ...)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/pgwire/conn.go:267 +0x122
created by github.com/cockroachdb/cockroach/pkg/sql/pgwire.(*conn).serveImpl
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/pgwire/conn.go:266 +0xf27

It looks like the query is

SELECT
	this_.person_id AS person_i1_2_0_,
	this_.version AS version2_2_0_,
	this_.name AS name3_2_0_,
	this_.sex AS sex4_2_0_,
	this_.height_centimeters / 2.54E0 AS height_c5_2_0_,
	this_.address AS address6_2_0_,
	this_.zip AS zip7_2_0_,
	this_.country AS country8_2_0_,
	this_1_.title AS title2_0_0_,
	this_1_.salary AS salary3_0_0_,
	this_1_.pwd_expiry_weeks * 7.0E0 AS pwd_expi4_0_0_,
	this_1_.manager AS manager5_0_0_,
	this_2_.comments AS comments2_1_0_,
	this_2_.salesperson AS salesper3_1_0_,
	CASE WHEN this_1_.person_id IS NOT NULL THEN 1 WHEN this_2_.person_id IS NOT NULL THEN 2 WHEN this_.person_id IS NOT NULL THEN 0 END
		AS clazz_0_
FROM
	jperson AS this_ LEFT JOIN jemployee AS this_1_ ON this_.person_id = this_1_.person_id
		LEFT JOIN jmanager AS this_2_ ON this_.person_id = this_2_.person_id
WHERE (this_.address, this_.zip, this_.country) IN (($1, $2, $3), ($4, $5, $6));

And the tables are

create table JEmployee (
       person_id int8 not null,
        "title" varchar(20) not null,
        salary numeric(19, 2),
        pwd_expiry_weeks float8 not null,
        manager int8,
        primary key (person_id)
    );

create table JManager (
       person_id int8 not null,
        comments varchar(255),
        salesperson int8,
        primary key (person_id)
    );

create table JPerson (
       person_id int8 not null,
        version int4 not null,
        name varchar(80) not null,
        sex char(1) not null,
        height_centimeters float8 not null,
        address varchar(255),
        zip varchar(255),
        country varchar(255),
        primary key (person_id)
    );

cc: @awoods187

@BramGruneir BramGruneir added the A-tools-hibernate Issues that pertain to Hibernate integration. label Jun 27, 2018
@awoods187 awoods187 added A-sql-optimizer SQL logical planning and optimizations. C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. C-test-failure Broken test (automatically or manually discovered). labels Jun 27, 2018
@andy-kimball
Copy link
Contributor

Justin, can you take a look at this? It's a crash in buildConstraintForTupleIn that may be related to your recent changes.

@BramGruneir
Copy link
Member Author

Got another one, looks like a similar failure.

This time from org.hibernate.test.subselect.CompositeIdTypeBindingTest.testCompositeTypeBinding

I can provide more details if needed.

I180627 17:48:50.160376 349168 sql/conn_executor.go:1050  [n1,client=127.0.0.1:62587,user=root] [Open pos:164] executing PrepareStmt: SELECT employeegr0_.departmentname AS departme1_1_, employeegr0_.groupname AS groupnam2_1_ FROM employeegroup AS employeegr0_ WHERE (employeegr0_.departmentname, employeegr0_.groupname) IN (($1, $2), ($3, $4), ($5, $6))
I180627 17:48:50.160553 349371 sql/conn_executor.go:1050  [intExec=get-table-statistics] [NoTxn pos:0] executing PrepareStmt: SELECT "tableID", "statisticID", name, "columnIDs", "createdAt", "rowCount", "distinctCount", "nullCount", histogram FROM system.table_statistics WHERE "tableID" = $1 ORDER BY "createdAt" DESC
I180627 17:48:50.161209 349371 sql/conn_executor.go:1050  [intExec=get-table-statistics] [NoTxn pos:1] executing BindStmt: ""->""
I180627 17:48:50.161221 349371 sql/conn_executor.go:1050  [intExec=get-table-statistics] [NoTxn pos:2] executing ExecPortal name: ""
I180627 17:48:50.161228 349371 sql/conn_executor.go:1093  [intExec=get-table-statistics] portal resolved to: SELECT "tableID", "statisticID", name, "columnIDs", "createdAt", "rowCount", "distinctCount", "nullCount", histogram FROM system.table_statistics WHERE "tableID" = $1 ORDER BY "createdAt" DESC
I180627 17:48:50.161248 349371 sql/conn_executor.go:1050  [intExec=get-table-statistics] [Open pos:2] executing ExecPortal name: ""
I180627 17:48:50.161255 349371 sql/conn_executor.go:1093  [intExec=get-table-statistics] portal resolved to: SELECT "tableID", "statisticID", name, "columnIDs", "createdAt", "rowCount", "distinctCount", "nullCount", histogram FROM system.table_statistics WHERE "tableID" = $1 ORDER BY "createdAt" DESC
I180627 17:48:50.161942 349371 sql/conn_executor.go:1050  [intExec=get-table-statistics] [NoTxn pos:3] executing Sync
I180627 17:48:50.161952 349371 sql/conn_executor.go:675  [intExec=get-table-statistics] finishing connExecutor
E180627 17:48:50.162044 349168 sql/conn_executor.go:655  [n1,client=127.0.0.1:62587,user=root] a SQL panic has occurred while executing "SELECT employeegr0_.departmentname AS departme1_1_, employeegr0_.groupname AS groupnam2_1_ FROM employeegroup AS employeegr0_ WHERE (employeegr0_.departmentname, employeegr0_.groupname) IN (($1, $2), ($3, $4), ($5, $6))": runtime error: index out of range
I180627 17:48:50.162066 349168 sql/conn_executor.go:675  [n1,client=127.0.0.1:62587,user=root] finishing connExecutor
E180627 17:48:50.162135 349168 util/log/crash_reporting.go:203  [n1,client=127.0.0.1:62587,user=root] a panic has occurred!
E180627 17:48:50.187646 349168 util/log/crash_reporting.go:477  [n1,client=127.0.0.1:62587,user=root] Reported as error f9837e40933c48169226356d1d6163c6
panic: runtime error: index out of range [recovered]
	panic: runtime error: index out of range [recovered]
	panic: panic while executing 1 statements: SELECT _._ AS _, _._ AS _ FROM _ AS _ WHERE (_._, _._) IN (($1, $2), ($3, $4), ($5, $6)); caused by runtime error: index out of range

goroutine 349168 [running]:
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).closeWrapper(0xc425d7f300, 0x66befa0, 0xc42d9cc2c0, 0x5ee1080, 0x79b41c0)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:669 +0x36f
github.com/cockroachdb/cockroach/pkg/sql.(*Server).ServeConn.func1(0xc425d7f300, 0x66befa0, 0xc42d9cc2c0)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:411 +0x61
panic(0x5ee1080, 0x79b41c0)
	/Users/bram/go1.10/src/runtime/panic.go:502 +0x229
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).Build.func1(0xc435778ff8)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:124 +0x99
panic(0x5ee1080, 0x79b41c0)
	/Users/bram/go1.10/src/runtime/panic.go:502 +0x229
github.com/cockroachdb/cockroach/pkg/sql/opt/constraint.(*Columns).Init(...)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/constraint/columns.go:40
github.com/cockroachdb/cockroach/pkg/sql/opt/memo.(*constraintsBuilder).buildConstraintForTupleIn(0xc435778738, 0xc425815440, 0xffff00370000000f, 0xc425815440, 0xffff00290000000e)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/memo/constraint_builder.go:225 +0xd3f
github.com/cockroachdb/cockroach/pkg/sql/opt/memo.(*constraintsBuilder).buildConstraints(0xc435778738, 0xc425815440, 0xffff00370000000f, 0xc425815440, 0xffff002d0000000f)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/memo/constraint_builder.go:408 +0x4d0
github.com/cockroachdb/cockroach/pkg/sql/opt/memo.(*constraintsBuilder).getConstraints(0xc435778738, 0xc425815440, 0xffff00370000000f, 0xc425815440, 0xffff00370000000f)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/memo/constraint_builder.go:351 +0xac
github.com/cockroachdb/cockroach/pkg/sql/opt/memo.(*constraintsBuilder).buildConstraints(0xc435778738, 0xc425815440, 0xffff002d00000010, 0xc4349f3e60, 0x400b576)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/memo/constraint_builder.go:381 +0xef
github.com/cockroachdb/cockroach/pkg/sql/opt/memo.(*logicalPropsBuilder).buildScalarProps(0xc435778878, 0xc425815440, 0xffff002d00000010, 0xc425815440, 0xffff002d00000010)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/memo/logical_props_builder.go:933 +0x24e
github.com/cockroachdb/cockroach/pkg/sql/opt/memo.(*logicalPropsBuilder).buildProps(0xc435778878, 0xc425815440, 0xffff002d00000010, 0xffff002d00000010, 0x11)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/memo/logical_props_builder.go:48 +0xbe
github.com/cockroachdb/cockroach/pkg/sql/opt/memo.(*Memo).MemoizeNormExpr(0xc425815440, 0xc425d7f7c0, 0xc0000002d, 0x1, 0x5cd38f0)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/memo/memo.go:275 +0x2e3
github.com/cockroachdb/cockroach/pkg/sql/opt/norm.(*Factory).onConstruct(0xc436626510, 0xc0000002d, 0x1, 0x7a519a0)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.go:158 +0x45
github.com/cockroachdb/cockroach/pkg/sql/opt/norm.(*Factory).ConstructFilters(0xc436626510, 0x10000000c, 0x1)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.og.go:4117 +0x959
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).buildFrom(0xc433e6c3f0, 0xc434e89590, 0xc42b116060, 0xc427093380, 0xc436626510)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:356 +0x511
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).buildSelectClause(0xc433e6c3f0, 0xc42fba7a70, 0x0, 0x0, 0x0, 0xc427093380, 0xc42534ca80)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:275 +0x53
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).buildSelect(0xc433e6c3f0, 0xc42ce07b00, 0xc427093380, 0xc433e6c3f0)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:233 +0x19e
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).buildStmt(0xc433e6c3f0, 0x66c1820, 0xc42ce07b00, 0xc427093380, 0x1)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:172 +0xf4
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder.(*Builder).Build(0xc433e6c3f0, 0xc400000000, 0x0, 0x0, 0x0)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:129 +0xab
github.com/cockroachdb/cockroach/pkg/sql.(*planner).makeOptimizerPlan(0xc425d7f730, 0x66bf060, 0xc42534c0f0, 0x66c1820, 0xc42ce07b00, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/plan.go:365 +0x24e
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).prepare.func1(0xc425d7f300, 0x66bf060, 0xc42534c0f0, 0xc436cefba0, 0xc434e89470, 0xc436626480, 0x66c1820, 0xc42ce07b00, 0x0, 0x0, ...)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:213 +0x5f9
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).prepare(0xc425d7f300, 0x66bf060, 0xc42534c0f0, 0x66c1820, 0xc42ce07b00, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:239 +0x310
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).addPreparedStmt(0xc425d7f300, 0x66bf060, 0xc42534c0f0, 0xc42602ad26, 0x0, 0x66c1820, 0xc42ce07b00, 0x0, 0x0, 0x0, ...)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:123 +0xe1
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execPrepare(0xc425d7f300, 0x66bf060, 0xc42534c0f0, 0xc42602ad26, 0x0, 0x66c1820, 0xc42ce07b00, 0xc434e89470, 0xc428d9c1c0, 0x6, ...)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:56 +0x15e
github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).run(0xc425d7f300, 0x66befa0, 0xc42d9cc2c0, 0xc4349b41a0, 0x0, 0x0)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1138 +0x2a15
github.com/cockroachdb/cockroach/pkg/sql.(*Server).ServeConn(0xc4207f5500, 0x66befa0, 0xc42d9cc2c0, 0xc42ac2d017, 0x12, 0xc42ac2d009, 0x4, 0x0, 0x0, 0x66a3be0, ...)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:413 +0x1bb
github.com/cockroachdb/cockroach/pkg/sql/pgwire.(*conn).serveImpl.func3(0xc4207f5500, 0x66befa0, 0xc42d9cc2c0, 0xc425a12380, 0x5400, 0x15000, 0xc4207d2600, 0xc4349b41a0, 0xc4349b4150, 0xc434e33400, ...)
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/pgwire/conn.go:267 +0x122
created by github.com/cockroachdb/cockroach/pkg/sql/pgwire.(*conn).serveImpl
	/Users/bram/go/src/github.com/cockroachdb/cockroach/pkg/sql/pgwire/conn.go:266 +0xf27

@BramGruneir
Copy link
Member Author

BramGruneir commented Jun 27, 2018

Another crash from IN.
Details look similar, but I can add more if needed.

I'll just use this message to list all crashes that match this pattern.

  • org.hibernate.test.joinedsubclass.JoinedSubclassTest.testJoinedSubclass
  • org.hibernate.test.subselect.CompositeIdTypeBindingTest.testCompositeTypeBinding
  • org.hibernate.test.annotations.cid.CompositeIdTest.testQueryInAndComposite
  • org.hibernate.test.annotations.cid.CompositeIdTest.testQueryInAndCompositeWithHQL

craig bot pushed a commit that referenced this issue Jun 28, 2018
25359: Metric metadata endpoint r=sploiselle a=sploiselle

This PR integrates two changes:
- Makes explicit more metric metadata properties
- Adds an endpoint to make all metric metadata externally consumbale

## Explicit Metric Metadata
Timeseries metrics had two implicit metadata properties:
- Units, which is the unit of data collected (Count, Bytes, or Duration)
- AxisLabel, which is the element measured by the metric (i.e. what the Y-axis represents)

Because these properties are used to display charts to users and do not change for the lifetime of
the metric, they should be defined when the when the metric is created. This ensures end users can
consistently and meaningfully interpret data in the way the metric's author intended.

### Testing
This PR adds a test to `status_test.go` to ensure that all metrics metadata have a Name, Help, and AxisLabel defined. Because Units have a zero value of "Count", the test doesn't check for it being set.

## Metric Metadata Endpoint
This PR adds an endpoint at `<Admin UI>/_admin/metricmetadata` that exposes all metric metadata, including the new Units and AxisLabel properties added in the first commit.

While this endpoint doesn't have much intrinsic value, it will be leveraged to generate a catalog of timeseries charts. That commit is ready to go, but is large, so wanted to make more incremental changes by splitting them into two PRs.

26949: ui: properly segregate/aggregate app sql stats r=couchand a=couchand

Previously we had been a bit lazy about the apps that statement statistics roll into, but feedback highlighted that the app was an important distinction for users.  This adds support for apps to the statements list and details pages.

The statements list now has a filter above the list to choose an app:
<img width="548" alt="screen shot 2018-06-25 at 1 04 56 pm" src="https://user-images.githubusercontent.com/793969/41864643-aeba45bc-7878-11e8-85ff-60d39d71beb6.png">

The details page now lists all apps a query appears in (when viewing all apps) or just the stats relevant to a single app.
<img width="466" alt="screen shot 2018-06-25 at 1 05 05 pm" src="https://user-images.githubusercontent.com/793969/41864691-d196db7c-7878-11e8-89d5-32717753a935.png">

Fixes: #26990 

27039: sql: fix panic when renaming a scalar source r=justinj a=justinj

Quite an edge case, found with RSG.

Release note (bug fix): fixed a panic that could occur when renaming a
scalar function used as a data source.

27042: cli: Fix ordering of columns in node status r=RaduBerinde a=neeral

The header and data for columns updated_at and started_at were swapped.
Example output before:
```
$ cockroach node status --insecure
+----+--------------------+------------------------------------------+
| id |      address       |                  build                   |
updated_at            |            started_at            | is_live |
+----+--------------------+------------------------------------------+
|  1 | neeral-M51AC:26257 | v2.1.0-alpha.20180604-872-g50ae724       |
2018-06-28 00:52:49.925433+00:00 | 2018-06-28 00:52:49.925691+00:00 |
true    |
|  2 | neeral-M51AC:25262 | v2.1.0-alpha.20180604-848-ga22c68d-dirty |
2018-06-27 22:18:44.617039+00:00 | 2018-06-28 00:42:54.651608+00:00 |
false   |
|  3 | neeral-M51AC:25263 | v2.1.0-alpha.20180604-849-g1782ff9-dirty |
2018-06-28 00:19:53.20144+00:00  | 2018-06-28 00:53:07.018604+00:00 |
true    |
|  4 | neeral-M51AC:25264 | v2.1.0-alpha.20180604-849-g1782ff9-dirty |
2018-06-28 00:19:59.773341+00:00 | 2018-06-28 00:52:59.80999+00:00  |
true    |
|  5 | neeral-M51AC:25265 | v2.1.0-alpha.20180604-849-g1782ff9-dirty |
2018-06-28 00:20:01.927442+00:00 | 2018-06-28 00:53:01.962355+00:00 |
true    |
+----+--------------------+------------------------------------------+
```

27048: build: assert clean for submodules r=benesch a=tschottdorf

I saw failing builds due to a dirty `c-deps/protobuf` directory; this
isn't cleaned up by the prior version of the script (and it also does
not tell you the diff). This new one will.

Also added a second `-f` to `git clean` which does not stop in nested
repos (excluding submodules). We don't need that but it seemed right
to add it.

Release note: None

27053: opt: fix panic in generating tuple IN constraints r=justinj a=justinj

Fixes #27016.

Previously this code would panic if there were no constrainable columns.
I've added an equivalent test case to the one provided, but it will be
difficult to run the test provided until #27034 lands. I suspect the
problem there was with placeholders (it didn't panic with the old code
and the placeholders replaced with constants).

We should also consider adding prepared statement support to opt_tester
so that we can test situations like that in the future.

Release note (bug fix): Fix a panic in the optimizer with IN filters.

Co-authored-by: Sean Loiselle <[email protected]>
Co-authored-by: Andrew Couch <[email protected]>
Co-authored-by: Justin Jaffray <[email protected]>
Co-authored-by: neeral <[email protected]>
Co-authored-by: Tobias Schottdorf <[email protected]>
@craig craig bot closed this as completed in 84a7b51 Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-optimizer SQL logical planning and optimizations. A-tools-hibernate Issues that pertain to Hibernate integration. C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. C-test-failure Broken test (automatically or manually discovered).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants