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: v19.2.2: assertion failed while validating a table descriptor #44850

Closed
cockroach-teamcity opened this issue Feb 7, 2020 · 2 comments
Closed
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.

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

Panic message:

*errors.errorString
*safedetails.withSafeDetails: parentID %d does not exist (1)
structured.go:1544: *withstack.withStack (2)
*assert.withAssertionFailure
(check the extra data payloads)

Stacktrace (expand for inline code snippets):

if !res.Exists() {
return errors.AssertionFailedf("parentID %d does not exist", errors.Safe(desc.ParentID))
}
in pkg/sql/sqlbase.(*TableDescriptor).validateCrossReferences
}
return desc.validateCrossReferences(ctx, txn)
}
in pkg/sql/sqlbase.(*TableDescriptor).Validate
if err := table.Validate(ctx, txn); err != nil {
return err
in pkg/sql.getDescriptorByID
desc := &sqlbase.TableDescriptor{}
err = getDescriptorByID(ctx, txn, descID, desc)
if err != nil {
in pkg/sql.UncachedPhysicalAccessor.GetObjectDesc

cockroach/pkg/sql/table.go

Lines 267 to 269 in 3cbd056

phyAccessor := UncachedPhysicalAccessor{}
obj, err := phyAccessor.GetObjectDesc(ctx, txn, tn, flags)
if obj == nil {
in pkg/sql.(*TableCollection).getTableVersion.func1

cockroach/pkg/sql/table.go

Lines 275 to 277 in 3cbd056

if avoidCache {
return readTableFromStore()
}
in pkg/sql.(*TableCollection).getTableVersion
}
table, err := a.tc.getTableVersion(ctx, txn, name, flags)
if table == nil {
in pkg/sql.(*CachedPhysicalAccessor).GetObjectDesc
// Fallthrough.
return l.SchemaAccessor.GetObjectDesc(ctx, txn, name, flags)
}
in pkg/sql.(*LogicalSchemaAccessor).GetObjectDesc
lookupFlags.CommonLookupFlags = p.CommonLookupFlags(false /* required */)
objDesc, err := sc.GetObjectDesc(ctx, p.txn, &p.tableName, lookupFlags)
return objDesc != nil, objDesc, err
in pkg/sql.(*planner).LookupObject
// Already 3 parts: nothing to search. Delegate to the resolver.
return r.LookupObject(ctx, lookupFlags, t.Catalog(), t.Schema(), t.Table())
}
in pkg/sql/sem/tree.(*TableName).ResolveExisting
) (res tree.NameResolutionResult, err error) {
found, descI, err := tn.ResolveExisting(ctx, sc, lookupFlags, sc.CurrentDatabase(), sc.CurrentSearchPath())
if err != nil {
in pkg/sql.resolveExistingObjectImpl
) (res *ImmutableTableDescriptor, err error) {
desc, err := resolveExistingObjectImpl(ctx, sc, tn, lookupFlags, requiredType)
if err != nil || desc == nil {
in pkg/sql.ResolveExistingObject
oc.tn = *name
desc, err := ResolveExistingObject(ctx, oc.planner, &oc.tn, tree.ObjectLookupFlagsWithRequired(), ResolveAnyDescType)
if err != nil {
in pkg/sql.(*optCatalog).ResolveDataSource
}
ds, resName, err := b.catalog.ResolveDataSource(b.ctx, flags, tn)
if err != nil {
in pkg/sql/opt/optbuilder.(*Builder).resolveDataSource
) (cat.Table, tree.TableName) {
ds, resName := b.resolveDataSource(tn, priv)
tab, ok := ds.(cat.Table)
in pkg/sql/opt/optbuilder.(*Builder).resolveTable
// Find which table we're working on, check the permissions.
tab, resName := b.resolveTable(tn, privilege.INSERT)
if alias == nil {
in pkg/sql/opt/optbuilder.(*Builder).buildInsert
case *tree.Insert:
return b.buildInsert(stmt, inScope)
in pkg/sql/opt/optbuilder.(*Builder).buildStmt
// and physical properties.
outScope := b.buildStmt(b.stmt, nil /* desiredTypes */, b.allocScope())
physical := outScope.makePhysicalProps()
in pkg/sql/opt/optbuilder.(*Builder).Build
bld := optbuilder.New(ctx, &p.semaCtx, p.EvalContext(), &opc.catalog, f, opc.p.stmt.AST)
if err := bld.Build(); err != nil {
return nil, err
in pkg/sql.(*optPlanningCtx).buildExecMemo
execMemo, err := opc.buildExecMemo(ctx)
if err != nil {
in pkg/sql.(*planner).makeOptimizerPlan
log.VEvent(ctx, 2, "generating optimizer plan")
if err := planner.makeOptimizerPlan(ctx); err != nil {
log.VEventf(ctx, 1, "optimizer plan failed: %v", err)
in pkg/sql.(*connExecutor).makeExecPlan
// 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
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, res, pinfo)
}
in pkg/sql.(*connExecutor).execStmt
stmtCtx := withStatement(ctx, ex.curStmt)
ev, payload, err = ex.execStmt(stmtCtx, curStmt, stmtRes, nil /* pinfo */)
if err != nil {
in pkg/sql.(*connExecutor).execCmd
var err error
if err = ex.execCmd(ex.Ctx()); err != nil {
if err == io.EOF || err == errDrainingComplete {
in pkg/sql.(*connExecutor).run
go func() {
if err := ex.run(ctx, ie.mon, mon.BoundAccount{} /*reserved*/, nil /* cancel */); err != nil {
ex.recordError(ctx, err)
in pkg/sql.(*internalExecutorImpl).initConnEx.func1
/usr/local/go/src/runtime/asm_amd64.s#L1336-L1338 in runtime.goexit

pkg/sql/sqlbase/structured.go in pkg/sql/sqlbase.(*TableDescriptor).validateCrossReferences at line 1544
pkg/sql/sqlbase/structured.go in pkg/sql/sqlbase.(*TableDescriptor).Validate at line 1531
pkg/sql/descriptor.go in pkg/sql.getDescriptorByID at line 183
pkg/sql/physical_schema_accessors.go in pkg/sql.UncachedPhysicalAccessor.GetObjectDesc at line 160
pkg/sql/table.go in pkg/sql.(*TableCollection).getTableVersion.func1 at line 268
pkg/sql/table.go in pkg/sql.(*TableCollection).getTableVersion at line 276
pkg/sql/physical_schema_accessors.go in pkg/sql.(*CachedPhysicalAccessor).GetObjectDesc at line 238
pkg/sql/logical_schema_accessors.go in pkg/sql.(*LogicalSchemaAccessor).GetObjectDesc at line 93
pkg/sql/resolver.go in pkg/sql.(*planner).LookupObject at line 293
pkg/sql/sem/tree/name_resolution.go in pkg/sql/sem/tree.(*TableName).ResolveExisting at line 280
pkg/sql/resolver.go in pkg/sql.resolveExistingObjectImpl at line 141
pkg/sql/resolver.go in pkg/sql.ResolveExistingObject at line 102
pkg/sql/opt_catalog.go in pkg/sql.(*optCatalog).ResolveDataSource at line 169
pkg/sql/opt/optbuilder/util.go in pkg/sql/opt/optbuilder.(*Builder).resolveDataSource at line 476
pkg/sql/opt/optbuilder/util.go in pkg/sql/opt/optbuilder.(*Builder).resolveTable at line 454
pkg/sql/opt/optbuilder/insert.go in pkg/sql/opt/optbuilder.(*Builder).buildInsert at line 168
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).buildStmt at line 235
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).Build at line 185
pkg/sql/plan_opt.go in pkg/sql.(*optPlanningCtx).buildExecMemo at line 419
pkg/sql/plan_opt.go in pkg/sql.(*planner).makeOptimizerPlan at line 161
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).makeExecPlan at line 743
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).dispatchToExecutionEngine at line 625
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).execStmtInOpenState at line 416
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).execStmt at line 98
pkg/sql/conn_executor.go in pkg/sql.(*connExecutor).execCmd at line 1243
pkg/sql/conn_executor.go in pkg/sql.(*connExecutor).run at line 1172
pkg/sql/internal.go in pkg/sql.(*internalExecutorImpl).initConnEx.func1 at line 202
/usr/local/go/src/runtime/asm_amd64.s in runtime.goexit at line 1337
Tag Value
Cockroach Release v19.2.2
Cockroach SHA: 3cbd056
Platform linux amd64
Distribution CCL
Environment v19.2.2
Command server
Go Version go1.12.12
# of CPUs 4
# of Goroutines 1784
@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 Feb 7, 2020
@yuzefovich yuzefovich changed the title sentry: *errors.errorString *safedetails.withSafeDetails: parentID %d does not exist (1) structured.go:1544: *withstack.withStack (2) *assert.withAssertionFailure (check the extra data payloads) sql: assertion failed while validating a table descriptor Feb 7, 2020
@yuzefovich
Copy link
Member

cc @otan I think you've been looking at some (maybe) related code recently.

@ajwerner
Copy link
Contributor

ajwerner commented Oct 9, 2020

I think this is #50997 which we backported to 20.1 but not to 19.2. I'm closing this and somebody can re-open it if they feel like that backport is in order.

@ajwerner ajwerner closed this as completed Oct 9, 2020
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

No branches or pull requests

3 participants