{"record":{"id":"f2d3658e4e484d1c","repo":"vitessio/vitess","slug":"unexpected-statement-type-s-in-row-based-replicat","errorCode":null,"errorMessage":"unexpected statement type %s in row-based replication: %q","messagePattern":"unexpected statement type (.+?) in row-based replication: %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vttablet/tabletserver/vstreamer/vstreamer.go","lineNumber":728,"sourceCode":"\t\tcase sqlparser.StmtOther, sqlparser.StmtAnalyze, sqlparser.StmtPriv, sqlparser.StmtSet, sqlparser.StmtComment, sqlparser.StmtFlush:\n\t\t\t// These are either:\n\t\t\t// 1) DBA statements like REPAIR that can be ignored.\n\t\t\t// 2) Privilege-altering statements like GRANT/REVOKE\n\t\t\t//    that we want to keep out of the stream for now.\n\t\t\tif shouldSend(binlogdatapb.VEventType_GTID) {\n\t\t\t\tvevents = append(vevents, &binlogdatapb.VEvent{\n\t\t\t\t\tType: binlogdatapb.VEventType_GTID,\n\t\t\t\t\tGtid: replication.EncodePosition(vs.pos),\n\t\t\t\t})\n\t\t\t}\n\t\t\t// OTHER is the terminal marker for these statements. It must still be\n\t\t\t// present internally so parseEvents flushes buffered requested events\n\t\t\t// even when OTHER is filtered from the caller's output.\n\t\t\tvevents = append(vevents, &binlogdatapb.VEvent{\n\t\t\t\tType: binlogdatapb.VEventType_OTHER,\n\t\t\t})\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected statement type %s in row-based replication: %q\", cat, q.SQL)\n\t\t}\n\tcase ev.IsRowsQuery():\n\t\tif !shouldSend(binlogdatapb.VEventType_ROWS_QUERY) {\n\t\t\treturn nil, nil\n\t\t}\n\t\tquery, err := ev.RowsQuery(vs.format)\n\t\tif err != nil {\n\t\t\treturn nil, vterrors.Wrapf(err, \"failed to parse ROWS_QUERY_LOG_EVENT\")\n\t\t}\n\t\tvevents = append(vevents, &binlogdatapb.VEvent{\n\t\t\tType:      binlogdatapb.VEventType_ROWS_QUERY,\n\t\t\tStatement: query,\n\t\t})\n\tcase ev.IsTableMap():\n\t\tif !shouldSend(binlogdatapb.VEventType_ROW) && !shouldSend(binlogdatapb.VEventType_FIELD) {\n\t\t\treturn nil, nil\n\t\t}\n\t\t// This is very frequent. It precedes every row event.","sourceCodeStart":710,"sourceCodeEnd":746,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/tabletserver/vstreamer/vstreamer.go#L710-L746","documentation":"While streaming row-based replication (RBR), vstreamer encountered a statement-category query event it cannot represent in the row-event stream. Only a known subset of statement types (DDL, and certain filtered/annotated statements) is expected; anything else in a RBR stream is treated as a protocol violation and fails the vstream.","triggerScenarios":"parseEvent's switch over statement categories (cat) hits the default case for a query event received while streaming ROW events — e.g. an unrecognized or unsupported SQL statement type delivered as a QUERY_EVENT.","commonSituations":"binlog_format mixed/STATEMENT rows slipping through on the primary; custom or newer MySQL statement types the running Vitess version doesn't classify; binlog-annotate settings producing unexpected query payloads.","solutions":["Ensure the source MySQL servers use binlog_format=ROW (not STATEMENT or MIXED)","Upgrade Vitess so the sqlparser/analyzer recognizes the statement type being replicated","Identify the offending SQL from the error payload and avoid or rewrite that statement on the primary","Check binlog row image / annotate event settings for compatibility"],"exampleFix":"// before (my.cnf on primary)\nbinlog_format = MIXED\n// after\nbinlog_format = ROW","handlingStrategy":"validation","validationCode":"// On every source server:\n// SELECT @@global.binlog_format; -- must be ROW","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set binlog_format=ROW globally on all MySQL sources","Avoid statements Vitess cannot classify in replicated traffic","Keep Vitess upgraded to support newer MySQL statement types"],"tags":["binlog","row-based-replication","statement","vstreamer"],"backgroundTag":"unsupported-statement-in-rbr","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}