{"record":{"id":"9d8f9444a5edcb0b","repo":"vitessio/vitess","slug":"failed-to-parse-max-tps-column-v","errorCode":null,"errorMessage":"failed to parse max_tps column: %v","messagePattern":"failed to parse max_tps column: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/binlog/binlogplayer/binlog_player.go","lineNumber":587,"sourceCode":"\tWorkflowOptions    *vtctldata.WorkflowOptions\n}\n\n// ReadVRSettings retrieves the settings for a vreplication stream.\nfunc ReadVRSettings(dbClient DBClient, uid int32) (VRSettings, error) {\n\tquery := fmt.Sprintf(GetWorkflowQuery, uid)\n\tqr, err := dbClient.ExecuteFetch(query, 1)\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"error %v in selecting vreplication settings %v\", err, query)\n\t}\n\n\tif len(qr.Rows) != 1 {\n\t\treturn VRSettings{}, fmt.Errorf(\"checkpoint information not available in db for %v\", uid)\n\t}\n\tvrRow := qr.Named().Row()\n\n\tmaxTPS, err := vrRow.ToInt64(\"max_tps\")\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse max_tps column: %v\", err)\n\t}\n\tmaxReplicationLag, err := vrRow.ToInt64(\"max_replication_lag\")\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse max_replication_lag column: %v\", err)\n\t}\n\tstartPos, err := DecodePosition(vrRow.AsString(\"pos\", \"\"))\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse pos column: %v\", err)\n\t}\n\tstopPos, err := replication.DecodePosition(vrRow.AsString(\"stop_pos\", \"\"))\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse stop_pos column: %v\", err)\n\t}\n\tworkflowType, err := vrRow.ToInt32(\"workflow_type\")\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse workflow_type column: %v\", err)\n\t}\n\tworkflowSubType, err := vrRow.ToInt32(\"workflow_sub_type\")","sourceCodeStart":569,"sourceCodeEnd":605,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/binlog/binlogplayer/binlog_player.go#L569-L605","documentation":"The max_tps column of the vreplication checkpoint row could not be converted to an int64 by the named-row helper. VRSettings.MaxTPS throttles event application; a corrupt or non-numeric value makes the settings unusable.","triggerScenarios":"vrRow.ToInt64(\"max_tps\") fails: the column holds a non-numeric string, NULL in a schema that lacks the ToInt64 NULL handling, or the row was written by an older/newer Vitess with a different column type.","commonSituations":"Manual edits to _vt.vreplication inserting garbage into max_tps; restores of _vt tables from dumps with altered types; partial writes during a crashed workflow insert.","solutions":["Inspect the row: `select uid, max_tps from _vt.vreplication where uid=<id>` and check the stored value.","Fix the value with VExec or SQL: `update _vt.vreplication set max_tps=<n> where uid=<id>` (a sane default is 2147483647 meaning unlimited).","If the schema/column type is wrong, restore the canonical _vt.vreplication schema for your Vitess version.","If corruption is from an external writer, find and stop whatever is modifying the row."],"exampleFix":"// before\nupdate _vt.vreplication set max_tps='fast' where uid=1;\n// after\nupdate _vt.vreplication set max_tps=2147483647 where uid=1;","handlingStrategy":"validation","validationCode":"qr, _ := dbClient.ExecuteFetch(fmt.Sprintf(\"SELECT max_tps FROM _vt.vreplication WHERE uid=%d\", uid), 1)\nif len(qr.Rows) == 1 {\n\tv := qr.Named().Row().AsString(\"max_tps\", \"\")\n\tif _, err := strconv.ParseInt(v, 10, 64); err != nil {\n\t\treturn fmt.Errorf(\"max_tps is not an integer (%q); fix the row before proceeding\", v)\n\t}\n}","typeGuard":"func isNumeric(s string) bool {\n\t_, err := strconv.ParseInt(s, 10, 64)\n\treturn err == nil\n}","tryCatchPattern":"settings, err := binlogplayer.ReadVRSettings(dbClient, uid)\nif err != nil && strings.Contains(err.Error(), \"failed to parse max_tps\") {\n\t_, _ = dbClient.ExecuteFetch(fmt.Sprintf(\"UPDATE _vt.vreplication SET max_tps=%d WHERE uid=%d\", math.MaxInt32, uid), 0)\n\tsettings, err = binlogplayer.ReadVRSettings(dbClient, uid)\n}","preventionTips":["Never hand-edit _vt.vreplication numeric columns; use VExec.","Use 2147483647 as the conventional 'unlimited TPS' value.","Keep _vt tables from same-version backups only."],"tags":["vreplication","data-corruption","mysql","parsing"],"backgroundTag":"column-parse-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}