{"record":{"id":"826e42253149fa5a","repo":"vitessio/vitess","slug":"error-v-updating-time","errorCode":null,"errorMessage":"error %v updating time","messagePattern":"error (.+?) updating time","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"go/vt/vttablet/tabletmanager/vreplication/vreplicator.go","lineNumber":746,"sourceCode":"\t\tupdate, err := binlogplayer.GenerateUpdateTimeThrottled(vr.id, tm, appName, reasonThrottled)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, err := vr.dbClient.ExecuteFetch(update, maxRows); err != nil {\n\t\t\treturn fmt.Errorf(\"error %v updating time throttled\", err)\n\t\t}\n\t\treturn nil\n\t})\n\treturn err\n}\n\nfunc (vr *vreplicator) updateHeartbeatTime(tm int64) error {\n\tupdate, err := binlogplayer.GenerateUpdateHeartbeat(vr.id, tm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err := vr.dbClient.ExecuteFetch(update, maxRows); err != nil {\n\t\treturn fmt.Errorf(\"error %v updating time\", err)\n\t}\n\treturn nil\n}\n\nfunc (vr *vreplicator) clearFKCheck(dbClient *vdbClient) error {\n\t_, err := dbClient.Execute(\"set @@session.foreign_key_checks=0\")\n\treturn err\n}\n\nfunc (vr *vreplicator) clearFKRestrict(dbClient *vdbClient) error {\n\tif !vr.needFKRestrict() {\n\t\treturn nil\n\t}\n\t_, err := dbClient.Execute(\"set @@session.restrict_fk_on_non_standard_key=0\")\n\treturn err\n}\n\nfunc recalculatePKColsInfoByColumnNames(uniqueKeyColumnNames []string, colInfos []*ColumnInfo) (pkColInfos []*ColumnInfo) {","sourceCodeStart":728,"sourceCodeEnd":764,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/tabletmanager/vreplication/vreplicator.go#L728-L764","documentation":"updateHeartbeatTime writes the current timestamp into _vt.vreplication.time_updated (GenerateUpdateHeartbeat). Failure is wrapped in this error. The heartbeat tells operators and auto-tuning logic that the stream is alive; failure to write it usually means the tablet cannot talk to MySQL or the row vanished.","triggerScenarios":"GenerateUpdateHeartbeat builds the UPDATE and ExecuteFetch fails: dead DB connection, mysqld down/read-only, or the _vt.vreplication row was deleted concurrently. Called from the heartbeat/recordHeartbeat path.","commonSituations":"MySQL failover or restart mid-stream; concurrent workflow cancellation; network partition between tablet and mysqld.","solutions":["Inspect the wrapped MySQL error (connection lost vs. row missing vs. read-only).","Check tablet-to-mysqld connectivity and recent failover/restart events.","If the row is gone, the workflow was cancelled — re-create/restart the workflow rather than forcing writes.","Monitor vitess_operation_errors / tablet logs for repeated heartbeat failures indicating a persistently unhealthy backend."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Health check before assuming stream liveness:\n// SELECT id, time_updated FROM _vt.vreplication WHERE id = <id>;\n// Verify backend reachability from the tablet (mysql ping).","typeGuard":null,"tryCatchPattern":"if _, err := vr.dbClient.ExecuteFetch(update, maxRows); err != nil {\n\tlog.Warn(\"heartbeat update failed\", slog.Any(\"error\", err))\n\t// retry with backoff; if row missing, the workflow was cancelled — stop\n}","preventionTips":["Monitor time_updated staleness as a workflow-health metric.","Alert on MySQL failovers and verify vreplication streams afterwards.","Avoid concurrent workflow deletion; use vtctldclient ordering.","Keep tablet-mysqld network paths redundant."],"tags":["vreplication","heartbeat","mysql"],"backgroundTag":"vreplication-heartbeat-update-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}