vitessio/vitess · error
GetKeyspaces
Error message
GetKeyspaces: %w
What it means
CopyKeyspaces wraps errors from fromTS.GetKeyspaces(ctx) with the 'GetKeyspaces: ' prefix. This function copies all keyspace records from a source topo server to a destination topo server. The wrapped error means the source topology could not be read at all (the listing RPC failed), so the copy aborts before touching the destination.
Solutions
- Verify the source topo server (fromTS) is reachable: check topo flags/config (--topo_implementation, --topo_server, --topo_etcd_server etc.) and test connectivity.
- Increase the context timeout / retry the copy if the deadline was exceeded.
- Check the source topo backend (etcd/zk/k8s) health and logs for the root cause included in the wrapped error.
- Inspect fromTS connection credentials/ACLs for read access to the keyspaces path.
Example fix
// before
keyspaces, err := fromTS.GetKeyspaces(ctx)
if err != nil {
return fmt.Errorf("GetKeyspaces: %w", err)
}
// after (caller-side retry)
var keyspaces []string
err := retry.Do(func() error {
var e error
keyspaces, e = fromTS.GetKeyspaces(ctx)
return e
}, retry.Attempts(3), retry.Delay(time.Second))
if err != nil {
return fmt.Errorf("GetKeyspaces: %w", err)
} Defensive patterns
Strategy: retry
Validate before calling
if _, err := fromTS.GetKeyspaces(ctx); err != nil {
return fmt.Errorf("source topo unreachable: %w", err)
} Try / catch
keyspaces, err := fromTS.GetKeyspaces(ctx)
if err != nil {
if ctx.Err() != nil {
return ctx.Err()
}
return fmt.Errorf("GetKeyspaces: %w", err)
} Prevention
- Pre-flight check source topo connectivity with a cheap GetKeyspaces or GetKnownCells call before copying.
- Use a context with a generous but bounded deadline for topo operations.
- Monitor the source topo backend (etcd/zk) health before starting topo migrations.
- Pin topo server addresses in config and validate them at startup.
When it happens
Trigger: Calling topo/helpers.CopyKeyspaces(ctx, fromTS, toTS, parser) when fromTS.GetKeyspaces fails: source topo server unreachable, connection refused, context canceled/expired mid-list, or the global cell is corrupted or unavailable.
Common situations: Wrong vtctld/topo endpoint or port in config during topo-to-topo migrations; source etcd/zk cluster down or misconfigured; firewall blocking the topo port; context deadline too short on slow topo backends; network partitions during cluster-to-cluster copy tooling.
Related errors
- fromTS.GetKnownCells
- fromTS.GetKeyspaces
- cannot dial to server
- cannot execute remote command
- cell set overlaps with existing alias
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/cb381539c4b74596.
Report an issue: GitHub.
Appendix: source
Thrown at go/vt/topo/helpers/copy.go:40
"context"
"fmt"
"google.golang.org/protobuf/proto"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/sqlparser"
"vitess.io/vitess/go/vt/topo"
"vitess.io/vitess/go/vt/topo/topoproto"
"vitess.io/vitess/go/vt/vtgate/vindexes"
topodatapb "vitess.io/vitess/go/vt/proto/topodata"
)
// CopyKeyspaces will create the keyspaces in the destination topo.
func CopyKeyspaces(ctx context.Context, fromTS, toTS *topo.Server, parser *sqlparser.Parser) error {
keyspaces, err := fromTS.GetKeyspaces(ctx)
if err != nil {
return fmt.Errorf("GetKeyspaces: %w", err)
}
for _, keyspace := range keyspaces {
ki, err := fromTS.GetKeyspace(ctx, keyspace)
if err != nil {
return fmt.Errorf("GetKeyspace(%v): %w", keyspace, err)
}
if err := toTS.CreateKeyspace(ctx, keyspace, ki.Keyspace); err != nil {
if topo.IsErrType(err, topo.NodeExists) {
log.Warn(fmt.Sprintf("keyspace %v already exists", keyspace))
} else {
log.Error(fmt.Sprintf("CreateKeyspace(%v): %v", keyspace, err))
}
}
ksvs, err := fromTS.GetVSchema(ctx, keyspace)
switch {View on GitHub (pinned to 01a25a7d17)