vitessio/vitess · error

GetShardReplication(%v, %v, %v) failed: %v

Error message

GetShardReplication(%v, %v, %v) failed: %v

What it means

DeleteShard reads each cell's ShardReplication object to enumerate the tablets it must consider for deletion. Errors other than ErrNoNode (which triggers the tablet-listing fallback) reach the default case: the GetShardReplication operation failed in a way the code does not handle, so deletion aborts with the cell/keyspace/shard and underlying error.

Source

Thrown at go/vt/wrangler/shard.go:109

		case topo.IsErrType(err, topo.NoNode):
			// No ShardReplication object. It means the
			// topo is inconsistent. Let's read all the
			// tablets for that cell, and if we find any
			// in our keyspace / shard, either abort or
			// try to delete them.
			aliases, err = wr.ts.GetTabletAliasesByCell(ctx, cell)
			if err != nil {
				return fmt.Errorf("GetTabletsByCell(%v) failed: %v", cell, err)
			}
		case err == nil:
			// We found a ShardReplication object. We
			// trust it to have all tablet records.
			aliases = make([]*topodatapb.TabletAlias, len(sri.Nodes))
			for i, n := range sri.Nodes {
				aliases[i] = n.TabletAlias
			}
		default:
			return fmt.Errorf("GetShardReplication(%v, %v, %v) failed: %v", cell, keyspace, shard, err)
		}

		// Get the corresponding Tablet records. Note
		// GetTabletMap ignores ErrNoNode, and it's good for
		// our purpose, it means a tablet was deleted but is
		// still referenced.
		tabletMap, err := wr.ts.GetTabletMap(ctx, aliases, nil)
		if err != nil {
			return fmt.Errorf("GetTabletMap() failed: %v", err)
		}

		// Remove the tablets that don't belong to our
		// keyspace/shard from the map.
		for a, ti := range tabletMap {
			if ti.Keyspace != keyspace || ti.Shard != shard {
				delete(tabletMap, a)
			}
		}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Retry DeleteShard once the topo server for the failing cell is healthy.
  2. Check for concurrent topo operations/locks on the shard and wait for them to complete.
  3. Inspect the wrapped error to distinguish transport issues from corrupted ShardReplication data; repair the node if corrupted.
Defensive patterns

Strategy: retry

Validate before calling

if _, err := ts.GetShardReplication(ctx, cell, keyspace, shard); err != nil && !errors.Is(err, topo.ErrNoNode) {
    return fmt.Errorf("topo unhealthy for cell %s: %v", cell, err)
}

Try / catch

err := wr.DeleteShard(ctx, keyspace, shard, evenIfServing, recursive)
if err != nil && strings.Contains(err.Error(), "GetShardReplication") {
    // wait for topo to recover / locks released, retry
}

Prevention

When it happens

Trigger: GetShardReplication returns a non-ErrNoNode error for a cell - topo server unreachable or timing out, permission error, corrupted node, or transient RPC failure while deleting the shard.

Common situations: etcd/zk timeouts during bulk shard cleanup; topo locks held by concurrent operations; network partition to one cell while deleting a multi-cell shard.

Related errors


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