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

sentry: (0) table.go:879: virtual descriptors cannot be stored, found: %v | *sqlbase.MutableTableDescriptor (see stack traces in additional data) #38440

Closed
cockroach-teamcity opened this issue Jun 26, 2019 · 5 comments · Fixed by #39195
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-sentry Originated from an in-the-wild panic report.
Milestone

Comments

@cockroach-teamcity
Copy link
Member

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/1087088546/?referrer=webhooks_plugin

Panic message:

(0) table.go:879: virtual descriptors cannot be stored, found: %v | *sqlbase.MutableTableDescriptor
(see stack traces in additional data)

Stacktrace (expand for inline code snippets):

cockroach/pkg/sql/table.go

Lines 878 to 880 in 25dd36f

if tableDesc.IsVirtualTable() {
return pgerror.NewAssertionErrorf("virtual descriptors cannot be stored, found: %v", tableDesc)
}
in pkg/sql.(*planner).writeTableDescToBatch

cockroach/pkg/sql/table.go

Lines 865 to 867 in 25dd36f

b := p.txn.NewBatch()
if err := p.writeTableDescToBatch(ctx, tableDesc, mutationID, b); err != nil {
return err
in pkg/sql.(*planner).writeTableDesc

cockroach/pkg/sql/table.go

Lines 839 to 841 in 25dd36f

}
return p.writeTableDesc(ctx, tableDesc, mutationID)
}
in pkg/sql.(*planner).writeSchemaChange
}
if err := params.p.writeSchemaChange(params.ctx, backRefMutable, sqlbase.InvalidMutationID); err != nil {
return err
in pkg/sql.(*createViewNode).startExec

cockroach/pkg/sql/plan.go

Lines 495 to 497 in 25dd36f

leaveNode: func(_ string, n planNode) error {
return n.startExec(params)
},
in pkg/sql.startExec.func2

cockroach/pkg/sql/walk.go

Lines 144 to 146 in 25dd36f

}
v.err = v.observer.leaveNode(name, plan)
}()
in pkg/sql.(*planVisitor).visitInternal.func1

cockroach/pkg/sql/walk.go

Lines 615 to 617 in 25dd36f

}
}
in pkg/sql.(*planVisitor).visitInternal

cockroach/pkg/sql/walk.go

Lines 111 to 113 in 25dd36f

}
v.visitInternal(plan, name)
return plan
in pkg/sql.(*planVisitor).visit
v := makePlanVisitor(ctx, observer)
v.visit(plan)
return v.err
in pkg/sql.walkPlan

cockroach/pkg/sql/plan.go

Lines 498 to 500 in 25dd36f

}
return walkPlan(params.ctx, plan, o)
}
in pkg/sql.startExec
// This starts all of the nodes below this node.
if err := startExec(p.params, p.node); err != nil {
p.MoveToDraining(err)
in pkg/sql.(*planNodeToRowSource).Start
}
ctx = pb.self.Start(ctx)
Run(ctx, pb.self, pb.out.output)
in pkg/sql/distsqlrun.(*ProcessorBase).Run
}
headProc.Run(ctx)
return nil
in pkg/sql/distsqlrun.(*Flow).Run
// TODO(radu): this should go through the flow scheduler.
if err := flow.Run(ctx, func() {}); err != nil {
log.Fatalf(ctx, "unexpected error from syncFlow.Start(): %s "+
in pkg/sql.(*DistSQLPlanner).Run
dsp.FinalizePlan(planCtx, &physPlan)
dsp.Run(planCtx, txn, &physPlan, recv, evalCtx, nil /* finishedSetupFn */)
}
in pkg/sql.(*DistSQLPlanner).PlanAndRun
// the planner whether or not to plan remote table readers.
ex.server.cfg.DistSQLPlanner.PlanAndRun(
ctx, evalCtx, planCtx, planner.txn, planner.curPlan.plan, recv)
in pkg/sql.(*connExecutor).execWithDistSQLEngine
ex.sessionTracing.TraceExecStart(ctx, "distributed")
err = ex.execWithDistSQLEngine(ctx, planner, stmt.AST.StatementType(), res, distributePlan)
ex.sessionTracing.TraceExecEnd(ctx, res.Err(), res.RowsAffected())
in pkg/sql.(*connExecutor).dispatchToExecutionEngine
p.autoCommit = os.ImplicitTxn.Get() && !ex.server.cfg.TestingKnobs.DisableAutoCommit
if err := ex.dispatchToExecutionEngine(ctx, p, res); err != nil {
return nil, nil, err
in pkg/sql.(*connExecutor).execStmtInOpenState
} else {
ev, payload, err = ex.execStmtInOpenState(ctx, stmt, pinfo, res)
}
in pkg/sql.(*connExecutor).execStmt
ctx := withStatement(ex.Ctx(), ex.curStmt)
ev, payload, err = ex.execStmt(ctx, curStmt, stmtRes, nil /* pinfo */)
if err != nil {
in pkg/sql.(*connExecutor).run
}()
return h.ex.run(ctx, s.pool, reserved, cancel)
}
in pkg/sql.(*Server).ServeConn
}()
writerErr = sqlServer.ServeConn(ctx, connHandler, reserved, cancelConn)
// TODO(andrei): Should we sometimes transmit the writerErr's to the
in pkg/sql/pgwire.(*conn).serveImpl.func4

