Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

[do not merge] Slack vitess v10.0.2.vtctld #231

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
67eff9c
Merge pull request #7965 from tinyspeck/am_move_wrangler_topofuncs_to…
rafael Apr 30, 2021
5295ac3
Merge pull request #7992 from tinyspeck/am_missing_return
rafael May 4, 2021
5a17bc1
Merge pull request #8052 from tinyspeck/am_change_tablet_type_remote_…
rafael May 7, 2021
05edb8c
Merge pull request #8084 from tinyspeck/am_reparent_tablet_prevent_se…
deepthi May 11, 2021
1618e74
Merge pull request #8221 from tinyspeck/sarabee-vtctld-getsrvvschemas
ajm188 Jun 1, 2021
df478fb
Merge pull request #8197 from tinyspeck/am_vtctldserver_routingrules
ajm188 Jun 1, 2021
b62e5d2
Merge pull request #8199 from tinyspeck/am_jaeger_sampler_configs
ajm188 Jun 4, 2021
6225dcd
Merge pull request #8219 from tinyspeck/am_cell_rw_rpcs
ajm188 Jun 1, 2021
9b12dec
Merge pull request #8232 from tinyspeck/am_vtctldserver_refresh_state…
ajm188 Jun 14, 2021
61919fd
Merge pull request #8261 from tinyspeck/am_vreplication_log
ajm188 Jun 13, 2021
485858a
Merge pull request #8266 from tinyspeck/am_vtctld_trace_getworkflows
ajm188 Jun 6, 2021
6e8b1c3
Merge pull request #8272 from tinyspeck/am_vtctld_concurrent_scanwork…
ajm188 Jun 15, 2021
92c0e33
Merge pull request #8284 from tinyspeck/am_vtctldclient_legacy_shim
ajm188 Jun 10, 2021
6d561fa
Merge pull request #8113 from Shopify/vtctld-applyvschema
ajm188 Jun 7, 2021
cf0a8a3
Merge pull request #8285 from tinyspeck/am_vtctldserver_tracing
ajm188 Jun 9, 2021
da47859
Merge pull request #8289 from tinyspeck/am_trace_logging
ajm188 Jun 18, 2021
57bfa23
Merge pull request #8291 from tinyspeck/am_expandcells_handle_aliases
ajm188 Jun 9, 2021
ce3bfbc
Merge pull request #8320 from tinyspeck/am_fix_vtctld_test_races
ajm188 Jun 12, 2021
4507dd1
Merge pull request #8321 from tinyspeck/am_additional_backup_info
ajm188 Jun 14, 2021
3e3b21f
Merge pull request #8402 from tinyspeck/am_vtctld_backup_detail_fix
ajm188 Jun 29, 2021
94677dd
Merge pull request #218 from tinyspeck/am_slack-vitess-9-r13-backups
ajm188 Jun 16, 2021
b17a402
Fix unit tests
ajm188 Jul 23, 2021
ef50e04
Merge pull request #8368 from tinyspeck/am_cached_grpctmclient_conns
ajm188 Jul 6, 2021
ec5bdbe
Merge pull request #232 from tinyspeck/slack-vitess-v10.0.2.vtctld.r1…
ajm188 Aug 25, 2021
5b3c83b
Merge pull request #8296 from tinyspeck/add-padding-to-keyrange-compa…
deepthi Jun 10, 2021
8d2d886
Merge pull request #8134 from guidoiaquinti/GenerateShardRanges
ajm188 May 18, 2021
da19f0f
Merge pull request #8873 from tinyspeck/fix-for-padding
deepthi Sep 24, 2021
d42ce6a
Merge pull request #233 from tinyspeck/am_vtctld_10.2.r2
ajm188 Oct 4, 2021
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
4 changes: 4 additions & 0 deletions go/cmd/vtadmin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ func main() {
rootCmd.Flags().Var(&clusterFileConfig, "cluster-config", "path to a yaml cluster configuration. see clusters.example.yaml") // (TODO:@amason) provide example config.
rootCmd.Flags().Var(&defaultClusterConfig, "cluster-defaults", "default options for all clusters")

rootCmd.Flags().AddGoFlag(flag.Lookup("tracer")) // defined in go/vt/trace
rootCmd.Flags().AddGoFlag(flag.Lookup("tracing-enable-logging")) // defined in go/vt/trace
rootCmd.Flags().AddGoFlag(flag.Lookup("tracing-sampling-type")) // defined in go/vt/trace
rootCmd.Flags().AddGoFlag(flag.Lookup("tracing-sampling-rate")) // defined in go/vt/trace
rootCmd.Flags().BoolVar(&opts.EnableTracing, "grpc-tracing", false, "whether to enable tracing on the gRPC server")
rootCmd.Flags().BoolVar(&httpOpts.EnableTracing, "http-tracing", false, "whether to enable tracing on the HTTP server")
rootCmd.Flags().BoolVar(&httpOpts.DisableCompression, "http-no-compress", false, "whether to disable compression of HTTP API responses")
Expand Down
4 changes: 4 additions & 0 deletions go/cmd/vtctlclient/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ func main() {
logutil.LogEvent(logger, e)
})
if err != nil {
if strings.Contains(err.Error(), "flag: help requested") {
return
}

errStr := strings.Replace(err.Error(), "remote error: ", "", -1)
fmt.Printf("%s Error: %s\n", flag.Arg(0), errStr)
log.Error(err)
Expand Down
42 changes: 35 additions & 7 deletions go/cmd/vtctldclient/internal/command/backups.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,54 @@ import (
"github.com/spf13/cobra"

"vitess.io/vitess/go/cmd/vtctldclient/cli"
"vitess.io/vitess/go/vt/topo/topoproto"

vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata"
)

// GetBackups makes a GetBackups gRPC call to a vtctld.
var GetBackups = &cobra.Command{
Use: "GetBackups keyspace shard",
Args: cobra.ExactArgs(2),
Use: "GetBackups <keyspace/shard>",
Args: cobra.ExactArgs(1),
RunE: commandGetBackups,
}

var getBackupsOptions = struct {
Limit uint32
Detailed bool
DetailedLimit uint32
OutputJSON bool
}{}

func commandGetBackups(cmd *cobra.Command, args []string) error {
cli.FinishedParsing(cmd)
keyspace, shard, err := topoproto.ParseKeyspaceShard(cmd.Flags().Arg(0))
if err != nil {
return err
}

keyspace := cmd.Flags().Arg(0)
shard := cmd.Flags().Arg(1)
cli.FinishedParsing(cmd)

resp, err := client.GetBackups(commandCtx, &vtctldatapb.GetBackupsRequest{
Keyspace: keyspace,
Shard: shard,
Keyspace: keyspace,
Shard: shard,
Limit: getBackupsOptions.Limit,
Detailed: getBackupsOptions.Detailed,
DetailedLimit: getBackupsOptions.DetailedLimit,
})
if err != nil {
return err
}

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

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

names := make([]string, len(resp.Backups))
for i, b := range resp.Backups {
names[i] = b.Name
Expand All @@ -58,5 +82,9 @@ func commandGetBackups(cmd *cobra.Command, args []string) error {
}

func init() {
GetBackups.Flags().Uint32VarP(&getBackupsOptions.Limit, "limit", "l", 0, "Retrieve only the most recent N backups")
GetBackups.Flags().BoolVarP(&getBackupsOptions.OutputJSON, "json", "j", false, "Output backup info in JSON format rather than a list of backups")
GetBackups.Flags().BoolVar(&getBackupsOptions.Detailed, "detailed", false, "Get detailed backup info, such as the engine used for each backup, and its status. Implies --json.")
GetBackups.Flags().Uint32Var(&getBackupsOptions.DetailedLimit, "detailed-limit", 0, "Get detailed backup info for only the most recent N backups. Ignored if --detailed is not passed.")
Root.AddCommand(GetBackups)
}
201 changes: 201 additions & 0 deletions go/cmd/vtctldclient/internal/command/cells.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,55 @@ import (

"vitess.io/vitess/go/cmd/vtctldclient/cli"

topodatapb "vitess.io/vitess/go/vt/proto/topodata"
vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata"
)

var (
// AddCellInfo makes an AddCellInfo gRPC call to a vtctld.
AddCellInfo = &cobra.Command{
Use: "AddCellInfo --root <root> [--server-address <addr>] <cell>",
Short: "Registers a local topology service in a new cell by creating the CellInfo.",
Long: `Registers a local topology service in a new cell by creating the CellInfo
with the provided parameters.

The address will be used to connect to the topology service, and Vitess data will
be stored starting at the provided root.`,
DisableFlagsInUseLine: true,
Args: cobra.ExactArgs(1),
RunE: commandAddCellInfo,
}
// AddCellsAlias makes an AddCellsAlias gRPC call to a vtctld.
AddCellsAlias = &cobra.Command{
Use: "AddCellsAlias --cells <cell1,cell2,...> [--cells <cell3> ...] <alias>",
Short: "Defines a group of cells that can be referenced by a single name (the alias).",
Long: `Defines a group of cells that can be referenced by a single name (the alias).

When routing query traffic, replica/rdonly traffic can be routed across cells
within the group (alias). Only primary traffic can be routed across cells not in
the same group (alias).`,
DisableFlagsInUseLine: true,
Args: cobra.ExactArgs(1),
RunE: commandAddCellsAlias,
}
// DeleteCellInfo makes a DeleteCellInfo gRPC call to a vtctld.
DeleteCellInfo = &cobra.Command{
Use: "DeleteCellInfo [--force] <cell>",
Short: "Deletes the CellInfo for the provided cell.",
Long: "Deletes the CellInfo for the provided cell. The cell cannot be referenced by any Shard record.",
DisableFlagsInUseLine: true,
Args: cobra.ExactArgs(1),
RunE: commandDeleteCellInfo,
}
// DeleteCellsAlias makes a DeleteCellsAlias gRPC call to a vtctld.
DeleteCellsAlias = &cobra.Command{
Use: "DeleteCellsAlias <alias>",
Short: "Deletes the CellsAlias for the provided alias.",
Long: "Deletes the CellsAlias for the provided alias.",
DisableFlagsInUseLine: true,
Args: cobra.ExactArgs(1),
RunE: commandDeleteCellsAlias,
}
// GetCellInfoNames makes a GetCellInfoNames gRPC call to a vtctld.
GetCellInfoNames = &cobra.Command{
Use: "GetCellInfoNames",
Expand All @@ -46,8 +91,99 @@ var (
Args: cobra.NoArgs,
RunE: commandGetCellsAliases,
}
// UpdateCellInfo makes an UpdateCellInfo gRPC call to a vtctld.
UpdateCellInfo = &cobra.Command{
Use: "UpdateCellInfo [--root <root>] [--server-address <addr>] <cell>",
Short: "Updates the content of a CellInfo with the provided parameters, creating the CellInfo if it does not exist.",
Long: `Updates the content of a CellInfo with the provided parameters, creating the CellInfo if it does not exist.

If a value is empty, it is ignored.`,
DisableFlagsInUseLine: true,
Args: cobra.ExactArgs(1),
RunE: commandUpdateCellInfo,
}
// UpdateCellsAlias makes an UpdateCellsAlias gRPC call to a vtctld.
UpdateCellsAlias = &cobra.Command{
Use: "UpdateCellsAlias [--cells <cell1,cell2,...> [--cells <cell4> ...]] <alias>",
Short: "Updates the content of a CellsAlias with the provided parameters, creating the CellsAlias if it does not exist.",
Long: "Updates the content of a CellsAlias with the provided parameters, creating the CellsAlias if it does not exist.",
DisableFlagsInUseLine: true,
Args: cobra.ExactArgs(1),
RunE: commandUpdateCellsAlias,
}
)

var addCellInfoOptions topodatapb.CellInfo

func commandAddCellInfo(cmd *cobra.Command, args []string) error {
cli.FinishedParsing(cmd)

cell := cmd.Flags().Arg(0)
_, err := client.AddCellInfo(commandCtx, &vtctldatapb.AddCellInfoRequest{
Name: cell,
CellInfo: &addCellInfoOptions,
})
if err != nil {
return err
}

fmt.Printf("Created cell: %s\n", cell)
return nil
}

var addCellsAliasOptions topodatapb.CellsAlias

func commandAddCellsAlias(cmd *cobra.Command, args []string) error {
cli.FinishedParsing(cmd)

alias := cmd.Flags().Arg(0)
_, err := client.AddCellsAlias(commandCtx, &vtctldatapb.AddCellsAliasRequest{
Name: alias,
Cells: addCellsAliasOptions.Cells,
})
if err != nil {
return err
}

fmt.Printf("Created cells alias: %s (cells = %v)\n", alias, addCellsAliasOptions.Cells)
return nil
}

var deleteCellInfoOptions = struct {
Force bool
}{}

func commandDeleteCellInfo(cmd *cobra.Command, args []string) error {
cli.FinishedParsing(cmd)

cell := cmd.Flags().Arg(0)
_, err := client.DeleteCellInfo(commandCtx, &vtctldatapb.DeleteCellInfoRequest{
Name: cell,
Force: deleteCellInfoOptions.Force,
})
if err != nil {
return err
}

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

func commandDeleteCellsAlias(cmd *cobra.Command, args []string) error {
cli.FinishedParsing(cmd)

alias := cmd.Flags().Arg(0)
_, err := client.DeleteCellsAlias(commandCtx, &vtctldatapb.DeleteCellsAliasRequest{
Name: alias,
})
if err != nil {
return err
}

fmt.Printf("Delete cells alias %s\n", alias)
return nil
}

func commandGetCellInfoNames(cmd *cobra.Command, args []string) error {
cli.FinishedParsing(cmd)

Expand Down Expand Up @@ -99,8 +235,73 @@ func commandGetCellsAliases(cmd *cobra.Command, args []string) error {
return nil
}

var updateCellInfoOptions topodatapb.CellInfo

func commandUpdateCellInfo(cmd *cobra.Command, args []string) error {
cli.FinishedParsing(cmd)

cell := cmd.Flags().Arg(0)
resp, err := client.UpdateCellInfo(commandCtx, &vtctldatapb.UpdateCellInfoRequest{
Name: cell,
CellInfo: &updateCellInfoOptions,
})
if err != nil {
return err
}

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

fmt.Printf("Updated cell %s. New CellInfo:\n%s\n", resp.Name, data)
return nil
}

var updateCellsAliasOptions topodatapb.CellsAlias

func commandUpdateCellsAlias(cmd *cobra.Command, args []string) error {
cli.FinishedParsing(cmd)

alias := cmd.Flags().Arg(0)
resp, err := client.UpdateCellsAlias(commandCtx, &vtctldatapb.UpdateCellsAliasRequest{
Name: alias,
CellsAlias: &updateCellsAliasOptions,
})
if err != nil {
return err
}

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

fmt.Printf("Updated cells alias %s. New CellsAlias:\n%s\n", resp.Name, data)
return nil
}

func init() {
AddCellInfo.Flags().StringVarP(&addCellInfoOptions.ServerAddress, "server-address", "a", "", "The address the topology server will connect to for this cell.")
AddCellInfo.Flags().StringVarP(&addCellInfoOptions.Root, "root", "r", "", "The root path the topology server will use for this cell")
AddCellInfo.MarkFlagRequired("root")
Root.AddCommand(AddCellInfo)

AddCellsAlias.Flags().StringSliceVarP(&addCellsAliasOptions.Cells, "cells", "c", nil, "The list of cell names that are members of this alias.")
Root.AddCommand(AddCellsAlias)

DeleteCellInfo.Flags().BoolVarP(&deleteCellInfoOptions.Force, "force", "f", false, "Proceeds even if the cell's topology server cannot be reached. The assumption is that you shut down the entire cell, and just need to update the global topo data.")
Root.AddCommand(DeleteCellInfo)
Root.AddCommand(DeleteCellsAlias)

Root.AddCommand(GetCellInfoNames)
Root.AddCommand(GetCellInfo)
Root.AddCommand(GetCellsAliases)

UpdateCellInfo.Flags().StringVarP(&updateCellInfoOptions.ServerAddress, "server-address", "a", "", "The address the topology server will connect to for this cell.")
UpdateCellInfo.Flags().StringVarP(&updateCellInfoOptions.Root, "root", "r", "", "The root path the topology server will use for this cell")
Root.AddCommand(UpdateCellInfo)

UpdateCellsAlias.Flags().StringSliceVarP(&updateCellsAliasOptions.Cells, "cells", "c", nil, "The list of cell names that are members of this alias.")
Root.AddCommand(UpdateCellsAlias)
}
Loading