Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic : Multi-column Vindex on Gen4 #9037

Closed
harshit-gangal opened this issue Oct 20, 2021 · 1 comment
Closed

Panic : Multi-column Vindex on Gen4 #9037

harshit-gangal opened this issue Oct 20, 2021 · 1 comment

Comments

@harshit-gangal
Copy link
Member

If multi-column vindex is defined on a table, Gen4 planner panic on it when using it on select query.

 panic: interface conversion: *vindexes.RegionJSON is not vindexes.SingleColumn: missing method Map

potential fix

diff --git a/go/vt/vtgate/planbuilder/routetree.go b/go/vt/vtgate/planbuilder/routetree.go
index 29bcb4d1fa..e460a46e1f 100644
--- a/go/vt/vtgate/planbuilder/routetree.go
+++ b/go/vt/vtgate/planbuilder/routetree.go
@@ -521,8 +521,11 @@ func (rp *routeTree) pickBestAvailableVindex() {
        for _, v := range rp.vindexPreds {
                option := v.bestOption()
                if option != nil && (rp.selected == nil || less(option.cost, rp.selected.cost)) {
-                       rp.selected = option
-                       rp.routeOpCode = option.opcode
+                       // Only pick single column vindexes for now until we have support for multi column vindexes.
+                       if _, ok := option.foundVindex.(vindexes.SingleColumn); ok {
+                               rp.selected = option
+                               rp.routeOpCode = option.opcode
+                       }
                }
        }
 }
@harshit-gangal
Copy link
Member Author

Fixed by #9061

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant