vitessio/vitess · error
cannot reshard streams with a mix of reference and sharded t
Error message
cannot reshard streams with a mix of reference and sharded tables: %v
What it means
blsIsReference determines the stream type (Reference vs Sharded) from the table filters inside a stream's BinlogSource. If different tables (or different streams) resolve to conflicting types — some reference, some sharded — the resharding code cannot handle the mix and errors, printing the offending BinlogSource.
Source
Thrown at go/vt/wrangler/resharder.go:269
return nil
})
return err
}
// blsIsReference is partially copied from streamMigrater.templatize.
// It reuses the constants from that function also.
func (rs *resharder) blsIsReference(bls *binlogdatapb.BinlogSource) (bool, error) {
streamType := workflow.StreamTypeUnknown
for _, rule := range bls.Filter.Rules {
typ, err := rs.identifyRuleType(rule)
if err != nil {
return false, err
}
switch typ {
case workflow.StreamTypeSharded:
if streamType == workflow.StreamTypeReference {
return false, fmt.Errorf("cannot reshard streams with a mix of reference and sharded tables: %v", bls)
}
streamType = workflow.StreamTypeSharded
case workflow.StreamTypeReference:
if streamType == workflow.StreamTypeSharded {
return false, fmt.Errorf("cannot reshard streams with a mix of reference and sharded tables: %v", bls)
}
streamType = workflow.StreamTypeReference
}
}
return streamType == workflow.StreamTypeReference, nil
}
func (rs *resharder) identifyRuleType(rule *binlogdatapb.Rule) (workflow.StreamType, error) {
vtable, ok := rs.vschema.Tables[rule.Match]
if !ok && !schema.IsInternalOperationTableName(rule.Match) {
return 0, fmt.Errorf("table %v not found in vschema", rule.Match)
}
if vtable != nil && vtable.Type == vindexes.TypeReference {View on GitHub (pinned to 01a25a7d17)
Solutions
- Inspect the stream's filter (print the BinlogSource from `_vt.vreplication`) and identify which rules are KeyRange-based vs reference-style.
- Split the workflow: move reference-table streams into a separate workflow/keyspace configuration from the sharded-table streams, then reshard each separately.
- Fix the filter rules so all tables in the stream are consistently typed (remove the keyrange on reference tables or drop them from this stream).
- Re-run the reshard after the stream configuration is homogeneous.
Example fix
// before: filter mixes rules
{"rules":[{"match":"ref_t"},{"match":"sharded_t","keyrange":"-80"}]}
// after: only sharded rules in this stream; move ref_t to a reference stream
{"rules":[{"match":"sharded_t","keyrange":"-80"}]} Defensive patterns
Strategy: validation
Validate before calling
for _, rule := range bls.Filter.Rules {
isSharded := rule.GetKeyrange() != ""
if lastSeen != nil && isSharded != *lastSeen {
return fmt.Errorf("filter mixes reference and sharded tables")
}
lastSeen = &isSharded
} Type guard
func isUniformStreamType(bls *binlogdatapb.BinlogSource) bool {
seenSharded, seenRef := false, false
for _, r := range bls.Filter.Rules {
if r.GetKeyrange() != "" { seenSharded = true } else { seenRef = true }
}
return !(seenSharded && seenRef)
} Try / catch
if err := wr.Reshard(...); err != nil {
if strings.Contains(err.Error(), "mix of reference and sharded tables") {
return splitReferenceAndShardedWorkflows(ctx, bls)
}
return err
} Prevention
- Keep reference-table streams in dedicated workflows separate from sharded-table streams
- Review filter rules for stray keyrange assignments on reference tables
- Validate stream type uniformity before initiating a reshard
When it happens
Trigger: Resharding a keyspace whose VReplication streams' filter rules mix `KeyRange`-sharded table rules with reference-table rules (no keyrange) within the same workflow's streams.
Common situations: A workflow was edited over time so some rules became reference tables while others stayed sharded; combining MoveTables output with reference-table streams manually; misconfigured filter JSON where a table intended to be reference got a keyrange assigned.
Related errors
- unsupported mix of '*' and columns
- unsupported qualifier for '*' expression
- unsupported non-select statement
- unsupported distinct clause
- unsupported select from dual
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/c435dd448f509fee.
Report an issue: GitHub.