vitessio/vitess · error
failed to get position after clone: %v
Error message
failed to get position after clone: %v
What it means
After a successful CLONE, CloneFromDonor queries mysqld.PrimaryPosition to learn the cloned position; if the query fails within the post-clone timeout (clonePrimaryPositionTimeout), the restore aborts because the position is required to configure replication.
Source
Thrown at go/vt/mysqlctl/clone.go:140
UseSSL: cloneConfig.UseSSL,
}
log.Info(fmt.Sprintf("Clone executor configured for donor %s:%d", executor.DonorHost, executor.DonorPort))
// Execute the clone operation.
// Note: ExecuteClone will wait for mysqld to restart and for the CLONE plugin to report successful completion
// success via performance_schema before returning.
if err := executor.ExecuteClone(ctx, mysqld, mycnf, cloneRestartWaitTimeout); err != nil {
return replication.Position{}, fmt.Errorf("clone execution failed: %v", err)
}
// After CLONE, keep going across the expected mysqld restart.
ctx, cancel := context.WithTimeout(ctx, clonePrimaryPositionTimeout)
defer cancel()
pos, err := mysqld.PrimaryPosition(ctx)
if err != nil {
return replication.Position{}, fmt.Errorf("failed to get position after clone: %v", err)
}
log.Info(fmt.Sprintf("Clone completed successfully at position %v", pos))
return pos, nil
}
// CloneExecutor handles MySQL CLONE REMOTE operations for backup and replica provisioning.
// It executes CLONE INSTANCE FROM on the recipient to clone data from a donor.
type CloneExecutor struct {
// DonorHost is the hostname or IP of the donor MySQL instance.
DonorHost string
// DonorPort is the MySQL port of the donor instance.
DonorPort int
// DonorUser is the MySQL user for clone operations (needs BACKUP_ADMIN on donor).
DonorUser string
// DonorPassword is the password for the clone user.
DonorPassword string
// UseSSL indicates whether to use SSL for the clone connection.View on GitHub (pinned to 01a25a7d17)
Solutions
- Check mysqld is up and accepting connections on the expected socket/port after clone.
- Inspect mysqld error log for slow InnoDB recovery; increase clonePrimaryPositionTimeout if restarts are slow.
- Retry the restore; the clone may have completed but restart raced the query.
- Verify dbconfigs/socket settings still match the restarted mysqld.
Defensive patterns
Strategy: retry
Validate before calling
// ensure mysqld is accepting connections before querying position
if err := mysqld.Ping(ctx); err != nil {
// wait/retry until mysqld is back up
} Try / catch
if err != nil && strings.Contains(err.Error(), "failed to get position after clone") {
// wait for mysqld restart to finish, then retry the restore
} Prevention
- Allow generous post-clone timeouts for large datasets
- Watch mysqld error log during InnoDB recovery
- Confirm socket/port config survives the clone restart
When it happens
Trigger: mysqld not fully restarted after CLONE, MySQL connection unavailable (wrong socket/port after restart), performance_schema not readable, or timeout too short for slow restarts.
Common situations: Slow mysqld startup after cloning a large dataset, mysqld restart racing the position query, socket path changed by the cloned my.cnf, MySQL refusing connections during InnoDB recovery.
Related errors
- clone execution failed: %v
- Last_SQL_Error: ${LastSQL_Error}, Last_IO_Error: ${LastIO_Er
- GetPreviousGTIDs: previous GTIDs not found
- ErrNoSemiSync
- no rpl_semi_sync_replica_status variable in mysql
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/823a20de6b1f00d4.
Report an issue: GitHub.