Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
29 changes: 0 additions & 29 deletions go/cmd/vtctldclient/cli/pflag.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"github.com/spf13/pflag"

"vitess.io/vitess/go/flagutil"
"vitess.io/vitess/go/vt/key"
"vitess.io/vitess/go/vt/topo/topoproto"

topodatapb "vitess.io/vitess/go/vt/proto/topodata"
Expand All @@ -37,34 +36,6 @@ func (v *StringMapValue) Type() string {
return "cli.StringMapValue"
}

// KeyspaceIDTypeFlag adds the pflag.Value interface to a
// topodatapb.KeyspaceIdType.
type KeyspaceIDTypeFlag topodatapb.KeyspaceIdType

var _ pflag.Value = (*KeyspaceIDTypeFlag)(nil)

// Set is part of the pflag.Value interface.
func (v *KeyspaceIDTypeFlag) Set(arg string) error {
t, err := key.ParseKeyspaceIDType(arg)
if err != nil {
return err
}

*v = KeyspaceIDTypeFlag(t)

return nil
}

// String is part of the pflag.Value interface.
func (v *KeyspaceIDTypeFlag) String() string {
return key.KeyspaceIDTypeString(topodatapb.KeyspaceIdType(*v))
}

// Type is part of the pflag.Value interface.
func (v *KeyspaceIDTypeFlag) Type() string {
return "cli.KeyspaceIdTypeFlag"
}

// KeyspaceTypeFlag adds the pflag.Value interface to a topodatapb.KeyspaceType.
type KeyspaceTypeFlag topodatapb.KeyspaceType

Expand Down
70 changes: 7 additions & 63 deletions go/cmd/vtctldclient/command/keyspaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/spf13/cobra"