pkg/sql/table.go in pkg/sql.(*planner).writeTableDescToBatch at line 879
pkg/sql/table.go in pkg/sql.(*planner).writeTableDesc at line 866
pkg/sql/table.go in pkg/sql.(*planner).writeSchemaChange at line 840
pkg/sql/create_view.go in pkg/sql.(*createViewNode).startExec at line 170
pkg/sql/plan.go in pkg/sql.startExec.func2 at line 496
pkg/sql/walk.go in pkg/sql.(*planVisitor).visitInternal.func1 at line 145
pkg/sql/walk.go in pkg/sql.(*planVisitor).visitInternal at line 616
pkg/sql/walk.go in pkg/sql.(*planVisitor).visit at line 112
pkg/sql/walk.go in pkg/sql.walkPlan at line 76
pkg/sql/plan.go in pkg/sql.startExec at line 499
pkg/sql/plan_node_to_row_source.go in pkg/sql.(*planNodeToRowSource).Start at line 124
pkg/sql/distsqlrun/processors.go in pkg/sql/distsqlrun.(*ProcessorBase).Run at line 800
pkg/sql/distsqlrun/flow.go in pkg/sql/distsqlrun.(*Flow).Run at line 626
pkg/sql/distsql_running.go in pkg/sql.(*DistSQLPlanner).Run at line 252
pkg/sql/distsql_running.go in pkg/sql.(*DistSQLPlanner).PlanAndRun at line 839
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).execWithDistSQLEngine at line 1112
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).dispatchToExecutionEngine at line 948
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).execStmtInOpenState at line 456
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).execStmt at line 102
pkg/sql/conn_executor.go in pkg/sql.(*connExecutor).run at line 1182
pkg/sql/conn_executor.go in pkg/sql.(*Server).ServeConn at line 433
pkg/sql/pgwire/conn.go in pkg/sql/pgwire.(*conn).serveImpl.func4 at line 337
Tag Value
Cockroach Release v19.1.0
Cockroach SHA: 25dd36f
Platform darwin amd64
Distribution CCL
Environment v19.1.0
Command server
Go Version go1.11.6
# of CPUs 8
# of Goroutines 206
@cockroach-teamcity cockroach-teamcity added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-sentry Originated from an in-the-wild panic report. labels Jun 26, 2019
@imjching
Copy link

This might be me. Is this expected?

