зеркало из https://github.com/github/vitess-gh.git
Migrate InitShardMaster=>InitShardPrimary to VtctldServer, update examples
There are no functional changes in this commit, just a pure port with the most minor changes to ensure identical behavior (like the callback logger). I also updated our `proto` target to assume a standard protoc installation (which installs a stdlib of well-known types into /usr/local/include). We can decide if this is okay to make a requirement, or if we should try to make this more portable in PR review. I also updated the local example to use the vtctldclient port, and went through the full example with no issues. Signed-off-by: Andrew Mason <amason@slack-corp.com>
This commit is contained in:
Родитель
13ba0c8bac
Коммит
05b68637a8
4
Makefile
4
Makefile
|
@ -181,8 +181,8 @@ endif
|
|||
|
||||
$(PROTO_GO_OUTS): install_protoc-gen-go proto/*.proto
|
||||
for name in $(PROTO_SRC_NAMES); do \
|
||||
$(VTROOT)/bin/protoc --go_out=plugins=grpc:. -Iproto proto/$${name}.proto && \
|
||||
goimports -local vitess.io/vitess -w vitess.io/vitess/go/vt/proto/$${name}/$${name}.pb.go; \
|
||||
$(VTROOT)/bin/protoc --go_out=plugins=grpc:. -I/usr/local/include:proto proto/$${name}.proto && \
|
||||
goimports -w vitess.io/vitess/go/vt/proto/$${name}/$${name}.pb.go; \
|
||||
done
|
||||
cp -Rf vitess.io/vitess/go/vt/proto/* go/vt/proto
|
||||
rm -rf vitess.io/vitess/go/vt/proto/
|
||||
|
|
|
@ -38,7 +38,7 @@ for i in 100 101 102; do
|
|||
done
|
||||
|
||||
# set one of the replicas to master
|
||||
vtctlclient InitShardMaster -force commerce/0 zone1-100
|
||||
vtctldclient InitShardPrimary --force commerce/0 zone1-100
|
||||
|
||||
# create the schema
|
||||
vtctlclient ApplySchema -sql-file create_commerce_schema.sql commerce
|
||||
|
|
|
@ -25,4 +25,4 @@ for i in 200 201 202; do
|
|||
CELL=zone1 KEYSPACE=customer TABLET_UID=$i ./scripts/vttablet-up.sh
|
||||
done
|
||||
|
||||
vtctlclient InitShardMaster -force customer/0 zone1-200
|
||||
vtctldclient InitShardPrimary --force customer/0 zone1-200
|
||||
|
|
|
@ -29,5 +29,5 @@ for i in 400 401 402; do
|
|||
SHARD=80- CELL=zone1 KEYSPACE=customer TABLET_UID=$i ./scripts/vttablet-up.sh
|
||||
done
|
||||
|
||||
vtctlclient InitShardMaster -force customer/-80 zone1-300
|
||||
vtctlclient InitShardMaster -force customer/80- zone1-400
|
||||
vtctldclient InitShardPrimary --force customer/-80 zone1-300
|
||||
vtctldclient InitShardPrimary --force customer/80- zone1-400
|
||||
|
|
|
@ -76,6 +76,7 @@ mkdir -p "${VTDATAROOT}/tmp"
|
|||
|
||||
alias mysql="command mysql -h 127.0.0.1 -P 15306"
|
||||
alias vtctlclient="command vtctlclient -server localhost:15999 -log_dir ${VTDATAROOT}/tmp -alsologtostderr"
|
||||
alias vtctldclient="command vtctldclient --server localhost:15999"
|
||||
|
||||
# Make sure aliases are expanded in non-interactive shell
|
||||
shopt -s expand_aliases
|
||||
|
|
|
@ -19,10 +19,14 @@ package main
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"vitess.io/vitess/go/vt/log"
|
||||
vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata"
|
||||
"vitess.io/vitess/go/vt/topo/topoproto"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -44,6 +48,11 @@ var (
|
|||
Args: cobra.NoArgs,
|
||||
RunE: commandGetKeyspaces,
|
||||
}
|
||||
initShardPrimaryCmd = &cobra.Command{
|
||||
Use: "InitShardPrimary",
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: commandInitShardPrimary,
|
||||
}
|
||||
)
|
||||
|
||||
func commandFindAllShardsInKeyspace(cmd *cobra.Command, args []string) error {
|
||||
|
@ -91,8 +100,43 @@ func commandGetKeyspaces(cmd *cobra.Command, args []string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var initShardPrimaryArgs = struct {
|
||||
WaitReplicasTimeout time.Duration
|
||||
Force bool
|
||||
}{}
|
||||
|
||||
func commandInitShardPrimary(cmd *cobra.Command, args []string) error {
|
||||
keyspace, shard, err := topoproto.ParseKeyspaceShard(cmd.Flags().Arg(0))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
tabletAlias, err := topoproto.ParseTabletAlias(cmd.Flags().Arg(1))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
resp, err := client.InitShardPrimary(commandCtx, &vtctldatapb.InitShardPrimaryRequest{
|
||||
Keyspace: keyspace,
|
||||
Shard: shard,
|
||||
PrimaryElectTabletAlias: tabletAlias,
|
||||
WaitReplicasTimeout: ptypes.DurationProto(initShardPrimaryArgs.WaitReplicasTimeout),
|
||||
Force: initShardPrimaryArgs.Force,
|
||||
})
|
||||
|
||||
for _, event := range resp.Events {
|
||||
log.Infof("%v", event)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(findAllShardsInKeyspaceCmd)
|
||||
rootCmd.AddCommand(getKeyspaceCmd)
|
||||
rootCmd.AddCommand(getKeyspacesCmd)
|
||||
|
||||
initShardPrimaryCmd.Flags().DurationVar(&initShardPrimaryArgs.WaitReplicasTimeout, "wait-replicas-timeout", 30*time.Second, "time to wait for replicas to catch up in reparenting")
|
||||
initShardPrimaryCmd.Flags().BoolVar(&initShardPrimaryArgs.Force, "force", false, "will force the reparent even if the provided tablet is not a master or the shard master")
|
||||
rootCmd.AddCommand(initShardPrimaryCmd)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
|
||||
automation "vitess.io/vitess/go/vt/proto/automation"
|
||||
)
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
math "math"
|
||||
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
|
||||
query "vitess.io/vitess/go/vt/proto/query"
|
||||
topodata "vitess.io/vitess/go/vt/proto/topodata"
|
||||
vtrpc "vitess.io/vitess/go/vt/proto/vtrpc"
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
|
||||
binlogdata "vitess.io/vitess/go/vt/proto/binlogdata"
|
||||
)
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
math "math"
|
||||
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
|
||||
vttime "vitess.io/vitess/go/vt/proto/vttime"
|
||||
)
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
math "math"
|
||||
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
|
||||
topodata "vitess.io/vitess/go/vt/proto/topodata"
|
||||
vtrpc "vitess.io/vitess/go/vt/proto/vtrpc"
|
||||
)
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
|
||||
binlogdata "vitess.io/vitess/go/vt/proto/binlogdata"
|
||||
query "vitess.io/vitess/go/vt/proto/query"
|
||||
)
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
math "math"
|
||||
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
|
||||
logutil "vitess.io/vitess/go/vt/proto/logutil"
|
||||
query "vitess.io/vitess/go/vt/proto/query"
|
||||
replicationdata "vitess.io/vitess/go/vt/proto/replicationdata"
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
|
||||
tabletmanagerdata "vitess.io/vitess/go/vt/proto/tabletmanagerdata"
|
||||
)
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
|
||||
throttlerdata "vitess.io/vitess/go/vt/proto/throttlerdata"
|
||||
)
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
math "math"
|
||||
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
|
||||
vttime "vitess.io/vitess/go/vt/proto/vttime"
|
||||
)
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
math "math"
|
||||
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
|
||||
query "vitess.io/vitess/go/vt/proto/query"
|
||||
)
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
|
||||
topodata "vitess.io/vitess/go/vt/proto/topodata"
|
||||
)
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
math "math"
|
||||
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
|
||||
duration "github.com/golang/protobuf/ptypes/duration"
|
||||
logutil "vitess.io/vitess/go/vt/proto/logutil"
|
||||
topodata "vitess.io/vitess/go/vt/proto/topodata"
|
||||
)
|
||||
|
@ -261,6 +261,116 @@ func (m *GetKeyspaceResponse) GetKeyspace() *Keyspace {
|
|||
return nil
|
||||
}
|
||||
|
||||
type InitShardPrimaryRequest struct {
|
||||
Keyspace string `protobuf:"bytes,1,opt,name=keyspace,proto3" json:"keyspace,omitempty"`
|
||||
Shard string `protobuf:"bytes,2,opt,name=shard,proto3" json:"shard,omitempty"`
|
||||
PrimaryElectTabletAlias *topodata.TabletAlias `protobuf:"bytes,3,opt,name=primary_elect_tablet_alias,json=primaryElectTabletAlias,proto3" json:"primary_elect_tablet_alias,omitempty"`
|
||||
Force bool `protobuf:"varint,4,opt,name=force,proto3" json:"force,omitempty"`
|
||||
WaitReplicasTimeout *duration.Duration `protobuf:"bytes,5,opt,name=wait_replicas_timeout,json=waitReplicasTimeout,proto3" json:"wait_replicas_timeout,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *InitShardPrimaryRequest) Reset() { *m = InitShardPrimaryRequest{} }
|
||||
func (m *InitShardPrimaryRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*InitShardPrimaryRequest) ProtoMessage() {}
|
||||
func (*InitShardPrimaryRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_f41247b323a1ab2e, []int{6}
|
||||
}
|
||||
|
||||
func (m *InitShardPrimaryRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_InitShardPrimaryRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *InitShardPrimaryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_InitShardPrimaryRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *InitShardPrimaryRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_InitShardPrimaryRequest.Merge(m, src)
|
||||
}
|
||||
func (m *InitShardPrimaryRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_InitShardPrimaryRequest.Size(m)
|
||||
}
|
||||
func (m *InitShardPrimaryRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_InitShardPrimaryRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_InitShardPrimaryRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *InitShardPrimaryRequest) GetKeyspace() string {
|
||||
if m != nil {
|
||||
return m.Keyspace
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *InitShardPrimaryRequest) GetShard() string {
|
||||
if m != nil {
|
||||
return m.Shard
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *InitShardPrimaryRequest) GetPrimaryElectTabletAlias() *topodata.TabletAlias {
|
||||
if m != nil {
|
||||
return m.PrimaryElectTabletAlias
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *InitShardPrimaryRequest) GetForce() bool {
|
||||
if m != nil {
|
||||
return m.Force
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *InitShardPrimaryRequest) GetWaitReplicasTimeout() *duration.Duration {
|
||||
if m != nil {
|
||||
return m.WaitReplicasTimeout
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type InitShardPrimaryResponse struct {
|
||||
Events []*logutil.Event `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *InitShardPrimaryResponse) Reset() { *m = InitShardPrimaryResponse{} }
|
||||
func (m *InitShardPrimaryResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*InitShardPrimaryResponse) ProtoMessage() {}
|
||||
func (*InitShardPrimaryResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_f41247b323a1ab2e, []int{7}
|
||||
}
|
||||
|
||||
func (m *InitShardPrimaryResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_InitShardPrimaryResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *InitShardPrimaryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_InitShardPrimaryResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *InitShardPrimaryResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_InitShardPrimaryResponse.Merge(m, src)
|
||||
}
|
||||
func (m *InitShardPrimaryResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_InitShardPrimaryResponse.Size(m)
|
||||
}
|
||||
func (m *InitShardPrimaryResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_InitShardPrimaryResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_InitShardPrimaryResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *InitShardPrimaryResponse) GetEvents() []*logutil.Event {
|
||||
if m != nil {
|
||||
return m.Events
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Keyspace struct {
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Keyspace *topodata.Keyspace `protobuf:"bytes,2,opt,name=keyspace,proto3" json:"keyspace,omitempty"`
|
||||
|
@ -273,7 +383,7 @@ func (m *Keyspace) Reset() { *m = Keyspace{} }
|
|||
func (m *Keyspace) String() string { return proto.CompactTextString(m) }
|
||||
func (*Keyspace) ProtoMessage() {}
|
||||
func (*Keyspace) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_f41247b323a1ab2e, []int{6}
|
||||
return fileDescriptor_f41247b323a1ab2e, []int{8}
|
||||
}
|
||||
|
||||
func (m *Keyspace) XXX_Unmarshal(b []byte) error {
|
||||
|
@ -319,7 +429,7 @@ func (m *FindAllShardsInKeyspaceRequest) Reset() { *m = FindAllShardsInK
|
|||
func (m *FindAllShardsInKeyspaceRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*FindAllShardsInKeyspaceRequest) ProtoMessage() {}
|
||||
func (*FindAllShardsInKeyspaceRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_f41247b323a1ab2e, []int{7}
|
||||
return fileDescriptor_f41247b323a1ab2e, []int{9}
|
||||
}
|
||||
|
||||
func (m *FindAllShardsInKeyspaceRequest) XXX_Unmarshal(b []byte) error {
|
||||
|
@ -358,7 +468,7 @@ func (m *FindAllShardsInKeyspaceResponse) Reset() { *m = FindAllShardsIn
|
|||
func (m *FindAllShardsInKeyspaceResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*FindAllShardsInKeyspaceResponse) ProtoMessage() {}
|
||||
func (*FindAllShardsInKeyspaceResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_f41247b323a1ab2e, []int{8}
|
||||
return fileDescriptor_f41247b323a1ab2e, []int{10}
|
||||
}
|
||||
|
||||
func (m *FindAllShardsInKeyspaceResponse) XXX_Unmarshal(b []byte) error {
|
||||
|
@ -399,7 +509,7 @@ func (m *Shard) Reset() { *m = Shard{} }
|
|||
func (m *Shard) String() string { return proto.CompactTextString(m) }
|
||||
func (*Shard) ProtoMessage() {}
|
||||
func (*Shard) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_f41247b323a1ab2e, []int{9}
|
||||
return fileDescriptor_f41247b323a1ab2e, []int{11}
|
||||
}
|
||||
|
||||
func (m *Shard) XXX_Unmarshal(b []byte) error {
|
||||
|
@ -459,7 +569,7 @@ func (m *TableMaterializeSettings) Reset() { *m = TableMaterializeSettin
|
|||
func (m *TableMaterializeSettings) String() string { return proto.CompactTextString(m) }
|
||||
func (*TableMaterializeSettings) ProtoMessage() {}
|
||||
func (*TableMaterializeSettings) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_f41247b323a1ab2e, []int{10}
|
||||
return fileDescriptor_f41247b323a1ab2e, []int{12}
|
||||
}
|
||||
|
||||
func (m *TableMaterializeSettings) XXX_Unmarshal(b []byte) error {
|
||||
|
@ -522,7 +632,7 @@ func (m *MaterializeSettings) Reset() { *m = MaterializeSettings{} }
|
|||
func (m *MaterializeSettings) String() string { return proto.CompactTextString(m) }
|
||||
func (*MaterializeSettings) ProtoMessage() {}
|
||||
func (*MaterializeSettings) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_f41247b323a1ab2e, []int{11}
|
||||
return fileDescriptor_f41247b323a1ab2e, []int{13}
|
||||
}
|
||||
|
||||
func (m *MaterializeSettings) XXX_Unmarshal(b []byte) error {
|
||||
|
@ -599,6 +709,8 @@ func init() {
|
|||
proto.RegisterType((*GetKeyspacesResponse)(nil), "vtctldata.GetKeyspacesResponse")
|
||||
proto.RegisterType((*GetKeyspaceRequest)(nil), "vtctldata.GetKeyspaceRequest")
|
||||
proto.RegisterType((*GetKeyspaceResponse)(nil), "vtctldata.GetKeyspaceResponse")
|
||||
proto.RegisterType((*InitShardPrimaryRequest)(nil), "vtctldata.InitShardPrimaryRequest")
|
||||
proto.RegisterType((*InitShardPrimaryResponse)(nil), "vtctldata.InitShardPrimaryResponse")
|
||||
proto.RegisterType((*Keyspace)(nil), "vtctldata.Keyspace")
|
||||
proto.RegisterType((*FindAllShardsInKeyspaceRequest)(nil), "vtctldata.FindAllShardsInKeyspaceRequest")
|
||||
proto.RegisterType((*FindAllShardsInKeyspaceResponse)(nil), "vtctldata.FindAllShardsInKeyspaceResponse")
|
||||
|
@ -611,45 +723,54 @@ func init() {
|
|||
func init() { proto.RegisterFile("vtctldata.proto", fileDescriptor_f41247b323a1ab2e) }
|
||||
|
||||
var fileDescriptor_f41247b323a1ab2e = []byte{
|
||||
// 629 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xdf, 0x6e, 0xd3, 0x30,
|
||||
0x14, 0xc6, 0x95, 0x76, 0x1d, 0xed, 0x29, 0x6d, 0x87, 0x07, 0x52, 0x54, 0x04, 0x94, 0xc0, 0xb6,
|
||||
0x4a, 0x48, 0x29, 0x0c, 0x09, 0x21, 0xc4, 0xcd, 0x18, 0x1d, 0x1a, 0x13, 0xbb, 0xc8, 0x26, 0x90,
|
||||
0xb8, 0x20, 0xf2, 0x92, 0xb3, 0x12, 0xcd, 0x8d, 0x43, 0x7c, 0xda, 0xad, 0xbc, 0x01, 0x2f, 0xc3,
|
||||
0x23, 0xf0, 0x6c, 0x28, 0x76, 0x92, 0x66, 0x68, 0x03, 0x71, 0xe7, 0xfc, 0xce, 0xbf, 0xef, 0x7c,
|
||||
0xb6, 0x02, 0xbd, 0x39, 0x05, 0x24, 0x42, 0x4e, 0xdc, 0x4d, 0x52, 0x49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, 0x9e, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x2e, 0xa9, 0x4e,
|
||||
0xcf, 0x53, 0x05, 0x00, 0x00,
|
||||
// 778 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0x5d, 0x8f, 0xdb, 0x44,
|
||||
0x14, 0x95, 0x93, 0x4d, 0x88, 0x6f, 0x48, 0xb2, 0x4c, 0xba, 0xaa, 0x31, 0xa2, 0x04, 0x43, 0xd3,
|
||||
0x48, 0x48, 0x0e, 0x14, 0x09, 0x21, 0xc4, 0xcb, 0x76, 0x9b, 0xa2, 0xa5, 0x6a, 0x85, 0xa6, 0x2b,
|
||||
0x90, 0x78, 0xc0, 0x9a, 0xb5, 0x27, 0xc1, 0xda, 0x89, 0xc7, 0xcc, 0x8c, 0xb3, 0x0d, 0xcf, 0xbc,
|
||||
0xf0, 0x67, 0xf8, 0x09, 0xfc, 0x36, 0xe4, 0xf9, 0x70, 0xbc, 0x65, 0x97, 0x8f, 0xb7, 0x99, 0x73,
|
||||
0xe7, 0xde, 0x7b, 0xee, 0xb9, 0x27, 0x31, 0x4c, 0x76, 0x2a, 0x55, 0x2c, 0x23, 0x8a, 0xc4, 0xa5,
|
||||
0xe0, 0x8a, 0x23, 0xbf, 0x01, 0xc2, 0x11, 0xe3, 0x9b, 0x4a, 0xe5, 0xcc, 0x44, 0xc2, 0xb1, 0xe2,
|
||||
0x25, 0x3f, 0xbc, 0x0c, 0x1f, 0x6c, 0x38, 0xdf, 0x30, 0xba, 0xd4, 0xb7, 0xcb, 0x6a, 0xbd, 0xcc,
|
||||
0x2a, 0x41, 0x54, 0xce, 0x0b, 0x13, 0x8f, 0x7e, 0x80, 0x70, 0xf5, 0x9a, 0xa6, 0x95, 0xa2, 0xdf,
|
||||
0xd7, 0x25, 0xcf, 0xf8, 0x76, 0x4b, 0x8a, 0x0c, 0xd3, 0x5f, 0x2a, 0x2a, 0x15, 0x42, 0x70, 0x44,
|
||||
0xc4, 0x46, 0x06, 0xde, 0xac, 0xbb, 0xf0, 0xb1, 0x3e, 0xa3, 0x87, 0x30, 0x26, 0x69, 0x5d, 0x21,
|
||||
0x51, 0xf9, 0x96, 0xf2, 0x4a, 0x05, 0x9d, 0x99, 0xb7, 0xe8, 0xe2, 0x91, 0x41, 0x2f, 0x0c, 0x18,
|
||||
0x9d, 0xc1, 0x7b, 0xb7, 0x16, 0x96, 0x25, 0x2f, 0x24, 0x45, 0x1f, 0x43, 0x8f, 0xee, 0x68, 0xa1,
|
||||
0x02, 0x6f, 0xe6, 0x2d, 0x86, 0x8f, 0xc7, 0xb1, 0x1b, 0x63, 0x55, 0xa3, 0xd8, 0x04, 0xa3, 0x13,
|
||||
0x98, 0x7e, 0x43, 0xd5, 0x73, 0xba, 0x97, 0x25, 0x49, 0xa9, 0xb4, 0xb4, 0xa2, 0x73, 0xb8, 0x77,
|
||||
0x13, 0xb6, 0x45, 0x3f, 0x03, 0xff, 0xca, 0x81, 0x9a, 0xf3, 0xf0, 0xf1, 0x34, 0x3e, 0x68, 0xe7,
|
||||
0x12, 0xf0, 0xe1, 0x55, 0xf4, 0x29, 0xa0, 0x56, 0x29, 0x37, 0x77, 0x08, 0x03, 0xf7, 0x44, 0x13,
|
||||
0xf4, 0x71, 0x73, 0x8f, 0x9e, 0xdd, 0xe0, 0xd4, 0xf4, 0x5e, 0xbe, 0x91, 0x72, 0x47, 0xeb, 0x43,
|
||||
0x9d, 0xdf, 0x3a, 0x70, 0xff, 0xbc, 0xc8, 0xd5, 0xab, 0x9f, 0x89, 0xc8, 0xbe, 0x13, 0xf9, 0x96,
|
||||
0x88, 0xfd, 0x7f, 0xe8, 0x8f, 0xee, 0x41, 0x4f, 0xd6, 0x29, 0x5a, 0x76, 0x1f, 0x9b, 0x0b, 0xc2,
|
||||
0x10, 0x96, 0xa6, 0x46, 0x42, 0x19, 0x4d, 0x55, 0xa2, 0x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ac, 0x3e, 0xa2, 0x39, 0xf4, 0x76, 0x84, 0x55, 0x6e, 0xfe,
|
||||
0xe3, 0x56, 0x3f, 0x9d, 0x88, 0x4d, 0xf8, 0xab, 0xce, 0x97, 0x5e, 0xf4, 0x13, 0xf4, 0x34, 0xf6,
|
||||
0x8f, 0x36, 0x74, 0x3a, 0x77, 0x5a, 0x3a, 0x3f, 0x74, 0xd6, 0x34, 0x7e, 0x9b, 0x1c, 0x44, 0xb6,
|
||||
0x3d, 0x74, 0x34, 0xfa, 0xdd, 0x83, 0x40, 0xfb, 0xec, 0x05, 0x51, 0x54, 0xe4, 0x84, 0xe5, 0xbf,
|
||||
0xd2, 0x57, 0x54, 0xa9, 0xbc, 0xd8, 0x48, 0xf4, 0x21, 0xbc, 0xad, 0x88, 0xd8, 0x50, 0xeb, 0x60,
|
||||
0xdb, 0x77, 0x68, 0x30, 0x9d, 0x85, 0x3e, 0x81, 0x77, 0x24, 0xaf, 0x44, 0x4a, 0x13, 0xfa, 0xba,
|
||||
0x14, 0x54, 0xca, 0x9c, 0x17, 0x96, 0xc7, 0xb1, 0x09, 0xac, 0x1a, 0x1c, 0xbd, 0x0f, 0x90, 0x0a,
|
||||
0x4a, 0x14, 0x4d, 0xb2, 0x8c, 0x69, 0x62, 0x3e, 0xf6, 0x0d, 0xf2, 0x34, 0x63, 0xd1, 0x1f, 0x1d,
|
||||
0x98, 0xde, 0x46, 0x23, 0x84, 0xc1, 0x35, 0x17, 0x57, 0x6b, 0xc6, 0xaf, 0xdd, 0xe8, 0xee, 0x8e,
|
||||
0x1e, 0xc1, 0xc4, 0xf6, 0xbf, 0xe1, 0x2a, 0x1f, 0x8f, 0x0d, 0xdc, 0x78, 0xf1, 0x11, 0x4c, 0xec,
|
||||
0x2c, 0xcd, 0x43, 0x43, 0x60, 0x6c, 0xe0, 0xe6, 0xe1, 0x1c, 0x26, 0x52, 0xf1, 0x32, 0x21, 0x6b,
|
||||
0x45, 0x45, 0x92, 0xf2, 0x72, 0x6f, 0x7f, 0x73, 0xa3, 0x1a, 0x3e, 0xad, 0xd1, 0x33, 0x5e, 0xee,
|
||||
0xd1, 0xb7, 0x30, 0xd6, 0xaa, 0x24, 0xd2, 0xf2, 0x0c, 0x7a, 0xda, 0x3e, 0x1f, 0xb5, 0xd6, 0x79,
|
||||
0x97, 0xb2, 0x78, 0xa4, 0x53, 0x9b, 0x09, 0x11, 0x1c, 0xa5, 0x94, 0xb1, 0xa0, 0x6f, 0x16, 0x58,
|
||||
0x9f, 0x8d, 0xf8, 0xfa, 0x7f, 0x43, 0xed, 0x4b, 0x2a, 0x83, 0xb7, 0x9c, 0xf8, 0x35, 0x76, 0x51,
|
||||
0x43, 0x4f, 0x16, 0x3f, 0xce, 0x77, 0xb9, 0xa2, 0x52, 0xc6, 0x39, 0x5f, 0x9a, 0xd3, 0x72, 0xc3,
|
||||
0x97, 0x3b, 0x65, 0x3e, 0x31, 0xcb, 0x86, 0xc8, 0x65, 0x5f, 0x03, 0x9f, 0xff, 0x15, 0x00, 0x00,
|
||||
0xff, 0xff, 0x0a, 0x35, 0x2b, 0x50, 0xbe, 0x06, 0x00, 0x00,
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
|
||||
vtctldata "vitess.io/vitess/go/vt/proto/vtctldata"
|
||||
)
|
||||
|
||||
|
@ -30,22 +29,24 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
|||
func init() { proto.RegisterFile("vtctlservice.proto", fileDescriptor_27055cdbb1148d2b) }
|
||||
|
||||
var fileDescriptor_27055cdbb1148d2b = []byte{
|
||||
// 235 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2a, 0x2b, 0x49, 0x2e,
|
||||
0xc9, 0x29, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2,
|
||||
0x41, 0x16, 0x93, 0xe2, 0x07, 0xf3, 0x52, 0x12, 0x4b, 0x12, 0x21, 0xd2, 0x46, 0x85, 0x5c, 0xac,
|
||||
0x61, 0x20, 0x21, 0xa1, 0x0c, 0x2e, 0x61, 0xd7, 0x8a, 0xd4, 0xe4, 0xd2, 0x92, 0x54, 0x30, 0xdf,
|
||||
0x39, 0x3f, 0x37, 0x37, 0x31, 0x2f, 0x45, 0x48, 0x55, 0x0f, 0xa1, 0x03, 0x8b, 0x7c, 0x50, 0x6a,
|
||||
0x61, 0x69, 0x6a, 0x71, 0x89, 0x94, 0x1a, 0x21, 0x65, 0xc5, 0x05, 0xf9, 0x79, 0xc5, 0xa9, 0x4a,
|
||||
0x0c, 0x06, 0x8c, 0x46, 0xf3, 0x99, 0xb8, 0xd8, 0xc0, 0x92, 0x29, 0x42, 0x45, 0x5c, 0xe2, 0x6e,
|
||||
0x99, 0x79, 0x29, 0x8e, 0x39, 0x39, 0xc1, 0x19, 0x89, 0x45, 0x29, 0xc5, 0x9e, 0x79, 0xde, 0xa9,
|
||||
0x95, 0xc5, 0x05, 0x89, 0xc9, 0xa9, 0x42, 0x9a, 0x48, 0x26, 0xe2, 0x50, 0x03, 0xb3, 0x5c, 0x8b,
|
||||
0x18, 0xa5, 0x30, 0x07, 0x08, 0xf9, 0x71, 0x71, 0xbb, 0xa7, 0x96, 0xc0, 0xed, 0x91, 0x45, 0xd2,
|
||||
0x8c, 0x24, 0x0e, 0x33, 0x5b, 0x0e, 0x97, 0x34, 0xdc, 0xbc, 0x40, 0x2e, 0x1e, 0x24, 0x89, 0x62,
|
||||
0x21, 0x1c, 0x3a, 0x8a, 0x61, 0x26, 0xca, 0xe3, 0x94, 0x87, 0x19, 0xe9, 0xa4, 0x1d, 0xa5, 0x59,
|
||||
0x96, 0x59, 0x92, 0x5a, 0x5c, 0xac, 0x97, 0x99, 0xaf, 0x0f, 0x61, 0xe9, 0xa7, 0xe7, 0xeb, 0x97,
|
||||
0x95, 0xe8, 0x83, 0x23, 0x4d, 0x1f, 0x39, 0x4a, 0x93, 0xd8, 0xc0, 0x62, 0xc6, 0x80, 0x00, 0x00,
|
||||
0x00, 0xff, 0xff, 0xd5, 0x49, 0x16, 0xd1, 0xfd, 0x01, 0x00, 0x00,
|
||||
// 263 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xdf, 0x4b, 0xc3, 0x30,
|
||||
0x10, 0xc7, 0x55, 0x70, 0x0f, 0x71, 0xa0, 0x9c, 0x0f, 0xc2, 0x40, 0x85, 0x89, 0xc2, 0x14, 0x1a,
|
||||
0x99, 0x7f, 0x81, 0x8a, 0xca, 0x10, 0xc4, 0x1f, 0xe0, 0x83, 0xe0, 0x43, 0x6c, 0x0e, 0x17, 0x68,
|
||||
0x93, 0x2e, 0x77, 0x2b, 0xee, 0x9f, 0x17, 0x31, 0x25, 0x35, 0x88, 0x55, 0xdf, 0x7a, 0xdf, 0x1f,
|
||||
0x9f, 0x6b, 0xe0, 0x04, 0xd4, 0x9c, 0x73, 0x41, 0xe8, 0x6b, 0x93, 0x63, 0x56, 0x79, 0xc7, 0x0e,
|
||||
0xfa, 0xa9, 0x36, 0x58, 0x0f, 0x93, 0x56, 0xac, 0x1a, 0x7b, 0x3c, 0x13, 0xab, 0x8f, 0x9f, 0x12,
|
||||
0x4c, 0xc5, 0xe6, 0xc5, 0x1b, 0xe6, 0x73, 0xc6, 0x30, 0x9f, 0xbb, 0xb2, 0x54, 0x56, 0xc3, 0x7e,
|
||||
0xf6, 0xd5, 0xf8, 0xc1, 0xbf, 0xc7, 0xd9, 0x1c, 0x89, 0x07, 0x07, 0x7f, 0xc5, 0xa8, 0x72, 0x96,
|
||||
0x70, 0xb8, 0x74, 0xbc, 0x3c, 0x7e, 0x5f, 0x11, 0xbd, 0x60, 0x6a, 0xf0, 0x62, 0xeb, 0xd2, 0x58,
|
||||
0x7d, 0x5a, 0x14, 0x0f, 0x53, 0xe5, 0x35, 0x4d, 0xec, 0x35, 0x2e, 0xa8, 0x52, 0x39, 0xc2, 0x28,
|
||||
0x21, 0x76, 0x64, 0xe2, 0xf2, 0xc3, 0xff, 0x44, 0xe3, 0x0f, 0xc0, 0x8d, 0x58, 0xbb, 0x42, 0x6e,
|
||||
0xf7, 0x6c, 0x27, 0xe5, 0x44, 0x8f, 0xec, 0x9d, 0x2e, 0xbb, 0xe5, 0xdd, 0x89, 0x7e, 0x62, 0x10,
|
||||
0x74, 0x34, 0x28, 0x12, 0x77, 0x3b, 0xfd, 0x16, 0xf9, 0x2c, 0x36, 0x26, 0xd6, 0x70, 0x78, 0xc4,
|
||||
0xad, 0x37, 0xa5, 0xf2, 0x0b, 0x18, 0x26, 0xb5, 0xef, 0x66, 0x44, 0xef, 0xfd, 0x9a, 0x89, 0xf8,
|
||||
0xb3, 0xa3, 0xa7, 0x51, 0x6d, 0x18, 0x89, 0x32, 0xe3, 0x64, 0xf3, 0x25, 0x5f, 0x9d, 0xac, 0x59,
|
||||
0x86, 0x9b, 0x90, 0xe9, 0xc5, 0xbc, 0xf4, 0x82, 0x76, 0xf2, 0x11, 0x00, 0x00, 0xff, 0xff, 0xae,
|
||||
0x74, 0xb6, 0x52, 0x5c, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
@ -165,6 +166,13 @@ type VtctldClient interface {
|
|||
GetKeyspace(ctx context.Context, in *vtctldata.GetKeyspaceRequest, opts ...grpc.CallOption) (*vtctldata.GetKeyspaceResponse, error)
|
||||
// GetKeyspaces returns the keyspace struct of all keyspaces in the topo.
|
||||
GetKeyspaces(ctx context.Context, in *vtctldata.GetKeyspacesRequest, opts ...grpc.CallOption) (*vtctldata.GetKeyspacesResponse, error)
|
||||
// InitShardPrimary sets the initial primary for a shard. Will make all other
|
||||
// tablets in the shard replicas of the provided primary.
|
||||
//
|
||||
// WARNING: This could cause data loss on an already replicating shard.
|
||||
// PlannedReparentShard or EmergencyReparentShard should be used in those
|
||||
// cases instead.
|
||||
InitShardPrimary(ctx context.Context, in *vtctldata.InitShardPrimaryRequest, opts ...grpc.CallOption) (*vtctldata.InitShardPrimaryResponse, error)
|
||||
}
|
||||
|
||||
type vtctldClient struct {
|
||||
|
@ -202,6 +210,15 @@ func (c *vtctldClient) GetKeyspaces(ctx context.Context, in *vtctldata.GetKeyspa
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *vtctldClient) InitShardPrimary(ctx context.Context, in *vtctldata.InitShardPrimaryRequest, opts ...grpc.CallOption) (*vtctldata.InitShardPrimaryResponse, error) {
|
||||
out := new(vtctldata.InitShardPrimaryResponse)
|
||||
err := c.cc.Invoke(ctx, "/vtctlservice.Vtctld/InitShardPrimary", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// VtctldServer is the server API for Vtctld service.
|
||||
type VtctldServer interface {
|
||||
// FindAllShardsInKeyspace returns a map of shard names to shard references for a given keyspace.
|
||||
|
@ -210,6 +227,13 @@ type VtctldServer interface {
|
|||
GetKeyspace(context.Context, *vtctldata.GetKeyspaceRequest) (*vtctldata.GetKeyspaceResponse, error)
|
||||
// GetKeyspaces returns the keyspace struct of all keyspaces in the topo.
|
||||
GetKeyspaces(context.Context, *vtctldata.GetKeyspacesRequest) (*vtctldata.GetKeyspacesResponse, error)
|
||||
// InitShardPrimary sets the initial primary for a shard. Will make all other
|
||||
// tablets in the shard replicas of the provided primary.
|
||||
//
|
||||
// WARNING: This could cause data loss on an already replicating shard.
|
||||
// PlannedReparentShard or EmergencyReparentShard should be used in those
|
||||
// cases instead.
|
||||
InitShardPrimary(context.Context, *vtctldata.InitShardPrimaryRequest) (*vtctldata.InitShardPrimaryResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedVtctldServer can be embedded to have forward compatible implementations.
|
||||
|
@ -225,6 +249,9 @@ func (*UnimplementedVtctldServer) GetKeyspace(ctx context.Context, req *vtctldat
|
|||
func (*UnimplementedVtctldServer) GetKeyspaces(ctx context.Context, req *vtctldata.GetKeyspacesRequest) (*vtctldata.GetKeyspacesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetKeyspaces not implemented")
|
||||
}
|
||||
func (*UnimplementedVtctldServer) InitShardPrimary(ctx context.Context, req *vtctldata.InitShardPrimaryRequest) (*vtctldata.InitShardPrimaryResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method InitShardPrimary not implemented")
|
||||
}
|
||||
|
||||
func RegisterVtctldServer(s *grpc.Server, srv VtctldServer) {
|
||||
s.RegisterService(&_Vtctld_serviceDesc, srv)
|
||||
|
@ -284,6 +311,24 @@ func _Vtctld_GetKeyspaces_Handler(srv interface{}, ctx context.Context, dec func
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Vtctld_InitShardPrimary_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(vtctldata.InitShardPrimaryRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(VtctldServer).InitShardPrimary(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/vtctlservice.Vtctld/InitShardPrimary",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(VtctldServer).InitShardPrimary(ctx, req.(*vtctldata.InitShardPrimaryRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Vtctld_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "vtctlservice.Vtctld",
|
||||
HandlerType: (*VtctldServer)(nil),
|
||||
|
@ -300,6 +345,10 @@ var _Vtctld_serviceDesc = grpc.ServiceDesc{
|
|||
MethodName: "GetKeyspaces",
|
||||
Handler: _Vtctld_GetKeyspaces_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "InitShardPrimary",
|
||||
Handler: _Vtctld_InitShardPrimary_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "vtctlservice.proto",
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
math "math"
|
||||
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
|
||||
binlogdata "vitess.io/vitess/go/vt/proto/binlogdata"
|
||||
query "vitess.io/vitess/go/vt/proto/query"
|
||||
topodata "vitess.io/vitess/go/vt/proto/topodata"
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
|
||||
vtgate "vitess.io/vitess/go/vt/proto/vtgate"
|
||||
)
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
math "math"
|
||||
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
|
||||
logutil "vitess.io/vitess/go/vt/proto/logutil"
|
||||
)
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
|
||||
vtworkerdata "vitess.io/vitess/go/vt/proto/vtworkerdata"
|
||||
)
|
||||
|
||||
|
|
|
@ -54,3 +54,12 @@ func (client *gRPCVtctldClient) GetKeyspaces(ctx context.Context, in *vtctldatap
|
|||
|
||||
return client.c.GetKeyspaces(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// InitShardPrimary is part of the vtctlservicepb.VtctldClient interface.
|
||||
func (client *gRPCVtctldClient) InitShardPrimary(ctx context.Context, in *vtctldatapb.InitShardPrimaryRequest, opts ...grpc.CallOption) (*vtctldatapb.InitShardPrimaryResponse, error) {
|
||||
if client.c == nil {
|
||||
return nil, status.Error(codes.Unavailable, connClosedMsg)
|
||||
}
|
||||
|
||||
return client.c.InitShardPrimary(ctx, in, opts...)
|
||||
}
|
||||
|
|
|
@ -18,13 +18,29 @@ package grpcvtctldserver
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"vitess.io/vitess/go/event"
|
||||
"vitess.io/vitess/go/sqlescape"
|
||||
"vitess.io/vitess/go/vt/concurrency"
|
||||
"vitess.io/vitess/go/vt/log"
|
||||
"vitess.io/vitess/go/vt/logutil"
|
||||
"vitess.io/vitess/go/vt/topo"
|
||||
"vitess.io/vitess/go/vt/topo/topoproto"
|
||||
"vitess.io/vitess/go/vt/topotools"
|
||||
"vitess.io/vitess/go/vt/topotools/events"
|
||||
"vitess.io/vitess/go/vt/vterrors"
|
||||
"vitess.io/vitess/go/vt/vttablet/tmclient"
|
||||
|
||||
logutilpb "vitess.io/vitess/go/vt/proto/logutil"
|
||||
vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata"
|
||||
vtctlservicepb "vitess.io/vitess/go/vt/proto/vtctlservice"
|
||||
"vitess.io/vitess/go/vt/proto/vtrpc"
|
||||
)
|
||||
|
||||
// VtctldServer implements the Vtctld RPC service protocol.
|
||||
|
@ -94,6 +110,245 @@ func (s *VtctldServer) GetKeyspaces(ctx context.Context, req *vtctldatapb.GetKey
|
|||
return &vtctldatapb.GetKeyspacesResponse{Keyspaces: keyspaces}, nil
|
||||
}
|
||||
|
||||
// InitShardPrimary is part of the vtctlservicepb.VtctldServer interface.
|
||||
func (s *VtctldServer) InitShardPrimary(ctx context.Context, req *vtctldatapb.InitShardPrimaryRequest) (*vtctldatapb.InitShardPrimaryResponse, error) {
|
||||
if req.Keyspace == "" {
|
||||
return nil, vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "keyspace field is required")
|
||||
}
|
||||
|
||||
if req.Shard == "" {
|
||||
return nil, vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "shard field is required")
|
||||
}
|
||||
|
||||
var waitReplicasTimeout time.Duration
|
||||
if req.WaitReplicasTimeout != nil {
|
||||
wrt, err := ptypes.Duration(req.WaitReplicasTimeout)
|
||||
if err != nil {
|
||||
return nil, vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "cannot parse WaitReplicasTimeout; err = %v", err)
|
||||
}
|
||||
|
||||
waitReplicasTimeout = wrt
|
||||
} else {
|
||||
waitReplicasTimeout = time.Second * 30
|
||||
}
|
||||
|
||||
ctx, unlock, err := s.ts.LockShard(ctx, req.Keyspace, req.Shard, fmt.Sprintf("InitShardPrimary(%v)", topoproto.TabletAliasString(req.PrimaryElectTabletAlias)))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer unlock(&err)
|
||||
|
||||
ev := &events.Reparent{}
|
||||
|
||||
resp, err := s.initShardPrimaryLocked(ctx, ev, req, waitReplicasTimeout)
|
||||
if err != nil {
|
||||
event.DispatchUpdate(ev, "failed InitShardPrimary: "+err.Error())
|
||||
} else {
|
||||
event.DispatchUpdate(ev, "finished InitShardPrimary")
|
||||
}
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (s *VtctldServer) initShardPrimaryLocked(ctx context.Context, ev *events.Reparent, req *vtctldatapb.InitShardPrimaryRequest, waitReplicasTimeout time.Duration) (*vtctldatapb.InitShardPrimaryResponse, error) {
|
||||
resp := &vtctldatapb.InitShardPrimaryResponse{}
|
||||
logger := logutil.NewCallbackLogger(func(e *logutilpb.Event) {
|
||||
resp.Events = append(resp.Events, e)
|
||||
})
|
||||
tmc := tmclient.NewTabletManagerClient()
|
||||
|
||||
// (TODO:@amason) The code below this point is a verbatim copy of
|
||||
// initShardMasterLocked in package wrangler, modulo the following:
|
||||
// - s/keyspace/req.Keyspace
|
||||
// - s/shard/req.Shard
|
||||
// - s/masterElectTabletAlias/req.PrimaryElectTabletAlias
|
||||
// - s/wr.logger/logger
|
||||
// - s/wr.tmc/tmc
|
||||
// - s/wr.ts/s.ts
|
||||
//
|
||||
// It is also sufficiently complex and critical code that I feel it's unwise
|
||||
// to port and refactor in one change; so, this comment serves both as an
|
||||
// acknowledgement of that, as well as a TODO marker for us to revisit this.
|
||||
shardInfo, err := s.ts.GetShard(ctx, req.Keyspace, req.Shard)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ev.ShardInfo = *shardInfo
|
||||
|
||||
event.DispatchUpdate(ev, "reading tablet map")
|
||||
tabletMap, err := s.ts.GetTabletMapForShard(ctx, req.Keyspace, req.Shard)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Check the master elect is in tabletMap.
|
||||
masterElectTabletAliasStr := topoproto.TabletAliasString(req.PrimaryElectTabletAlias)
|
||||
masterElectTabletInfo, ok := tabletMap[masterElectTabletAliasStr]
|
||||
if !ok {
|
||||
return resp, fmt.Errorf("master-elect tablet %v is not in the shard", topoproto.TabletAliasString(req.PrimaryElectTabletAlias))
|
||||
}
|
||||
ev.NewMaster = *masterElectTabletInfo.Tablet
|
||||
|
||||
// Check the master is the only master is the shard, or -force was used.
|
||||
_, masterTabletMap := topotools.SortedTabletMap(tabletMap)
|
||||
if !topoproto.TabletAliasEqual(shardInfo.MasterAlias, req.PrimaryElectTabletAlias) {
|
||||
if !req.Force {
|
||||
return resp, fmt.Errorf("master-elect tablet %v is not the shard master, use -force to proceed anyway", topoproto.TabletAliasString(req.PrimaryElectTabletAlias))
|
||||
}
|
||||
|
||||
logger.Warningf("master-elect tablet %v is not the shard master, proceeding anyway as -force was used", topoproto.TabletAliasString(req.PrimaryElectTabletAlias))
|
||||
}
|
||||
if _, ok := masterTabletMap[masterElectTabletAliasStr]; !ok {
|
||||
if !req.Force {
|
||||
return resp, fmt.Errorf("master-elect tablet %v is not a master in the shard, use -force to proceed anyway", topoproto.TabletAliasString(req.PrimaryElectTabletAlias))
|
||||
}
|
||||
logger.Warningf("master-elect tablet %v is not a master in the shard, proceeding anyway as -force was used", topoproto.TabletAliasString(req.PrimaryElectTabletAlias))
|
||||
}
|
||||
haveOtherMaster := false
|
||||
for alias := range masterTabletMap {
|
||||
if masterElectTabletAliasStr != alias {
|
||||
haveOtherMaster = true
|
||||
}
|
||||
}
|
||||
if haveOtherMaster {
|
||||
if !req.Force {
|
||||
return resp, fmt.Errorf("master-elect tablet %v is not the only master in the shard, use -force to proceed anyway", topoproto.TabletAliasString(req.PrimaryElectTabletAlias))
|
||||
}
|
||||
logger.Warningf("master-elect tablet %v is not the only master in the shard, proceeding anyway as -force was used", topoproto.TabletAliasString(req.PrimaryElectTabletAlias))
|
||||
}
|
||||
|
||||
// First phase: reset replication on all tablets. If anyone fails,
|
||||
// we stop. It is probably because it is unreachable, and may leave
|
||||
// an unstable database process in the mix, with a database daemon
|
||||
// at a wrong replication spot.
|
||||
|
||||
// Create a context for the following RPCs that respects waitReplicasTimeout
|
||||
resetCtx, resetCancel := context.WithTimeout(ctx, waitReplicasTimeout)
|
||||
defer resetCancel()
|
||||
|
||||
event.DispatchUpdate(ev, "resetting replication on all tablets")
|
||||
wg := sync.WaitGroup{}
|
||||
rec := concurrency.AllErrorRecorder{}
|
||||
for alias, tabletInfo := range tabletMap {
|
||||
wg.Add(1)
|
||||
go func(alias string, tabletInfo *topo.TabletInfo) {
|
||||
defer wg.Done()
|
||||
logger.Infof("resetting replication on tablet %v", alias)
|
||||
if err := tmc.ResetReplication(resetCtx, tabletInfo.Tablet); err != nil {
|
||||
rec.RecordError(fmt.Errorf("tablet %v ResetReplication failed (either fix it, or Scrap it): %v", alias, err))
|
||||
}
|
||||
}(alias, tabletInfo)
|
||||
}
|
||||
wg.Wait()
|
||||
if err := rec.Error(); err != nil {
|
||||
// if any of the replicas failed
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// Check we still have the topology lock.
|
||||
if err := topo.CheckShardLocked(ctx, req.Keyspace, req.Shard); err != nil {
|
||||
return resp, fmt.Errorf("lost topology lock, aborting: %v", err)
|
||||
}
|
||||
|
||||
// Tell the new master to break its replicas, return its replication
|
||||
// position
|
||||
logger.Infof("initializing master on %v", topoproto.TabletAliasString(req.PrimaryElectTabletAlias))
|
||||
event.DispatchUpdate(ev, "initializing master")
|
||||
rp, err := tmc.InitMaster(ctx, masterElectTabletInfo.Tablet)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// Check we stil have the topology lock.
|
||||
if err := topo.CheckShardLocked(ctx, req.Keyspace, req.Shard); err != nil {
|
||||
return resp, fmt.Errorf("lost topology lock, aborting: %v", err)
|
||||
}
|
||||
|
||||
// Create a cancelable context for the following RPCs.
|
||||
// If error conditions happen, we can cancel all outgoing RPCs.
|
||||
replCtx, replCancel := context.WithTimeout(ctx, waitReplicasTimeout)
|
||||
defer replCancel()
|
||||
|
||||
// Now tell the new master to insert the reparent_journal row,
|
||||
// and tell everybody else to become a replica of the new master,
|
||||
// and wait for the row in the reparent_journal table.
|
||||
// We start all these in parallel, to handle the semi-sync
|
||||
// case: for the master to be able to commit its row in the
|
||||
// reparent_journal table, it needs connected replicas.
|
||||
event.DispatchUpdate(ev, "reparenting all tablets")
|
||||
now := time.Now().UnixNano()
|
||||
wgMaster := sync.WaitGroup{}
|
||||
wgReplicas := sync.WaitGroup{}
|
||||
var masterErr error
|
||||
for alias, tabletInfo := range tabletMap {
|
||||
if alias == masterElectTabletAliasStr {
|
||||
wgMaster.Add(1)
|
||||
go func(alias string, tabletInfo *topo.TabletInfo) {
|
||||
defer wgMaster.Done()
|
||||
logger.Infof("populating reparent journal on new master %v", alias)
|
||||
masterErr = tmc.PopulateReparentJournal(replCtx, tabletInfo.Tablet, now,
|
||||
"InitShardMaster", // (TODO:@amason), these are private constants in package wrangler
|
||||
req.PrimaryElectTabletAlias, rp)
|
||||
}(alias, tabletInfo)
|
||||
} else {
|
||||
wgReplicas.Add(1)
|
||||
go func(alias string, tabletInfo *topo.TabletInfo) {
|
||||
defer wgReplicas.Done()
|
||||
logger.Infof("initializing replica %v", alias)
|
||||
if err := tmc.InitReplica(replCtx, tabletInfo.Tablet, req.PrimaryElectTabletAlias, rp, now); err != nil {
|
||||
rec.RecordError(fmt.Errorf("tablet %v InitReplica failed: %v", alias, err))
|
||||
}
|
||||
}(alias, tabletInfo)
|
||||
}
|
||||
}
|
||||
|
||||
// After the master is done, we can update the shard record
|
||||
// (note with semi-sync, it also means at least one replica is done).
|
||||
wgMaster.Wait()
|
||||
if masterErr != nil {
|
||||
// The master failed, there is no way the
|
||||
// replicas will work. So we cancel them all.
|
||||
logger.Warningf("master failed to PopulateReparentJournal, canceling replicas")
|
||||
replCancel()
|
||||
wgReplicas.Wait()
|
||||
return resp, fmt.Errorf("failed to PopulateReparentJournal on master: %v", masterErr)
|
||||
}
|
||||
if !topoproto.TabletAliasEqual(shardInfo.MasterAlias, req.PrimaryElectTabletAlias) {
|
||||
if _, err := s.ts.UpdateShardFields(ctx, req.Keyspace, req.Shard, func(si *topo.ShardInfo) error {
|
||||
si.MasterAlias = req.PrimaryElectTabletAlias
|
||||
return nil
|
||||
}); err != nil {
|
||||
wgReplicas.Wait()
|
||||
return resp, fmt.Errorf("failed to update shard master record: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for the replicas to complete. If some of them fail, we
|
||||
// don't want to rebuild the shard serving graph (the failure
|
||||
// will most likely be a timeout, and our context will be
|
||||
// expired, so the rebuild will fail anyway)
|
||||
wgReplicas.Wait()
|
||||
if err := rec.Error(); err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// Create database if necessary on the master. replicas will get it too through
|
||||
// replication. Since the user called InitShardMaster, they've told us to
|
||||
// assume that whatever data is on all the replicas is what they intended.
|
||||
// If the database doesn't exist, it means the user intends for these tablets
|
||||
// to begin serving with no data (i.e. first time initialization).
|
||||
createDB := fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s", sqlescape.EscapeID(topoproto.TabletDbName(masterElectTabletInfo.Tablet)))
|
||||
if _, err := tmc.ExecuteFetchAsDba(ctx, masterElectTabletInfo.Tablet, false, []byte(createDB), 1, false, true); err != nil {
|
||||
return resp, fmt.Errorf("failed to create database: %v", err)
|
||||
}
|
||||
// Refresh the state to force the tabletserver to reconnect after db has been created.
|
||||
if err := tmc.RefreshState(ctx, masterElectTabletInfo.Tablet); err != nil {
|
||||
log.Warningf("RefreshState failed: %v", err)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// StartServer registers a VtctldServer for RPCs on the given gRPC server.
|
||||
func StartServer(s *grpc.Server, ts *topo.Server) {
|
||||
vtctlservicepb.RegisterVtctldServer(s, NewVtctldServer(ts))
|
||||
|
|
|
@ -24,6 +24,7 @@ package vtctldata;
|
|||
|
||||
import "logutil.proto";
|
||||
import "topodata.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
|
||||
// ExecuteVtctlCommandRequest is the payload for ExecuteVtctlCommand.
|
||||
// timeouts are in nanoseconds.
|
||||
|
@ -52,6 +53,18 @@ message GetKeyspaceResponse {
|
|||
Keyspace keyspace = 1;
|
||||
}
|
||||
|
||||
message InitShardPrimaryRequest {
|
||||
string keyspace = 1;
|
||||
string shard = 2;
|
||||
topodata.TabletAlias primary_elect_tablet_alias = 3;
|
||||
bool force = 4;
|
||||
google.protobuf.Duration wait_replicas_timeout = 5;
|
||||
}
|
||||
|
||||
message InitShardPrimaryResponse {
|
||||
repeated logutil.Event events = 1;
|
||||
}
|
||||
|
||||
message Keyspace {
|
||||
string name = 1;
|
||||
topodata.Keyspace keyspace = 2;
|
||||
|
|
|
@ -37,4 +37,11 @@ service Vtctld {
|
|||
rpc GetKeyspace(vtctldata.GetKeyspaceRequest) returns (vtctldata.GetKeyspaceResponse) {};
|
||||
// GetKeyspaces returns the keyspace struct of all keyspaces in the topo.
|
||||
rpc GetKeyspaces(vtctldata.GetKeyspacesRequest) returns (vtctldata.GetKeyspacesResponse) {};
|
||||
// InitShardPrimary sets the initial primary for a shard. Will make all other
|
||||
// tablets in the shard replicas of the provided primary.
|
||||
//
|
||||
// WARNING: This could cause data loss on an already replicating shard.
|
||||
// PlannedReparentShard or EmergencyReparentShard should be used in those
|
||||
// cases instead.
|
||||
rpc InitShardPrimary(vtctldata.InitShardPrimaryRequest) returns (vtctldata.InitShardPrimaryResponse) {};
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче