-
Notifications
You must be signed in to change notification settings - Fork 4.1k
opt: v20.1.0-rc.2: assertion failed: estimated row count must be non-zero #49911
Description
This issue was autofiled by Sentry. It represents a crash or reported error on a live cluster with telemetry enabled.
Sentry link: https://sentry.io/organizations/cockroach-labs/issues/1711322401/?referrer=webhooks_plugin
Panic message:
*errors.errorString
*safedetails.withSafeDetails: estimated row count must be non-zero (1)
statistics_builder.go:2301: *withstack.withStack (2)
*assert.withAssertionFailure
(check the extra data payloads)
Stacktrace (expand for inline code snippets):
cockroach/pkg/sql/opt/memo/statistics_builder.go
Lines 2300 to 2302 in c0f00d2
| if s.RowCount <= 0 && relProps.Cardinality.Max > 0 { | |
| panic(errors.AssertionFailedf("estimated row count must be non-zero")) | |
| } |
cockroach/pkg/sql/opt/memo/statistics_builder.go
Lines 2135 to 2137 in c0f00d2
| s.RowCount = inputStats.RowCount | |
| sb.finalizeFromCardinality(relProps) | |
| } |
cockroach/pkg/sql/opt/memo/logical_props_builder.go
Lines 799 to 801 in c0f00d2
| if !b.disableStats { | |
| b.sb.buildWithScan(withScan, rel) | |
| } |
https://github.com/cockroachdb/cockroach/blob/c0f00d2a156295a1cb79ed960940c167cb03ccbc/pkg/sql/opt/memo/expr.og.go#L16550-L16552 in pkg/sql/opt/memo.(*Memo).MemoizeWithScan
https://github.com/cockroachdb/cockroach/blob/c0f00d2a156295a1cb79ed960940c167cb03ccbc/pkg/sql/opt/norm/factory.og.go#L8535-L8537 in pkg/sql/opt/norm.(*Factory).ConstructWithScan
cockroach/pkg/sql/opt/optbuilder/select.go
Lines 95 to 97 in c0f00d2
| outScope.expr = b.factory.ConstructWithScan(&memo.WithScanPrivate{ | |
| With: cte.id, |
cockroach/pkg/sql/opt/optbuilder/select.go
Lines 62 to 64 in c0f00d2
| outScope = b.buildDataSource(source.Expr, indexFlags, locking, inScope) | |
cockroach/pkg/sql/opt/optbuilder/select.go
Lines 1094 to 1096 in c0f00d2
| ) (outScope *scope) { | |
| outScope = b.buildDataSource(tables[0], nil /* indexFlags */, locking, inScope) | |
cockroach/pkg/sql/opt/optbuilder/select.go
Lines 1101 to 1103 in c0f00d2
| } | |
| tableScope := b.buildFromTablesRightDeep(tables, locking, inScope) | |
cockroach/pkg/sql/opt/optbuilder/select.go
Lines 1071 to 1073 in c0f00d2
| } | |
| return b.buildFromTablesRightDeep(tables, locking, inScope) | |
| } |
cockroach/pkg/sql/opt/optbuilder/select.go
Lines 998 to 1000 in c0f00d2
| if len(from.Tables) > 0 { | |
| outScope = b.buildFromTables(from.Tables, locking, inScope) | |
| } else { |
cockroach/pkg/sql/opt/optbuilder/select.go
Lines 920 to 922 in c0f00d2
| ) (outScope *scope) { | |
| fromScope := b.buildFrom(sel.From, locking, inScope) | |
| b.processWindowDefs(sel, fromScope) |
cockroach/pkg/sql/opt/optbuilder/select.go
Lines 868 to 870 in c0f00d2
| case *tree.SelectClause: | |
| outScope = b.buildSelectClause(t, orderBy, locking, desiredTypes, inScope) | |
cockroach/pkg/sql/opt/optbuilder/select.go
Lines 841 to 843 in c0f00d2
| return b.processWiths(with, inScope, func(inScope *scope) *scope { | |
| return b.buildSelectStmtWithoutParens( | |
| wrapped, orderBy, limit, locking, desiredTypes, inScope, |
cockroach/pkg/sql/opt/optbuilder/with.go
Lines 28 to 30 in c0f00d2
| inScope.atRoot = false | |
| outScope := buildStmt(inScope) | |
| inScope.atRoot = prevAtRoot |
cockroach/pkg/sql/opt/optbuilder/select.go
Lines 840 to 842 in c0f00d2
| return b.processWiths(with, inScope, func(inScope *scope) *scope { | |
| return b.buildSelectStmtWithoutParens( |
cockroach/pkg/sql/opt/optbuilder/builder.go
Lines 252 to 254 in c0f00d2
| case *tree.Select: | |
| return b.buildSelect(stmt, noRowLocking, desiredTypes, inScope) | |
cockroach/pkg/sql/opt/optbuilder/with.go
Lines 157 to 159 in c0f00d2
| b.pushWithFrame() | |
| recursiveScope := b.buildStmt(recursive, initialTypes /* desiredTypes */, cteScope) | |
| b.popWithFrame(recursiveScope) |
cockroach/pkg/sql/opt/optbuilder/select.go
Lines 680 to 682 in c0f00d2
| hasRecursive = hasRecursive || with.Recursive | |
| cteExpr, cteCols := b.buildCTE(cte, outScope, with.Recursive) | |
cockroach/pkg/sql/opt/optbuilder/with.go
Lines 25 to 27 in c0f00d2
| ) *scope { | |
| inScope = b.buildCTEs(with, inScope) | |
| prevAtRoot := inScope.atRoot |
cockroach/pkg/sql/opt/optbuilder/select.go
Lines 840 to 842 in c0f00d2
| return b.processWiths(with, inScope, func(inScope *scope) *scope { | |
| return b.buildSelectStmtWithoutParens( |
cockroach/pkg/sql/opt/optbuilder/builder.go
Lines 252 to 254 in c0f00d2
| case *tree.Select: | |
| return b.buildSelect(stmt, noRowLocking, desiredTypes, inScope) | |
cockroach/pkg/sql/opt/optbuilder/builder.go
Lines 216 to 218 in c0f00d2
| return b.buildStmt(stmt, desiredTypes, inScope) | |
| } |
cockroach/pkg/sql/opt/optbuilder/builder.go
Lines 187 to 189 in c0f00d2
| // and physical properties. | |
| outScope := b.buildStmtAtRoot(b.stmt, nil /* desiredTypes */, b.allocScope()) | |
Lines 432 to 434 in c0f00d2
| bld := optbuilder.New(ctx, &p.semaCtx, p.EvalContext(), &opc.catalog, f, opc.p.stmt.AST) | |
| if err := bld.Build(); err != nil { | |
| return nil, err |
Lines 168 to 170 in c0f00d2
| execMemo, err := opc.buildExecMemo(ctx) | |
| if err != nil { |
cockroach/pkg/sql/conn_executor_exec.go
Lines 800 to 802 in c0f00d2
| if err := planner.makeOptimizerPlan(ctx); err != nil { | |
| log.VEventf(ctx, 1, "optimizer plan failed: %v", err) |
cockroach/pkg/sql/conn_executor_exec.go
Lines 690 to 692 in c0f00d2
| // between here and there needs to happen even if there's an error. | |
| err := ex.makeExecPlan(ctx, planner) | |
| // We'll be closing the plan manually below after execution; this |
cockroach/pkg/sql/conn_executor_exec.go
Lines 480 to 482 in c0f00d2
| p.autoCommit = os.ImplicitTxn.Get() && !ex.server.cfg.TestingKnobs.DisableAutoCommit | |
| if err := ex.dispatchToExecutionEngine(ctx, p, res); err != nil { | |
| return nil, nil, err |
cockroach/pkg/sql/conn_executor_exec.go
Lines 95 to 97 in c0f00d2
| } else { | |
| ev, payload, err = ex.execStmtInOpenState(ctx, stmt, res, pinfo) | |
| } |
cockroach/pkg/sql/conn_executor.go
Lines 1367 to 1369 in c0f00d2
| stmtCtx := withStatement(ctx, ex.curStmt) | |
| ev, payload, err = ex.execStmt(stmtCtx, curStmt, stmtRes, nil /* pinfo */) | |
| if err != nil { |
cockroach/pkg/sql/conn_executor.go
Lines 1296 to 1298 in c0f00d2
| var err error | |
| if err = ex.execCmd(ex.Ctx()); err != nil { | |
| if err == io.EOF || err == errDrainingComplete { |
pkg/sql/opt/memo/statistics_builder.go in pkg/sql/opt/memo.(*statisticsBuilder).finalizeFromCardinality at line 2301
pkg/sql/opt/memo/statistics_builder.go in pkg/sql/opt/memo.(*statisticsBuilder).buildWithScan at line 2136
pkg/sql/opt/memo/logical_props_builder.go in pkg/sql/opt/memo.(*logicalPropsBuilder).buildWithScanProps at line 800
pkg/sql/opt/memo/expr.og.go in pkg/sql/opt/memo.(*Memo).MemoizeWithScan at line 16551
pkg/sql/opt/norm/factory.og.go in pkg/sql/opt/norm.(*Factory).ConstructWithScan at line 8536
pkg/sql/opt/optbuilder/select.go in pkg/sql/opt/optbuilder.(*Builder).buildDataSource at line 96
pkg/sql/opt/optbuilder/select.go in pkg/sql/opt/optbuilder.(*Builder).buildDataSource at line 63
pkg/sql/opt/optbuilder/select.go in pkg/sql/opt/optbuilder.(*Builder).buildFromTablesRightDeep at line 1095
pkg/sql/opt/optbuilder/select.go in pkg/sql/opt/optbuilder.(*Builder).buildFromTablesRightDeep at line 1102
pkg/sql/opt/optbuilder/select.go in pkg/sql/opt/optbuilder.(*Builder).buildFromTables at line 1072
pkg/sql/opt/optbuilder/select.go in pkg/sql/opt/optbuilder.(*Builder).buildFrom at line 999
pkg/sql/opt/optbuilder/select.go in pkg/sql/opt/optbuilder.(*Builder).buildSelectClause at line 921
pkg/sql/opt/optbuilder/select.go in pkg/sql/opt/optbuilder.(*Builder).buildSelectStmtWithoutParens at line 869
pkg/sql/opt/optbuilder/select.go in pkg/sql/opt/optbuilder.(*Builder).buildSelect.func1 at line 842
pkg/sql/opt/optbuilder/with.go in pkg/sql/opt/optbuilder.(*Builder).processWiths at line 29
pkg/sql/opt/optbuilder/select.go in pkg/sql/opt/optbuilder.(*Builder).buildSelect at line 841
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).buildStmt at line 253
pkg/sql/opt/optbuilder/with.go in pkg/sql/opt/optbuilder.(*Builder).buildCTE at line 158
pkg/sql/opt/optbuilder/select.go in pkg/sql/opt/optbuilder.(*Builder).buildCTEs at line 681
pkg/sql/opt/optbuilder/with.go in pkg/sql/opt/optbuilder.(*Builder).processWiths at line 26
pkg/sql/opt/optbuilder/select.go in pkg/sql/opt/optbuilder.(*Builder).buildSelect at line 841
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).buildStmt at line 253
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).buildStmtAtRoot at line 217
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).Build at line 188
pkg/sql/plan_opt.go in pkg/sql.(*optPlanningCtx).buildExecMemo at line 433
pkg/sql/plan_opt.go in pkg/sql.(*planner).makeOptimizerPlan at line 169
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).makeExecPlan at line 801
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).dispatchToExecutionEngine at line 691
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).execStmtInOpenState at line 481
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).execStmt at line 96
pkg/sql/conn_executor.go in pkg/sql.(*connExecutor).execCmd at line 1368
pkg/sql/conn_executor.go in pkg/sql.(*connExecutor).run at line 1297
| Tag | Value |
|---|---|
| Cockroach Release | v20.1.0-rc.2 |
| Cockroach SHA: | c0f00d2 |
| Platform | linux amd64 |
| Distribution | CCL |
| Environment | v20.1.0-rc.2 |
| Command | server |
| Go Version | go1.13.9 |
| # of CPUs | 8 |
| # of Goroutines | 197 |