Skip to content

Commit

Permalink
small refactor - removed unused code
Browse files Browse the repository at this point in the history
Signed-off-by: Harshit Gangal <[email protected]>
  • Loading branch information
harshit-gangal committed Sep 8, 2023
1 parent f232f6b commit 2adba03
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
2 changes: 2 additions & 0 deletions go/vt/vtgate/engine/fk_verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"vitess.io/vitess/go/vt/vterrors"
)

// Verify contains the verification primitve and its type i.e. parent or child
type Verify struct {
Exec Primitive
Typ string
Expand All @@ -40,6 +41,7 @@ type FkVerify struct {
txNeeded
}

// constants for verification type.
const (
ParentVerify = "VerifyParent"
ChildVerify = "VerifyChild"
Expand Down
11 changes: 1 addition & 10 deletions go/vt/vtgate/planbuilder/plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ import (
"strings"
"testing"

"vitess.io/vitess/go/test/vschemawrapper"
querypb "vitess.io/vitess/go/vt/proto/query"

"github.com/nsf/jsondiff"
"github.com/stretchr/testify/require"

"vitess.io/vitess/go/sqltypes"
"vitess.io/vitess/go/test/utils"
"vitess.io/vitess/go/test/vschemawrapper"
"vitess.io/vitess/go/vt/key"
topodatapb "vitess.io/vitess/go/vt/proto/topodata"
"vitess.io/vitess/go/vt/servenv"
Expand Down Expand Up @@ -126,7 +124,6 @@ func setFks(t *testing.T, vschema *vindexes.VSchema) {
_ = vschema.AddForeignKey("sharded_fk_allow", "tbl10", createFkDefinition([]string{"sk", "col"}, "tbl2", []string{"col2", "col"}, sqlparser.Restrict, sqlparser.Restrict))
// FK from tbl10 referencing tbl3 that is not shard scoped.
_ = vschema.AddForeignKey("sharded_fk_allow", "tbl10", createFkDefinition([]string{"col"}, "tbl3", []string{"col"}, sqlparser.Restrict, sqlparser.Restrict))
setCol(t, vschema, "sharded_fk_allow", "tbl3", "col", sqltypes.VarChar, "CollationUtf8mb4ID")

// FK from tbl4 referencing tbl5 that is shard scoped.
_ = vschema.AddForeignKey("sharded_fk_allow", "tbl4", createFkDefinition([]string{"col4"}, "tbl5", []string{"col5"}, sqlparser.SetNull, sqlparser.Cascade))
Expand Down Expand Up @@ -172,12 +169,6 @@ func setFks(t *testing.T, vschema *vindexes.VSchema) {
}
}

func setCol(t *testing.T, vschema *vindexes.VSchema, ks string, name string, col string, typ querypb.Type, coll string) {
tbl, err := vschema.FindTable(ks, name)
require.NoError(t, err)
tbl.Columns = append(tbl.Columns, vindexes.Column{Name: sqlparser.NewIdentifierCI(col), Type: typ, CollationName: coll})
}

func TestSystemTables57(t *testing.T) {
// first we move everything to use 5.7 logic
oldVer := servenv.MySQLServerVersion()
Expand Down
9 changes: 0 additions & 9 deletions go/vt/vtgate/vindexes/vschema.go
Original file line number Diff line number Diff line change
Expand Up @@ -1336,12 +1336,3 @@ func (t *Table) getReferenceInKeyspace(keyspace string) *Table {
}
return t
}

func (t *Table) FindColumn(column sqlparser.IdentifierCI) *Column {
for _, c := range t.Columns {
if c.Name.Equal(column) {
return &c
}
}
return nil
}

0 comments on commit 2adba03

Please sign in to comment.