pq: internal error: virtual descriptors cannot be stored, found: name:"ranges" id:4294967270 parent_id:0 version:1 modification_time:<> columns:<name:"range_id" id:1 type:<semantic_type:INT width:64 precision:0 visible_type:BIGINT > nullable:false hidden:false > columns:<name:"start_key" id:2 type:<semantic_type:BYTES width:0 precision:0 visible_type:NONE > nullable:false hidden:false > columns:<name:"start_pretty" id:3 type:<semantic_type:STRING width:0 precision:0 visible_type:NONE > nullable:false hidden:false > columns:<name:"end_key" id:4 type:<semantic_type:BYTES width:0 precision:0 visible_type:NONE > nullable:false hidden:false > columns:<name:"end_pretty" id:5 type:<semantic_type:STRING width:0 precision:0 visible_type:NONE > nullable:false hidden:false > columns:<name:"database_name" id:6 type:<semantic_type:STRING width:0 precision:0 visible_type:NONE > nullable:false hidden:false > columns:<name:"table_name" id:7 type:<semantic_type:STRING width:0 precision:0 visible_type:NONE > nullable:false hidden:false > columns:<name:"index_name" id:8 type:<semantic_type:STRING width:0 precision:0 visible_type:NONE > nullable:false hidden:false > columns:<name:"replicas" id:9 type:<semantic_type:ARRAY width:64 precision:0 visible_type:BIGINT array_contents:INT > nullable:false hidden:false > columns:<name:"lease_holder" id:10 type:<semantic_type:INT width:64 precision:0 visible_type:BIGINT > nullable:false hidden:false > next_column_id:11 next_family_id:0 primary_index:<name:"" id:0 unique:false foreign_key:<table:0 index:0 name:"" validity:Validated shared_prefix_len:0 on_delete:NO_ACTION on_update:NO_ACTION match:SIMPLE > interleave:<> partitioning:<num_columns:0 > type:FORWARD > next_index_id:0 privileges:<users:<user:"public" privileges:32 > > next_mutation_id:1 format_version:3 state:PUBLIC view_query:"SELECT range_id, start_key, start_pretty, end_key, end_pretty, database_name, table_name, index_name, replicas, crdb_internal.lease_holder(start_key) AS lease_holder FROM crdb_internal.ranges_no_leases" dependedOnBy:<id:77 index_id:0 column_ids:1 column_ids:2 column_ids:3 column_ids:4 column_ids:5 column_ids:6 column_ids:7 column_ids:8 column_ids:9 column_ids:10 > drop_time:0 replacement_of:<id:0 time:<> > audit_mode:DISABLED drop_job_id:0
DETAIL: stack trace:
github.com/cockroachdb/cockroach/pkg/sql/table.go:879: in writeTableDescToBatch()
github.com/cockroachdb/cockroach/pkg/sql/table.go:866: in writeTableDesc()
github.com/cockroachdb/cockroach/pkg/sql/table.go:840: in writeSchemaChange()
github.com/cockroachdb/cockroach/pkg/sql/create_view.go:170: in startExec()
github.com/cockroachdb/cockroach/pkg/sql/plan.go:496: in func2()
github.com/cockroachdb/cockroach/pkg/sql/walk.go:145: in func1()
github.com/cockroachdb/cockroach/pkg/sql/walk.go:616: in visitInternal()
github.com/cockroachdb/cockroach/pkg/sql/walk.go:112: in visit()
github.com/cockroachdb/cockroach/pkg/sql/walk.go:76: in walkPlan()
github.com/cockroachdb/cockroach/pkg/sql/plan.go:499: in startExec()
github.com/cockroachdb/cockroach/pkg/sql/plan_node_to_row_source.go:124: in Start()
github.com/cockroachdb/cockroach/pkg/sql/distsqlrun/processors.go:800: in Run()
github.com/cockroachdb/cockroach/pkg/sql/distsqlrun/flow.go:626: in Run()
github.com/cockroachdb/cockroach/pkg/sql/distsql_running.go:252: in Run()
github.com/cockroachdb/cockroach/pkg/sql/distsql_running.go:839: in PlanAndRun()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:1112: in execWithDistSQLEngine()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:948: in dispatchToExecutionEngine()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:456: in execStmtInOpenState()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:102: in execStmt()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1182: in run()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:433: in ServeConn()
github.com/cockroachdb/cockroach/pkg/sql/pgwire/conn.go:337: in func4()

HINT: You have encountered an unexpected error inside CockroachDB.

Please check https://github.com/cockroachdb/cockroach/issues to check
whether this problem is already tracked. If you cannot find it there,
please report the error with details at:

    https://github.com/cockroachdb/cockroach/issues/new/choose

If you would rather not post publicly, please contact us directly at:

    support@cockroachlabs.com

The Cockroach Labs team appreciates your feedback.

This happens when we attempt to create a view for crdb_internal.ranges.

CREATE VIEW test_view AS SELECT range_id, lease_holder FROM crdb_internal.ranges;

@jordanlewis
Copy link
Member

@RaduBerinde I haven't looked at this thoroughly but is this limitation liftable by moving view creation into opt by any chance?

@RaduBerinde
Copy link
Member

Ha, it just so happens I've been working on that (#39169) and I hit a similar error during development. It was because I was reporting a dependency on a virtual table. This situation is similar, except that we have a virtual view. I will work on fixing this too as part of that PR.

@RaduBerinde
Copy link
Member

@imjching this is the definition of crdb_internal.ranges:

CREATE VIEW crdb_internal.ranges AS SELECT
	range_id,
	start_key,
	start_pretty,
	end_key,
	end_pretty,
	database_name,
	table_name,
	index_name,
	replicas,
	learner_replicas,
	split_enforced_until,
	crdb_internal.lease_holder(start_key) AS lease_holder
FROM crdb_internal.ranges_no_leases

As a workaround, you can do:

CREATE VIEW test_view AS SELECT range_id, crdb_internal.lease_holder(start_key) AS lease_holder FROM crdb_internal.ranges_no_leases

@RaduBerinde RaduBerinde added this to the 19.2 milestone Jul 31, 2019
@jordanlewis
Copy link
Member

Thanks for taking this on!

RaduBerinde added a commit to RaduBerinde/cockroach that referenced this issue Jul 31, 2019
When creating a view, we report a plan dependency on virtual
views which causes a failure. This commit fixes the logic to avoid
reporting a dependency in this case (just like we don't report
dependencies on virtual tables).

Fixes cockroachdb#38440.

Release note (bug fix): crdb_internal.ranges_no_leases can now be used
inside views.
RaduBerinde added a commit to RaduBerinde/cockroach that referenced this issue Aug 1, 2019
When creating a view, we report a plan dependency on virtual
views which causes a failure. This commit fixes the logic to avoid
reporting a dependency in this case (just like we don't report
dependencies on virtual tables).

Fixes cockroachdb#38440.

Release note (bug fix): crdb_internal.ranges can now be used inside
views. Note that such views can become invalid in future releases if
`crdb_internal.ranges` changes.
craig bot pushed a commit that referenced this issue Aug 1, 2019
39195: sql: support views that depend on virtual views r=RaduBerinde a=RaduBerinde

When creating a view, we report a plan dependency on virtual
views which causes a failure. This commit fixes the logic to avoid
reporting a dependency in this case (just like we don't report
dependencies on virtual tables).

Fixes #38440.

Release note (bug fix): crdb_internal.ranges can now be used inside
views. Note that such views can become invalid in future releases if
`crdb_internal.ranges` changes.


Co-authored-by: Radu Berinde <radu@cockroachlabs.com>
@craig craig bot closed this as completed in #39195 Aug 1, 2019
RaduBerinde added a commit to RaduBerinde/cockroach that referenced this issue Aug 1, 2019
When creating a view, we report a plan dependency on virtual
views which causes a failure. This commit fixes the logic to avoid
reporting a dependency in this case (just like we don't report
dependencies on virtual tables).

Fixes cockroachdb#38440.

Release note (bug fix): crdb_internal.ranges can now be used inside
views. Note that such views can become invalid in future releases if
`crdb_internal.ranges` changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-sentry Originated from an in-the-wild panic report.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants