Skip to content

catalog/descs: v21.2.4: deadline below read timestamp is nonsensical #76727

@cockroach-teamcity

Description

@cockroach-teamcity

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

Panic message:

txn.go:773: deadline below read timestamp is nonsensical; txn has would have no chance to commit. Deadline: 1645098134.258021630,0. Read timestamp: 1645099099.305391838,0 Previous Deadline: .
--
*errutil.leafError: deadline below read timestamp is nonsensical; txn has would have no chance to commit. Deadline: 1645098134.258021630,0. Read timestamp: 1645099099.305391838,0 Previous Deadline: . (1)
txn.go:773: *withstack.withStack (top exception)
*assert.withAssertionFailure
(check the extra data payloads)

Stacktrace (expand for inline code snippets):

cockroach/pkg/kv/txn.go

Lines 772 to 774 in 0c8df44

if deadline.Less(readTimestamp) {
return errors.AssertionFailedf("deadline below read timestamp is nonsensical; "+
"txn has would have no chance to commit. Deadline: %s. Read timestamp: %s Previous Deadline: %s.",
in pkg/kv.(*Txn).UpdateDeadline
if !deadline.IsEmpty() {
return txn.UpdateDeadline(ctx, deadline)
}
in pkg/sql/catalog/descs.(*leasedDescriptors).maybeUpdateDeadline
if setDeadline {
if err := ld.maybeUpdateDeadline(ctx, txn, nil); err != nil {
return nil, false, err
in pkg/sql/catalog/descs.(*leasedDescriptors).getResult
const setTxnDeadline = true
return ld.getResult(ctx, txn, setTxnDeadline, ldesc, err)
}
in pkg/sql/catalog/descs.(*leasedDescriptors).getByName
var shouldReadFromStore bool
desc, shouldReadFromStore, err = tc.leased.getByName(ctx, tc.deadlineHolder(txn), parentID, parentSchemaID, name)
if err != nil {
in pkg/sql/catalog/descs.(*Collection).getByName
prefix.Schema = sc
found, obj, err := tc.getByName(
ctx, txn, db, sc, objectName, flags.AvoidCached, flags.RequireMutable,
in pkg/sql/catalog/descs.(*Collection).getObjectByNameIgnoringRequiredAndType
}()
prefix, desc, err = tc.getObjectByNameIgnoringRequiredAndType(
ctx, txn, catalogName, schemaName, objectName, flags,
in pkg/sql/catalog/descs.(*Collection).getObjectByName
) (prefix catalog.ResolvedObjectPrefix, desc catalog.Descriptor, err error) {
return tc.getObjectByName(ctx, txn, db, schema, object, flags)
}
in pkg/sql/catalog/descs.(*Collection).GetObjectDesc
prefix, objMeta, err = sc.GetObjectDesc(ctx, p.txn, dbName, scName, obName, flags)
return objMeta != nil, prefix, objMeta, err
in pkg/sql.(*planner).LookupObject
if isVirtualSchema || curDb != "" {
if found, prefix, result, err = r.LookupObject(
ctx, lookupFlags, curDb, u.Schema(), u.Object(),
in pkg/sql/catalog/resolver.ResolveExisting
) (res catalog.Descriptor, _ catalog.ResolvedObjectPrefix, err error) {
found, prefix, obj, err := ResolveExisting(ctx, un, sc, lookupFlags, sc.CurrentDatabase(), sc.CurrentSearchPath())
if err != nil {
in pkg/sql/catalog/resolver.ResolveExistingObject
un := tn.ToUnresolvedObjectName()
desc, prefix, err := ResolveExistingObject(ctx, sc, un, lookupFlags)
if err != nil || desc == nil {
in pkg/sql/catalog/resolver.ResolveExistingTableObject
lflags := tree.ObjectLookupFlagsWithRequiredTableKind(tree.ResolveAnyTableKind)
prefix, desc, err := resolver.ResolveExistingTableObject(ctx, oc.planner, &oc.tn, lflags)
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
case *tree.TableName:
tab, alias = b.resolveTable(t, priv)
depName = opt.DepByName(t)
in pkg/sql/opt/optbuilder.(*Builder).resolveTableForMutation
// Find which table we're working on, check the permissions.
tab, depName, alias, refColumns := b.resolveTableForMutation(ins.Table, privilege.INSERT)
in pkg/sql/opt/optbuilder.(*Builder).buildInsert
return b.processWiths(stmt.With, inScope, func(inScope *scope) *scope {
return b.buildInsert(stmt, inScope)
})
in pkg/sql/opt/optbuilder.(*Builder).buildStmt.func2
inScope.atRoot = false
outScope := buildStmt(inScope)
outScope.expr = b.buildWiths(outScope.expr, correlatedCTEs)
in pkg/sql/opt/optbuilder.(*Builder).processWiths
case *tree.Insert:
return b.processWiths(stmt.With, inScope, func(inScope *scope) *scope {
return b.buildInsert(stmt, inScope)
in pkg/sql/opt/optbuilder.(*Builder).buildStmt
b.ctes = nil
outScope = b.buildStmt(stmt, desiredTypes, inScope)
// Build With operators for any CTEs hoisted to the top level.
in pkg/sql/opt/optbuilder.(*Builder).buildStmtAtRoot
// and physical properties.
outScope := b.buildStmtAtRoot(b.stmt, nil /* desiredTypes */)
in pkg/sql/opt/optbuilder.(*Builder).Build
bld.KeepPlaceholders = true
if err := bld.Build(); err != nil {
return nil, err
in pkg/sql.(*optPlanningCtx).buildReusableMemo
memo, err := opc.buildReusableMemo(ctx)
if err != nil {
in pkg/sql.(*planner).prepareUsingOptimizer
// future.
flags, err := p.prepareUsingOptimizer(ctx)
if err != nil {
in pkg/sql.(*connExecutor).populatePrepared
p.semaCtx.Annotations = tree.MakeAnnotations(stmt.NumAnnotations)
flags, err = ex.populatePrepared(ctx, txn, placeholderHints, p)
return err
in pkg/sql.(*connExecutor).prepare.func1

cockroach/pkg/kv/db.go

Lines 835 to 837 in 0c8df44

err := txn.exec(ctx, func(ctx context.Context, txn *Txn) error {
return retryable(ctx, txn)
})
in pkg/kv.runTxn.func1

cockroach/pkg/kv/txn.go

Lines 907 to 909 in 0c8df44

}
err = fn(ctx, txn)
in pkg/kv.(*Txn).exec

cockroach/pkg/kv/db.go

Lines 834 to 836 in 0c8df44

func runTxn(ctx context.Context, txn *Txn, retryable func(context.Context, *Txn) error) error {
err := txn.exec(ctx, func(ctx context.Context, txn *Txn) error {
return retryable(ctx, txn)
in pkg/kv.runTxn

cockroach/pkg/kv/db.go

Lines 816 to 818 in 0c8df44

txn.SetDebugName("unnamed")
return runTxn(ctx, txn, retryable)
}
in pkg/kv.(*DB).Txn
// than bubbling them up to the connExecutor state machine.
if err := ex.server.cfg.DB.Txn(ctx, prepare); err != nil {
return nil, err
in pkg/sql.(*connExecutor).prepare
// Prepare the query. This completes the typing of placeholders.
prepared, err := ex.prepare(ctx, stmt, placeholderHints, rawTypeHints, origin)
if err != nil {
in pkg/sql.(*connExecutor).addPreparedStmt

pkg/kv/txn.go in pkg/kv.(*Txn).UpdateDeadline at line 773
pkg/sql/catalog/descs/leased_descriptors.go in pkg/sql/catalog/descs.(*leasedDescriptors).maybeUpdateDeadline at line 217
pkg/sql/catalog/descs/leased_descriptors.go in pkg/sql/catalog/descs.(*leasedDescriptors).getResult at line 183
pkg/sql/catalog/descs/leased_descriptors.go in pkg/sql/catalog/descs.(*leasedDescriptors).getByName at line 112
pkg/sql/catalog/descs/descriptor.go in pkg/sql/catalog/descs.(*Collection).getByName at line 200
pkg/sql/catalog/descs/object.go in pkg/sql/catalog/descs.(*Collection).getObjectByNameIgnoringRequiredAndType at line 168
pkg/sql/catalog/descs/object.go in pkg/sql/catalog/descs.(*Collection).getObjectByName at line 61
pkg/sql/catalog/descs/object.go in pkg/sql/catalog/descs.(*Collection).GetObjectDesc at line 36
pkg/sql/resolver.go in pkg/sql.(*planner).LookupObject at line 190
pkg/sql/catalog/resolver/resolver.go in pkg/sql/catalog/resolver.ResolveExisting at line 395
pkg/sql/catalog/resolver/resolver.go in pkg/sql/catalog/resolver.ResolveExistingObject at line 184
pkg/sql/catalog/resolver/resolver.go in pkg/sql/catalog/resolver.ResolveExistingTableObject at line 121
pkg/sql/opt_catalog.go in pkg/sql.(*optCatalog).ResolveDataSource at line 206
pkg/sql/opt/optbuilder/util.go in pkg/sql/opt/optbuilder.(*Builder).resolveDataSource at line 604
pkg/sql/opt/optbuilder/util.go in pkg/sql/opt/optbuilder.(*Builder).resolveTable at line 569
pkg/sql/opt/optbuilder/util.go in pkg/sql/opt/optbuilder.(*Builder).resolveTableForMutation at line 529
pkg/sql/opt/optbuilder/insert.go in pkg/sql/opt/optbuilder.(*Builder).buildInsert at line 184
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).buildStmt.func2 at line 293
pkg/sql/opt/optbuilder/with.go in pkg/sql/opt/optbuilder.(*Builder).processWiths at line 111
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).buildStmt at line 292
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).buildStmtAtRoot at line 241
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).Build at line 215
pkg/sql/plan_opt.go in pkg/sql.(*optPlanningCtx).buildReusableMemo at line 380
pkg/sql/plan_opt.go in pkg/sql.(*planner).prepareUsingOptimizer at line 123
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).populatePrepared at line 287
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).prepare.func1 at line 220
pkg/kv/db.go in pkg/kv.runTxn.func1 at line 836
pkg/kv/txn.go in pkg/kv.(*Txn).exec at line 908
pkg/kv/db.go in pkg/kv.runTxn at line 835
pkg/kv/db.go in pkg/kv.(*DB).Txn at line 817
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).prepare at line 232
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).addPreparedStmt at line 111
Tag Value
Cockroach Release v21.2.4
Cockroach SHA: 0c8df44
Platform linux amd64
Distribution CCL
Environment development
Command server
Go Version ``
# of CPUs
# of Goroutines

Jira issue: CRDB-13324

Metadata

Metadata

Assignees

Labels

C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.GA-blockerO-sentryOriginated from an in-the-wild panic report.T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)branch-release-23.1Used to mark GA and release blockers, technical advisories, and bugs for 23.1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions