{"record":{"id":"5d656d4e42e5726d","repo":"vitessio/vitess","slug":"streams-are-mismatched-across-source-shards-v","errorCode":null,"errorMessage":"streams are mismatched across source shards: %v","messagePattern":"streams are mismatched across source shards: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/workflow/resharder.go","lineNumber":220,"sourceCode":"\t\t\t\trefKey := fmt.Sprintf(\"%s:%s:%s\", workflow.Workflow, bls.Keyspace, bls.Shard)\n\t\t\t\tif mustCreate {\n\t\t\t\t\trs.refStreams[refKey] = &refStream{\n\t\t\t\t\t\tworkflow:        workflow.Workflow,\n\t\t\t\t\t\tbls:             bls,\n\t\t\t\t\t\tcell:            workflow.Cells,\n\t\t\t\t\t\ttabletTypes:     discovery.BuildTabletTypesString(workflow.TabletTypes, workflow.TabletSelectionPreference),\n\t\t\t\t\t\tworkflowType:    workflow.WorkflowType,\n\t\t\t\t\t\tworkflowSubType: workflow.WorkflowSubType,\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif !ref[refKey] {\n\t\t\t\t\t\treturn fmt.Errorf(\"streams are mismatched across source shards for workflow: %s\", workflow)\n\t\t\t\t\t}\n\t\t\t\t\tdelete(ref, refKey)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(ref) != 0 {\n\t\t\t\treturn fmt.Errorf(\"streams are mismatched across source shards: %v\", ref)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\treturn err\n}\n\n// blsIsReference is partially copied from streamMigrater.templatize.\n// It reuses the constants from that function also.\nfunc (rs *resharder) blsIsReference(bls *binlogdatapb.BinlogSource) (bool, error) {\n\tstreamType := StreamTypeUnknown\n\tfor _, rule := range bls.Filter.Rules {\n\t\ttyp, err := rs.identifyRuleType(rule)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tswitch typ {","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/workflow/resharder.go#L202-L238","documentation":"After processing all streams on a source shard, the resharder checks that the accumulated set of reference-stream keys (ref) has been fully matched. Leftover keys mean some reference streams exist on one shard but not on others, so the stream sets across source shards are inconsistent and resharding is aborted.","triggerScenarios":"Reshard/MigrateStreams where reference-table streams (streams filtering on reference tables) exist on some source shards but are missing (or have differing filter/settings) on others.","commonSituations":"Reference table streams were set up on a subset of shards; an interrupted migration left partial reference streams; manual per-shard stream creation for reference tables.","solutions":["Ensure every source shard has identical reference streams: compare _vt.vreplication rows across shards.","Recreate the missing reference streams on the shards that lack them.","Cancel and re-run the stream migration once all shards are consistent."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"-- Ensure reference streams exist identically on all source shards\nSELECT shard, workflow FROM _vt.vreplication WHERE workflow LIKE '%reference%' ORDER BY workflow, shard;","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"mismatched across source shards: \") {\n    // parse the listed ref keys and create the missing streams\n}","preventionTips":["Create reference-table streams on every shard in one operation","Reconcile partially-created reference streams before resharding"],"tags":["vreplication","resharding","consistency"],"backgroundTag":"vreplication-stream-mismatch-across-shards","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}