{"record":{"id":"823a20de6b1f00d4","repo":"vitessio/vitess","slug":"failed-to-get-position-after-clone-v","errorCode":null,"errorMessage":"failed to get position after clone: %v","messagePattern":"failed to get position after clone: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/mysqlctl/clone.go","lineNumber":140,"sourceCode":"\t\tUseSSL:        cloneConfig.UseSSL,\n\t}\n\n\tlog.Info(fmt.Sprintf(\"Clone executor configured for donor %s:%d\", executor.DonorHost, executor.DonorPort))\n\n\t// Execute the clone operation.\n\t// Note: ExecuteClone will wait for mysqld to restart and for the CLONE plugin to report successful completion\n\t// success via performance_schema before returning.\n\tif err := executor.ExecuteClone(ctx, mysqld, mycnf, cloneRestartWaitTimeout); err != nil {\n\t\treturn replication.Position{}, fmt.Errorf(\"clone execution failed: %v\", err)\n\t}\n\n\t// After CLONE, keep going across the expected mysqld restart.\n\tctx, cancel := context.WithTimeout(ctx, clonePrimaryPositionTimeout)\n\tdefer cancel()\n\n\tpos, err := mysqld.PrimaryPosition(ctx)\n\tif err != nil {\n\t\treturn replication.Position{}, fmt.Errorf(\"failed to get position after clone: %v\", err)\n\t}\n\n\tlog.Info(fmt.Sprintf(\"Clone completed successfully at position %v\", pos))\n\treturn pos, nil\n}\n\n// CloneExecutor handles MySQL CLONE REMOTE operations for backup and replica provisioning.\n// It executes CLONE INSTANCE FROM on the recipient to clone data from a donor.\ntype CloneExecutor struct {\n\t// DonorHost is the hostname or IP of the donor MySQL instance.\n\tDonorHost string\n\t// DonorPort is the MySQL port of the donor instance.\n\tDonorPort int\n\t// DonorUser is the MySQL user for clone operations (needs BACKUP_ADMIN on donor).\n\tDonorUser string\n\t// DonorPassword is the password for the clone user.\n\tDonorPassword string\n\t// UseSSL indicates whether to use SSL for the clone connection.","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/mysqlctl/clone.go#L122-L158","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// ensure mysqld is accepting connections before querying position\nif err := mysqld.Ping(ctx); err != nil {\n\t// wait/retry until mysqld is back up\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"failed to get position after clone\") {\n\t// wait for mysqld restart to finish, then retry the restore\n}","preventionTips":["Allow generous post-clone timeouts for large datasets","Watch mysqld error log during InnoDB recovery","Confirm socket/port config survives the clone restart"],"tags":["mysql","clone","replication","timeout"],"backgroundTag":"clone-position-lookup-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}