From 01487f796fa634a3ad0e4bea63ac8b16208367ed Mon Sep 17 00:00:00 2001 From: reshke Date: Tue, 13 Feb 2024 13:11:26 +0000 Subject: [PATCH] Check distribution on create table statement --- router/qrouter/proxy_routing.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/router/qrouter/proxy_routing.go b/router/qrouter/proxy_routing.go index a96a9a851..07ea82911 100644 --- a/router/qrouter/proxy_routing.go +++ b/router/qrouter/proxy_routing.go @@ -630,6 +630,12 @@ func (qr *ProxyQrouter) CheckTableIsRoutable(ctx context.Context, node *lyx.Crea entries = append(entries, elt.ColName) } + // XXX: TBD: check also all columns + if _, err := qr.Mgr().QDB().GetRelationDistribution(ctx, node.TableName); err != nil { + return fmt.Errorf("create table stmt ignored: no distributions for this relation found") + } + + // TODO: drop this with migration from sharding rule to distributions if _, err := MatchShardingRule(ctx, node.TableName, entries, qr.mgr.QDB()); err == ErrRuleIntersect { return nil }