vitessio/vitess · error

no vdiff found for id %d on tablet %v

Error message

no vdiff found for id %d on tablet %v

What it means

getVDiffByID fetches exactly one _vt.vdiff row by primary-key id; if the query returns any row count other than 1 (i.e. zero, since id is a PK), it reports that no vdiff exists for that id on this tablet. Callers (create/resume handling, run loop) treat this as a missing-record condition.

Source

Thrown at go/vt/vttablet/tabletmanager/vdiff/engine.go:332

		return nil, err
	}
	if len(qr.Rows) == 0 {
		return nil, nil
	}
	return qr, nil
}

func (vde *Engine) getVDiffByID(ctx context.Context, dbClient binlogplayer.DBClient, id int64) (*sqltypes.Result, error) {
	query, err := sqlparser.ParseAndBind(sqlGetVDiffByID, sqltypes.Int64BindVariable(id), sqltypes.StringBindVariable(vde.dbName))
	if err != nil {
		return nil, err
	}
	qr, err := dbClient.ExecuteFetch(query, -1)
	if err != nil {
		return nil, err
	}
	if len(qr.Rows) != 1 {
		return nil, fmt.Errorf("no vdiff found for id %d on tablet %v",
			id, vde.thisTablet.Alias)
	}
	return qr, nil
}

func (vde *Engine) retryVDiffs(ctx context.Context) error {
	vde.mu.Lock()
	defer vde.mu.Unlock()
	dbClient := vde.dbClientFactoryFiltered()
	if err := dbClient.Connect(); err != nil {
		return err
	}
	defer dbClient.Close()

	qr, err := vde.getVDiffsToRetry(ctx, dbClient)
	if err != nil {
		return err
	}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Re-run the create/resume so a fresh vdiff record is inserted on the tablet.
  2. Check the table: SELECT * FROM _vt.vdiff WHERE id=<id>; on the target tablet to confirm absence.
  3. Avoid racing delete and show/resume operations on the same workflow.

Example fix

// before
ct, _ := vde.getVDiffByID(ctx, dbClient, staleID)
// after (operator flow)
vtctldclient vdiff --keyspace ks --workflow wf delete all
vtctldclient vdiff --keyspace ks --workflow wf create // fresh id
Defensive patterns

Strategy: validation

Validate before calling

var n int
_ := db.QueryRow("SELECT COUNT(*) FROM _vt.vdiff WHERE id=?", id).Scan(&n)
if n != 1 { recreateVDiff() } // record missing on this tablet

Try / catch

if err != nil && strings.Contains(err.Error(), "no vdiff found for id") {
  // record was deleted or tablet lost state; start a fresh vdiff
  createVDiff(keyspace, workflow)
}

Prevention

When it happens

Trigger: handleCreateResumeAction or run calls getVDiffByID with an id that has no row in this tablet's local _vt.vdiff table — e.g. the record was deleted concurrently or the tablet's local table was recreated.

Common situations: A 'vdiff delete all' racing with a create/resume; targeting a replica tablet that was recently rebuilt/restored and lost _vt.vdiff rows; resuming after someone manually cleaned the table.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/1145a3fc1494de13. Report an issue: GitHub.