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

Keyspace ServedFrom: remove this deprecated attribute and related code #14694

Merged
merged 5 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions go/cmd/vtctldclient/command/keyspaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import (
"vitess.io/vitess/go/cmd/vtctldclient/cli"
"vitess.io/vitess/go/constants/sidecar"
"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/vt/topo"

topodatapb "vitess.io/vitess/go/vt/proto/topodata"
vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata"
"vitess.io/vitess/go/vt/proto/vttime"
Expand Down Expand Up @@ -135,8 +133,6 @@ var createKeyspaceOptions = struct {
Force bool
AllowEmptyVSchema bool

ServedFromsMap cli.StringMapValue

KeyspaceType cli.KeyspaceTypeFlag
BaseKeyspace string
SnapshotTimestamp string
Expand Down Expand Up @@ -203,18 +199,6 @@ func commandCreateKeyspace(cmd *cobra.Command, args []string) error {
SidecarDbName: createKeyspaceOptions.SidecarDBName,
}

for n, v := range createKeyspaceOptions.ServedFromsMap.StringMapValue {
tt, err := topo.ParseServingTabletType(n)
if err != nil {
return err
}

req.ServedFroms = append(req.ServedFroms, &topodatapb.Keyspace_ServedFrom{
TabletType: tt,
Keyspace: v,
})
}

resp, err := client.CreateKeyspace(commandCtx, req)
if err != nil {
return err
Expand Down Expand Up @@ -422,7 +406,6 @@ func commandValidateVersionKeyspace(cmd *cobra.Command, args []string) error {
func init() {
CreateKeyspace.Flags().BoolVarP(&createKeyspaceOptions.Force, "force", "f", false, "Proceeds even if the keyspace already exists. Does not overwrite the existing keyspace record.")
CreateKeyspace.Flags().BoolVarP(&createKeyspaceOptions.AllowEmptyVSchema, "allow-empty-vschema", "e", false, "Allows a new keyspace to have no vschema.")
CreateKeyspace.Flags().Var(&createKeyspaceOptions.ServedFromsMap, "served-from", "Specifies a set of db_type:keyspace pairs used to serve traffic for the keyspace.")
CreateKeyspace.Flags().Var(&createKeyspaceOptions.KeyspaceType, "type", "The type of the keyspace.")
CreateKeyspace.Flags().StringVar(&createKeyspaceOptions.BaseKeyspace, "base-keyspace", "", "The base keyspace for a snapshot keyspace.")
CreateKeyspace.Flags().StringVar(&createKeyspaceOptions.SnapshotTimestamp, "snapshot-timestamp", "", "The snapshot time for a snapshot keyspace, as a timestamp in RFC3339 format.")
Expand Down
3 changes: 1 addition & 2 deletions go/test/endtoend/vtcombo/recreate/recreate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ func TestMain(m *testing.M) {
ReplicaCount: 2,
},
{
Name: redirected,
ServedFrom: ks1,
Name: redirected,
},
}

Expand Down
14 changes: 0 additions & 14 deletions go/test/endtoend/vtcombo/vttest_sample_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ var (
vtctldAddr string
mysqlAddress string
ks1 = "test_keyspace"
redirected = "redirected"
jsonTopo = `
{
"keyspaces": [
Expand All @@ -58,10 +57,6 @@ var (
"rdonlyCount": 1,
"replicaCount": 2
},
{
"name": "redirected",
"servedFrom": "test_keyspace"
},
{
"name": "routed",
"shards": [{"name": "0"}]
Expand Down Expand Up @@ -174,15 +169,6 @@ func assertInsertedRowsExist(ctx context.Context, t *testing.T, conn *vtgateconn
require.NoError(t, err)

assert.Equal(t, rowCount, len(res.Rows))

cur = conn.Session(redirected+":-80@replica", nil)
bindVariables = map[string]*querypb.BindVariable{
"id_start": {Type: querypb.Type_UINT64, Value: []byte(strconv.FormatInt(int64(idStart), 10))},
}
res, err = cur.Execute(ctx, "select * from test_table where id = :id_start", bindVariables)
require.NoError(t, err)
require.Equal(t, 1, len(res.Rows))
assert.Equal(t, "VARCHAR(\"test1000\")", res.Rows[0][1].String())
}

func assertRouting(ctx context.Context, t *testing.T, db *sql.DB) {
Expand Down
9 changes: 1 addition & 8 deletions go/vt/discovery/keyspace_events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,7 @@ func TestSrvKeyspaceWithNilNewKeyspace(t *testing.T) {
keyspace: keyspace,
shards: make(map[string]*shardState),
}
kss.lastKeyspace = &topodatapb.SrvKeyspace{
ServedFrom: []*topodatapb.SrvKeyspace_ServedFrom{
{
TabletType: topodatapb.TabletType_PRIMARY,
Keyspace: keyspace,
},
},
}
kss.lastKeyspace = &topodatapb.SrvKeyspace{}
require.True(t, kss.onSrvKeyspace(nil, nil))
}

Expand Down
Loading
Loading