From c96bf3aecd626a35a628db98d3d3b29ae2bc2790 Mon Sep 17 00:00:00 2001 From: Liz van Dijk Date: Wed, 27 May 2026 12:55:16 +0100 Subject: [PATCH] Apply SessionVars to initPool dumpTableSchema runs against initPool, so it needs the same session pin (USE keyspace/shard from --shard) that the per-database data pool already gets. Without this, schema-only dumps of a MoveTables-import target return the source's schema because vtgate falls back to routing-rule resolution for fully-qualified SHOW CREATE TABLE. --- internal/dumper/dumper.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/dumper/dumper.go b/internal/dumper/dumper.go index ea9cb145..273d9eaa 100644 --- a/internal/dumper/dumper.go +++ b/internal/dumper/dumper.go @@ -89,7 +89,8 @@ type dumpContext struct { } func (d *Dumper) Run(ctx context.Context) error { - initPool, err := NewPool(d.log, d.cfg.Threads, d.cfg.Address, d.cfg.User, d.cfg.Password, nil, "") + // dumpTableSchema runs against initPool, so it needs --shard's USE pin in SessionVars too. + initPool, err := NewPool(d.log, d.cfg.Threads, d.cfg.Address, d.cfg.User, d.cfg.Password, d.cfg.SessionVars, "") if err != nil { return err }