"vitess.io/vitess/go/cmd/vtctldclient/cli"
"vitess.io/vitess/go/vt/key"
"vitess.io/vitess/go/vt/logutil"
"vitess.io/vitess/go/vt/topo"
"vitess.io/vitess/go/vt/topo/topoproto"
Expand Down Expand Up @@ -139,9 +138,6 @@ var createKeyspaceOptions = struct {
Force bool
AllowEmptyVSchema bool

ShardingColumnName string
ShardingColumnType cli.KeyspaceIDTypeFlag

ServedFromsMap cli.StringMapValue

KeyspaceType cli.KeyspaceTypeFlag
Expand Down Expand Up @@ -190,15 +186,13 @@ func commandCreateKeyspace(cmd *cobra.Command, args []string) error {
cli.FinishedParsing(cmd)

req := &vtctldatapb.CreateKeyspaceRequest{
Name: name,
Force: createKeyspaceOptions.Force,
AllowEmptyVSchema: createKeyspaceOptions.AllowEmptyVSchema,
ShardingColumnName: createKeyspaceOptions.ShardingColumnName,
ShardingColumnType: topodatapb.KeyspaceIdType(createKeyspaceOptions.ShardingColumnType),
Type: topodatapb.KeyspaceType(createKeyspaceOptions.KeyspaceType),
BaseKeyspace: createKeyspaceOptions.BaseKeyspace,
SnapshotTime: snapshotTime,
DurabilityPolicy: createKeyspaceOptions.DurabilityPolicy,
Name: name,
Force: createKeyspaceOptions.Force,
AllowEmptyVSchema: createKeyspaceOptions.AllowEmptyVSchema,
Type: topodatapb.KeyspaceType(createKeyspaceOptions.KeyspaceType),
BaseKeyspace: createKeyspaceOptions.BaseKeyspace,
SnapshotTime: snapshotTime,
DurabilityPolicy: createKeyspaceOptions.DurabilityPolicy,
}

for n, v := range createKeyspaceOptions.ServedFromsMap.StringMapValue {
Expand Down Expand Up @@ -400,54 +394,6 @@ var setKeyspaceShardingInfoOptions = struct {
}{}

func commandSetKeyspaceShardingInfo(cmd *cobra.Command, args []string) error {
var (
keyspace = cmd.Flags().Arg(0)
columnName string
columnType = topodatapb.KeyspaceIdType_UNSET
)

switch len(cmd.Flags().Args()) {
case 1:
// Nothing else to do; we set keyspace already above.
case 2:
columnName = cmd.Flags().Arg(1)
case 3:
var err error
columnType, err = key.ParseKeyspaceIDType(cmd.Flags().Arg(2))
if err != nil {
return err
}
default:
// This should be impossible due to cobra.RangeArgs, but we handle it
// explicitly anyway.
return fmt.Errorf("SetKeyspaceShardingInfo expects between 1 and 3 positional args; have %d", len(cmd.Flags().Args()))
}

isColumnNameSet := columnName != ""
isColumnTypeSet := columnType != topodatapb.KeyspaceIdType_UNSET

if (isColumnNameSet && !isColumnTypeSet) || (!isColumnNameSet && isColumnTypeSet) {
return fmt.Errorf("both <column_name:%v> and <column_type:%v> must be set, or both must be unset", columnName, key.KeyspaceIDTypeString(columnType))
}

cli.FinishedParsing(cmd)

resp, err := client.SetKeyspaceShardingInfo(commandCtx, &vtctldatapb.SetKeyspaceShardingInfoRequest{
Keyspace: keyspace,
ColumnName: columnName,
ColumnType: columnType,
Force: setKeyspaceShardingInfoOptions.Force,
})
if err != nil {
return err
}

data, err := cli.MarshalJSON(resp)
if err != nil {
return err
}

fmt.Printf("%s\n", data)
return nil
}

Expand Down Expand Up @@ -507,8 +453,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().StringVar(&createKeyspaceOptions.ShardingColumnName, "sharding-column-name", "", "The column name to use for sharding operations")
CreateKeyspace.Flags().Var(&createKeyspaceOptions.ShardingColumnType, "sharding-column-type", "The type of the column to use for sharding operations")
Comment on lines -510 to -511
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ajm188 what is the right way to deprecate these options?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pflag has native support for this!! (vaguely gestures at "won't it be great to use pflag everywhere in the future?"):

CreateKeyspace.Flags().StringVar(&createKeyspaceOptions.ShardingColumnName, "sharding-column-name", ...)
CreateKeyspace.Flags().MarkDeprecated("sharding-column-name", "Keyspace.ShardingColumnName is no longer used for resharding") // feel free to tweak the deprecation message, i didn't give this much thought
// same pattern for ShardingColumnType

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I'm thinking we should let this PR delete these flags on main (to go into v15) and do a separate PR to deprecate them in v14 (on release-14.0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense to me!

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.")
Expand Down
8 changes: 4 additions & 4 deletions go/test/endtoend/cellalias/cell_alias_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ func TestAlias(t *testing.T) {
expectedPartitions[topodata.TabletType_PRIMARY] = []string{shard1.Name, shard2.Name}
expectedPartitions[topodata.TabletType_REPLICA] = []string{shard1.Name, shard2.Name}
expectedPartitions[topodata.TabletType_RDONLY] = []string{shard1.Name, shard2.Name}
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, "", 0, expectedPartitions, *localCluster)
sharding.CheckSrvKeyspace(t, cell2, keyspaceName, "", 0, expectedPartitions, *localCluster)
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, expectedPartitions, *localCluster)
sharding.CheckSrvKeyspace(t, cell2, keyspaceName, expectedPartitions, *localCluster)

// Adds alias so vtgate can route to replica/rdonly tablets that are not in the same cell, but same alias
err = localCluster.VtctlclientProcess.ExecuteCommand("AddCellsAlias", "--",
Expand Down Expand Up @@ -306,8 +306,8 @@ func TestAddAliasWhileVtgateUp(t *testing.T) {
expectedPartitions[topodata.TabletType_PRIMARY] = []string{shard1.Name, shard2.Name}
expectedPartitions[topodata.TabletType_REPLICA] = []string{shard1.Name, shard2.Name}
expectedPartitions[topodata.TabletType_RDONLY] = []string{shard1.Name, shard2.Name}
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, "", 0, expectedPartitions, *localCluster)
sharding.CheckSrvKeyspace(t, cell2, keyspaceName, "", 0, expectedPartitions, *localCluster)
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, expectedPartitions, *localCluster)
sharding.CheckSrvKeyspace(t, cell2, keyspaceName, expectedPartitions, *localCluster)

vtgateInstance := localCluster.NewVtgateInstance()
vtgateInstance.CellsToWatch = allCells
Expand Down
3 changes: 0 additions & 3 deletions go/test/endtoend/keyspace/keyspace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,6 @@ func TestGetKeyspace(t *testing.T) {

err = json.Unmarshal([]byte(output), &keyspace)
require.Nil(t, err)

assert.Equal(t, keyspace.ShardingColumnName, "keyspace_id")
assert.Equal(t, keyspace.ShardingColumnType, topodata.KeyspaceIdType(1))
}

func TestDeleteKeyspace(t *testing.T) {
Expand Down
8 changes: 1 addition & 7 deletions go/test/endtoend/sharding/base_sharding.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,8 @@ const (
)

// CheckSrvKeyspace verifies the schema with expectedPartition
func CheckSrvKeyspace(t *testing.T, cell string, ksname string, shardingCol string, colType topodata.KeyspaceIdType, expectedPartition map[topodata.TabletType][]string, ci cluster.LocalProcessCluster) {
func CheckSrvKeyspace(t *testing.T, cell string, ksname string, expectedPartition map[topodata.TabletType][]string, ci cluster.LocalProcessCluster) {
srvKeyspace := GetSrvKeyspace(t, cell, ksname, ci)
if shardingCol != "" {
assert.Equal(t, srvKeyspace.ShardingColumnName, shardingCol)
}
if colType != 0 {
assert.Equal(t, srvKeyspace.ShardingColumnType, colType)
}

currentPartition := map[topodata.TabletType][]string{}

Expand Down
2 changes: 1 addition & 1 deletion go/test/endtoend/sharding/initialsharding/sharding_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ func KillVtgateInstances() {
}

func checkSrvKeyspaceForSharding(t *testing.T, ksName string, expectedPartitions map[topodatapb.TabletType][]string) {
sharding.CheckSrvKeyspace(t, cell, ksName, "", 0, expectedPartitions, *ClusterInstance)
sharding.CheckSrvKeyspace(t, cell, ksName, expectedPartitions, *ClusterInstance)
}

// Create a new init_db.sql file that sets up passwords for all users.
Expand Down
12 changes: 4 additions & 8 deletions go/test/endtoend/sharding/mergesharding/mergesharding_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,6 @@ func TestMergesharding(t *testing.T, useVarbinaryShardingKeyType bool) {
err = clusterInstance.VtctlclientProcess.ExecuteCommand("RebuildKeyspaceGraph", keyspaceName)
require.NoError(t, err)

// Get Keyspace and verify the structure
srvKeyspace := sharding.GetSrvKeyspace(t, cell, keyspaceName, *clusterInstance)
assert.Equal(t, "", srvKeyspace.GetShardingColumnName())

//Start Tablets and Wait for the Process
for _, shard := range clusterInstance.Keyspaces[0].Shards {
for _, tablet := range shard.Vttablets {
Expand Down Expand Up @@ -266,7 +262,7 @@ func TestMergesharding(t *testing.T, useVarbinaryShardingKeyType bool) {
expectedPartitions[topodatapb.TabletType_PRIMARY] = []string{shard0.Name, shard1.Name, shard2.Name}
expectedPartitions[topodatapb.TabletType_REPLICA] = []string{shard0.Name, shard1.Name, shard2.Name}
expectedPartitions[topodatapb.TabletType_RDONLY] = []string{shard0.Name, shard1.Name, shard2.Name}
sharding.CheckSrvKeyspace(t, cell, keyspaceName, "", 0, expectedPartitions, *clusterInstance)
sharding.CheckSrvKeyspace(t, cell, keyspaceName, expectedPartitions, *clusterInstance)

// we need to create the schema, and the worker will do data copying
err = clusterInstance.VtctlclientProcess.ExecuteCommand("CopySchemaShard",
Expand Down Expand Up @@ -434,7 +430,7 @@ func TestMergesharding(t *testing.T, useVarbinaryShardingKeyType bool) {
expectedPartitions[topodatapb.TabletType_PRIMARY] = []string{shard0.Name, shard1.Name, shard2.Name}
expectedPartitions[topodatapb.TabletType_RDONLY] = []string{shard3.Name, shard2.Name}
expectedPartitions[topodatapb.TabletType_REPLICA] = []string{shard0.Name, shard1.Name, shard2.Name}
sharding.CheckSrvKeyspace(t, cell, keyspaceName, "", 0, expectedPartitions, *clusterInstance)
sharding.CheckSrvKeyspace(t, cell, keyspaceName, expectedPartitions, *clusterInstance)

sharding.CheckTabletQueryService(t, *shard0Rdonly, "NOT_SERVING", true, *clusterInstance)
sharding.CheckTabletQueryService(t, *shard1Rdonly, "NOT_SERVING", true, *clusterInstance)
Expand All @@ -448,7 +444,7 @@ func TestMergesharding(t *testing.T, useVarbinaryShardingKeyType bool) {
expectedPartitions[topodatapb.TabletType_PRIMARY] = []string{shard0.Name, shard1.Name, shard2.Name}
expectedPartitions[topodatapb.TabletType_RDONLY] = []string{shard3.Name, shard2.Name}
expectedPartitions[topodatapb.TabletType_REPLICA] = []string{shard3.Name, shard2.Name}
sharding.CheckSrvKeyspace(t, cell, keyspaceName, "", 0, expectedPartitions, *clusterInstance)
sharding.CheckSrvKeyspace(t, cell, keyspaceName, expectedPartitions, *clusterInstance)

// now serve from the split shards
err = clusterInstance.VtctlclientProcess.ExecuteCommand(
Expand All @@ -459,7 +455,7 @@ func TestMergesharding(t *testing.T, useVarbinaryShardingKeyType bool) {
expectedPartitions[topodatapb.TabletType_PRIMARY] = []string{shard3.Name, shard2.Name}
expectedPartitions[topodatapb.TabletType_RDONLY] = []string{shard3.Name, shard2.Name}
expectedPartitions[topodatapb.TabletType_REPLICA] = []string{shard3.Name, shard2.Name}
sharding.CheckSrvKeyspace(t, cell, keyspaceName, "", 0, expectedPartitions, *clusterInstance)
sharding.CheckSrvKeyspace(t, cell, keyspaceName, expectedPartitions, *clusterInstance)

sharding.CheckTabletQueryService(t, *shard0Primary, "NOT_SERVING", true, *clusterInstance)
sharding.CheckTabletQueryService(t, *shard1Primary, "NOT_SERVING", true, *clusterInstance)
Expand Down
24 changes: 10 additions & 14 deletions go/test/endtoend/sharding/resharding/resharding_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,6 @@ func TestResharding(t *testing.T, useVarbinaryShardingKeyType bool) {
err = clusterInstance.VtctlclientProcess.ExecuteCommand("RebuildKeyspaceGraph", keyspaceName)
require.Nil(t, err)

// Get Keyspace and verify the structure
srvKeyspace := sharding.GetSrvKeyspace(t, cell1, keyspaceName, *clusterInstance)
assert.Equal(t, "", srvKeyspace.GetShardingColumnName())

// Start Tablets
for _, shard := range clusterInstance.Keyspaces[0].Shards {
for _, tablet := range shard.Vttablets {
Expand Down Expand Up @@ -369,7 +365,7 @@ func TestResharding(t *testing.T, useVarbinaryShardingKeyType bool) {
expectedPartitions[topodatapb.TabletType_PRIMARY] = []string{shard0.Name, shard1.Name}
expectedPartitions[topodatapb.TabletType_REPLICA] = []string{shard0.Name, shard1.Name}
expectedPartitions[topodatapb.TabletType_RDONLY] = []string{shard0.Name, shard1.Name}
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, "", 0, expectedPartitions, *clusterInstance)
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, expectedPartitions, *clusterInstance)

// disable shard1Replica2, so we're sure filtered replication will go from shard1Replica1
err = clusterInstance.VtctlclientProcess.ExecuteCommand("ChangeTabletType", shard1Replica2.Alias, "spare")
Expand Down Expand Up @@ -648,14 +644,14 @@ func TestResharding(t *testing.T, useVarbinaryShardingKeyType bool) {
expectedPartitions[topodatapb.TabletType_PRIMARY] = []string{shard0.Name, shard1.Name}
expectedPartitions[topodatapb.TabletType_RDONLY] = []string{shard0.Name, shard2.Name, shard3.Name}
expectedPartitions[topodatapb.TabletType_REPLICA] = []string{shard0.Name, shard1.Name}
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, "", 0, expectedPartitions, *clusterInstance)
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, expectedPartitions, *clusterInstance)

// Cell 2 is not affected
expectedPartitions = map[topodatapb.TabletType][]string{}
expectedPartitions[topodatapb.TabletType_PRIMARY] = []string{shard0.Name, shard1.Name}
expectedPartitions[topodatapb.TabletType_RDONLY] = []string{shard0.Name, shard1.Name}
expectedPartitions[topodatapb.TabletType_REPLICA] = []string{shard0.Name, shard1.Name}
sharding.CheckSrvKeyspace(t, cell2, keyspaceName, "", 0, expectedPartitions, *clusterInstance)
sharding.CheckSrvKeyspace(t, cell2, keyspaceName, expectedPartitions, *clusterInstance)

sharding.CheckTabletQueryService(t, *shard0RdonlyZ2, "SERVING", false, *clusterInstance)
sharding.CheckTabletQueryService(t, *shard1RdonlyZ2, "SERVING", false, *clusterInstance)
Expand Down Expand Up @@ -685,9 +681,9 @@ func TestResharding(t *testing.T, useVarbinaryShardingKeyType bool) {
expectedPartitions[topodatapb.TabletType_PRIMARY] = []string{shard0.Name, shard1.Name}
expectedPartitions[topodatapb.TabletType_RDONLY] = []string{shard0.Name, shard2.Name, shard3.Name}
expectedPartitions[topodatapb.TabletType_REPLICA] = []string{shard0.Name, shard1.Name}
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, "", 0, expectedPartitions, *clusterInstance)
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, expectedPartitions, *clusterInstance)
// Cell 2 is also changed
sharding.CheckSrvKeyspace(t, cell2, keyspaceName, "", 0, expectedPartitions, *clusterInstance)
sharding.CheckSrvKeyspace(t, cell2, keyspaceName, expectedPartitions, *clusterInstance)

sharding.CheckTabletQueryService(t, *shard0RdonlyZ2, "SERVING", false, *clusterInstance)
sharding.CheckTabletQueryService(t, *shard1RdonlyZ2, "NOT_SERVING", true, *clusterInstance)
Expand All @@ -711,7 +707,7 @@ func TestResharding(t *testing.T, useVarbinaryShardingKeyType bool) {
expectedPartitions[topodatapb.TabletType_PRIMARY] = []string{shard0.Name, shard1.Name}
expectedPartitions[topodatapb.TabletType_RDONLY] = []string{shard0.Name, shard2.Name, shard3.Name}
expectedPartitions[topodatapb.TabletType_REPLICA] = []string{shard0.Name, shard2.Name, shard3.Name}
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, "", 0, expectedPartitions, *clusterInstance)
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, expectedPartitions, *clusterInstance)

// move replica back and forth
err = clusterInstance.VtctlclientProcess.ExecuteCommand(
Expand All @@ -734,7 +730,7 @@ func TestResharding(t *testing.T, useVarbinaryShardingKeyType bool) {
expectedPartitions[topodatapb.TabletType_PRIMARY] = []string{shard0.Name, shard1.Name}
expectedPartitions[topodatapb.TabletType_RDONLY] = []string{shard0.Name, shard2.Name, shard3.Name}
expectedPartitions[topodatapb.TabletType_REPLICA] = []string{shard0.Name, shard1.Name}
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, "", 0, expectedPartitions, *clusterInstance)
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, expectedPartitions, *clusterInstance)

err = clusterInstance.VtctlclientProcess.ExecuteCommand(
"MigrateServedTypes", shard1Ks, "replica")
Expand All @@ -753,7 +749,7 @@ func TestResharding(t *testing.T, useVarbinaryShardingKeyType bool) {
expectedPartitions[topodatapb.TabletType_PRIMARY] = []string{shard0.Name, shard1.Name}
expectedPartitions[topodatapb.TabletType_RDONLY] = []string{shard0.Name, shard2.Name, shard3.Name}
expectedPartitions[topodatapb.TabletType_REPLICA] = []string{shard0.Name, shard2.Name, shard3.Name}
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, "", 0, expectedPartitions, *clusterInstance)
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, expectedPartitions, *clusterInstance)

// reparent shard2 to shard2Replica1, then insert more data and see it flow through still
err = clusterInstance.VtctlclientProcess.ExecuteCommand("PlannedReparentShard", "--", "--keyspace_shard", shard2Ks,
Expand Down Expand Up @@ -821,7 +817,7 @@ func TestResharding(t *testing.T, useVarbinaryShardingKeyType bool) {
expectedPartitions[topodatapb.TabletType_PRIMARY] = []string{shard0.Name, shard1.Name}
expectedPartitions[topodatapb.TabletType_RDONLY] = []string{shard0.Name, shard2.Name, shard3.Name}
expectedPartitions[topodatapb.TabletType_REPLICA] = []string{shard0.Name, shard2.Name, shard3.Name}
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, "", 0, expectedPartitions, *clusterInstance)
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, expectedPartitions, *clusterInstance)

sharding.CheckTabletQueryService(t, *shard1Primary, "SERVING", false, *clusterInstance)

Expand Down Expand Up @@ -869,7 +865,7 @@ func TestResharding(t *testing.T, useVarbinaryShardingKeyType bool) {
expectedPartitions[topodatapb.TabletType_PRIMARY] = []string{shard0.Name, shard2.Name, shard3.Name}
expectedPartitions[topodatapb.TabletType_RDONLY] = []string{shard0.Name, shard2.Name, shard3.Name}
expectedPartitions[topodatapb.TabletType_REPLICA] = []string{shard0.Name, shard2.Name, shard3.Name}
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, "", 0, expectedPartitions, *clusterInstance)
sharding.CheckSrvKeyspace(t, cell1, keyspaceName, expectedPartitions, *clusterInstance)

sharding.CheckTabletQueryService(t, *shard1Primary, "NOT_SERVING", true, *clusterInstance)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,6 @@ func checkSrvKeyspaceServedFrom(t *testing.T, cell string, ksname string, expect
result = result + fmt.Sprintf("ServedFrom(%s): %s\n", "replica", tabletTypeKeyspaceMap["replica"])
}
assert.Equal(t, expected, result, fmt.Sprintf("Mismatch in srv keyspace for cell %s keyspace %s, expected:\n %s\ngot:\n%s", cell, ksname, expected, result))
assert.Equal(t, "", srvKeyspace.GetShardingColumnName(), fmt.Sprintf("Got a sharding_column_name in SrvKeyspace: %s", srvKeyspace.GetShardingColumnName()))
assert.Equal(t, "UNSET", srvKeyspace.GetShardingColumnType().String(), fmt.Sprintf("Got a sharding_column_type in SrvKeyspace: %s", srvKeyspace.GetShardingColumnType().String()))
}

func initializeCluster() (int, error) {
Expand Down
Loading