From a6b9fced8e5e8b67c661db91057ea73d4623841d Mon Sep 17 00:00:00 2001 From: LeeHao <1838249551@qq.com> Date: Tue, 16 Jul 2024 22:46:22 +0800 Subject: [PATCH 1/9] feat-cdc:initial docking Kafka Signed-off-by: LeeHao <1838249551@qq.com> --- tools/pika_cdc/conf/cdc.yml | 15 +++++++ tools/pika_cdc/conf/conf.go | 46 ++++++++++++++++++++++ tools/pika_cdc/go.mod | 13 +++++++ tools/pika_cdc/go.sum | 69 ++++++++++++++++++++++++++++++++ tools/pika_cdc/main.go | 23 +++++++++++ tools/pika_cdc/mq/kafka.go | 78 +++++++++++++++++++++++++++++++++++++ tools/pika_cdc/mq/mq.go | 30 ++++++++++++++ tools/pika_cdc/pika/cmd.go | 7 ++++ 8 files changed, 281 insertions(+) create mode 100644 tools/pika_cdc/conf/cdc.yml create mode 100644 tools/pika_cdc/conf/conf.go create mode 100644 tools/pika_cdc/go.mod create mode 100644 tools/pika_cdc/go.sum create mode 100644 tools/pika_cdc/main.go create mode 100644 tools/pika_cdc/mq/kafka.go create mode 100644 tools/pika_cdc/mq/mq.go create mode 100644 tools/pika_cdc/pika/cmd.go diff --git a/tools/pika_cdc/conf/cdc.yml b/tools/pika_cdc/conf/cdc.yml new file mode 100644 index 0000000000..201670391e --- /dev/null +++ b/tools/pika_cdc/conf/cdc.yml @@ -0,0 +1,15 @@ +# todo(leehao): The parameter configuration file for canal should be available for reference +# https://github.com/alibaba/canal/wiki/Canal-Kafka-RocketMQ-QuickStart + +# if there are more than one, separated by commas, like this +# 127.0.0.1:9092, 127.0.0.1:9091 +servers : 127.0.0.1:9092 +# will create this topic, if this topic not exist +# and all servers will use same name topic +topic : test +# retry times while send message failed +retries : 0 + + + + diff --git a/tools/pika_cdc/conf/conf.go b/tools/pika_cdc/conf/conf.go new file mode 100644 index 0000000000..f32bd01c2f --- /dev/null +++ b/tools/pika_cdc/conf/conf.go @@ -0,0 +1,46 @@ +package conf + +import ( + "gopkg.in/yaml.v3" + "io/ioutil" + "log" + "strings" +) + +type PikaCdcConfig struct { + Servers []string `yaml:"servers"` + Topic string `yaml:"topic"` + Retries int `yaml:"retries"` +} + +var ConfigInstance = PikaCdcConfig{} + +func init() { + file, err := ioutil.ReadFile("conf/cdc.yml") + if err != nil { + log.Fatal("fail to read file:", err) + } + + err = yaml.Unmarshal(file, &ConfigInstance) + if err != nil { + log.Fatal("fail to yaml unmarshal:", err) + } +} + +func (c *PikaCdcConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { + var tmp struct { + Servers string `yaml:"servers"` + Topic string `yaml:"topic"` + Retries int `yaml:"retries"` + } + + if err := unmarshal(&tmp); err != nil { + return err + } + + c.Servers = strings.Split(tmp.Servers, ",") + c.Retries = tmp.Retries + c.Topic = tmp.Topic + + return nil +} diff --git a/tools/pika_cdc/go.mod b/tools/pika_cdc/go.mod new file mode 100644 index 0000000000..3fc3f28943 --- /dev/null +++ b/tools/pika_cdc/go.mod @@ -0,0 +1,13 @@ +module pika_cdc + +go 1.20 + +require ( + github.com/segmentio/kafka-go v0.4.47 + gopkg.in/yaml.v3 v3.0.1 +) + +require ( + github.com/klauspost/compress v1.15.9 // indirect + github.com/pierrec/lz4/v4 v4.1.15 // indirect +) diff --git a/tools/pika_cdc/go.sum b/tools/pika_cdc/go.sum new file mode 100644 index 0000000000..3905795032 --- /dev/null +++ b/tools/pika_cdc/go.sum @@ -0,0 +1,69 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY= +github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= +github.com/pierrec/lz4/v4 v4.1.15 h1:MO0/ucJhngq7299dKLwIMtgTfbkoSPF6AoMYDd8Q4q0= +github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/segmentio/kafka-go v0.4.47 h1:IqziR4pA3vrZq7YdRxaT3w1/5fvIH5qpCwstUanQQB0= +github.com/segmentio/kafka-go v0.4.47/go.mod h1:HjF6XbOKh0Pjlkr5GVZxt6CsjjwnmhVOfURM5KMd8qg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= +github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= +github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8= +github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tools/pika_cdc/main.go b/tools/pika_cdc/main.go new file mode 100644 index 0000000000..a6f32c6e76 --- /dev/null +++ b/tools/pika_cdc/main.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + "pika_cdc/conf" + "pika_cdc/mq" + "pika_cdc/pika" + "time" +) + +func main() { + mqFactory := mq.Factory{} + messageQue, err := mqFactory.GetMq(mq.KAFKA, conf.ConfigInstance) + if err != nil { + panic("failed to create mq, " + err.Error()) + } else { + fmt.Println(messageQue.Name()) + c := pika.Cmd{} + _ = messageQue.SendCmdMessage(c) + } + defer messageQue.Close() + time.Sleep(time.Second) +} diff --git a/tools/pika_cdc/mq/kafka.go b/tools/pika_cdc/mq/kafka.go new file mode 100644 index 0000000000..c1231cb35d --- /dev/null +++ b/tools/pika_cdc/mq/kafka.go @@ -0,0 +1,78 @@ +package mq + +import ( + "context" + "errors" + "github.com/segmentio/kafka-go" + "log" + "pika_cdc/pika" + "sync" + "time" +) + +type Kafka struct { + servers []string + topic string + retries int + conns []*kafka.Conn + wg sync.WaitGroup + messageChan chan kafka.Message // 就非缓冲队列就可以了 + stopChan chan bool +} + +func (k *Kafka) SendCmdMessage(cmd pika.Cmd) error { + select { + case k.messageChan <- kafka.Message{Value: []byte(cmd.Name())}: + return nil + case <-time.After(2 * time.Second): + e := errors.New("send pika cmd timeout") + log.Printf("%v", e) + return e + } +} + +func (k *Kafka) sendMessage() { + for { + select { + case msg := <-k.messageChan: + for _, conn := range k.conns { + _, _ = conn.WriteMessages(msg) + } + case _ = <-k.stopChan: + return + } + } +} + +func (k *Kafka) Name() string { + return "Kafka" +} + +func NewKafka(servers []string, topic string, retries int) (*Kafka, error) { + k := &Kafka{} + for _, server := range servers { + conn, err := kafka.DialLeader(context.Background(), "tcp", server, topic, 0) + if err != nil { + return k, err + } else { + conn.SetWriteDeadline(time.Now().Add(10 * time.Second)) + k.conns = append(k.conns, conn) + } + } + k.messageChan = make(chan kafka.Message) + k.stopChan = make(chan bool) + go k.sendMessage() + return k, nil +} + +func (k *Kafka) Close() error { + k.stopChan <- true + for _, conn := range k.conns { + err := conn.Close() + if err != nil { + log.Println(err) + return err + } + } + return nil +} diff --git a/tools/pika_cdc/mq/mq.go b/tools/pika_cdc/mq/mq.go new file mode 100644 index 0000000000..3d0f3f117d --- /dev/null +++ b/tools/pika_cdc/mq/mq.go @@ -0,0 +1,30 @@ +package mq + +import ( + "pika_cdc/conf" + "pika_cdc/pika" +) + +type Mq interface { + SendCmdMessage(cmd pika.Cmd) error + Name() string + Close() error +} + +type Factory struct{} +type Type int + +const ( + KAFKA = iota + PULSAR +) + +func (f *Factory) GetMq(t Type, config conf.PikaCdcConfig) (Mq, error) { + switch t { + case KAFKA: + return NewKafka(config.Servers, config.Topic, config.Retries) + default: + + } + panic("unimplemented") +} diff --git a/tools/pika_cdc/pika/cmd.go b/tools/pika_cdc/pika/cmd.go new file mode 100644 index 0000000000..aea5886bc0 --- /dev/null +++ b/tools/pika_cdc/pika/cmd.go @@ -0,0 +1,7 @@ +package pika + +type Cmd struct{} + +func (c *Cmd) Name() string { + return "unimplemented" +} From 8749c2ed07886b77d2651e8e51fa92ed55e07e45 Mon Sep 17 00:00:00 2001 From: LeeHao <1838249551@qq.com> Date: Sun, 21 Jul 2024 23:37:06 +0800 Subject: [PATCH 2/9] feat-cdc:add pika repl send proxy test Signed-off-by: LeeHao <1838249551@qq.com> feat-cdc:add pika repl send proxy test Signed-off-by: LeeHao <1838249551@qq.com> feat-cdc:add pika repl send proxy test Signed-off-by: LeeHao <1838249551@qq.com> --- third/blackwidow | 1 + third/glog | 1 + third/pink | 1 + tools/pika_cdc/README.md | 6 + tools/pika_cdc/conf/cdc.yml | 12 +- tools/pika_cdc/conf/conf.go | 27 +- tools/pika_cdc/go.mod | 5 + tools/pika_cdc/go.sum | 12 + tools/pika_cdc/main.go | 4 + tools/pika_cdc/mq/kafka.go | 15 +- tools/pika_cdc/mq/mq.go | 3 +- tools/pika_cdc/pika/pika_inner_message.proto | 168 ++ .../pika/proto/inner/pika_inner_message.pb.go | 2169 +++++++++++++++++ .../pika/proto/rsync/rsync_service.pb.go | 702 ++++++ tools/pika_cdc/pika/replproxy.go | 4 + tools/pika_cdc/pika/replproxy_test.go | 76 + tools/pika_cdc/pika/rsync_service.proto | 53 + tools/pika_cdc/pika/server.go | 34 + 18 files changed, 3278 insertions(+), 15 deletions(-) create mode 160000 third/blackwidow create mode 160000 third/glog create mode 160000 third/pink create mode 100644 tools/pika_cdc/README.md create mode 100644 tools/pika_cdc/pika/pika_inner_message.proto create mode 100644 tools/pika_cdc/pika/proto/inner/pika_inner_message.pb.go create mode 100644 tools/pika_cdc/pika/proto/rsync/rsync_service.pb.go create mode 100644 tools/pika_cdc/pika/replproxy.go create mode 100644 tools/pika_cdc/pika/replproxy_test.go create mode 100644 tools/pika_cdc/pika/rsync_service.proto create mode 100644 tools/pika_cdc/pika/server.go diff --git a/third/blackwidow b/third/blackwidow new file mode 160000 index 0000000000..904475824b --- /dev/null +++ b/third/blackwidow @@ -0,0 +1 @@ +Subproject commit 904475824bc9d12b7bea4dc7ca30a00c7317d0f6 diff --git a/third/glog b/third/glog new file mode 160000 index 0000000000..ecdbd7cda6 --- /dev/null +++ b/third/glog @@ -0,0 +1 @@ +Subproject commit ecdbd7cda69e1ff304ac02f7f277715a162e1474 diff --git a/third/pink b/third/pink new file mode 160000 index 0000000000..60ac6c5677 --- /dev/null +++ b/third/pink @@ -0,0 +1 @@ +Subproject commit 60ac6c5677eb1dd51bb9b95e4c2f12a903633d0b diff --git a/tools/pika_cdc/README.md b/tools/pika_cdc/README.md new file mode 100644 index 0000000000..db06c9357b --- /dev/null +++ b/tools/pika_cdc/README.md @@ -0,0 +1,6 @@ +# Build +## generate proto file +```bash +cd pika +protoc --go_out=. *.proto +``` \ No newline at end of file diff --git a/tools/pika_cdc/conf/cdc.yml b/tools/pika_cdc/conf/cdc.yml index 201670391e..b6b229b5f9 100644 --- a/tools/pika_cdc/conf/cdc.yml +++ b/tools/pika_cdc/conf/cdc.yml @@ -1,15 +1,21 @@ # todo(leehao): The parameter configuration file for canal should be available for reference # https://github.com/alibaba/canal/wiki/Canal-Kafka-RocketMQ-QuickStart - +# pika_server +pika_server : 127.0.0.1:9221 # if there are more than one, separated by commas, like this # 127.0.0.1:9092, 127.0.0.1:9091 -servers : 127.0.0.1:9092 +mq_servers : 127.0.0.1:9092 # will create this topic, if this topic not exist # and all servers will use same name topic topic : test # retry times while send message failed retries : 0 - +# retry interval while send message failed(ms) +retry_interval: 10 +# Canal默认支持并行处理和发送数据到Kafka,这表示Canal将使用5个线程并行处理和发送数据到Kafka。 +parallel_thread_size: 5 +## 是否并发,如果保证并发的情况下,就会采用分区的方式发送数据, +#parallel: true diff --git a/tools/pika_cdc/conf/conf.go b/tools/pika_cdc/conf/conf.go index f32bd01c2f..23dd5e2855 100644 --- a/tools/pika_cdc/conf/conf.go +++ b/tools/pika_cdc/conf/conf.go @@ -4,19 +4,26 @@ import ( "gopkg.in/yaml.v3" "io/ioutil" "log" + "path/filepath" + "runtime" "strings" ) type PikaCdcConfig struct { - Servers []string `yaml:"servers"` - Topic string `yaml:"topic"` - Retries int `yaml:"retries"` + PikaServer string `yaml:"pika_server"` + MqServers []string `yaml:"mq_servers"` + Topic string `yaml:"topic"` + Retries int `yaml:"retries"` + RetryInterval int `yaml:"retry_interval"` + ParallelThreadSize int `yaml:"parallel_thread_size"` } var ConfigInstance = PikaCdcConfig{} func init() { - file, err := ioutil.ReadFile("conf/cdc.yml") + _, filename, _, _ := runtime.Caller(0) + filename = filepath.Join(filepath.Dir(filename), "cdc.yml") + file, err := ioutil.ReadFile(filename) if err != nil { log.Fatal("fail to read file:", err) } @@ -29,18 +36,22 @@ func init() { func (c *PikaCdcConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { var tmp struct { - Servers string `yaml:"servers"` - Topic string `yaml:"topic"` - Retries int `yaml:"retries"` + PikaServer string `yaml:"pika_server"` + MqServers string `yaml:"mq_servers"` + Topic string `yaml:"topic"` + Retries int `yaml:"retries"` + RetryInterval int `yaml:"retry_interval"` + ParallelThreadSize int `yaml:"parallel_thread_size"` } if err := unmarshal(&tmp); err != nil { return err } - c.Servers = strings.Split(tmp.Servers, ",") + c.MqServers = strings.Split(tmp.MqServers, ",") c.Retries = tmp.Retries c.Topic = tmp.Topic + c.PikaServer = tmp.PikaServer return nil } diff --git a/tools/pika_cdc/go.mod b/tools/pika_cdc/go.mod index 3fc3f28943..a01b2ae667 100644 --- a/tools/pika_cdc/go.mod +++ b/tools/pika_cdc/go.mod @@ -8,6 +8,11 @@ require ( ) require ( + github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/klauspost/compress v1.15.9 // indirect github.com/pierrec/lz4/v4 v4.1.15 // indirect + github.com/redis/go-redis/v9 v9.6.0 // indirect + google.golang.org/protobuf v1.34.2 // indirect ) diff --git a/tools/pika_cdc/go.sum b/tools/pika_cdc/go.sum index 3905795032..6b93fe51d0 100644 --- a/tools/pika_cdc/go.sum +++ b/tools/pika_cdc/go.sum @@ -1,12 +1,21 @@ +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY= github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= github.com/pierrec/lz4/v4 v4.1.15 h1:MO0/ucJhngq7299dKLwIMtgTfbkoSPF6AoMYDd8Q4q0= github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/redis/go-redis/v9 v9.6.0 h1:NLck+Rab3AOTHw21CGRpvQpgTrAU4sgdCswqGtlhGRA= +github.com/redis/go-redis/v9 v9.6.0/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= github.com/segmentio/kafka-go v0.4.47 h1:IqziR4pA3vrZq7YdRxaT3w1/5fvIH5qpCwstUanQQB0= github.com/segmentio/kafka-go v0.4.47/go.mod h1:HjF6XbOKh0Pjlkr5GVZxt6CsjjwnmhVOfURM5KMd8qg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -62,6 +71,9 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tools/pika_cdc/main.go b/tools/pika_cdc/main.go index a6f32c6e76..96d58933b0 100644 --- a/tools/pika_cdc/main.go +++ b/tools/pika_cdc/main.go @@ -20,4 +20,8 @@ func main() { } defer messageQue.Close() time.Sleep(time.Second) + + //pikaServer := pika.New(conf.ConfigInstance.PikaServer) + //pikaServer.Start() + //defer pikaServer.Close() } diff --git a/tools/pika_cdc/mq/kafka.go b/tools/pika_cdc/mq/kafka.go index c1231cb35d..8945bd9c7b 100644 --- a/tools/pika_cdc/mq/kafka.go +++ b/tools/pika_cdc/mq/kafka.go @@ -16,8 +16,9 @@ type Kafka struct { retries int conns []*kafka.Conn wg sync.WaitGroup - messageChan chan kafka.Message // 就非缓冲队列就可以了 + messageChan chan kafka.Message stopChan chan bool + once sync.Once } func (k *Kafka) SendCmdMessage(cmd pika.Cmd) error { @@ -65,8 +66,10 @@ func NewKafka(servers []string, topic string, retries int) (*Kafka, error) { return k, nil } -func (k *Kafka) Close() error { +func (k *Kafka) close() error { k.stopChan <- true + close(k.stopChan) + close(k.messageChan) for _, conn := range k.conns { err := conn.Close() if err != nil { @@ -76,3 +79,11 @@ func (k *Kafka) Close() error { } return nil } +func (k *Kafka) Close() error { + var err error + err = nil + k.once.Do(func() { + err = k.close() + }) + return err +} diff --git a/tools/pika_cdc/mq/mq.go b/tools/pika_cdc/mq/mq.go index 3d0f3f117d..3799730c8f 100644 --- a/tools/pika_cdc/mq/mq.go +++ b/tools/pika_cdc/mq/mq.go @@ -22,9 +22,8 @@ const ( func (f *Factory) GetMq(t Type, config conf.PikaCdcConfig) (Mq, error) { switch t { case KAFKA: - return NewKafka(config.Servers, config.Topic, config.Retries) + return NewKafka(config.MqServers, config.Topic, config.Retries) default: - } panic("unimplemented") } diff --git a/tools/pika_cdc/pika/pika_inner_message.proto b/tools/pika_cdc/pika/pika_inner_message.proto new file mode 100644 index 0000000000..92619f651d --- /dev/null +++ b/tools/pika_cdc/pika/pika_inner_message.proto @@ -0,0 +1,168 @@ +syntax = "proto2"; +package InnerMessage; + +option go_package = "./proto/inner"; + +enum Type { + kMetaSync = 1; + kTrySync = 2; + kDBSync = 3; + kBinlogSync = 4; + kHeatBeat = 5; + kRemoveSlaveNode = 6; +} + +enum StatusCode { + kOk = 1; + kError = 2; + kOther = 3; +} + +message BinlogOffset { + required uint32 filenum = 1; + required uint64 offset = 2; + // consensus use + optional uint32 term = 3; + optional uint64 index = 4; +} + +message Node { + required string ip = 1; + required int32 port = 2; +} + +message Slot { + required string db_name = 1; + required uint32 slot_id = 2; +} + +message DBInfo { + required string db_name = 1; + required uint32 slot_num = 2; + repeated uint32 slot_ids = 3; +} + +message PikaMeta { + repeated DBInfo db_infos = 1; +} + +message ConsensusMeta { + optional uint32 term = 1; + // Leader -> Follower prev_log_offset + // Follower -> Leader last_log_offset + optional BinlogOffset log_offset = 2; + optional BinlogOffset commit = 3; + optional bool reject = 4; + repeated BinlogOffset hint = 5; +} + +// Request message +message InnerRequest { + // slave to master + message MetaSync { + required Node node = 1; + optional string auth = 2; + } + + // slave to master + message TrySync { + required Node node = 1; + required Slot slot = 2; + required BinlogOffset binlog_offset = 3; + } + + // slave to master + message DBSync { + required Node node = 1; + required Slot slot = 2; + required BinlogOffset binlog_offset = 3; + } + + message BinlogSync { + required Node node = 1; + required string db_name = 2; + required uint32 slot_id = 3; + required BinlogOffset ack_range_start = 4; + required BinlogOffset ack_range_end = 5; + required int32 session_id = 6; + required bool first_send = 7; + } + + message RemoveSlaveNode { + required Node node = 1; + required Slot slot = 2; + } + + required Type type = 1; + optional MetaSync meta_sync = 2; + optional TrySync try_sync = 3; + optional DBSync db_sync = 4; + optional BinlogSync binlog_sync = 5; + repeated RemoveSlaveNode remove_slave_node = 6; + optional ConsensusMeta consensus_meta = 7; +} + +message SlotInfo { + required uint32 slot_id = 1; + required Node master = 2; + repeated Node slaves = 3; +} + +// Response message +message InnerResponse { + // master to slave + message MetaSync { + message DBInfo { + required string db_name = 1; + required int32 slot_num = 2; + required int32 db_instance_num = 3; + } + required bool classic_mode = 1; + repeated DBInfo dbs_info = 2; + required string run_id = 3; + optional string replication_id = 4; + } + + // master to slave + message TrySync { + enum ReplyCode { + kOk = 1; + kSyncPointBePurged = 2; + kSyncPointLarger = 3; + kError = 4; + } + required ReplyCode reply_code = 1; + required Slot slot = 2; + optional BinlogOffset binlog_offset = 3; + optional int32 session_id = 4; + } + + message DBSync { + required Slot slot = 1; + required int32 session_id = 2; + } + + // master to slave + message BinlogSync { + required Slot slot = 1; + required BinlogOffset binlog_offset = 2; + required bytes binlog = 3; + required int32 session_id = 4; + } + + message RemoveSlaveNode { + required Node node = 1; + required Slot slot = 2; + } + + required Type type = 1; + required StatusCode code = 2; + optional string reply = 3; + optional MetaSync meta_sync = 4; + optional DBSync db_sync = 5; + optional TrySync try_sync = 6; + repeated BinlogSync binlog_sync = 7; + repeated RemoveSlaveNode remove_slave_node = 8; + // consensus use + optional ConsensusMeta consensus_meta = 9; +} diff --git a/tools/pika_cdc/pika/proto/inner/pika_inner_message.pb.go b/tools/pika_cdc/pika/proto/inner/pika_inner_message.pb.go new file mode 100644 index 0000000000..76baa64950 --- /dev/null +++ b/tools/pika_cdc/pika/proto/inner/pika_inner_message.pb.go @@ -0,0 +1,2169 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc v5.27.1 +// source: pika_inner_message.proto + +package inner + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Type int32 + +const ( + Type_kMetaSync Type = 1 + Type_kTrySync Type = 2 + Type_kDBSync Type = 3 + Type_kBinlogSync Type = 4 + Type_kHeatBeat Type = 5 + Type_kRemoveSlaveNode Type = 6 +) + +// Enum value maps for Type. +var ( + Type_name = map[int32]string{ + 1: "kMetaSync", + 2: "kTrySync", + 3: "kDBSync", + 4: "kBinlogSync", + 5: "kHeatBeat", + 6: "kRemoveSlaveNode", + } + Type_value = map[string]int32{ + "kMetaSync": 1, + "kTrySync": 2, + "kDBSync": 3, + "kBinlogSync": 4, + "kHeatBeat": 5, + "kRemoveSlaveNode": 6, + } +) + +func (x Type) Enum() *Type { + p := new(Type) + *p = x + return p +} + +func (x Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Type) Descriptor() protoreflect.EnumDescriptor { + return file_pika_inner_message_proto_enumTypes[0].Descriptor() +} + +func (Type) Type() protoreflect.EnumType { + return &file_pika_inner_message_proto_enumTypes[0] +} + +func (x Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *Type) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = Type(num) + return nil +} + +// Deprecated: Use Type.Descriptor instead. +func (Type) EnumDescriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{0} +} + +type StatusCode int32 + +const ( + StatusCode_kOk StatusCode = 1 + StatusCode_kError StatusCode = 2 + StatusCode_kOther StatusCode = 3 +) + +// Enum value maps for StatusCode. +var ( + StatusCode_name = map[int32]string{ + 1: "kOk", + 2: "kError", + 3: "kOther", + } + StatusCode_value = map[string]int32{ + "kOk": 1, + "kError": 2, + "kOther": 3, + } +) + +func (x StatusCode) Enum() *StatusCode { + p := new(StatusCode) + *p = x + return p +} + +func (x StatusCode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (StatusCode) Descriptor() protoreflect.EnumDescriptor { + return file_pika_inner_message_proto_enumTypes[1].Descriptor() +} + +func (StatusCode) Type() protoreflect.EnumType { + return &file_pika_inner_message_proto_enumTypes[1] +} + +func (x StatusCode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *StatusCode) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = StatusCode(num) + return nil +} + +// Deprecated: Use StatusCode.Descriptor instead. +func (StatusCode) EnumDescriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{1} +} + +type InnerResponse_TrySync_ReplyCode int32 + +const ( + InnerResponse_TrySync_kOk InnerResponse_TrySync_ReplyCode = 1 + InnerResponse_TrySync_kSyncPointBePurged InnerResponse_TrySync_ReplyCode = 2 + InnerResponse_TrySync_kSyncPointLarger InnerResponse_TrySync_ReplyCode = 3 + InnerResponse_TrySync_kError InnerResponse_TrySync_ReplyCode = 4 +) + +// Enum value maps for InnerResponse_TrySync_ReplyCode. +var ( + InnerResponse_TrySync_ReplyCode_name = map[int32]string{ + 1: "kOk", + 2: "kSyncPointBePurged", + 3: "kSyncPointLarger", + 4: "kError", + } + InnerResponse_TrySync_ReplyCode_value = map[string]int32{ + "kOk": 1, + "kSyncPointBePurged": 2, + "kSyncPointLarger": 3, + "kError": 4, + } +) + +func (x InnerResponse_TrySync_ReplyCode) Enum() *InnerResponse_TrySync_ReplyCode { + p := new(InnerResponse_TrySync_ReplyCode) + *p = x + return p +} + +func (x InnerResponse_TrySync_ReplyCode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (InnerResponse_TrySync_ReplyCode) Descriptor() protoreflect.EnumDescriptor { + return file_pika_inner_message_proto_enumTypes[2].Descriptor() +} + +func (InnerResponse_TrySync_ReplyCode) Type() protoreflect.EnumType { + return &file_pika_inner_message_proto_enumTypes[2] +} + +func (x InnerResponse_TrySync_ReplyCode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *InnerResponse_TrySync_ReplyCode) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = InnerResponse_TrySync_ReplyCode(num) + return nil +} + +// Deprecated: Use InnerResponse_TrySync_ReplyCode.Descriptor instead. +func (InnerResponse_TrySync_ReplyCode) EnumDescriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{8, 1, 0} +} + +type BinlogOffset struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Filenum *uint32 `protobuf:"varint,1,req,name=filenum" json:"filenum,omitempty"` + Offset *uint64 `protobuf:"varint,2,req,name=offset" json:"offset,omitempty"` + // consensus use + Term *uint32 `protobuf:"varint,3,opt,name=term" json:"term,omitempty"` + Index *uint64 `protobuf:"varint,4,opt,name=index" json:"index,omitempty"` +} + +func (x *BinlogOffset) Reset() { + *x = BinlogOffset{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BinlogOffset) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BinlogOffset) ProtoMessage() {} + +func (x *BinlogOffset) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BinlogOffset.ProtoReflect.Descriptor instead. +func (*BinlogOffset) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{0} +} + +func (x *BinlogOffset) GetFilenum() uint32 { + if x != nil && x.Filenum != nil { + return *x.Filenum + } + return 0 +} + +func (x *BinlogOffset) GetOffset() uint64 { + if x != nil && x.Offset != nil { + return *x.Offset + } + return 0 +} + +func (x *BinlogOffset) GetTerm() uint32 { + if x != nil && x.Term != nil { + return *x.Term + } + return 0 +} + +func (x *BinlogOffset) GetIndex() uint64 { + if x != nil && x.Index != nil { + return *x.Index + } + return 0 +} + +type Node struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ip *string `protobuf:"bytes,1,req,name=ip" json:"ip,omitempty"` + Port *int32 `protobuf:"varint,2,req,name=port" json:"port,omitempty"` +} + +func (x *Node) Reset() { + *x = Node{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Node) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Node) ProtoMessage() {} + +func (x *Node) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Node.ProtoReflect.Descriptor instead. +func (*Node) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{1} +} + +func (x *Node) GetIp() string { + if x != nil && x.Ip != nil { + return *x.Ip + } + return "" +} + +func (x *Node) GetPort() int32 { + if x != nil && x.Port != nil { + return *x.Port + } + return 0 +} + +type Slot struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DbName *string `protobuf:"bytes,1,req,name=db_name,json=dbName" json:"db_name,omitempty"` + SlotId *uint32 `protobuf:"varint,2,req,name=slot_id,json=slotId" json:"slot_id,omitempty"` +} + +func (x *Slot) Reset() { + *x = Slot{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Slot) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Slot) ProtoMessage() {} + +func (x *Slot) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Slot.ProtoReflect.Descriptor instead. +func (*Slot) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{2} +} + +func (x *Slot) GetDbName() string { + if x != nil && x.DbName != nil { + return *x.DbName + } + return "" +} + +func (x *Slot) GetSlotId() uint32 { + if x != nil && x.SlotId != nil { + return *x.SlotId + } + return 0 +} + +type DBInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DbName *string `protobuf:"bytes,1,req,name=db_name,json=dbName" json:"db_name,omitempty"` + SlotNum *uint32 `protobuf:"varint,2,req,name=slot_num,json=slotNum" json:"slot_num,omitempty"` + SlotIds []uint32 `protobuf:"varint,3,rep,name=slot_ids,json=slotIds" json:"slot_ids,omitempty"` +} + +func (x *DBInfo) Reset() { + *x = DBInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DBInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DBInfo) ProtoMessage() {} + +func (x *DBInfo) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DBInfo.ProtoReflect.Descriptor instead. +func (*DBInfo) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{3} +} + +func (x *DBInfo) GetDbName() string { + if x != nil && x.DbName != nil { + return *x.DbName + } + return "" +} + +func (x *DBInfo) GetSlotNum() uint32 { + if x != nil && x.SlotNum != nil { + return *x.SlotNum + } + return 0 +} + +func (x *DBInfo) GetSlotIds() []uint32 { + if x != nil { + return x.SlotIds + } + return nil +} + +type PikaMeta struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DbInfos []*DBInfo `protobuf:"bytes,1,rep,name=db_infos,json=dbInfos" json:"db_infos,omitempty"` +} + +func (x *PikaMeta) Reset() { + *x = PikaMeta{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PikaMeta) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PikaMeta) ProtoMessage() {} + +func (x *PikaMeta) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PikaMeta.ProtoReflect.Descriptor instead. +func (*PikaMeta) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{4} +} + +func (x *PikaMeta) GetDbInfos() []*DBInfo { + if x != nil { + return x.DbInfos + } + return nil +} + +type ConsensusMeta struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Term *uint32 `protobuf:"varint,1,opt,name=term" json:"term,omitempty"` + // Leader -> Follower prev_log_offset + // Follower -> Leader last_log_offset + LogOffset *BinlogOffset `protobuf:"bytes,2,opt,name=log_offset,json=logOffset" json:"log_offset,omitempty"` + Commit *BinlogOffset `protobuf:"bytes,3,opt,name=commit" json:"commit,omitempty"` + Reject *bool `protobuf:"varint,4,opt,name=reject" json:"reject,omitempty"` + Hint []*BinlogOffset `protobuf:"bytes,5,rep,name=hint" json:"hint,omitempty"` +} + +func (x *ConsensusMeta) Reset() { + *x = ConsensusMeta{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConsensusMeta) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConsensusMeta) ProtoMessage() {} + +func (x *ConsensusMeta) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConsensusMeta.ProtoReflect.Descriptor instead. +func (*ConsensusMeta) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{5} +} + +func (x *ConsensusMeta) GetTerm() uint32 { + if x != nil && x.Term != nil { + return *x.Term + } + return 0 +} + +func (x *ConsensusMeta) GetLogOffset() *BinlogOffset { + if x != nil { + return x.LogOffset + } + return nil +} + +func (x *ConsensusMeta) GetCommit() *BinlogOffset { + if x != nil { + return x.Commit + } + return nil +} + +func (x *ConsensusMeta) GetReject() bool { + if x != nil && x.Reject != nil { + return *x.Reject + } + return false +} + +func (x *ConsensusMeta) GetHint() []*BinlogOffset { + if x != nil { + return x.Hint + } + return nil +} + +// Request message +type InnerRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type *Type `protobuf:"varint,1,req,name=type,enum=InnerMessage.Type" json:"type,omitempty"` + MetaSync *InnerRequest_MetaSync `protobuf:"bytes,2,opt,name=meta_sync,json=metaSync" json:"meta_sync,omitempty"` + TrySync *InnerRequest_TrySync `protobuf:"bytes,3,opt,name=try_sync,json=trySync" json:"try_sync,omitempty"` + DbSync *InnerRequest_DBSync `protobuf:"bytes,4,opt,name=db_sync,json=dbSync" json:"db_sync,omitempty"` + BinlogSync *InnerRequest_BinlogSync `protobuf:"bytes,5,opt,name=binlog_sync,json=binlogSync" json:"binlog_sync,omitempty"` + RemoveSlaveNode []*InnerRequest_RemoveSlaveNode `protobuf:"bytes,6,rep,name=remove_slave_node,json=removeSlaveNode" json:"remove_slave_node,omitempty"` + ConsensusMeta *ConsensusMeta `protobuf:"bytes,7,opt,name=consensus_meta,json=consensusMeta" json:"consensus_meta,omitempty"` +} + +func (x *InnerRequest) Reset() { + *x = InnerRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InnerRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InnerRequest) ProtoMessage() {} + +func (x *InnerRequest) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InnerRequest.ProtoReflect.Descriptor instead. +func (*InnerRequest) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{6} +} + +func (x *InnerRequest) GetType() Type { + if x != nil && x.Type != nil { + return *x.Type + } + return Type_kMetaSync +} + +func (x *InnerRequest) GetMetaSync() *InnerRequest_MetaSync { + if x != nil { + return x.MetaSync + } + return nil +} + +func (x *InnerRequest) GetTrySync() *InnerRequest_TrySync { + if x != nil { + return x.TrySync + } + return nil +} + +func (x *InnerRequest) GetDbSync() *InnerRequest_DBSync { + if x != nil { + return x.DbSync + } + return nil +} + +func (x *InnerRequest) GetBinlogSync() *InnerRequest_BinlogSync { + if x != nil { + return x.BinlogSync + } + return nil +} + +func (x *InnerRequest) GetRemoveSlaveNode() []*InnerRequest_RemoveSlaveNode { + if x != nil { + return x.RemoveSlaveNode + } + return nil +} + +func (x *InnerRequest) GetConsensusMeta() *ConsensusMeta { + if x != nil { + return x.ConsensusMeta + } + return nil +} + +type SlotInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SlotId *uint32 `protobuf:"varint,1,req,name=slot_id,json=slotId" json:"slot_id,omitempty"` + Master *Node `protobuf:"bytes,2,req,name=master" json:"master,omitempty"` + Slaves []*Node `protobuf:"bytes,3,rep,name=slaves" json:"slaves,omitempty"` +} + +func (x *SlotInfo) Reset() { + *x = SlotInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SlotInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SlotInfo) ProtoMessage() {} + +func (x *SlotInfo) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SlotInfo.ProtoReflect.Descriptor instead. +func (*SlotInfo) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{7} +} + +func (x *SlotInfo) GetSlotId() uint32 { + if x != nil && x.SlotId != nil { + return *x.SlotId + } + return 0 +} + +func (x *SlotInfo) GetMaster() *Node { + if x != nil { + return x.Master + } + return nil +} + +func (x *SlotInfo) GetSlaves() []*Node { + if x != nil { + return x.Slaves + } + return nil +} + +// Response message +type InnerResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type *Type `protobuf:"varint,1,req,name=type,enum=InnerMessage.Type" json:"type,omitempty"` + Code *StatusCode `protobuf:"varint,2,req,name=code,enum=InnerMessage.StatusCode" json:"code,omitempty"` + Reply *string `protobuf:"bytes,3,opt,name=reply" json:"reply,omitempty"` + MetaSync *InnerResponse_MetaSync `protobuf:"bytes,4,opt,name=meta_sync,json=metaSync" json:"meta_sync,omitempty"` + DbSync *InnerResponse_DBSync `protobuf:"bytes,5,opt,name=db_sync,json=dbSync" json:"db_sync,omitempty"` + TrySync *InnerResponse_TrySync `protobuf:"bytes,6,opt,name=try_sync,json=trySync" json:"try_sync,omitempty"` + BinlogSync []*InnerResponse_BinlogSync `protobuf:"bytes,7,rep,name=binlog_sync,json=binlogSync" json:"binlog_sync,omitempty"` + RemoveSlaveNode []*InnerResponse_RemoveSlaveNode `protobuf:"bytes,8,rep,name=remove_slave_node,json=removeSlaveNode" json:"remove_slave_node,omitempty"` + // consensus use + ConsensusMeta *ConsensusMeta `protobuf:"bytes,9,opt,name=consensus_meta,json=consensusMeta" json:"consensus_meta,omitempty"` +} + +func (x *InnerResponse) Reset() { + *x = InnerResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InnerResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InnerResponse) ProtoMessage() {} + +func (x *InnerResponse) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InnerResponse.ProtoReflect.Descriptor instead. +func (*InnerResponse) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{8} +} + +func (x *InnerResponse) GetType() Type { + if x != nil && x.Type != nil { + return *x.Type + } + return Type_kMetaSync +} + +func (x *InnerResponse) GetCode() StatusCode { + if x != nil && x.Code != nil { + return *x.Code + } + return StatusCode_kOk +} + +func (x *InnerResponse) GetReply() string { + if x != nil && x.Reply != nil { + return *x.Reply + } + return "" +} + +func (x *InnerResponse) GetMetaSync() *InnerResponse_MetaSync { + if x != nil { + return x.MetaSync + } + return nil +} + +func (x *InnerResponse) GetDbSync() *InnerResponse_DBSync { + if x != nil { + return x.DbSync + } + return nil +} + +func (x *InnerResponse) GetTrySync() *InnerResponse_TrySync { + if x != nil { + return x.TrySync + } + return nil +} + +func (x *InnerResponse) GetBinlogSync() []*InnerResponse_BinlogSync { + if x != nil { + return x.BinlogSync + } + return nil +} + +func (x *InnerResponse) GetRemoveSlaveNode() []*InnerResponse_RemoveSlaveNode { + if x != nil { + return x.RemoveSlaveNode + } + return nil +} + +func (x *InnerResponse) GetConsensusMeta() *ConsensusMeta { + if x != nil { + return x.ConsensusMeta + } + return nil +} + +// slave to master +type InnerRequest_MetaSync struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Node *Node `protobuf:"bytes,1,req,name=node" json:"node,omitempty"` + Auth *string `protobuf:"bytes,2,opt,name=auth" json:"auth,omitempty"` +} + +func (x *InnerRequest_MetaSync) Reset() { + *x = InnerRequest_MetaSync{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InnerRequest_MetaSync) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InnerRequest_MetaSync) ProtoMessage() {} + +func (x *InnerRequest_MetaSync) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InnerRequest_MetaSync.ProtoReflect.Descriptor instead. +func (*InnerRequest_MetaSync) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{6, 0} +} + +func (x *InnerRequest_MetaSync) GetNode() *Node { + if x != nil { + return x.Node + } + return nil +} + +func (x *InnerRequest_MetaSync) GetAuth() string { + if x != nil && x.Auth != nil { + return *x.Auth + } + return "" +} + +// slave to master +type InnerRequest_TrySync struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Node *Node `protobuf:"bytes,1,req,name=node" json:"node,omitempty"` + Slot *Slot `protobuf:"bytes,2,req,name=slot" json:"slot,omitempty"` + BinlogOffset *BinlogOffset `protobuf:"bytes,3,req,name=binlog_offset,json=binlogOffset" json:"binlog_offset,omitempty"` +} + +func (x *InnerRequest_TrySync) Reset() { + *x = InnerRequest_TrySync{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InnerRequest_TrySync) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InnerRequest_TrySync) ProtoMessage() {} + +func (x *InnerRequest_TrySync) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InnerRequest_TrySync.ProtoReflect.Descriptor instead. +func (*InnerRequest_TrySync) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{6, 1} +} + +func (x *InnerRequest_TrySync) GetNode() *Node { + if x != nil { + return x.Node + } + return nil +} + +func (x *InnerRequest_TrySync) GetSlot() *Slot { + if x != nil { + return x.Slot + } + return nil +} + +func (x *InnerRequest_TrySync) GetBinlogOffset() *BinlogOffset { + if x != nil { + return x.BinlogOffset + } + return nil +} + +// slave to master +type InnerRequest_DBSync struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Node *Node `protobuf:"bytes,1,req,name=node" json:"node,omitempty"` + Slot *Slot `protobuf:"bytes,2,req,name=slot" json:"slot,omitempty"` + BinlogOffset *BinlogOffset `protobuf:"bytes,3,req,name=binlog_offset,json=binlogOffset" json:"binlog_offset,omitempty"` +} + +func (x *InnerRequest_DBSync) Reset() { + *x = InnerRequest_DBSync{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InnerRequest_DBSync) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InnerRequest_DBSync) ProtoMessage() {} + +func (x *InnerRequest_DBSync) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InnerRequest_DBSync.ProtoReflect.Descriptor instead. +func (*InnerRequest_DBSync) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{6, 2} +} + +func (x *InnerRequest_DBSync) GetNode() *Node { + if x != nil { + return x.Node + } + return nil +} + +func (x *InnerRequest_DBSync) GetSlot() *Slot { + if x != nil { + return x.Slot + } + return nil +} + +func (x *InnerRequest_DBSync) GetBinlogOffset() *BinlogOffset { + if x != nil { + return x.BinlogOffset + } + return nil +} + +type InnerRequest_BinlogSync struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Node *Node `protobuf:"bytes,1,req,name=node" json:"node,omitempty"` + DbName *string `protobuf:"bytes,2,req,name=db_name,json=dbName" json:"db_name,omitempty"` + SlotId *uint32 `protobuf:"varint,3,req,name=slot_id,json=slotId" json:"slot_id,omitempty"` + AckRangeStart *BinlogOffset `protobuf:"bytes,4,req,name=ack_range_start,json=ackRangeStart" json:"ack_range_start,omitempty"` + AckRangeEnd *BinlogOffset `protobuf:"bytes,5,req,name=ack_range_end,json=ackRangeEnd" json:"ack_range_end,omitempty"` + SessionId *int32 `protobuf:"varint,6,req,name=session_id,json=sessionId" json:"session_id,omitempty"` + FirstSend *bool `protobuf:"varint,7,req,name=first_send,json=firstSend" json:"first_send,omitempty"` +} + +func (x *InnerRequest_BinlogSync) Reset() { + *x = InnerRequest_BinlogSync{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InnerRequest_BinlogSync) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InnerRequest_BinlogSync) ProtoMessage() {} + +func (x *InnerRequest_BinlogSync) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InnerRequest_BinlogSync.ProtoReflect.Descriptor instead. +func (*InnerRequest_BinlogSync) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{6, 3} +} + +func (x *InnerRequest_BinlogSync) GetNode() *Node { + if x != nil { + return x.Node + } + return nil +} + +func (x *InnerRequest_BinlogSync) GetDbName() string { + if x != nil && x.DbName != nil { + return *x.DbName + } + return "" +} + +func (x *InnerRequest_BinlogSync) GetSlotId() uint32 { + if x != nil && x.SlotId != nil { + return *x.SlotId + } + return 0 +} + +func (x *InnerRequest_BinlogSync) GetAckRangeStart() *BinlogOffset { + if x != nil { + return x.AckRangeStart + } + return nil +} + +func (x *InnerRequest_BinlogSync) GetAckRangeEnd() *BinlogOffset { + if x != nil { + return x.AckRangeEnd + } + return nil +} + +func (x *InnerRequest_BinlogSync) GetSessionId() int32 { + if x != nil && x.SessionId != nil { + return *x.SessionId + } + return 0 +} + +func (x *InnerRequest_BinlogSync) GetFirstSend() bool { + if x != nil && x.FirstSend != nil { + return *x.FirstSend + } + return false +} + +type InnerRequest_RemoveSlaveNode struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Node *Node `protobuf:"bytes,1,req,name=node" json:"node,omitempty"` + Slot *Slot `protobuf:"bytes,2,req,name=slot" json:"slot,omitempty"` +} + +func (x *InnerRequest_RemoveSlaveNode) Reset() { + *x = InnerRequest_RemoveSlaveNode{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InnerRequest_RemoveSlaveNode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InnerRequest_RemoveSlaveNode) ProtoMessage() {} + +func (x *InnerRequest_RemoveSlaveNode) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InnerRequest_RemoveSlaveNode.ProtoReflect.Descriptor instead. +func (*InnerRequest_RemoveSlaveNode) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{6, 4} +} + +func (x *InnerRequest_RemoveSlaveNode) GetNode() *Node { + if x != nil { + return x.Node + } + return nil +} + +func (x *InnerRequest_RemoveSlaveNode) GetSlot() *Slot { + if x != nil { + return x.Slot + } + return nil +} + +// master to slave +type InnerResponse_MetaSync struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ClassicMode *bool `protobuf:"varint,1,req,name=classic_mode,json=classicMode" json:"classic_mode,omitempty"` + DbsInfo []*InnerResponse_MetaSync_DBInfo `protobuf:"bytes,2,rep,name=dbs_info,json=dbsInfo" json:"dbs_info,omitempty"` + RunId *string `protobuf:"bytes,3,req,name=run_id,json=runId" json:"run_id,omitempty"` + ReplicationId *string `protobuf:"bytes,4,opt,name=replication_id,json=replicationId" json:"replication_id,omitempty"` +} + +func (x *InnerResponse_MetaSync) Reset() { + *x = InnerResponse_MetaSync{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InnerResponse_MetaSync) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InnerResponse_MetaSync) ProtoMessage() {} + +func (x *InnerResponse_MetaSync) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InnerResponse_MetaSync.ProtoReflect.Descriptor instead. +func (*InnerResponse_MetaSync) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{8, 0} +} + +func (x *InnerResponse_MetaSync) GetClassicMode() bool { + if x != nil && x.ClassicMode != nil { + return *x.ClassicMode + } + return false +} + +func (x *InnerResponse_MetaSync) GetDbsInfo() []*InnerResponse_MetaSync_DBInfo { + if x != nil { + return x.DbsInfo + } + return nil +} + +func (x *InnerResponse_MetaSync) GetRunId() string { + if x != nil && x.RunId != nil { + return *x.RunId + } + return "" +} + +func (x *InnerResponse_MetaSync) GetReplicationId() string { + if x != nil && x.ReplicationId != nil { + return *x.ReplicationId + } + return "" +} + +// master to slave +type InnerResponse_TrySync struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ReplyCode *InnerResponse_TrySync_ReplyCode `protobuf:"varint,1,req,name=reply_code,json=replyCode,enum=InnerMessage.InnerResponse_TrySync_ReplyCode" json:"reply_code,omitempty"` + Slot *Slot `protobuf:"bytes,2,req,name=slot" json:"slot,omitempty"` + BinlogOffset *BinlogOffset `protobuf:"bytes,3,opt,name=binlog_offset,json=binlogOffset" json:"binlog_offset,omitempty"` + SessionId *int32 `protobuf:"varint,4,opt,name=session_id,json=sessionId" json:"session_id,omitempty"` +} + +func (x *InnerResponse_TrySync) Reset() { + *x = InnerResponse_TrySync{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InnerResponse_TrySync) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InnerResponse_TrySync) ProtoMessage() {} + +func (x *InnerResponse_TrySync) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InnerResponse_TrySync.ProtoReflect.Descriptor instead. +func (*InnerResponse_TrySync) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{8, 1} +} + +func (x *InnerResponse_TrySync) GetReplyCode() InnerResponse_TrySync_ReplyCode { + if x != nil && x.ReplyCode != nil { + return *x.ReplyCode + } + return InnerResponse_TrySync_kOk +} + +func (x *InnerResponse_TrySync) GetSlot() *Slot { + if x != nil { + return x.Slot + } + return nil +} + +func (x *InnerResponse_TrySync) GetBinlogOffset() *BinlogOffset { + if x != nil { + return x.BinlogOffset + } + return nil +} + +func (x *InnerResponse_TrySync) GetSessionId() int32 { + if x != nil && x.SessionId != nil { + return *x.SessionId + } + return 0 +} + +type InnerResponse_DBSync struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Slot *Slot `protobuf:"bytes,1,req,name=slot" json:"slot,omitempty"` + SessionId *int32 `protobuf:"varint,2,req,name=session_id,json=sessionId" json:"session_id,omitempty"` +} + +func (x *InnerResponse_DBSync) Reset() { + *x = InnerResponse_DBSync{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InnerResponse_DBSync) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InnerResponse_DBSync) ProtoMessage() {} + +func (x *InnerResponse_DBSync) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InnerResponse_DBSync.ProtoReflect.Descriptor instead. +func (*InnerResponse_DBSync) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{8, 2} +} + +func (x *InnerResponse_DBSync) GetSlot() *Slot { + if x != nil { + return x.Slot + } + return nil +} + +func (x *InnerResponse_DBSync) GetSessionId() int32 { + if x != nil && x.SessionId != nil { + return *x.SessionId + } + return 0 +} + +// master to slave +type InnerResponse_BinlogSync struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Slot *Slot `protobuf:"bytes,1,req,name=slot" json:"slot,omitempty"` + BinlogOffset *BinlogOffset `protobuf:"bytes,2,req,name=binlog_offset,json=binlogOffset" json:"binlog_offset,omitempty"` + Binlog []byte `protobuf:"bytes,3,req,name=binlog" json:"binlog,omitempty"` + SessionId *int32 `protobuf:"varint,4,req,name=session_id,json=sessionId" json:"session_id,omitempty"` +} + +func (x *InnerResponse_BinlogSync) Reset() { + *x = InnerResponse_BinlogSync{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InnerResponse_BinlogSync) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InnerResponse_BinlogSync) ProtoMessage() {} + +func (x *InnerResponse_BinlogSync) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InnerResponse_BinlogSync.ProtoReflect.Descriptor instead. +func (*InnerResponse_BinlogSync) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{8, 3} +} + +func (x *InnerResponse_BinlogSync) GetSlot() *Slot { + if x != nil { + return x.Slot + } + return nil +} + +func (x *InnerResponse_BinlogSync) GetBinlogOffset() *BinlogOffset { + if x != nil { + return x.BinlogOffset + } + return nil +} + +func (x *InnerResponse_BinlogSync) GetBinlog() []byte { + if x != nil { + return x.Binlog + } + return nil +} + +func (x *InnerResponse_BinlogSync) GetSessionId() int32 { + if x != nil && x.SessionId != nil { + return *x.SessionId + } + return 0 +} + +type InnerResponse_RemoveSlaveNode struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Node *Node `protobuf:"bytes,1,req,name=node" json:"node,omitempty"` + Slot *Slot `protobuf:"bytes,2,req,name=slot" json:"slot,omitempty"` +} + +func (x *InnerResponse_RemoveSlaveNode) Reset() { + *x = InnerResponse_RemoveSlaveNode{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InnerResponse_RemoveSlaveNode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InnerResponse_RemoveSlaveNode) ProtoMessage() {} + +func (x *InnerResponse_RemoveSlaveNode) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InnerResponse_RemoveSlaveNode.ProtoReflect.Descriptor instead. +func (*InnerResponse_RemoveSlaveNode) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{8, 4} +} + +func (x *InnerResponse_RemoveSlaveNode) GetNode() *Node { + if x != nil { + return x.Node + } + return nil +} + +func (x *InnerResponse_RemoveSlaveNode) GetSlot() *Slot { + if x != nil { + return x.Slot + } + return nil +} + +type InnerResponse_MetaSync_DBInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DbName *string `protobuf:"bytes,1,req,name=db_name,json=dbName" json:"db_name,omitempty"` + SlotNum *int32 `protobuf:"varint,2,req,name=slot_num,json=slotNum" json:"slot_num,omitempty"` + DbInstanceNum *int32 `protobuf:"varint,3,req,name=db_instance_num,json=dbInstanceNum" json:"db_instance_num,omitempty"` +} + +func (x *InnerResponse_MetaSync_DBInfo) Reset() { + *x = InnerResponse_MetaSync_DBInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_pika_inner_message_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InnerResponse_MetaSync_DBInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InnerResponse_MetaSync_DBInfo) ProtoMessage() {} + +func (x *InnerResponse_MetaSync_DBInfo) ProtoReflect() protoreflect.Message { + mi := &file_pika_inner_message_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InnerResponse_MetaSync_DBInfo.ProtoReflect.Descriptor instead. +func (*InnerResponse_MetaSync_DBInfo) Descriptor() ([]byte, []int) { + return file_pika_inner_message_proto_rawDescGZIP(), []int{8, 0, 0} +} + +func (x *InnerResponse_MetaSync_DBInfo) GetDbName() string { + if x != nil && x.DbName != nil { + return *x.DbName + } + return "" +} + +func (x *InnerResponse_MetaSync_DBInfo) GetSlotNum() int32 { + if x != nil && x.SlotNum != nil { + return *x.SlotNum + } + return 0 +} + +func (x *InnerResponse_MetaSync_DBInfo) GetDbInstanceNum() int32 { + if x != nil && x.DbInstanceNum != nil { + return *x.DbInstanceNum + } + return 0 +} + +var File_pika_inner_message_proto protoreflect.FileDescriptor + +var file_pika_inner_message_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x70, 0x69, 0x6b, 0x61, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x49, 0x6e, 0x6e, 0x65, + 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x6a, 0x0a, 0x0c, 0x42, 0x69, 0x6e, 0x6c, + 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x65, + 0x6e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0d, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x65, 0x6e, + 0x75, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x02, + 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, + 0x72, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x74, 0x65, 0x72, 0x6d, 0x12, 0x14, + 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x22, 0x2a, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x70, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x12, 0x0a, 0x04, + 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x02, 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, + 0x22, 0x38, 0x0a, 0x04, 0x53, 0x6c, 0x6f, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x06, 0x64, 0x62, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x6c, 0x6f, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x02, + 0x28, 0x0d, 0x52, 0x06, 0x73, 0x6c, 0x6f, 0x74, 0x49, 0x64, 0x22, 0x57, 0x0a, 0x06, 0x44, 0x42, + 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x06, 0x64, 0x62, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, + 0x08, 0x73, 0x6c, 0x6f, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0d, 0x52, + 0x07, 0x73, 0x6c, 0x6f, 0x74, 0x4e, 0x75, 0x6d, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x6c, 0x6f, 0x74, + 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x07, 0x73, 0x6c, 0x6f, 0x74, + 0x49, 0x64, 0x73, 0x22, 0x3b, 0x0a, 0x08, 0x50, 0x69, 0x6b, 0x61, 0x4d, 0x65, 0x74, 0x61, 0x12, + 0x2f, 0x0a, 0x08, 0x64, 0x62, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x14, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x2e, 0x44, 0x42, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x07, 0x64, 0x62, 0x49, 0x6e, 0x66, 0x6f, 0x73, + 0x22, 0xda, 0x01, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x4d, 0x65, + 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x04, 0x74, 0x65, 0x72, 0x6d, 0x12, 0x39, 0x0a, 0x0a, 0x6c, 0x6f, 0x67, 0x5f, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x49, 0x6e, 0x6e, + 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x42, 0x69, 0x6e, 0x6c, 0x6f, 0x67, + 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x09, 0x6c, 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x12, 0x32, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x2e, 0x42, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x06, 0x63, + 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x2e, 0x0a, + 0x04, 0x68, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x49, 0x6e, + 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x42, 0x69, 0x6e, 0x6c, 0x6f, + 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x04, 0x68, 0x69, 0x6e, 0x74, 0x22, 0xe6, 0x09, + 0x0a, 0x0c, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, + 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x49, + 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x40, 0x0a, 0x09, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, + 0x79, 0x6e, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x49, 0x6e, 0x6e, 0x65, + 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x08, + 0x6d, 0x65, 0x74, 0x61, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x3d, 0x0a, 0x08, 0x74, 0x72, 0x79, 0x5f, + 0x73, 0x79, 0x6e, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x49, 0x6e, 0x6e, + 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x72, 0x79, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x07, + 0x74, 0x72, 0x79, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x3a, 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x73, 0x79, + 0x6e, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x2e, 0x44, 0x42, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x06, 0x64, 0x62, 0x53, + 0x79, 0x6e, 0x63, 0x12, 0x46, 0x0a, 0x0b, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x5f, 0x73, 0x79, + 0x6e, 0x63, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x52, + 0x0a, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x56, 0x0a, 0x11, 0x72, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x73, 0x6c, 0x61, 0x76, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, + 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x6c, 0x61, 0x76, 0x65, 0x4e, 0x6f, + 0x64, 0x65, 0x52, 0x0f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x6c, 0x61, 0x76, 0x65, 0x4e, + 0x6f, 0x64, 0x65, 0x12, 0x42, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, + 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x49, 0x6e, + 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x65, + 0x6e, 0x73, 0x75, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, + 0x73, 0x75, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x1a, 0x46, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x53, + 0x79, 0x6e, 0x63, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, + 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x61, + 0x75, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x75, 0x74, 0x68, 0x1a, + 0x9a, 0x01, 0x0a, 0x07, 0x54, 0x72, 0x79, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x26, 0x0a, 0x04, 0x6e, + 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, + 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, + 0x6f, 0x64, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x02, 0x28, + 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, 0x3f, 0x0a, 0x0d, 0x62, + 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x02, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x2e, 0x42, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x0c, + 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x1a, 0x99, 0x01, 0x0a, + 0x06, 0x44, 0x42, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, + 0x01, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x12, + 0x26, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, + 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x6c, 0x6f, + 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, 0x3f, 0x0a, 0x0d, 0x62, 0x69, 0x6e, 0x6c, 0x6f, + 0x67, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x42, 0x69, + 0x6e, 0x6c, 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x0c, 0x62, 0x69, 0x6e, 0x6c, + 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x1a, 0xa8, 0x02, 0x0a, 0x0a, 0x42, 0x69, 0x6e, + 0x6c, 0x6f, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, + 0x01, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x12, + 0x17, 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x02, 0x28, 0x09, + 0x52, 0x06, 0x64, 0x62, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x6c, 0x6f, 0x74, + 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x02, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x6c, 0x6f, 0x74, 0x49, + 0x64, 0x12, 0x42, 0x0a, 0x0f, 0x61, 0x63, 0x6b, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x18, 0x04, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x49, 0x6e, 0x6e, + 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x42, 0x69, 0x6e, 0x6c, 0x6f, 0x67, + 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x0d, 0x61, 0x63, 0x6b, 0x52, 0x61, 0x6e, 0x67, 0x65, + 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x3e, 0x0a, 0x0d, 0x61, 0x63, 0x6b, 0x5f, 0x72, 0x61, 0x6e, + 0x67, 0x65, 0x5f, 0x65, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x49, + 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x42, 0x69, 0x6e, 0x6c, + 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x0b, 0x61, 0x63, 0x6b, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x45, 0x6e, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x02, 0x28, 0x05, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x73, 0x65, + 0x6e, 0x64, 0x18, 0x07, 0x20, 0x02, 0x28, 0x08, 0x52, 0x09, 0x66, 0x69, 0x72, 0x73, 0x74, 0x53, + 0x65, 0x6e, 0x64, 0x1a, 0x61, 0x0a, 0x0f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x6c, 0x61, + 0x76, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, + 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x26, + 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, + 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x6c, 0x6f, 0x74, + 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x22, 0x7b, 0x0a, 0x08, 0x53, 0x6c, 0x6f, 0x74, 0x49, 0x6e, + 0x66, 0x6f, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x6c, 0x6f, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x02, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x6c, 0x6f, 0x74, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x06, 0x6d, + 0x61, 0x73, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, + 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, + 0x06, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x6c, 0x61, 0x76, 0x65, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x06, 0x73, 0x6c, 0x61, + 0x76, 0x65, 0x73, 0x22, 0xd2, 0x0b, 0x0a, 0x0d, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, + 0x02, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2c, 0x0a, + 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x49, 0x6e, + 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, + 0x65, 0x70, 0x6c, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x72, 0x65, 0x70, 0x6c, + 0x79, 0x12, 0x41, 0x0a, 0x09, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x53, 0x79, 0x6e, 0x63, 0x12, 0x3b, 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x2e, 0x44, 0x42, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x06, 0x64, 0x62, 0x53, 0x79, 0x6e, + 0x63, 0x12, 0x3e, 0x0a, 0x08, 0x74, 0x72, 0x79, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x2e, 0x54, 0x72, 0x79, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x07, 0x74, 0x72, 0x79, 0x53, 0x79, 0x6e, + 0x63, 0x12, 0x47, 0x0a, 0x0b, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x5f, 0x73, 0x79, 0x6e, 0x63, + 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x0a, + 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x57, 0x0a, 0x11, 0x72, 0x65, + 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x73, 0x6c, 0x61, 0x76, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, + 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x6c, 0x61, 0x76, 0x65, 0x4e, 0x6f, + 0x64, 0x65, 0x52, 0x0f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x6c, 0x61, 0x76, 0x65, 0x4e, + 0x6f, 0x64, 0x65, 0x12, 0x42, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, + 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x49, 0x6e, + 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x65, + 0x6e, 0x73, 0x75, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, + 0x73, 0x75, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x1a, 0x99, 0x02, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, + 0x53, 0x79, 0x6e, 0x63, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x63, 0x5f, + 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x08, 0x52, 0x0b, 0x63, 0x6c, 0x61, 0x73, + 0x73, 0x69, 0x63, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x46, 0x0a, 0x08, 0x64, 0x62, 0x73, 0x5f, 0x69, + 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x49, 0x6e, 0x6e, 0x65, + 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x53, 0x79, 0x6e, 0x63, 0x2e, + 0x44, 0x42, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x07, 0x64, 0x62, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x12, + 0x15, 0x0a, 0x06, 0x72, 0x75, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x02, 0x28, 0x09, 0x52, + 0x05, 0x72, 0x75, 0x6e, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, + 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x1a, 0x64, 0x0a, + 0x06, 0x44, 0x42, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x06, 0x64, 0x62, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x19, 0x0a, 0x08, 0x73, 0x6c, 0x6f, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x02, + 0x28, 0x05, 0x52, 0x07, 0x73, 0x6c, 0x6f, 0x74, 0x4e, 0x75, 0x6d, 0x12, 0x26, 0x0a, 0x0f, 0x64, + 0x62, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x03, + 0x20, 0x02, 0x28, 0x05, 0x52, 0x0d, 0x64, 0x62, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x4e, 0x75, 0x6d, 0x1a, 0xaf, 0x02, 0x0a, 0x07, 0x54, 0x72, 0x79, 0x53, 0x79, 0x6e, 0x63, 0x12, + 0x4c, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, + 0x02, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x2e, 0x54, 0x72, 0x79, 0x53, 0x79, 0x6e, 0x63, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x43, 0x6f, + 0x64, 0x65, 0x52, 0x09, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x26, 0x0a, + 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, + 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, + 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, 0x3f, 0x0a, 0x0d, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x5f, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x49, + 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x42, 0x69, 0x6e, 0x6c, + 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x0c, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, + 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x4e, 0x0a, 0x09, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x43, 0x6f, + 0x64, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x6b, 0x4f, 0x6b, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x6b, + 0x53, 0x79, 0x6e, 0x63, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x42, 0x65, 0x50, 0x75, 0x72, 0x67, 0x65, + 0x64, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x6b, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x6f, 0x69, 0x6e, + 0x74, 0x4c, 0x61, 0x72, 0x67, 0x65, 0x72, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x6b, 0x45, 0x72, + 0x72, 0x6f, 0x72, 0x10, 0x04, 0x1a, 0x4f, 0x0a, 0x06, 0x44, 0x42, 0x53, 0x79, 0x6e, 0x63, 0x12, + 0x26, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, + 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x6c, 0x6f, + 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x02, 0x28, 0x05, 0x52, 0x09, 0x73, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x1a, 0xac, 0x01, 0x0a, 0x0a, 0x42, 0x69, 0x6e, 0x6c, 0x6f, + 0x67, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x26, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x01, 0x20, + 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, 0x3f, 0x0a, + 0x0d, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x02, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x2e, 0x42, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x52, 0x0c, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x16, + 0x0a, 0x06, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x18, 0x03, 0x20, 0x02, 0x28, 0x0c, 0x52, 0x06, + 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x02, 0x28, 0x05, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x1a, 0x61, 0x0a, 0x0f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, + 0x6c, 0x61, 0x76, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, + 0x18, 0x01, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, + 0x12, 0x26, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, + 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x6c, + 0x6f, 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x2a, 0x66, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x0d, 0x0a, 0x09, 0x6b, 0x4d, 0x65, 0x74, 0x61, 0x53, 0x79, 0x6e, 0x63, 0x10, 0x01, 0x12, + 0x0c, 0x0a, 0x08, 0x6b, 0x54, 0x72, 0x79, 0x53, 0x79, 0x6e, 0x63, 0x10, 0x02, 0x12, 0x0b, 0x0a, + 0x07, 0x6b, 0x44, 0x42, 0x53, 0x79, 0x6e, 0x63, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x6b, 0x42, + 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x6b, + 0x48, 0x65, 0x61, 0x74, 0x42, 0x65, 0x61, 0x74, 0x10, 0x05, 0x12, 0x14, 0x0a, 0x10, 0x6b, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x6c, 0x61, 0x76, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x10, 0x06, + 0x2a, 0x2d, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x07, + 0x0a, 0x03, 0x6b, 0x4f, 0x6b, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x6b, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x6b, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x10, 0x03, 0x42, + 0x0f, 0x5a, 0x0d, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x69, 0x6e, 0x6e, 0x65, 0x72, +} + +var ( + file_pika_inner_message_proto_rawDescOnce sync.Once + file_pika_inner_message_proto_rawDescData = file_pika_inner_message_proto_rawDesc +) + +func file_pika_inner_message_proto_rawDescGZIP() []byte { + file_pika_inner_message_proto_rawDescOnce.Do(func() { + file_pika_inner_message_proto_rawDescData = protoimpl.X.CompressGZIP(file_pika_inner_message_proto_rawDescData) + }) + return file_pika_inner_message_proto_rawDescData +} + +var file_pika_inner_message_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_pika_inner_message_proto_msgTypes = make([]protoimpl.MessageInfo, 20) +var file_pika_inner_message_proto_goTypes = []any{ + (Type)(0), // 0: InnerMessage.Type + (StatusCode)(0), // 1: InnerMessage.StatusCode + (InnerResponse_TrySync_ReplyCode)(0), // 2: InnerMessage.InnerResponse.TrySync.ReplyCode + (*BinlogOffset)(nil), // 3: InnerMessage.BinlogOffset + (*Node)(nil), // 4: InnerMessage.Node + (*Slot)(nil), // 5: InnerMessage.Slot + (*DBInfo)(nil), // 6: InnerMessage.DBInfo + (*PikaMeta)(nil), // 7: InnerMessage.PikaMeta + (*ConsensusMeta)(nil), // 8: InnerMessage.ConsensusMeta + (*InnerRequest)(nil), // 9: InnerMessage.InnerRequest + (*SlotInfo)(nil), // 10: InnerMessage.SlotInfo + (*InnerResponse)(nil), // 11: InnerMessage.InnerResponse + (*InnerRequest_MetaSync)(nil), // 12: InnerMessage.InnerRequest.MetaSync + (*InnerRequest_TrySync)(nil), // 13: InnerMessage.InnerRequest.TrySync + (*InnerRequest_DBSync)(nil), // 14: InnerMessage.InnerRequest.DBSync + (*InnerRequest_BinlogSync)(nil), // 15: InnerMessage.InnerRequest.BinlogSync + (*InnerRequest_RemoveSlaveNode)(nil), // 16: InnerMessage.InnerRequest.RemoveSlaveNode + (*InnerResponse_MetaSync)(nil), // 17: InnerMessage.InnerResponse.MetaSync + (*InnerResponse_TrySync)(nil), // 18: InnerMessage.InnerResponse.TrySync + (*InnerResponse_DBSync)(nil), // 19: InnerMessage.InnerResponse.DBSync + (*InnerResponse_BinlogSync)(nil), // 20: InnerMessage.InnerResponse.BinlogSync + (*InnerResponse_RemoveSlaveNode)(nil), // 21: InnerMessage.InnerResponse.RemoveSlaveNode + (*InnerResponse_MetaSync_DBInfo)(nil), // 22: InnerMessage.InnerResponse.MetaSync.DBInfo +} +var file_pika_inner_message_proto_depIdxs = []int32{ + 6, // 0: InnerMessage.PikaMeta.db_infos:type_name -> InnerMessage.DBInfo + 3, // 1: InnerMessage.ConsensusMeta.log_offset:type_name -> InnerMessage.BinlogOffset + 3, // 2: InnerMessage.ConsensusMeta.commit:type_name -> InnerMessage.BinlogOffset + 3, // 3: InnerMessage.ConsensusMeta.hint:type_name -> InnerMessage.BinlogOffset + 0, // 4: InnerMessage.InnerRequest.type:type_name -> InnerMessage.Type + 12, // 5: InnerMessage.InnerRequest.meta_sync:type_name -> InnerMessage.InnerRequest.MetaSync + 13, // 6: InnerMessage.InnerRequest.try_sync:type_name -> InnerMessage.InnerRequest.TrySync + 14, // 7: InnerMessage.InnerRequest.db_sync:type_name -> InnerMessage.InnerRequest.DBSync + 15, // 8: InnerMessage.InnerRequest.binlog_sync:type_name -> InnerMessage.InnerRequest.BinlogSync + 16, // 9: InnerMessage.InnerRequest.remove_slave_node:type_name -> InnerMessage.InnerRequest.RemoveSlaveNode + 8, // 10: InnerMessage.InnerRequest.consensus_meta:type_name -> InnerMessage.ConsensusMeta + 4, // 11: InnerMessage.SlotInfo.master:type_name -> InnerMessage.Node + 4, // 12: InnerMessage.SlotInfo.slaves:type_name -> InnerMessage.Node + 0, // 13: InnerMessage.InnerResponse.type:type_name -> InnerMessage.Type + 1, // 14: InnerMessage.InnerResponse.code:type_name -> InnerMessage.StatusCode + 17, // 15: InnerMessage.InnerResponse.meta_sync:type_name -> InnerMessage.InnerResponse.MetaSync + 19, // 16: InnerMessage.InnerResponse.db_sync:type_name -> InnerMessage.InnerResponse.DBSync + 18, // 17: InnerMessage.InnerResponse.try_sync:type_name -> InnerMessage.InnerResponse.TrySync + 20, // 18: InnerMessage.InnerResponse.binlog_sync:type_name -> InnerMessage.InnerResponse.BinlogSync + 21, // 19: InnerMessage.InnerResponse.remove_slave_node:type_name -> InnerMessage.InnerResponse.RemoveSlaveNode + 8, // 20: InnerMessage.InnerResponse.consensus_meta:type_name -> InnerMessage.ConsensusMeta + 4, // 21: InnerMessage.InnerRequest.MetaSync.node:type_name -> InnerMessage.Node + 4, // 22: InnerMessage.InnerRequest.TrySync.node:type_name -> InnerMessage.Node + 5, // 23: InnerMessage.InnerRequest.TrySync.slot:type_name -> InnerMessage.Slot + 3, // 24: InnerMessage.InnerRequest.TrySync.binlog_offset:type_name -> InnerMessage.BinlogOffset + 4, // 25: InnerMessage.InnerRequest.DBSync.node:type_name -> InnerMessage.Node + 5, // 26: InnerMessage.InnerRequest.DBSync.slot:type_name -> InnerMessage.Slot + 3, // 27: InnerMessage.InnerRequest.DBSync.binlog_offset:type_name -> InnerMessage.BinlogOffset + 4, // 28: InnerMessage.InnerRequest.BinlogSync.node:type_name -> InnerMessage.Node + 3, // 29: InnerMessage.InnerRequest.BinlogSync.ack_range_start:type_name -> InnerMessage.BinlogOffset + 3, // 30: InnerMessage.InnerRequest.BinlogSync.ack_range_end:type_name -> InnerMessage.BinlogOffset + 4, // 31: InnerMessage.InnerRequest.RemoveSlaveNode.node:type_name -> InnerMessage.Node + 5, // 32: InnerMessage.InnerRequest.RemoveSlaveNode.slot:type_name -> InnerMessage.Slot + 22, // 33: InnerMessage.InnerResponse.MetaSync.dbs_info:type_name -> InnerMessage.InnerResponse.MetaSync.DBInfo + 2, // 34: InnerMessage.InnerResponse.TrySync.reply_code:type_name -> InnerMessage.InnerResponse.TrySync.ReplyCode + 5, // 35: InnerMessage.InnerResponse.TrySync.slot:type_name -> InnerMessage.Slot + 3, // 36: InnerMessage.InnerResponse.TrySync.binlog_offset:type_name -> InnerMessage.BinlogOffset + 5, // 37: InnerMessage.InnerResponse.DBSync.slot:type_name -> InnerMessage.Slot + 5, // 38: InnerMessage.InnerResponse.BinlogSync.slot:type_name -> InnerMessage.Slot + 3, // 39: InnerMessage.InnerResponse.BinlogSync.binlog_offset:type_name -> InnerMessage.BinlogOffset + 4, // 40: InnerMessage.InnerResponse.RemoveSlaveNode.node:type_name -> InnerMessage.Node + 5, // 41: InnerMessage.InnerResponse.RemoveSlaveNode.slot:type_name -> InnerMessage.Slot + 42, // [42:42] is the sub-list for method output_type + 42, // [42:42] is the sub-list for method input_type + 42, // [42:42] is the sub-list for extension type_name + 42, // [42:42] is the sub-list for extension extendee + 0, // [0:42] is the sub-list for field type_name +} + +func init() { file_pika_inner_message_proto_init() } +func file_pika_inner_message_proto_init() { + if File_pika_inner_message_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pika_inner_message_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*BinlogOffset); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pika_inner_message_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*Node); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pika_inner_message_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*Slot); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pika_inner_message_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*DBInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pika_inner_message_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*PikaMeta); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pika_inner_message_proto_msgTypes[5].Exporter = func(v any, i int) any { + switch v := v.(*ConsensusMeta); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pika_inner_message_proto_msgTypes[6].Exporter = func(v any, i int) any { + switch v := v.(*InnerRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pika_inner_message_proto_msgTypes[7].Exporter = func(v any, i int) any { + switch v := v.(*SlotInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pika_inner_message_proto_msgTypes[8].Exporter = func(v any, i int) any { + switch v := v.(*InnerResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pika_inner_message_proto_msgTypes[9].Exporter = func(v any, i int) any { + switch v := v.(*InnerRequest_MetaSync); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pika_inner_message_proto_msgTypes[10].Exporter = func(v any, i int) any { + switch v := v.(*InnerRequest_TrySync); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pika_inner_message_proto_msgTypes[11].Exporter = func(v any, i int) any { + switch v := v.(*InnerRequest_DBSync); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pika_inner_message_proto_msgTypes[12].Exporter = func(v any, i int) any { + switch v := v.(*InnerRequest_BinlogSync); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pika_inner_message_proto_msgTypes[13].Exporter = func(v any, i int) any { + switch v := v.(*InnerRequest_RemoveSlaveNode); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pika_inner_message_proto_msgTypes[14].Exporter = func(v any, i int) any { + switch v := v.(*InnerResponse_MetaSync); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pika_inner_message_proto_msgTypes[15].Exporter = func(v any, i int) any { + switch v := v.(*InnerResponse_TrySync); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pika_inner_message_proto_msgTypes[16].Exporter = func(v any, i int) any { + switch v := v.(*InnerResponse_DBSync); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pika_inner_message_proto_msgTypes[17].Exporter = func(v any, i int) any { + switch v := v.(*InnerResponse_BinlogSync); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pika_inner_message_proto_msgTypes[18].Exporter = func(v any, i int) any { + switch v := v.(*InnerResponse_RemoveSlaveNode); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pika_inner_message_proto_msgTypes[19].Exporter = func(v any, i int) any { + switch v := v.(*InnerResponse_MetaSync_DBInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pika_inner_message_proto_rawDesc, + NumEnums: 3, + NumMessages: 20, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pika_inner_message_proto_goTypes, + DependencyIndexes: file_pika_inner_message_proto_depIdxs, + EnumInfos: file_pika_inner_message_proto_enumTypes, + MessageInfos: file_pika_inner_message_proto_msgTypes, + }.Build() + File_pika_inner_message_proto = out.File + file_pika_inner_message_proto_rawDesc = nil + file_pika_inner_message_proto_goTypes = nil + file_pika_inner_message_proto_depIdxs = nil +} diff --git a/tools/pika_cdc/pika/proto/rsync/rsync_service.pb.go b/tools/pika_cdc/pika/proto/rsync/rsync_service.pb.go new file mode 100644 index 0000000000..15663f01aa --- /dev/null +++ b/tools/pika_cdc/pika/proto/rsync/rsync_service.pb.go @@ -0,0 +1,702 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc v5.27.1 +// source: rsync_service.proto + +package rsync + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Type int32 + +const ( + Type_kRsyncMeta Type = 1 + Type_kRsyncFile Type = 2 +) + +// Enum value maps for Type. +var ( + Type_name = map[int32]string{ + 1: "kRsyncMeta", + 2: "kRsyncFile", + } + Type_value = map[string]int32{ + "kRsyncMeta": 1, + "kRsyncFile": 2, + } +) + +func (x Type) Enum() *Type { + p := new(Type) + *p = x + return p +} + +func (x Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Type) Descriptor() protoreflect.EnumDescriptor { + return file_rsync_service_proto_enumTypes[0].Descriptor() +} + +func (Type) Type() protoreflect.EnumType { + return &file_rsync_service_proto_enumTypes[0] +} + +func (x Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *Type) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = Type(num) + return nil +} + +// Deprecated: Use Type.Descriptor instead. +func (Type) EnumDescriptor() ([]byte, []int) { + return file_rsync_service_proto_rawDescGZIP(), []int{0} +} + +type StatusCode int32 + +const ( + StatusCode_kOk StatusCode = 1 + StatusCode_kErr StatusCode = 2 +) + +// Enum value maps for StatusCode. +var ( + StatusCode_name = map[int32]string{ + 1: "kOk", + 2: "kErr", + } + StatusCode_value = map[string]int32{ + "kOk": 1, + "kErr": 2, + } +) + +func (x StatusCode) Enum() *StatusCode { + p := new(StatusCode) + *p = x + return p +} + +func (x StatusCode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (StatusCode) Descriptor() protoreflect.EnumDescriptor { + return file_rsync_service_proto_enumTypes[1].Descriptor() +} + +func (StatusCode) Type() protoreflect.EnumType { + return &file_rsync_service_proto_enumTypes[1] +} + +func (x StatusCode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *StatusCode) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = StatusCode(num) + return nil +} + +// Deprecated: Use StatusCode.Descriptor instead. +func (StatusCode) EnumDescriptor() ([]byte, []int) { + return file_rsync_service_proto_rawDescGZIP(), []int{1} +} + +type MetaResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Filenames []string `protobuf:"bytes,1,rep,name=filenames" json:"filenames,omitempty"` +} + +func (x *MetaResponse) Reset() { + *x = MetaResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_rsync_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MetaResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MetaResponse) ProtoMessage() {} + +func (x *MetaResponse) ProtoReflect() protoreflect.Message { + mi := &file_rsync_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MetaResponse.ProtoReflect.Descriptor instead. +func (*MetaResponse) Descriptor() ([]byte, []int) { + return file_rsync_service_proto_rawDescGZIP(), []int{0} +} + +func (x *MetaResponse) GetFilenames() []string { + if x != nil { + return x.Filenames + } + return nil +} + +type FileRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Filename *string `protobuf:"bytes,1,req,name=filename" json:"filename,omitempty"` + Count *uint64 `protobuf:"varint,2,req,name=count" json:"count,omitempty"` + Offset *uint64 `protobuf:"varint,3,req,name=offset" json:"offset,omitempty"` +} + +func (x *FileRequest) Reset() { + *x = FileRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_rsync_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FileRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FileRequest) ProtoMessage() {} + +func (x *FileRequest) ProtoReflect() protoreflect.Message { + mi := &file_rsync_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FileRequest.ProtoReflect.Descriptor instead. +func (*FileRequest) Descriptor() ([]byte, []int) { + return file_rsync_service_proto_rawDescGZIP(), []int{1} +} + +func (x *FileRequest) GetFilename() string { + if x != nil && x.Filename != nil { + return *x.Filename + } + return "" +} + +func (x *FileRequest) GetCount() uint64 { + if x != nil && x.Count != nil { + return *x.Count + } + return 0 +} + +func (x *FileRequest) GetOffset() uint64 { + if x != nil && x.Offset != nil { + return *x.Offset + } + return 0 +} + +type FileResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Eof *int32 `protobuf:"varint,1,req,name=eof" json:"eof,omitempty"` + Count *uint64 `protobuf:"varint,2,req,name=count" json:"count,omitempty"` + Offset *uint64 `protobuf:"varint,3,req,name=offset" json:"offset,omitempty"` + Data []byte `protobuf:"bytes,4,req,name=data" json:"data,omitempty"` + Checksum *string `protobuf:"bytes,5,req,name=checksum" json:"checksum,omitempty"` + Filename *string `protobuf:"bytes,6,req,name=filename" json:"filename,omitempty"` +} + +func (x *FileResponse) Reset() { + *x = FileResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_rsync_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FileResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FileResponse) ProtoMessage() {} + +func (x *FileResponse) ProtoReflect() protoreflect.Message { + mi := &file_rsync_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FileResponse.ProtoReflect.Descriptor instead. +func (*FileResponse) Descriptor() ([]byte, []int) { + return file_rsync_service_proto_rawDescGZIP(), []int{2} +} + +func (x *FileResponse) GetEof() int32 { + if x != nil && x.Eof != nil { + return *x.Eof + } + return 0 +} + +func (x *FileResponse) GetCount() uint64 { + if x != nil && x.Count != nil { + return *x.Count + } + return 0 +} + +func (x *FileResponse) GetOffset() uint64 { + if x != nil && x.Offset != nil { + return *x.Offset + } + return 0 +} + +func (x *FileResponse) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +func (x *FileResponse) GetChecksum() string { + if x != nil && x.Checksum != nil { + return *x.Checksum + } + return "" +} + +func (x *FileResponse) GetFilename() string { + if x != nil && x.Filename != nil { + return *x.Filename + } + return "" +} + +type RsyncRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type *Type `protobuf:"varint,1,req,name=type,enum=RsyncService.Type" json:"type,omitempty"` + ReaderIndex *int32 `protobuf:"varint,2,req,name=reader_index,json=readerIndex" json:"reader_index,omitempty"` + DbName *string `protobuf:"bytes,3,req,name=db_name,json=dbName" json:"db_name,omitempty"` + SlotId *uint32 `protobuf:"varint,4,req,name=slot_id,json=slotId" json:"slot_id,omitempty"` + FileReq *FileRequest `protobuf:"bytes,5,opt,name=file_req,json=fileReq" json:"file_req,omitempty"` +} + +func (x *RsyncRequest) Reset() { + *x = RsyncRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_rsync_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RsyncRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RsyncRequest) ProtoMessage() {} + +func (x *RsyncRequest) ProtoReflect() protoreflect.Message { + mi := &file_rsync_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RsyncRequest.ProtoReflect.Descriptor instead. +func (*RsyncRequest) Descriptor() ([]byte, []int) { + return file_rsync_service_proto_rawDescGZIP(), []int{3} +} + +func (x *RsyncRequest) GetType() Type { + if x != nil && x.Type != nil { + return *x.Type + } + return Type_kRsyncMeta +} + +func (x *RsyncRequest) GetReaderIndex() int32 { + if x != nil && x.ReaderIndex != nil { + return *x.ReaderIndex + } + return 0 +} + +func (x *RsyncRequest) GetDbName() string { + if x != nil && x.DbName != nil { + return *x.DbName + } + return "" +} + +func (x *RsyncRequest) GetSlotId() uint32 { + if x != nil && x.SlotId != nil { + return *x.SlotId + } + return 0 +} + +func (x *RsyncRequest) GetFileReq() *FileRequest { + if x != nil { + return x.FileReq + } + return nil +} + +type RsyncResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type *Type `protobuf:"varint,1,req,name=type,enum=RsyncService.Type" json:"type,omitempty"` + ReaderIndex *int32 `protobuf:"varint,2,req,name=reader_index,json=readerIndex" json:"reader_index,omitempty"` + SnapshotUuid *string `protobuf:"bytes,3,req,name=snapshot_uuid,json=snapshotUuid" json:"snapshot_uuid,omitempty"` + DbName *string `protobuf:"bytes,4,req,name=db_name,json=dbName" json:"db_name,omitempty"` + SlotId *uint32 `protobuf:"varint,5,req,name=slot_id,json=slotId" json:"slot_id,omitempty"` + Code *StatusCode `protobuf:"varint,6,req,name=code,enum=RsyncService.StatusCode" json:"code,omitempty"` + MetaResp *MetaResponse `protobuf:"bytes,7,opt,name=meta_resp,json=metaResp" json:"meta_resp,omitempty"` + FileResp *FileResponse `protobuf:"bytes,8,opt,name=file_resp,json=fileResp" json:"file_resp,omitempty"` +} + +func (x *RsyncResponse) Reset() { + *x = RsyncResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_rsync_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RsyncResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RsyncResponse) ProtoMessage() {} + +func (x *RsyncResponse) ProtoReflect() protoreflect.Message { + mi := &file_rsync_service_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RsyncResponse.ProtoReflect.Descriptor instead. +func (*RsyncResponse) Descriptor() ([]byte, []int) { + return file_rsync_service_proto_rawDescGZIP(), []int{4} +} + +func (x *RsyncResponse) GetType() Type { + if x != nil && x.Type != nil { + return *x.Type + } + return Type_kRsyncMeta +} + +func (x *RsyncResponse) GetReaderIndex() int32 { + if x != nil && x.ReaderIndex != nil { + return *x.ReaderIndex + } + return 0 +} + +func (x *RsyncResponse) GetSnapshotUuid() string { + if x != nil && x.SnapshotUuid != nil { + return *x.SnapshotUuid + } + return "" +} + +func (x *RsyncResponse) GetDbName() string { + if x != nil && x.DbName != nil { + return *x.DbName + } + return "" +} + +func (x *RsyncResponse) GetSlotId() uint32 { + if x != nil && x.SlotId != nil { + return *x.SlotId + } + return 0 +} + +func (x *RsyncResponse) GetCode() StatusCode { + if x != nil && x.Code != nil { + return *x.Code + } + return StatusCode_kOk +} + +func (x *RsyncResponse) GetMetaResp() *MetaResponse { + if x != nil { + return x.MetaResp + } + return nil +} + +func (x *RsyncResponse) GetFileResp() *FileResponse { + if x != nil { + return x.FileResp + } + return nil +} + +var File_rsync_service_proto protoreflect.FileDescriptor + +var file_rsync_service_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x72, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x52, 0x73, 0x79, 0x6e, 0x63, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x22, 0x2c, 0x0a, 0x0c, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, + 0x73, 0x22, 0x57, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x02, + 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x52, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x02, + 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x22, 0x9a, 0x01, 0x0a, 0x0c, 0x46, + 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, + 0x6f, 0x66, 0x18, 0x01, 0x20, 0x02, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6f, 0x66, 0x12, 0x14, 0x0a, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, + 0x02, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, + 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x02, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, + 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x18, 0x05, 0x20, 0x02, 0x28, + 0x09, 0x52, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x66, + 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x02, 0x28, 0x09, 0x52, 0x08, 0x66, + 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xc1, 0x01, 0x0a, 0x0c, 0x52, 0x73, 0x79, 0x6e, + 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x01, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x52, 0x73, 0x79, 0x6e, 0x63, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, + 0x18, 0x02, 0x20, 0x02, 0x28, 0x05, 0x52, 0x0b, 0x72, 0x65, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, + 0x64, 0x65, 0x78, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, + 0x20, 0x02, 0x28, 0x09, 0x52, 0x06, 0x64, 0x62, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07, + 0x73, 0x6c, 0x6f, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x02, 0x28, 0x0d, 0x52, 0x06, 0x73, + 0x6c, 0x6f, 0x74, 0x49, 0x64, 0x12, 0x34, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x72, 0x65, + 0x71, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x52, 0x73, 0x79, 0x6e, 0x63, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x22, 0xd1, 0x02, 0x0a, 0x0d, + 0x52, 0x73, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x52, 0x73, + 0x79, 0x6e, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, + 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x02, 0x28, 0x05, 0x52, 0x0b, 0x72, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x6e, 0x61, 0x70, + 0x73, 0x68, 0x6f, 0x74, 0x5f, 0x75, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x02, 0x28, 0x09, 0x52, + 0x0c, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x55, 0x75, 0x69, 0x64, 0x12, 0x17, 0x0a, + 0x07, 0x64, 0x62, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x02, 0x28, 0x09, 0x52, 0x06, + 0x64, 0x62, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x6c, 0x6f, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x05, 0x20, 0x02, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x6c, 0x6f, 0x74, 0x49, 0x64, 0x12, + 0x2c, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x06, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x18, 0x2e, + 0x52, 0x73, 0x79, 0x6e, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x37, 0x0a, + 0x09, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x52, 0x73, 0x79, 0x6e, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x4d, 0x65, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x6d, 0x65, + 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x12, 0x37, 0x0a, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x72, + 0x65, 0x73, 0x70, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x52, 0x73, 0x79, 0x6e, + 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x2a, + 0x26, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x0a, 0x6b, 0x52, 0x73, 0x79, 0x6e, + 0x63, 0x4d, 0x65, 0x74, 0x61, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x6b, 0x52, 0x73, 0x79, 0x6e, + 0x63, 0x46, 0x69, 0x6c, 0x65, 0x10, 0x02, 0x2a, 0x1f, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x6b, 0x4f, 0x6b, 0x10, 0x01, 0x12, 0x08, + 0x0a, 0x04, 0x6b, 0x45, 0x72, 0x72, 0x10, 0x02, 0x42, 0x0f, 0x5a, 0x0d, 0x2e, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x73, 0x79, 0x6e, 0x63, +} + +var ( + file_rsync_service_proto_rawDescOnce sync.Once + file_rsync_service_proto_rawDescData = file_rsync_service_proto_rawDesc +) + +func file_rsync_service_proto_rawDescGZIP() []byte { + file_rsync_service_proto_rawDescOnce.Do(func() { + file_rsync_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_rsync_service_proto_rawDescData) + }) + return file_rsync_service_proto_rawDescData +} + +var file_rsync_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_rsync_service_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_rsync_service_proto_goTypes = []any{ + (Type)(0), // 0: RsyncService.Type + (StatusCode)(0), // 1: RsyncService.StatusCode + (*MetaResponse)(nil), // 2: RsyncService.MetaResponse + (*FileRequest)(nil), // 3: RsyncService.FileRequest + (*FileResponse)(nil), // 4: RsyncService.FileResponse + (*RsyncRequest)(nil), // 5: RsyncService.RsyncRequest + (*RsyncResponse)(nil), // 6: RsyncService.RsyncResponse +} +var file_rsync_service_proto_depIdxs = []int32{ + 0, // 0: RsyncService.RsyncRequest.type:type_name -> RsyncService.Type + 3, // 1: RsyncService.RsyncRequest.file_req:type_name -> RsyncService.FileRequest + 0, // 2: RsyncService.RsyncResponse.type:type_name -> RsyncService.Type + 1, // 3: RsyncService.RsyncResponse.code:type_name -> RsyncService.StatusCode + 2, // 4: RsyncService.RsyncResponse.meta_resp:type_name -> RsyncService.MetaResponse + 4, // 5: RsyncService.RsyncResponse.file_resp:type_name -> RsyncService.FileResponse + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_rsync_service_proto_init() } +func file_rsync_service_proto_init() { + if File_rsync_service_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_rsync_service_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*MetaResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rsync_service_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*FileRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rsync_service_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*FileResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rsync_service_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*RsyncRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rsync_service_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*RsyncResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_rsync_service_proto_rawDesc, + NumEnums: 2, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_rsync_service_proto_goTypes, + DependencyIndexes: file_rsync_service_proto_depIdxs, + EnumInfos: file_rsync_service_proto_enumTypes, + MessageInfos: file_rsync_service_proto_msgTypes, + }.Build() + File_rsync_service_proto = out.File + file_rsync_service_proto_rawDesc = nil + file_rsync_service_proto_goTypes = nil + file_rsync_service_proto_depIdxs = nil +} diff --git a/tools/pika_cdc/pika/replproxy.go b/tools/pika_cdc/pika/replproxy.go new file mode 100644 index 0000000000..206f0e1e28 --- /dev/null +++ b/tools/pika_cdc/pika/replproxy.go @@ -0,0 +1,4 @@ +package pika + +type ReplProxy struct { +} diff --git a/tools/pika_cdc/pika/replproxy_test.go b/tools/pika_cdc/pika/replproxy_test.go new file mode 100644 index 0000000000..26ae0daa33 --- /dev/null +++ b/tools/pika_cdc/pika/replproxy_test.go @@ -0,0 +1,76 @@ +package pika + +import ( + "context" + "encoding/binary" + "fmt" + "github.com/golang/protobuf/proto" + "github.com/redis/go-redis/v9" + "net" + "os" + "pika_cdc/conf" + "pika_cdc/pika/proto/inner" + "strconv" + "strings" + "testing" +) + +func TestConnect(t *testing.T) { + cxt := context.Background() + addr := "127.0.0.1:9221" + client := redis.NewClient(&redis.Options{ + Addr: addr, + Password: "", // no password set + DB: 0, // use default DB + }) + fmt.Println(client.Get(cxt, "key")) +} + +func getPort(addr string) int32 { + portStr := addr[strings.LastIndex(addr, ":")+1:] + port, _ := strconv.Atoi(portStr) + return int32(port) +} + +func TestSendMetaSync(t *testing.T) { + ip := string("127.0.0.1") + listener, e := net.Listen("tcp", ":0") + if e != nil { + os.Exit(1) + } + selfPort := getPort(listener.Addr().String()) + var masterPort int32 = getPort(conf.ConfigInstance.PikaServer) + 2000 + addr := ip + ":" + strconv.Itoa(int(masterPort)) + tt := inner.Type_kMetaSync + request := inner.InnerRequest{ + Type: &tt, + MetaSync: &inner.InnerRequest_MetaSync{ + Node: &inner.Node{ + Ip: &ip, + Port: &selfPort, + }, + }, + } + msg, err := proto.Marshal(&request) + conn, err := net.Dial("tcp", addr) + if err != nil { + fmt.Println("Error connecting:", err) + os.Exit(1) + } + defer conn.Close() + + pikaTag := []byte(BuildInternalTag(msg)) + allBytes := append(pikaTag, msg...) + _, err = conn.Write(allBytes) + if err != nil { + fmt.Println("Error writing to server:", err) + os.Exit(1) + } +} + +func BuildInternalTag(resp []byte) (tag string) { + respSize := uint32(len(resp)) + buf := make([]byte, 4) + binary.BigEndian.PutUint32(buf, respSize) + return string(buf) +} diff --git a/tools/pika_cdc/pika/rsync_service.proto b/tools/pika_cdc/pika/rsync_service.proto new file mode 100644 index 0000000000..abaf7671ae --- /dev/null +++ b/tools/pika_cdc/pika/rsync_service.proto @@ -0,0 +1,53 @@ +syntax = "proto2"; +package RsyncService; + +option go_package = "./proto/rsync"; + +enum Type { + kRsyncMeta = 1; + kRsyncFile = 2; +} + +enum StatusCode { + kOk = 1; + kErr = 2; +} + +message MetaResponse { + repeated string filenames = 1; +} + +message FileRequest { + required string filename = 1; + required uint64 count = 2; + required uint64 offset = 3; +} + +message FileResponse { + required int32 eof = 1; + required uint64 count = 2; + required uint64 offset = 3; + required bytes data = 4; + required string checksum = 5; + required string filename = 6; +} + +message RsyncRequest { + required Type type = 1; + required int32 reader_index = 2; + required string db_name = 3; + required uint32 slot_id = 4; + optional FileRequest file_req = 5; +} + +message RsyncResponse { + required Type type = 1; + required int32 reader_index = 2; + required string snapshot_uuid = 3; + required string db_name = 4; + required uint32 slot_id = 5; + required StatusCode code = 6; + optional MetaResponse meta_resp = 7; + optional FileResponse file_resp = 8; +} + diff --git a/tools/pika_cdc/pika/server.go b/tools/pika_cdc/pika/server.go new file mode 100644 index 0000000000..ddfaca51a3 --- /dev/null +++ b/tools/pika_cdc/pika/server.go @@ -0,0 +1,34 @@ +package pika + +type Server struct { + stop chan bool +} + +func New(s string) Server { + return Server{} +} +func (s *Server) Start() { +} +func (s *Server) Loop() { + + //for { + // select { + // case stop := <-s.stop: + // { + // + // } + // case msg := <- s.: + // + // } + //} +} +func (s *Server) Stop() { + defer func() {}() + s.stop <- true +} +func (s *Server) Close() { + s.stop <- true +} +func (s *Server) GetMessage() { + +} From b3d1ed3be4f3342f4c1df11d4136cc1547b3d947 Mon Sep 17 00:00:00 2001 From: LeeHao <1838249551@qq.com> Date: Wed, 24 Jul 2024 23:25:24 +0800 Subject: [PATCH 3/9] feat-cdc:add send metaSync test Signed-off-by: LeeHao <1838249551@qq.com> --- tools/pika_cdc/pika/replproxy.go | 4 + tools/pika_cdc/pika/replproxy_test.go | 278 ++++++++++++++++++++++++++ tools/pika_cdc/pika/server.go | 4 + 3 files changed, 286 insertions(+) diff --git a/tools/pika_cdc/pika/replproxy.go b/tools/pika_cdc/pika/replproxy.go index 206f0e1e28..f9e2a024f2 100644 --- a/tools/pika_cdc/pika/replproxy.go +++ b/tools/pika_cdc/pika/replproxy.go @@ -2,3 +2,7 @@ package pika type ReplProxy struct { } + +func (repl *ReplProxy) SendMetaSync() { + +} diff --git a/tools/pika_cdc/pika/replproxy_test.go b/tools/pika_cdc/pika/replproxy_test.go index 26ae0daa33..d367bab105 100644 --- a/tools/pika_cdc/pika/replproxy_test.go +++ b/tools/pika_cdc/pika/replproxy_test.go @@ -1,11 +1,14 @@ package pika import ( + "bytes" "context" "encoding/binary" "fmt" "github.com/golang/protobuf/proto" "github.com/redis/go-redis/v9" + "io" + "log" "net" "os" "pika_cdc/conf" @@ -31,6 +34,13 @@ func getPort(addr string) int32 { port, _ := strconv.Atoi(portStr) return int32(port) } +func getIP(addr string) string { + index := strings.LastIndex(addr, ":") + if index == -1 { + return addr + } + return addr[:index] +} func TestSendMetaSync(t *testing.T) { ip := string("127.0.0.1") @@ -68,9 +78,277 @@ func TestSendMetaSync(t *testing.T) { } } +const HeaderLength = 4 + +func receiveReplMsg(listener net.Listener) { + defer listener.Close() + fmt.Println("Listening on ", listener.Addr().String()) + for { + conn, err := listener.Accept() + fmt.Println(conn.LocalAddr().String() + " connect") + if err != nil { + fmt.Println("Error accepting connection:", err) + continue + } + //go handleConnection(conn) + } +} +func getResponse(conn net.Conn) *inner.InnerResponse { + // Read the header (length) + header := make([]byte, HeaderLength) + _, err := io.ReadFull(conn, header) + if err != nil { + if err != io.EOF { + fmt.Println("Error reading header:", err) + } + return nil + } + + // Convert the header to an integer + var bodyLength uint32 + buffer := bytes.NewBuffer(header) + err = binary.Read(buffer, binary.BigEndian, &bodyLength) + if err != nil { + log.Fatal("Error converting header to integer:", err) + return nil + } + // Read the body + body := make([]byte, bodyLength) + _, err = io.ReadFull(conn, body) + if err != nil { + log.Fatal("Error reading body:", err) + return nil + } + + res := &inner.InnerResponse{} + err = proto.Unmarshal(body, res) + if err != nil { + log.Fatal("Error Deserialization:", err) + } + return res +} + +func sendReplReq(conn net.Conn, request *inner.InnerRequest) (net.Conn, error) { + if conn == nil { + ip := string("127.0.0.1") + var masterReplPort int32 = getPort(conf.ConfigInstance.PikaServer) + 2000 + addr := ip + ":" + strconv.Itoa(int(masterReplPort)) + newConn, err := net.Dial("tcp", addr) + if err != nil { + return nil, err + } + conn = newConn + } + msg, err := proto.Marshal(request) + if err != nil { + log.Fatal("Error Marshal:", err) + } + + pikaTag := []byte(BuildInternalTag(msg)) + allBytes := append(pikaTag, msg...) + _, err = conn.Write(allBytes) + if err != nil { + log.Fatal("Error writing to server:", err) + } + return conn, nil +} + +func sendMetaSyncRequest(conn net.Conn) (net.Conn, error) { + if conn == nil { + ip := string("127.0.0.1") + var masterReplPort int32 = getPort(conf.ConfigInstance.PikaServer) + 2000 + addr := ip + ":" + strconv.Itoa(int(masterReplPort)) + newConn, err := net.Dial("tcp", addr) + if err != nil { + return nil, err + } + conn = newConn + } + metaSyncType := inner.Type_kMetaSync + port := getPort(conn.LocalAddr().String()) + ip := getIP(conn.LocalAddr().String()) + request := &inner.InnerRequest{ + Type: &metaSyncType, + MetaSync: &inner.InnerRequest_MetaSync{ + Node: &inner.Node{ + Ip: &ip, + Port: &port, + }, + }, + } + return sendReplReq(conn, request) +} + +func TestGetOffsetFromMaster(t *testing.T) { + ip := string("127.0.0.1") + listener, e := net.Listen("tcp", ":0") + if e != nil { + os.Exit(1) + } + selfPort := getPort(listener.Addr().String()) + conn, err := sendMetaSyncRequest(nil) + if err != nil { + log.Fatal("Failed to sendMetaSyncRequest") + } + metaResp := getResponse(conn) + trySyncType := inner.Type_kTrySync + replDBs := metaResp.MetaSync.DbsInfo + var fileNum uint32 = 1 + var offset uint64 = 0 + for _, db := range replDBs { + slotId := uint32(*db.SlotNum) + trySync := &inner.InnerRequest{ + Type: &trySyncType, + TrySync: &inner.InnerRequest_TrySync{ + Node: &inner.Node{ + Ip: &ip, + Port: &selfPort, + }, + Slot: &inner.Slot{ + DbName: db.DbName, + SlotId: &slotId, + }, + BinlogOffset: &inner.BinlogOffset{ + Filenum: &fileNum, + Offset: &offset, + Term: nil, + Index: nil, + }, + }, + ConsensusMeta: nil, + } + _, err = sendReplReq(conn, trySync) + if err != nil { + log.Fatal("Failed to send TrySync Msg", err) + } + trySyncResp := getResponse(conn) + if trySyncResp == nil || *trySyncResp.Code != inner.StatusCode_kOk { + log.Fatal("Failed to get TrySync Response Msg", err) + } + trySync.TrySync.BinlogOffset = trySyncResp.TrySync.GetBinlogOffset() + log.Println("get offset:", trySync.TrySync.BinlogOffset) + } +} + +func TestSendDbSyncReqMsg(t *testing.T) { + ip := string("127.0.0.1") + listener, e := net.Listen("tcp", ":0") + if e != nil { + os.Exit(1) + } + + selfPort := getPort(listener.Addr().String()) + + metaSyncType := inner.Type_kMetaSync + + request := &inner.InnerRequest{ + Type: &metaSyncType, + MetaSync: &inner.InnerRequest_MetaSync{ + Node: &inner.Node{ + Ip: &ip, + Port: &selfPort, + }, + }, + } + conn, err := sendReplReq(nil, request) + if err != nil { + os.Exit(1) + } + metaResp := getResponse(conn) + + dbSyncType := inner.Type_kDBSync + replDBs := metaResp.MetaSync.DbsInfo + for _, db := range replDBs { + var fileNum uint32 = 1 + var offset uint64 = 0 + slotId := uint32(*db.SlotNum) + dbSyncReq := &inner.InnerRequest{ + Type: &dbSyncType, + DbSync: &inner.InnerRequest_DBSync{ + Node: &inner.Node{ + Ip: &ip, + Port: &selfPort, + }, + Slot: &inner.Slot{ + DbName: db.DbName, + SlotId: &slotId, + }, + BinlogOffset: &inner.BinlogOffset{ + Filenum: &fileNum, + Offset: &offset, + Term: nil, + Index: nil, + }, + }, + ConsensusMeta: nil, + } + sendReplReq(conn, dbSyncReq) + } +} + func BuildInternalTag(resp []byte) (tag string) { respSize := uint32(len(resp)) buf := make([]byte, 4) binary.BigEndian.PutUint32(buf, respSize) return string(buf) } + +func TestGetIncrementalSync(t *testing.T) { + conn, err := sendMetaSyncRequest(nil) + if err != nil { + log.Fatal(err) + } + metaResp := getResponse(conn) + if metaResp == nil { + log.Fatal("Failed to get metaResp") + } + trySyncType := inner.Type_kTrySync + replDBs := metaResp.MetaSync.DbsInfo + var fileNum uint32 = 1 + var offset uint64 = 0 + ip := getIP(conn.LocalAddr().String()) + port := getPort(conn.LocalAddr().String()) + + for _, db := range replDBs { + slotId := uint32(*db.SlotNum) + trySync := &inner.InnerRequest{ + Type: &trySyncType, + TrySync: &inner.InnerRequest_TrySync{ + Node: &inner.Node{ + Ip: &ip, + Port: &port, + }, + Slot: &inner.Slot{ + DbName: db.DbName, + SlotId: &slotId, + }, + BinlogOffset: &inner.BinlogOffset{ + Filenum: &fileNum, + Offset: &offset, + Term: nil, + Index: nil, + }, + }, + ConsensusMeta: nil, + } + _, err = sendReplReq(conn, trySync) + if err != nil { + log.Fatal("Failed to send TrySync Msg", err) + } + trySyncResp := getResponse(conn) + if trySyncResp == nil || *trySyncResp.Code != inner.StatusCode_kOk { + log.Fatal("Failed to get TrySync Response Msg", err) + } + // todo(leehao) test send BinlogSync to get Incremental data + binlogSyncReq := &inner.InnerRequest_BinlogSync{ + Node: nil, + DbName: nil, + SlotId: nil, + AckRangeStart: nil, + AckRangeEnd: nil, + SessionId: nil, + FirstSend: nil, + } + trySync.TrySync.BinlogOffset = trySyncResp.TrySync.GetBinlogOffset() + } +} diff --git a/tools/pika_cdc/pika/server.go b/tools/pika_cdc/pika/server.go index ddfaca51a3..e06aa10145 100644 --- a/tools/pika_cdc/pika/server.go +++ b/tools/pika_cdc/pika/server.go @@ -32,3 +32,7 @@ func (s *Server) Close() { func (s *Server) GetMessage() { } + +func (s *Server) SendMetaSync() { + +} From 0e3ab97790674ca8f8efe0077f89c7aa42bf237b Mon Sep 17 00:00:00 2001 From: LeeHao <1838249551@qq.com> Date: Sat, 27 Jul 2024 19:01:32 +0800 Subject: [PATCH 4/9] feat-cdc:add send binlogSync test Basic incremental synchronization to redis has been completed Signed-off-by: LeeHao <1838249551@qq.com> --- tools/pika_cdc/conf/conf.go | 17 ++- tools/pika_cdc/go.mod | 8 +- tools/pika_cdc/go.sum | 9 ++ tools/pika_cdc/pika/replproxy_test.go | 172 ++++++++++++++++++++++---- 4 files changed, 178 insertions(+), 28 deletions(-) diff --git a/tools/pika_cdc/conf/conf.go b/tools/pika_cdc/conf/conf.go index 23dd5e2855..5b92647cfe 100644 --- a/tools/pika_cdc/conf/conf.go +++ b/tools/pika_cdc/conf/conf.go @@ -1,12 +1,17 @@ package conf import ( - "gopkg.in/yaml.v3" + "fmt" "io/ioutil" "log" + "os" + "path" "path/filepath" "runtime" "strings" + + "github.com/sirupsen/logrus" + "gopkg.in/yaml.v3" ) type PikaCdcConfig struct { @@ -32,6 +37,16 @@ func init() { if err != nil { log.Fatal("fail to yaml unmarshal:", err) } + + logrus.SetFormatter(&logrus.TextFormatter{ + FullTimestamp: true, + CallerPrettyfier: func(f *runtime.Frame) (string, string) { + return "", fmt.Sprintf("%s:%d", path.Base(f.File), f.Line) + }, + }) + + logrus.SetReportCaller(true) + logrus.SetOutput(os.Stdout) } func (c *PikaCdcConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { diff --git a/tools/pika_cdc/go.mod b/tools/pika_cdc/go.mod index a01b2ae667..02c20be1ae 100644 --- a/tools/pika_cdc/go.mod +++ b/tools/pika_cdc/go.mod @@ -3,16 +3,18 @@ module pika_cdc go 1.20 require ( + github.com/golang/protobuf v1.5.4 + github.com/redis/go-redis/v9 v9.6.0 github.com/segmentio/kafka-go v0.4.47 + google.golang.org/protobuf v1.34.2 gopkg.in/yaml.v3 v3.0.1 ) require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect - github.com/golang/protobuf v1.5.4 // indirect github.com/klauspost/compress v1.15.9 // indirect github.com/pierrec/lz4/v4 v4.1.15 // indirect - github.com/redis/go-redis/v9 v9.6.0 // indirect - google.golang.org/protobuf v1.34.2 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect + golang.org/x/sys v0.13.0 // indirect ) diff --git a/tools/pika_cdc/go.sum b/tools/pika_cdc/go.sum index 6b93fe51d0..dc7d26503e 100644 --- a/tools/pika_cdc/go.sum +++ b/tools/pika_cdc/go.sum @@ -1,3 +1,5 @@ +github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= +github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -7,6 +9,7 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY= github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= @@ -18,8 +21,11 @@ github.com/redis/go-redis/v9 v9.6.0 h1:NLck+Rab3AOTHw21CGRpvQpgTrAU4sgdCswqGtlhG github.com/redis/go-redis/v9 v9.6.0/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= github.com/segmentio/kafka-go v0.4.47 h1:IqziR4pA3vrZq7YdRxaT3w1/5fvIH5qpCwstUanQQB0= github.com/segmentio/kafka-go v0.4.47/go.mod h1:HjF6XbOKh0Pjlkr5GVZxt6CsjjwnmhVOfURM5KMd8qg= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= @@ -49,9 +55,11 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -71,6 +79,7 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= diff --git a/tools/pika_cdc/pika/replproxy_test.go b/tools/pika_cdc/pika/replproxy_test.go index d367bab105..43dbe881a9 100644 --- a/tools/pika_cdc/pika/replproxy_test.go +++ b/tools/pika_cdc/pika/replproxy_test.go @@ -1,14 +1,15 @@ package pika import ( + "bufio" "bytes" "context" "encoding/binary" "fmt" "github.com/golang/protobuf/proto" "github.com/redis/go-redis/v9" + "github.com/sirupsen/logrus" "io" - "log" "net" "os" "pika_cdc/conf" @@ -16,6 +17,7 @@ import ( "strconv" "strings" "testing" + "time" ) func TestConnect(t *testing.T) { @@ -109,21 +111,21 @@ func getResponse(conn net.Conn) *inner.InnerResponse { buffer := bytes.NewBuffer(header) err = binary.Read(buffer, binary.BigEndian, &bodyLength) if err != nil { - log.Fatal("Error converting header to integer:", err) + logrus.Fatal("Error converting header to integer:", err) return nil } // Read the body body := make([]byte, bodyLength) _, err = io.ReadFull(conn, body) if err != nil { - log.Fatal("Error reading body:", err) + logrus.Fatal("Error reading body:", err) return nil } res := &inner.InnerResponse{} err = proto.Unmarshal(body, res) if err != nil { - log.Fatal("Error Deserialization:", err) + logrus.Fatal("Error Deserialization:", err) } return res } @@ -141,14 +143,14 @@ func sendReplReq(conn net.Conn, request *inner.InnerRequest) (net.Conn, error) { } msg, err := proto.Marshal(request) if err != nil { - log.Fatal("Error Marshal:", err) + logrus.Fatal("Error Marshal:", err) } pikaTag := []byte(BuildInternalTag(msg)) allBytes := append(pikaTag, msg...) _, err = conn.Write(allBytes) if err != nil { - log.Fatal("Error writing to server:", err) + logrus.Fatal("Error writing to server:", err) } return conn, nil } @@ -188,7 +190,7 @@ func TestGetOffsetFromMaster(t *testing.T) { selfPort := getPort(listener.Addr().String()) conn, err := sendMetaSyncRequest(nil) if err != nil { - log.Fatal("Failed to sendMetaSyncRequest") + logrus.Fatal("Failed to sendMetaSyncRequest") } metaResp := getResponse(conn) trySyncType := inner.Type_kTrySync @@ -219,14 +221,14 @@ func TestGetOffsetFromMaster(t *testing.T) { } _, err = sendReplReq(conn, trySync) if err != nil { - log.Fatal("Failed to send TrySync Msg", err) + logrus.Fatal("Failed to send TrySync Msg", err) } trySyncResp := getResponse(conn) if trySyncResp == nil || *trySyncResp.Code != inner.StatusCode_kOk { - log.Fatal("Failed to get TrySync Response Msg", err) + logrus.Fatal("Failed to get TrySync Response Msg", err) } trySync.TrySync.BinlogOffset = trySyncResp.TrySync.GetBinlogOffset() - log.Println("get offset:", trySync.TrySync.BinlogOffset) + logrus.Println("get offset:", trySync.TrySync.BinlogOffset) } } @@ -293,16 +295,29 @@ func BuildInternalTag(resp []byte) (tag string) { return string(buf) } +// CustomData 解析后的自定义数据结构 +type BinlogItem struct { + Type uint16 + CreateTime uint32 + TermId uint32 + LogicId uint64 + FileNum uint32 + Offset uint64 + ContentLength uint32 + Content []byte +} + func TestGetIncrementalSync(t *testing.T) { conn, err := sendMetaSyncRequest(nil) if err != nil { - log.Fatal(err) + logrus.Fatal(err) } metaResp := getResponse(conn) if metaResp == nil { - log.Fatal("Failed to get metaResp") + logrus.Fatal("Failed to get metaResp") } trySyncType := inner.Type_kTrySync + binlogSyncType := inner.Type_kBinlogSync replDBs := metaResp.MetaSync.DbsInfo var fileNum uint32 = 1 var offset uint64 = 0 @@ -333,22 +348,131 @@ func TestGetIncrementalSync(t *testing.T) { } _, err = sendReplReq(conn, trySync) if err != nil { - log.Fatal("Failed to send TrySync Msg", err) + logrus.Fatal("Failed to send TrySync Msg", err) } trySyncResp := getResponse(conn) if trySyncResp == nil || *trySyncResp.Code != inner.StatusCode_kOk { - log.Fatal("Failed to get TrySync Response Msg", err) + logrus.Fatal("Failed to get TrySync Response Msg", err) } - // todo(leehao) test send BinlogSync to get Incremental data - binlogSyncReq := &inner.InnerRequest_BinlogSync{ - Node: nil, - DbName: nil, - SlotId: nil, - AckRangeStart: nil, - AckRangeEnd: nil, - SessionId: nil, - FirstSend: nil, + startOffset := trySyncResp.TrySync.GetBinlogOffset() + trySync.TrySync.BinlogOffset = startOffset + // send twice to get session id + sendReplReq(conn, trySync) + trySyncResp = getResponse(conn) + + isFirst := true + binlogSyncReq := &inner.InnerRequest{ + Type: &binlogSyncType, + MetaSync: nil, + TrySync: nil, + DbSync: nil, + BinlogSync: &inner.InnerRequest_BinlogSync{ + Node: trySync.TrySync.Node, + DbName: db.DbName, + SlotId: &slotId, + AckRangeStart: startOffset, + AckRangeEnd: startOffset, + SessionId: trySyncResp.TrySync.SessionId, + FirstSend: &isFirst, + }, + RemoveSlaveNode: nil, + ConsensusMeta: nil, } - trySync.TrySync.BinlogOffset = trySyncResp.TrySync.GetBinlogOffset() + sendReplReq(conn, binlogSyncReq) + go func() { + for { + binlogSyncResp := getResponse(conn) + if binlogSyncResp == nil || *binlogSyncResp.Code != inner.StatusCode_kOk || + *binlogSyncResp.Type != inner.Type_kBinlogSync || binlogSyncResp.BinlogSync == nil { + logrus.Fatal("get binlog sync response failed") + } else { + for _, item := range binlogSyncResp.BinlogSync { + *binlogSyncReq.BinlogSync.FirstSend = false + if len(item.Binlog) == 0 { + *binlogSyncReq.BinlogSync.AckRangeStart.Filenum = 0 + *binlogSyncReq.BinlogSync.AckRangeStart.Offset = 0 + logrus.Println("receive binlog response keep alive") + } else { + binlogSyncReq.BinlogSync.AckRangeStart = item.BinlogOffset + binlogSyncReq.BinlogSync.AckRangeEnd = item.BinlogOffset + if binlogItem, err := DecodeBinlogItem(item.Binlog); err != nil { + logrus.Fatal(err) + } else { + SendRedisData("127.0.0.1:6379", binlogItem.Content) + } + } + sendReplReq(conn, binlogSyncReq) + } + } + } + }() + } + for { + } +} + +func SendRedisData(addr string, data []byte) (string, error) { + conn, err := net.Dial("tcp", addr) + if err != nil { + return "", fmt.Errorf("failed to connect to Redis server: %v", err) + } + defer conn.Close() + + conn.SetDeadline(time.Now().Add(5 * time.Second)) + + _, err = conn.Write(data) + if err != nil { + return "", fmt.Errorf("failed to send data to Redis server: %v", err) + } + + reader := bufio.NewReader(conn) + response, err := reader.ReadString('\n') + if err != nil { + return "", fmt.Errorf("failed to read response from Redis server: %v", err) + } + + return response, nil +} + +func DecodeBinlogItem(data []byte) (*BinlogItem, error) { + if len(data) < 34 { + return nil, fmt.Errorf("data length is too short") + } + + reader := bytes.NewReader(data) + + binlogItem := &BinlogItem{} + if err := binary.Read(reader, binary.LittleEndian, &binlogItem.Type); err != nil { + return nil, fmt.Errorf("failed to read Type: %v", err) + } + if err := binary.Read(reader, binary.LittleEndian, &binlogItem.CreateTime); err != nil { + return nil, fmt.Errorf("failed to read Create Time: %v", err) + } + if err := binary.Read(reader, binary.LittleEndian, &binlogItem.TermId); err != nil { + return nil, fmt.Errorf("failed to read Term Id: %v", err) } + if err := binary.Read(reader, binary.LittleEndian, &binlogItem.LogicId); err != nil { + return nil, fmt.Errorf("failed to read Logic Id: %v", err) + } + if err := binary.Read(reader, binary.LittleEndian, &binlogItem.FileNum); err != nil { + return nil, fmt.Errorf("failed to read File Num: %v", err) + } + if err := binary.Read(reader, binary.LittleEndian, &binlogItem.Offset); err != nil { + return nil, fmt.Errorf("failed to read Offset: %v", err) + } + if err := binary.Read(reader, binary.LittleEndian, &binlogItem.ContentLength); err != nil { + return nil, fmt.Errorf("failed to read Content Length: %v", err) + } + + contentLength := int(binlogItem.ContentLength) + if len(data) < 34+contentLength { + return nil, fmt.Errorf("data length is too short for content") + } + + binlogItem.Content = make([]byte, contentLength) + if _, err := reader.Read(binlogItem.Content); err != nil { + return nil, fmt.Errorf("failed to read Content: %v", err) + } + + return binlogItem, nil } From a63f5df2190199ea3c083564a3ead479ede4be0a Mon Sep 17 00:00:00 2001 From: LeeHao <1838249551@qq.com> Date: Thu, 8 Aug 2024 21:30:32 +0800 Subject: [PATCH 5/9] feat-cdc:Basic incremental synchronization to redis has been completed Signed-off-by: LeeHao <1838249551@qq.com> --- tools/pika_cdc/conf/cdc.yml | 18 +- tools/pika_cdc/conf/conf.go | 32 +- tools/pika_cdc/consumer/consumer.go | 26 ++ tools/pika_cdc/{mq => consumer}/kafka.go | 18 +- tools/pika_cdc/consumer/protocol.go | 16 + tools/pika_cdc/consumer/redis.go | 62 ++++ tools/pika_cdc/go.mod | 28 +- tools/pika_cdc/go.sum | 72 +++- tools/pika_cdc/main.go | 28 +- tools/pika_cdc/mq/mq.go | 29 -- tools/pika_cdc/pika/replprotocol.go | 328 ++++++++++++++++++ ...replproxy_test.go => replprotocol_test.go} | 27 +- tools/pika_cdc/pika/replproxy.go | 8 - tools/pika_cdc/pika/server.go | 99 ++++-- 14 files changed, 649 insertions(+), 142 deletions(-) create mode 100644 tools/pika_cdc/consumer/consumer.go rename tools/pika_cdc/{mq => consumer}/kafka.go (83%) create mode 100644 tools/pika_cdc/consumer/protocol.go create mode 100644 tools/pika_cdc/consumer/redis.go delete mode 100644 tools/pika_cdc/mq/mq.go create mode 100644 tools/pika_cdc/pika/replprotocol.go rename tools/pika_cdc/pika/{replproxy_test.go => replprotocol_test.go} (97%) delete mode 100644 tools/pika_cdc/pika/replproxy.go diff --git a/tools/pika_cdc/conf/cdc.yml b/tools/pika_cdc/conf/cdc.yml index b6b229b5f9..68d12c8375 100644 --- a/tools/pika_cdc/conf/cdc.yml +++ b/tools/pika_cdc/conf/cdc.yml @@ -1,10 +1,11 @@ -# todo(leehao): The parameter configuration file for canal should be available for reference -# https://github.com/alibaba/canal/wiki/Canal-Kafka-RocketMQ-QuickStart # pika_server -pika_server : 127.0.0.1:9221 -# if there are more than one, separated by commas, like this -# 127.0.0.1:9092, 127.0.0.1:9091 -mq_servers : 127.0.0.1:9092 +pika_server : 127.0.0.1:11221 +kafka_servers: + - 127.0.0.1:9092 +redis_servers: + - 127.0.0.1:6379 +pulsar_servers: + - 127.0.0.1:6650 # will create this topic, if this topic not exist # and all servers will use same name topic topic : test @@ -12,10 +13,7 @@ topic : test retries : 0 # retry interval while send message failed(ms) retry_interval: 10 -# Canal默认支持并行处理和发送数据到Kafka,这表示Canal将使用5个线程并行处理和发送数据到Kafka。 -parallel_thread_size: 5 -## 是否并发,如果保证并发的情况下,就会采用分区的方式发送数据, -#parallel: true +parallel_thread_size: 1 diff --git a/tools/pika_cdc/conf/conf.go b/tools/pika_cdc/conf/conf.go index 5b92647cfe..1f3fb58b8f 100644 --- a/tools/pika_cdc/conf/conf.go +++ b/tools/pika_cdc/conf/conf.go @@ -2,21 +2,21 @@ package conf import ( "fmt" + "github.com/sirupsen/logrus" + "gopkg.in/yaml.v3" "io/ioutil" "log" "os" "path" "path/filepath" "runtime" - "strings" - - "github.com/sirupsen/logrus" - "gopkg.in/yaml.v3" ) type PikaCdcConfig struct { PikaServer string `yaml:"pika_server"` - MqServers []string `yaml:"mq_servers"` + KafkaServers []string `yaml:"kafka_servers"` + RedisServers []string `yaml:"redis_servers"` + PulsarServers []string `yaml:"pulsar_servers"` Topic string `yaml:"topic"` Retries int `yaml:"retries"` RetryInterval int `yaml:"retry_interval"` @@ -48,25 +48,3 @@ func init() { logrus.SetReportCaller(true) logrus.SetOutput(os.Stdout) } - -func (c *PikaCdcConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { - var tmp struct { - PikaServer string `yaml:"pika_server"` - MqServers string `yaml:"mq_servers"` - Topic string `yaml:"topic"` - Retries int `yaml:"retries"` - RetryInterval int `yaml:"retry_interval"` - ParallelThreadSize int `yaml:"parallel_thread_size"` - } - - if err := unmarshal(&tmp); err != nil { - return err - } - - c.MqServers = strings.Split(tmp.MqServers, ",") - c.Retries = tmp.Retries - c.Topic = tmp.Topic - c.PikaServer = tmp.PikaServer - - return nil -} diff --git a/tools/pika_cdc/consumer/consumer.go b/tools/pika_cdc/consumer/consumer.go new file mode 100644 index 0000000000..a00e0aab09 --- /dev/null +++ b/tools/pika_cdc/consumer/consumer.go @@ -0,0 +1,26 @@ +package consumer + +import ( + "pika_cdc/conf" +) + +type Consumer interface { + SendCmdMessage(msg []byte) error + Name() string + Close() error + Run() + Stop() +} + +type Factory struct{} + +func GenerateConsumers(config conf.PikaCdcConfig, msgChan *chan []byte) ([]Consumer, error) { + var consumers []Consumer + kafka, _ := NewKafka(config.KafkaServers, config.Topic, config.Retries) + consumers = append(consumers, kafka) + for _, r := range config.RedisServers { + newRedis, _ := NewRedis(r, msgChan) + consumers = append(consumers, newRedis) + } + return consumers, nil +} diff --git a/tools/pika_cdc/mq/kafka.go b/tools/pika_cdc/consumer/kafka.go similarity index 83% rename from tools/pika_cdc/mq/kafka.go rename to tools/pika_cdc/consumer/kafka.go index 8945bd9c7b..68eb408e1d 100644 --- a/tools/pika_cdc/mq/kafka.go +++ b/tools/pika_cdc/consumer/kafka.go @@ -1,11 +1,11 @@ -package mq +package consumer import ( "context" "errors" "github.com/segmentio/kafka-go" + "github.com/sirupsen/logrus" "log" - "pika_cdc/pika" "sync" "time" ) @@ -19,15 +19,16 @@ type Kafka struct { messageChan chan kafka.Message stopChan chan bool once sync.Once + protocol Protocol } -func (k *Kafka) SendCmdMessage(cmd pika.Cmd) error { +func (k *Kafka) SendCmdMessage(msg []byte) error { select { - case k.messageChan <- kafka.Message{Value: []byte(cmd.Name())}: + case k.messageChan <- kafka.Message{Value: k.protocol.ToConsumer(msg)}: return nil case <-time.After(2 * time.Second): e := errors.New("send pika cmd timeout") - log.Printf("%v", e) + logrus.Warn("{}", e) return e } } @@ -51,6 +52,7 @@ func (k *Kafka) Name() string { func NewKafka(servers []string, topic string, retries int) (*Kafka, error) { k := &Kafka{} + k.protocol = &KafkaProtocol{} for _, server := range servers { conn, err := kafka.DialLeader(context.Background(), "tcp", server, topic, 0) if err != nil { @@ -87,3 +89,9 @@ func (k *Kafka) Close() error { }) return err } +func (k *Kafka) Run() { + +} +func (k *Kafka) Stop() { + +} diff --git a/tools/pika_cdc/consumer/protocol.go b/tools/pika_cdc/consumer/protocol.go new file mode 100644 index 0000000000..7ce8da1aad --- /dev/null +++ b/tools/pika_cdc/consumer/protocol.go @@ -0,0 +1,16 @@ +package consumer + +type Protocol interface { + ToConsumer(msg []byte) []byte +} +type RedisProtocol struct{} + +func (rp RedisProtocol) ToConsumer(msg []byte) []byte { + return msg +} + +type KafkaProtocol struct{} + +func (kp KafkaProtocol) ToConsumer(msg []byte) []byte { + return nil +} diff --git a/tools/pika_cdc/consumer/redis.go b/tools/pika_cdc/consumer/redis.go new file mode 100644 index 0000000000..7951c83028 --- /dev/null +++ b/tools/pika_cdc/consumer/redis.go @@ -0,0 +1,62 @@ +package consumer + +import ( + "bufio" + "fmt" + "net" + "time" +) + +type Redis struct { + protocol Protocol + conn net.Conn + msgChan *chan []byte +} + +func NewRedis(addr string, msgChan *chan []byte) (*Redis, error) { + r := &Redis{protocol: RedisProtocol{}, msgChan: msgChan} + var err error + r.conn, err = net.Dial("tcp", addr) + if err != nil { + return nil, fmt.Errorf("failed to connect to Redis server: %v", err) + } + return r, nil +} + +func (r *Redis) SendCmdMessage(msg []byte) error { + _, err := r.sendRedisData(msg) + return err +} + +func (r *Redis) Name() string { + return string("Redis") +} +func (r *Redis) Close() error { + return r.conn.Close() +} + +func (r *Redis) sendRedisData(data []byte) (string, error) { + + r.conn.SetDeadline(time.Now().Add(5 * time.Second)) + + _, err := r.conn.Write(data) + if err != nil { + return "", fmt.Errorf("failed to send data to Redis server: %v", err) + } + + reader := bufio.NewReader(r.conn) + response, err := reader.ReadString('\n') + if err != nil { + return "", fmt.Errorf("failed to read response from Redis server: %v", err) + } + + return response, nil +} +func (r *Redis) Run() { + for msg := range *r.msgChan { + r.sendRedisData(msg) + } +} +func (r *Redis) Stop() { + +} diff --git a/tools/pika_cdc/go.mod b/tools/pika_cdc/go.mod index 02c20be1ae..4fa1eb9066 100644 --- a/tools/pika_cdc/go.mod +++ b/tools/pika_cdc/go.mod @@ -3,18 +3,42 @@ module pika_cdc go 1.20 require ( + github.com/gin-gonic/gin v1.10.0 github.com/golang/protobuf v1.5.4 github.com/redis/go-redis/v9 v9.6.0 github.com/segmentio/kafka-go v0.4.47 + github.com/sirupsen/logrus v1.9.3 google.golang.org/protobuf v1.34.2 gopkg.in/yaml.v3 v3.0.1 ) require ( + github.com/bytedance/sonic v1.11.6 // indirect + github.com/bytedance/sonic/loader v0.1.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cloudwego/base64x v0.1.4 // indirect + github.com/cloudwego/iasm v0.2.0 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/gabriel-vasile/mimetype v1.4.3 // indirect + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-playground/validator/v10 v10.20.0 // indirect + github.com/goccy/go-json v0.10.2 // indirect + github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.15.9 // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect + github.com/leodido/go-urn v1.4.0 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pierrec/lz4/v4 v4.1.15 // indirect - github.com/sirupsen/logrus v1.9.3 // indirect - golang.org/x/sys v0.13.0 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.2.12 // indirect + golang.org/x/arch v0.8.0 // indirect + golang.org/x/crypto v0.23.0 // indirect + golang.org/x/net v0.25.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/text v0.15.0 // indirect ) diff --git a/tools/pika_cdc/go.sum b/tools/pika_cdc/go.sum index dc7d26503e..14162e1595 100644 --- a/tools/pika_cdc/go.sum +++ b/tools/pika_cdc/go.sum @@ -1,18 +1,58 @@ github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= +github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0= +github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= +github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= +github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= +github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= +github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= +github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= +github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= +github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= +github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= +github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY= github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= +github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pierrec/lz4/v4 v4.1.15 h1:MO0/ucJhngq7299dKLwIMtgTfbkoSPF6AoMYDd8Q4q0= github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -25,10 +65,20 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= +github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= +github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= +github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= @@ -36,9 +86,14 @@ github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3k github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8= github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc= +golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -46,8 +101,9 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -58,9 +114,11 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -72,15 +130,15 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= @@ -88,3 +146,5 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/tools/pika_cdc/main.go b/tools/pika_cdc/main.go index 96d58933b0..2f8dac15fb 100644 --- a/tools/pika_cdc/main.go +++ b/tools/pika_cdc/main.go @@ -1,27 +1,23 @@ package main import ( - "fmt" + "github.com/sirupsen/logrus" "pika_cdc/conf" - "pika_cdc/mq" + "pika_cdc/consumer" "pika_cdc/pika" - "time" ) func main() { - mqFactory := mq.Factory{} - messageQue, err := mqFactory.GetMq(mq.KAFKA, conf.ConfigInstance) - if err != nil { - panic("failed to create mq, " + err.Error()) + if pikaServer, err := pika.New(conf.ConfigInstance.PikaServer, nil); err != nil { + logrus.Fatal("failed to connect pika server, {}", err) } else { - fmt.Println(messageQue.Name()) - c := pika.Cmd{} - _ = messageQue.SendCmdMessage(c) + if consumers, err := consumer.GenerateConsumers(conf.ConfigInstance, pikaServer.MsgChan); err != nil { + logrus.Fatal("failed to generate consumers, {}", err) + } else { + for _, c := range consumers { + go c.Run() + } + } + pikaServer.Run() } - defer messageQue.Close() - time.Sleep(time.Second) - - //pikaServer := pika.New(conf.ConfigInstance.PikaServer) - //pikaServer.Start() - //defer pikaServer.Close() } diff --git a/tools/pika_cdc/mq/mq.go b/tools/pika_cdc/mq/mq.go deleted file mode 100644 index 3799730c8f..0000000000 --- a/tools/pika_cdc/mq/mq.go +++ /dev/null @@ -1,29 +0,0 @@ -package mq - -import ( - "pika_cdc/conf" - "pika_cdc/pika" -) - -type Mq interface { - SendCmdMessage(cmd pika.Cmd) error - Name() string - Close() error -} - -type Factory struct{} -type Type int - -const ( - KAFKA = iota - PULSAR -) - -func (f *Factory) GetMq(t Type, config conf.PikaCdcConfig) (Mq, error) { - switch t { - case KAFKA: - return NewKafka(config.MqServers, config.Topic, config.Retries) - default: - } - panic("unimplemented") -} diff --git a/tools/pika_cdc/pika/replprotocol.go b/tools/pika_cdc/pika/replprotocol.go new file mode 100644 index 0000000000..6674b77228 --- /dev/null +++ b/tools/pika_cdc/pika/replprotocol.go @@ -0,0 +1,328 @@ +package pika + +import ( + "bufio" + "bytes" + "encoding/binary" + "fmt" + "github.com/golang/protobuf/proto" + "github.com/sirupsen/logrus" + "io" + "pika_cdc/pika/proto/inner" +) + +const HeaderLength = 4 + +type ReplProtocol struct { + writer *bufio.Writer + reader *bufio.Reader + binlogSyncInfos []binlogSyncInfo + dbMetaInfo *inner.InnerResponse_MetaSync + ip string + port int32 +} + +type binlogSyncInfo struct { + binlogOffset *inner.BinlogOffset + fileNum uint32 + offset uint64 + sessionId int32 + isFirst bool +} + +func (repl *ReplProtocol) GetSyncWithPika() error { + if err := repl.sendMetaSyncRequest(); err != nil { + return err + } + metaResp := repl.getResponse() + if metaResp == nil { + logrus.Fatal("Failed to get metaResp") + } + repl.dbMetaInfo = metaResp.MetaSync + + trySyncType := inner.Type_kTrySync + binlogSyncType := inner.Type_kBinlogSync + + replDBs := metaResp.MetaSync.DbsInfo + var a uint64 = 0 + var b uint32 = 0 + for _, dbInfo := range replDBs { + newMetaInfo := binlogSyncInfo{ + binlogOffset: &inner.BinlogOffset{ + Filenum: nil, + Offset: nil, + Term: nil, + Index: nil, + }, + fileNum: 0, + offset: 0, + sessionId: 0, + } + newMetaInfo.binlogOffset.Offset = &a + newMetaInfo.binlogOffset.Filenum = &b + + slotId := uint32(*dbInfo.SlotNum) + trySync := &inner.InnerRequest{ + Type: &trySyncType, + TrySync: &inner.InnerRequest_TrySync{ + Node: &inner.Node{ + Ip: &repl.ip, + Port: &repl.port, + }, + Slot: &inner.Slot{ + DbName: dbInfo.DbName, + SlotId: &slotId, + }, + BinlogOffset: newMetaInfo.binlogOffset, + }, + ConsensusMeta: nil, + } + if err := repl.sendReplReq(trySync); err != nil { + return err + } + + trySyncResp := repl.getResponse() + if trySyncResp == nil || *trySyncResp.Code != inner.StatusCode_kOk { + logrus.Fatal("Failed to get TrySync Response Msg") + } + startOffset := trySyncResp.TrySync.GetBinlogOffset() + trySync.TrySync.BinlogOffset = startOffset + // send twice to get session id + if err := repl.sendReplReq(trySync); err != nil { + return err + } + trySyncResp = repl.getResponse() + + newMetaInfo.binlogOffset = startOffset + newMetaInfo.sessionId = *trySyncResp.TrySync.SessionId + newMetaInfo.isFirst = true + repl.binlogSyncInfos = append(repl.binlogSyncInfos, newMetaInfo) + } + + // todo(leehao): Can find ways to optimize using coroutines here. May be use goroutine + for index, dbInfo := range repl.binlogSyncInfos { + slotId := uint32(*repl.dbMetaInfo.DbsInfo[index].SlotNum) + binlogSyncReq := &inner.InnerRequest{ + Type: &binlogSyncType, + MetaSync: nil, + TrySync: nil, + DbSync: nil, + BinlogSync: &inner.InnerRequest_BinlogSync{ + Node: &inner.Node{ + Ip: &repl.ip, + Port: &repl.port, + }, + DbName: repl.dbMetaInfo.DbsInfo[index].DbName, + SlotId: &slotId, + AckRangeStart: dbInfo.binlogOffset, + AckRangeEnd: dbInfo.binlogOffset, + SessionId: &dbInfo.sessionId, + FirstSend: &dbInfo.isFirst, + }, + RemoveSlaveNode: nil, + ConsensusMeta: nil, + } + if err := repl.sendReplReq(binlogSyncReq); err != nil { + return err + } + repl.binlogSyncInfos[index].isFirst = false + } + return nil +} + +func (repl *ReplProtocol) GetBinlogSync() ([]byte, error) { + + binlogSyncType := inner.Type_kBinlogSync + var binlogByte []byte + // todo(leehao): Receive multiple binlog sync responses simultaneously + binlogSyncResp := repl.getResponse() + if binlogSyncResp == nil || *binlogSyncResp.Code != inner.StatusCode_kOk || + *binlogSyncResp.Type != inner.Type_kBinlogSync || binlogSyncResp.BinlogSync == nil { + logrus.Fatal("get binlog sync response failed") + } else { + for index, item := range binlogSyncResp.BinlogSync { + slotId := uint32(*repl.dbMetaInfo.DbsInfo[index].SlotNum) + binlogOffset := repl.binlogSyncInfos[index].binlogOffset + if len(item.Binlog) == 0 { + *binlogOffset.Filenum = 0 + *binlogOffset.Offset = 0 + logrus.Println("receive binlog response keep alive") + } else { + binlogOffset = item.BinlogOffset + repl.binlogSyncInfos[index].binlogOffset = binlogOffset + if binlogItem, err := repl.decodeBinlogItem(item.Binlog); err != nil { + logrus.Fatal(err) + } else { + binlogByte = binlogItem.Content + } + } + err := repl.sendReplReq(&inner.InnerRequest{ + Type: &binlogSyncType, + MetaSync: nil, + TrySync: nil, + DbSync: nil, + BinlogSync: &inner.InnerRequest_BinlogSync{ + Node: &inner.Node{ + Ip: &repl.ip, + Port: &repl.port, + }, + DbName: repl.dbMetaInfo.DbsInfo[index].DbName, + SlotId: &slotId, + AckRangeStart: binlogOffset, + AckRangeEnd: binlogOffset, + SessionId: &repl.binlogSyncInfos[index].sessionId, + FirstSend: &repl.binlogSyncInfos[index].isFirst, + }, + RemoveSlaveNode: nil, + ConsensusMeta: nil, + }) + if err != nil { + logrus.Warn("Failed to send binlog sync, {}", err) + return nil, err + } + } + } + return binlogByte, nil +} + +func (repl *ReplProtocol) Ping() string { + _, err := repl.writer.WriteString("PING\r\n") + if err != nil { + logrus.Warn("Error writing to connection:", err) + return string("") + } + repl.writer.Flush() + + resp, err := repl.reader.ReadString('\n') + if err != nil { + logrus.Warn("Error reading from connection:", err) + return string("") + } + return resp +} + +func (repl *ReplProtocol) sendMetaSyncRequest() error { + logrus.Info("sendMetaSyncRequest") + metaSyncType := inner.Type_kMetaSync + request := &inner.InnerRequest{ + Type: &metaSyncType, + MetaSync: &inner.InnerRequest_MetaSync{ + Node: &inner.Node{ + Ip: &repl.ip, + Port: &repl.port, + }, + }, + } + return repl.sendReplReq(request) +} + +func (repl *ReplProtocol) sendReplReq(request *inner.InnerRequest) error { + msg, err := proto.Marshal(request) + if err != nil { + logrus.Fatal("Error Marshal:", err) + } + + pikaTag := []byte(repl.buildInternalTag(msg)) + allBytes := append(pikaTag, msg...) + _, err = repl.writer.Write(allBytes) + if err != nil { + logrus.Fatal("Error writing to server:", err) + } + repl.writer.Flush() + return nil +} + +func (repl *ReplProtocol) getResponse() *inner.InnerResponse { + header := make([]byte, HeaderLength) + _, err := repl.reader.Read(header) + if err != nil { + if err != io.EOF { + logrus.Fatal("Error reading header:", err) + } + return nil + } + + // Convert the header to an integer + var bodyLength uint32 + buffer := bytes.NewBuffer(header) + err = binary.Read(buffer, binary.BigEndian, &bodyLength) + if err != nil { + logrus.Fatal("Error converting header to integer:", err) + return nil + } + // Read the body + body := make([]byte, bodyLength) + _, err = repl.reader.Read(body) + if err != nil { + logrus.Fatal("Error reading body:", err) + return nil + } + + res := &inner.InnerResponse{} + err = proto.Unmarshal(body, res) + if err != nil { + logrus.Fatal("Error Deserialization:", err) + } + return res +} + +func (repl *ReplProtocol) buildInternalTag(resp []byte) (tag string) { + respSize := uint32(len(resp)) + buf := make([]byte, 4) + binary.BigEndian.PutUint32(buf, respSize) + return string(buf) +} + +type binlogItem struct { + Type uint16 + CreateTime uint32 + TermId uint32 + LogicId uint64 + FileNum uint32 + Offset uint64 + ContentLength uint32 + Content []byte +} + +func (repl *ReplProtocol) decodeBinlogItem(data []byte) (*binlogItem, error) { + if len(data) < 34 { + return nil, fmt.Errorf("data length is too short") + } + + reader := bytes.NewReader(data) + + binlogItem := &binlogItem{} + if err := binary.Read(reader, binary.LittleEndian, &binlogItem.Type); err != nil { + return nil, fmt.Errorf("failed to read Type: %v", err) + } + if err := binary.Read(reader, binary.LittleEndian, &binlogItem.CreateTime); err != nil { + return nil, fmt.Errorf("failed to read Create Time: %v", err) + } + if err := binary.Read(reader, binary.LittleEndian, &binlogItem.TermId); err != nil { + return nil, fmt.Errorf("failed to read Term Id: %v", err) + } + if err := binary.Read(reader, binary.LittleEndian, &binlogItem.LogicId); err != nil { + return nil, fmt.Errorf("failed to read Logic Id: %v", err) + } + if err := binary.Read(reader, binary.LittleEndian, &binlogItem.FileNum); err != nil { + return nil, fmt.Errorf("failed to read File Num: %v", err) + } + if err := binary.Read(reader, binary.LittleEndian, &binlogItem.Offset); err != nil { + return nil, fmt.Errorf("failed to read Offset: %v", err) + } + if err := binary.Read(reader, binary.LittleEndian, &binlogItem.ContentLength); err != nil { + return nil, fmt.Errorf("failed to read Content Length: %v", err) + } + + contentLength := int(binlogItem.ContentLength) + if len(data) < 34+contentLength { + return nil, fmt.Errorf("data length is too short for content") + } + + binlogItem.Content = make([]byte, contentLength) + if _, err := reader.Read(binlogItem.Content); err != nil { + return nil, fmt.Errorf("failed to read Content: %v", err) + } + + return binlogItem, nil +} diff --git a/tools/pika_cdc/pika/replproxy_test.go b/tools/pika_cdc/pika/replprotocol_test.go similarity index 97% rename from tools/pika_cdc/pika/replproxy_test.go rename to tools/pika_cdc/pika/replprotocol_test.go index 43dbe881a9..13b7e01787 100644 --- a/tools/pika_cdc/pika/replproxy_test.go +++ b/tools/pika_cdc/pika/replprotocol_test.go @@ -15,7 +15,6 @@ import ( "pika_cdc/conf" "pika_cdc/pika/proto/inner" "strconv" - "strings" "testing" "time" ) @@ -31,18 +30,18 @@ func TestConnect(t *testing.T) { fmt.Println(client.Get(cxt, "key")) } -func getPort(addr string) int32 { - portStr := addr[strings.LastIndex(addr, ":")+1:] - port, _ := strconv.Atoi(portStr) - return int32(port) -} -func getIP(addr string) string { - index := strings.LastIndex(addr, ":") - if index == -1 { - return addr - } - return addr[:index] -} +//func getPort(addr string) int32 { +// portStr := addr[strings.LastIndex(addr, ":")+1:] +// port, _ := strconv.Atoi(portStr) +// return int32(port) +//} +//func getIP(addr string) string { +// index := strings.LastIndex(addr, ":") +// if index == -1 { +// return addr +// } +// return addr[:index] +//} func TestSendMetaSync(t *testing.T) { ip := string("127.0.0.1") @@ -80,8 +79,6 @@ func TestSendMetaSync(t *testing.T) { } } -const HeaderLength = 4 - func receiveReplMsg(listener net.Listener) { defer listener.Close() fmt.Println("Listening on ", listener.Addr().String()) diff --git a/tools/pika_cdc/pika/replproxy.go b/tools/pika_cdc/pika/replproxy.go deleted file mode 100644 index f9e2a024f2..0000000000 --- a/tools/pika_cdc/pika/replproxy.go +++ /dev/null @@ -1,8 +0,0 @@ -package pika - -type ReplProxy struct { -} - -func (repl *ReplProxy) SendMetaSync() { - -} diff --git a/tools/pika_cdc/pika/server.go b/tools/pika_cdc/pika/server.go index e06aa10145..dc1bcde4ae 100644 --- a/tools/pika_cdc/pika/server.go +++ b/tools/pika_cdc/pika/server.go @@ -1,38 +1,89 @@ package pika +import ( + "bufio" + "github.com/sirupsen/logrus" + "log" + "net" + "strconv" + "strings" + "time" +) + type Server struct { - stop chan bool + stop chan bool + pikaConn net.Conn + pikaAddr string + MsgChan *chan []byte + pikaReplProtocol ReplProtocol + writer *bufio.Writer + reader *bufio.Reader } -func New(s string) Server { - return Server{} -} -func (s *Server) Start() { -} -func (s *Server) Loop() { +// Use todo(leehao): add middleware here +func Use() { - //for { - // select { - // case stop := <-s.stop: - // { - // - // } - // case msg := <- s.: - // - // } - //} } -func (s *Server) Stop() { - defer func() {}() - s.stop <- true +func getPort(addr string) int32 { + portStr := addr[strings.LastIndex(addr, ":")+1:] + port, _ := strconv.Atoi(portStr) + return int32(port) } -func (s *Server) Close() { - s.stop <- true +func getIP(addr string) string { + index := strings.LastIndex(addr, ":") + if index == -1 { + return addr + } + return addr[:index] } -func (s *Server) GetMessage() { +func New(s string, msgChan *chan []byte) (Server, error) { + server := Server{} + if msgChan == nil { + ch := make(chan []byte, 10) + server.MsgChan = &ch + } + conn, err := net.Dial("tcp", s) + if err != nil { + log.Fatal("Error connecting to Pika server:", err) + } + server.pikaConn = conn + server.writer = bufio.NewWriter(server.pikaConn) + server.reader = bufio.NewReader(server.pikaConn) + server.pikaReplProtocol = ReplProtocol{ + writer: server.writer, + reader: server.reader, + ip: getIP(conn.LocalAddr().String()), + port: getPort(conn.LocalAddr().String()), + } + err = server.CreateSyncWithPika() + return server, err } -func (s *Server) SendMetaSync() { +// Run This method will block execution until an error occurs +func (s *Server) Run() { + for { + select { + case <-s.stop: + return + case <-time.After(100 * time.Millisecond): + bytes, _ := s.pikaReplProtocol.GetBinlogSync() + if len(bytes) != 0 { + logrus.Info("get a pika binlog send to msg chan") + *s.MsgChan <- bytes + } + } + } +} + +func (s *Server) Exit() { + s.stop <- true + close(s.stop) + close(*s.MsgChan) +} +func (s *Server) CreateSyncWithPika() error { + //ping := s.pikaReplProtocol.Ping() + //logrus.Info(ping) + return s.pikaReplProtocol.GetSyncWithPika() } From 295cc774a66fd17ef2236e4007afd424777f3a87 Mon Sep 17 00:00:00 2001 From: LeeHao <1838249551@qq.com> Date: Thu, 8 Aug 2024 22:37:00 +0800 Subject: [PATCH 6/9] feat-cdc:Use Makefile to build pika cdc Signed-off-by: LeeHao <1838249551@qq.com> a Signed-off-by: LeeHao <1838249551@qq.com> feat-cdc:Use Makefile to build pika cdc Signed-off-by: LeeHao <1838249551@qq.com> --- src/pika_inner_message.proto | 2 ++ src/rsync_service.proto | 2 ++ tools/pika_cdc/Makefile | 26 ++++++++++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 tools/pika_cdc/Makefile diff --git a/src/pika_inner_message.proto b/src/pika_inner_message.proto index 9e2a3ef04c..92619f651d 100644 --- a/src/pika_inner_message.proto +++ b/src/pika_inner_message.proto @@ -1,6 +1,8 @@ syntax = "proto2"; package InnerMessage; +option go_package = "./proto/inner"; + enum Type { kMetaSync = 1; kTrySync = 2; diff --git a/src/rsync_service.proto b/src/rsync_service.proto index ee23b3e8a4..abaf7671ae 100644 --- a/src/rsync_service.proto +++ b/src/rsync_service.proto @@ -1,6 +1,8 @@ syntax = "proto2"; package RsyncService; +option go_package = "./proto/rsync"; + enum Type { kRsyncMeta = 1; kRsyncFile = 2; diff --git a/tools/pika_cdc/Makefile b/tools/pika_cdc/Makefile new file mode 100644 index 0000000000..837d0cc1dc --- /dev/null +++ b/tools/pika_cdc/Makefile @@ -0,0 +1,26 @@ +PROTO_OUT = ./pika +PROTO_DIR = ../../src/ + +GO_FILES = $(shell find . -name '*.go') + +PROTO_FILES := $(wildcard $(PROTO_DIR)/*.proto) + +OUTPUT_BIN = pika_cdc + +PROTOC = protoc +GO_BUILD = go build +GO_CLEAN = go clean + +.PHONY: all proto build clean + +all: proto build + +proto: $(PROTO_FILES) + $(PROTOC) --proto_path=$(PROTO_DIR) --go_out=$(PROTO_OUT) $^ + +build: $(GO_FILES) + $(GO_BUILD) -o $(OUTPUT_BIN) + +clean: + $(GO_CLEAN) + rm -f $(OUTPUT_BIN) \ No newline at end of file From 361f86c7658ade4e96d912154135ebba63d68c3e Mon Sep 17 00:00:00 2001 From: LeeHao <1838249551@qq.com> Date: Thu, 8 Aug 2024 22:44:42 +0800 Subject: [PATCH 7/9] feat-cdc:remove track of pb file Signed-off-by: LeeHao <1838249551@qq.com> --- .gitignore | 1 + tools/pika_cdc/pika/pika_inner_message.proto | 168 -- .../pika/proto/inner/pika_inner_message.pb.go | 2169 ----------------- .../pika/proto/rsync/rsync_service.pb.go | 702 ------ tools/pika_cdc/pika/rsync_service.proto | 53 - 5 files changed, 1 insertion(+), 3092 deletions(-) delete mode 100644 tools/pika_cdc/pika/pika_inner_message.proto delete mode 100644 tools/pika_cdc/pika/proto/inner/pika_inner_message.pb.go delete mode 100644 tools/pika_cdc/pika/proto/rsync/rsync_service.pb.go delete mode 100644 tools/pika_cdc/pika/rsync_service.proto diff --git a/.gitignore b/.gitignore index ab567194a1..f066ba0931 100644 --- a/.gitignore +++ b/.gitignore @@ -74,3 +74,4 @@ pkg !codis/cmd/fe/assets/** tests/tmp +tools/pika_cdc/pika/proto \ No newline at end of file diff --git a/tools/pika_cdc/pika/pika_inner_message.proto b/tools/pika_cdc/pika/pika_inner_message.proto deleted file mode 100644 index 92619f651d..0000000000 --- a/tools/pika_cdc/pika/pika_inner_message.proto +++ /dev/null @@ -1,168 +0,0 @@ -syntax = "proto2"; -package InnerMessage; - -option go_package = "./proto/inner"; - -enum Type { - kMetaSync = 1; - kTrySync = 2; - kDBSync = 3; - kBinlogSync = 4; - kHeatBeat = 5; - kRemoveSlaveNode = 6; -} - -enum StatusCode { - kOk = 1; - kError = 2; - kOther = 3; -} - -message BinlogOffset { - required uint32 filenum = 1; - required uint64 offset = 2; - // consensus use - optional uint32 term = 3; - optional uint64 index = 4; -} - -message Node { - required string ip = 1; - required int32 port = 2; -} - -message Slot { - required string db_name = 1; - required uint32 slot_id = 2; -} - -message DBInfo { - required string db_name = 1; - required uint32 slot_num = 2; - repeated uint32 slot_ids = 3; -} - -message PikaMeta { - repeated DBInfo db_infos = 1; -} - -message ConsensusMeta { - optional uint32 term = 1; - // Leader -> Follower prev_log_offset - // Follower -> Leader last_log_offset - optional BinlogOffset log_offset = 2; - optional BinlogOffset commit = 3; - optional bool reject = 4; - repeated BinlogOffset hint = 5; -} - -// Request message -message InnerRequest { - // slave to master - message MetaSync { - required Node node = 1; - optional string auth = 2; - } - - // slave to master - message TrySync { - required Node node = 1; - required Slot slot = 2; - required BinlogOffset binlog_offset = 3; - } - - // slave to master - message DBSync { - required Node node = 1; - required Slot slot = 2; - required BinlogOffset binlog_offset = 3; - } - - message BinlogSync { - required Node node = 1; - required string db_name = 2; - required uint32 slot_id = 3; - required BinlogOffset ack_range_start = 4; - required BinlogOffset ack_range_end = 5; - required int32 session_id = 6; - required bool first_send = 7; - } - - message RemoveSlaveNode { - required Node node = 1; - required Slot slot = 2; - } - - required Type type = 1; - optional MetaSync meta_sync = 2; - optional TrySync try_sync = 3; - optional DBSync db_sync = 4; - optional BinlogSync binlog_sync = 5; - repeated RemoveSlaveNode remove_slave_node = 6; - optional ConsensusMeta consensus_meta = 7; -} - -message SlotInfo { - required uint32 slot_id = 1; - required Node master = 2; - repeated Node slaves = 3; -} - -// Response message -message InnerResponse { - // master to slave - message MetaSync { - message DBInfo { - required string db_name = 1; - required int32 slot_num = 2; - required int32 db_instance_num = 3; - } - required bool classic_mode = 1; - repeated DBInfo dbs_info = 2; - required string run_id = 3; - optional string replication_id = 4; - } - - // master to slave - message TrySync { - enum ReplyCode { - kOk = 1; - kSyncPointBePurged = 2; - kSyncPointLarger = 3; - kError = 4; - } - required ReplyCode reply_code = 1; - required Slot slot = 2; - optional BinlogOffset binlog_offset = 3; - optional int32 session_id = 4; - } - - message DBSync { - required Slot slot = 1; - required int32 session_id = 2; - } - - // master to slave - message BinlogSync { - required Slot slot = 1; - required BinlogOffset binlog_offset = 2; - required bytes binlog = 3; - required int32 session_id = 4; - } - - message RemoveSlaveNode { - required Node node = 1; - required Slot slot = 2; - } - - required Type type = 1; - required StatusCode code = 2; - optional string reply = 3; - optional MetaSync meta_sync = 4; - optional DBSync db_sync = 5; - optional TrySync try_sync = 6; - repeated BinlogSync binlog_sync = 7; - repeated RemoveSlaveNode remove_slave_node = 8; - // consensus use - optional ConsensusMeta consensus_meta = 9; -} diff --git a/tools/pika_cdc/pika/proto/inner/pika_inner_message.pb.go b/tools/pika_cdc/pika/proto/inner/pika_inner_message.pb.go deleted file mode 100644 index 76baa64950..0000000000 --- a/tools/pika_cdc/pika/proto/inner/pika_inner_message.pb.go +++ /dev/null @@ -1,2169 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.1 -// source: pika_inner_message.proto - -package inner - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Type int32 - -const ( - Type_kMetaSync Type = 1 - Type_kTrySync Type = 2 - Type_kDBSync Type = 3 - Type_kBinlogSync Type = 4 - Type_kHeatBeat Type = 5 - Type_kRemoveSlaveNode Type = 6 -) - -// Enum value maps for Type. -var ( - Type_name = map[int32]string{ - 1: "kMetaSync", - 2: "kTrySync", - 3: "kDBSync", - 4: "kBinlogSync", - 5: "kHeatBeat", - 6: "kRemoveSlaveNode", - } - Type_value = map[string]int32{ - "kMetaSync": 1, - "kTrySync": 2, - "kDBSync": 3, - "kBinlogSync": 4, - "kHeatBeat": 5, - "kRemoveSlaveNode": 6, - } -) - -func (x Type) Enum() *Type { - p := new(Type) - *p = x - return p -} - -func (x Type) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Type) Descriptor() protoreflect.EnumDescriptor { - return file_pika_inner_message_proto_enumTypes[0].Descriptor() -} - -func (Type) Type() protoreflect.EnumType { - return &file_pika_inner_message_proto_enumTypes[0] -} - -func (x Type) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Do not use. -func (x *Type) UnmarshalJSON(b []byte) error { - num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) - if err != nil { - return err - } - *x = Type(num) - return nil -} - -// Deprecated: Use Type.Descriptor instead. -func (Type) EnumDescriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{0} -} - -type StatusCode int32 - -const ( - StatusCode_kOk StatusCode = 1 - StatusCode_kError StatusCode = 2 - StatusCode_kOther StatusCode = 3 -) - -// Enum value maps for StatusCode. -var ( - StatusCode_name = map[int32]string{ - 1: "kOk", - 2: "kError", - 3: "kOther", - } - StatusCode_value = map[string]int32{ - "kOk": 1, - "kError": 2, - "kOther": 3, - } -) - -func (x StatusCode) Enum() *StatusCode { - p := new(StatusCode) - *p = x - return p -} - -func (x StatusCode) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (StatusCode) Descriptor() protoreflect.EnumDescriptor { - return file_pika_inner_message_proto_enumTypes[1].Descriptor() -} - -func (StatusCode) Type() protoreflect.EnumType { - return &file_pika_inner_message_proto_enumTypes[1] -} - -func (x StatusCode) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Do not use. -func (x *StatusCode) UnmarshalJSON(b []byte) error { - num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) - if err != nil { - return err - } - *x = StatusCode(num) - return nil -} - -// Deprecated: Use StatusCode.Descriptor instead. -func (StatusCode) EnumDescriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{1} -} - -type InnerResponse_TrySync_ReplyCode int32 - -const ( - InnerResponse_TrySync_kOk InnerResponse_TrySync_ReplyCode = 1 - InnerResponse_TrySync_kSyncPointBePurged InnerResponse_TrySync_ReplyCode = 2 - InnerResponse_TrySync_kSyncPointLarger InnerResponse_TrySync_ReplyCode = 3 - InnerResponse_TrySync_kError InnerResponse_TrySync_ReplyCode = 4 -) - -// Enum value maps for InnerResponse_TrySync_ReplyCode. -var ( - InnerResponse_TrySync_ReplyCode_name = map[int32]string{ - 1: "kOk", - 2: "kSyncPointBePurged", - 3: "kSyncPointLarger", - 4: "kError", - } - InnerResponse_TrySync_ReplyCode_value = map[string]int32{ - "kOk": 1, - "kSyncPointBePurged": 2, - "kSyncPointLarger": 3, - "kError": 4, - } -) - -func (x InnerResponse_TrySync_ReplyCode) Enum() *InnerResponse_TrySync_ReplyCode { - p := new(InnerResponse_TrySync_ReplyCode) - *p = x - return p -} - -func (x InnerResponse_TrySync_ReplyCode) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (InnerResponse_TrySync_ReplyCode) Descriptor() protoreflect.EnumDescriptor { - return file_pika_inner_message_proto_enumTypes[2].Descriptor() -} - -func (InnerResponse_TrySync_ReplyCode) Type() protoreflect.EnumType { - return &file_pika_inner_message_proto_enumTypes[2] -} - -func (x InnerResponse_TrySync_ReplyCode) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Do not use. -func (x *InnerResponse_TrySync_ReplyCode) UnmarshalJSON(b []byte) error { - num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) - if err != nil { - return err - } - *x = InnerResponse_TrySync_ReplyCode(num) - return nil -} - -// Deprecated: Use InnerResponse_TrySync_ReplyCode.Descriptor instead. -func (InnerResponse_TrySync_ReplyCode) EnumDescriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{8, 1, 0} -} - -type BinlogOffset struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Filenum *uint32 `protobuf:"varint,1,req,name=filenum" json:"filenum,omitempty"` - Offset *uint64 `protobuf:"varint,2,req,name=offset" json:"offset,omitempty"` - // consensus use - Term *uint32 `protobuf:"varint,3,opt,name=term" json:"term,omitempty"` - Index *uint64 `protobuf:"varint,4,opt,name=index" json:"index,omitempty"` -} - -func (x *BinlogOffset) Reset() { - *x = BinlogOffset{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BinlogOffset) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BinlogOffset) ProtoMessage() {} - -func (x *BinlogOffset) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BinlogOffset.ProtoReflect.Descriptor instead. -func (*BinlogOffset) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{0} -} - -func (x *BinlogOffset) GetFilenum() uint32 { - if x != nil && x.Filenum != nil { - return *x.Filenum - } - return 0 -} - -func (x *BinlogOffset) GetOffset() uint64 { - if x != nil && x.Offset != nil { - return *x.Offset - } - return 0 -} - -func (x *BinlogOffset) GetTerm() uint32 { - if x != nil && x.Term != nil { - return *x.Term - } - return 0 -} - -func (x *BinlogOffset) GetIndex() uint64 { - if x != nil && x.Index != nil { - return *x.Index - } - return 0 -} - -type Node struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Ip *string `protobuf:"bytes,1,req,name=ip" json:"ip,omitempty"` - Port *int32 `protobuf:"varint,2,req,name=port" json:"port,omitempty"` -} - -func (x *Node) Reset() { - *x = Node{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Node) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Node) ProtoMessage() {} - -func (x *Node) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Node.ProtoReflect.Descriptor instead. -func (*Node) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{1} -} - -func (x *Node) GetIp() string { - if x != nil && x.Ip != nil { - return *x.Ip - } - return "" -} - -func (x *Node) GetPort() int32 { - if x != nil && x.Port != nil { - return *x.Port - } - return 0 -} - -type Slot struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - DbName *string `protobuf:"bytes,1,req,name=db_name,json=dbName" json:"db_name,omitempty"` - SlotId *uint32 `protobuf:"varint,2,req,name=slot_id,json=slotId" json:"slot_id,omitempty"` -} - -func (x *Slot) Reset() { - *x = Slot{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Slot) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Slot) ProtoMessage() {} - -func (x *Slot) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Slot.ProtoReflect.Descriptor instead. -func (*Slot) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{2} -} - -func (x *Slot) GetDbName() string { - if x != nil && x.DbName != nil { - return *x.DbName - } - return "" -} - -func (x *Slot) GetSlotId() uint32 { - if x != nil && x.SlotId != nil { - return *x.SlotId - } - return 0 -} - -type DBInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - DbName *string `protobuf:"bytes,1,req,name=db_name,json=dbName" json:"db_name,omitempty"` - SlotNum *uint32 `protobuf:"varint,2,req,name=slot_num,json=slotNum" json:"slot_num,omitempty"` - SlotIds []uint32 `protobuf:"varint,3,rep,name=slot_ids,json=slotIds" json:"slot_ids,omitempty"` -} - -func (x *DBInfo) Reset() { - *x = DBInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DBInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DBInfo) ProtoMessage() {} - -func (x *DBInfo) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DBInfo.ProtoReflect.Descriptor instead. -func (*DBInfo) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{3} -} - -func (x *DBInfo) GetDbName() string { - if x != nil && x.DbName != nil { - return *x.DbName - } - return "" -} - -func (x *DBInfo) GetSlotNum() uint32 { - if x != nil && x.SlotNum != nil { - return *x.SlotNum - } - return 0 -} - -func (x *DBInfo) GetSlotIds() []uint32 { - if x != nil { - return x.SlotIds - } - return nil -} - -type PikaMeta struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - DbInfos []*DBInfo `protobuf:"bytes,1,rep,name=db_infos,json=dbInfos" json:"db_infos,omitempty"` -} - -func (x *PikaMeta) Reset() { - *x = PikaMeta{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PikaMeta) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PikaMeta) ProtoMessage() {} - -func (x *PikaMeta) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PikaMeta.ProtoReflect.Descriptor instead. -func (*PikaMeta) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{4} -} - -func (x *PikaMeta) GetDbInfos() []*DBInfo { - if x != nil { - return x.DbInfos - } - return nil -} - -type ConsensusMeta struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Term *uint32 `protobuf:"varint,1,opt,name=term" json:"term,omitempty"` - // Leader -> Follower prev_log_offset - // Follower -> Leader last_log_offset - LogOffset *BinlogOffset `protobuf:"bytes,2,opt,name=log_offset,json=logOffset" json:"log_offset,omitempty"` - Commit *BinlogOffset `protobuf:"bytes,3,opt,name=commit" json:"commit,omitempty"` - Reject *bool `protobuf:"varint,4,opt,name=reject" json:"reject,omitempty"` - Hint []*BinlogOffset `protobuf:"bytes,5,rep,name=hint" json:"hint,omitempty"` -} - -func (x *ConsensusMeta) Reset() { - *x = ConsensusMeta{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ConsensusMeta) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ConsensusMeta) ProtoMessage() {} - -func (x *ConsensusMeta) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ConsensusMeta.ProtoReflect.Descriptor instead. -func (*ConsensusMeta) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{5} -} - -func (x *ConsensusMeta) GetTerm() uint32 { - if x != nil && x.Term != nil { - return *x.Term - } - return 0 -} - -func (x *ConsensusMeta) GetLogOffset() *BinlogOffset { - if x != nil { - return x.LogOffset - } - return nil -} - -func (x *ConsensusMeta) GetCommit() *BinlogOffset { - if x != nil { - return x.Commit - } - return nil -} - -func (x *ConsensusMeta) GetReject() bool { - if x != nil && x.Reject != nil { - return *x.Reject - } - return false -} - -func (x *ConsensusMeta) GetHint() []*BinlogOffset { - if x != nil { - return x.Hint - } - return nil -} - -// Request message -type InnerRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type *Type `protobuf:"varint,1,req,name=type,enum=InnerMessage.Type" json:"type,omitempty"` - MetaSync *InnerRequest_MetaSync `protobuf:"bytes,2,opt,name=meta_sync,json=metaSync" json:"meta_sync,omitempty"` - TrySync *InnerRequest_TrySync `protobuf:"bytes,3,opt,name=try_sync,json=trySync" json:"try_sync,omitempty"` - DbSync *InnerRequest_DBSync `protobuf:"bytes,4,opt,name=db_sync,json=dbSync" json:"db_sync,omitempty"` - BinlogSync *InnerRequest_BinlogSync `protobuf:"bytes,5,opt,name=binlog_sync,json=binlogSync" json:"binlog_sync,omitempty"` - RemoveSlaveNode []*InnerRequest_RemoveSlaveNode `protobuf:"bytes,6,rep,name=remove_slave_node,json=removeSlaveNode" json:"remove_slave_node,omitempty"` - ConsensusMeta *ConsensusMeta `protobuf:"bytes,7,opt,name=consensus_meta,json=consensusMeta" json:"consensus_meta,omitempty"` -} - -func (x *InnerRequest) Reset() { - *x = InnerRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InnerRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InnerRequest) ProtoMessage() {} - -func (x *InnerRequest) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InnerRequest.ProtoReflect.Descriptor instead. -func (*InnerRequest) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{6} -} - -func (x *InnerRequest) GetType() Type { - if x != nil && x.Type != nil { - return *x.Type - } - return Type_kMetaSync -} - -func (x *InnerRequest) GetMetaSync() *InnerRequest_MetaSync { - if x != nil { - return x.MetaSync - } - return nil -} - -func (x *InnerRequest) GetTrySync() *InnerRequest_TrySync { - if x != nil { - return x.TrySync - } - return nil -} - -func (x *InnerRequest) GetDbSync() *InnerRequest_DBSync { - if x != nil { - return x.DbSync - } - return nil -} - -func (x *InnerRequest) GetBinlogSync() *InnerRequest_BinlogSync { - if x != nil { - return x.BinlogSync - } - return nil -} - -func (x *InnerRequest) GetRemoveSlaveNode() []*InnerRequest_RemoveSlaveNode { - if x != nil { - return x.RemoveSlaveNode - } - return nil -} - -func (x *InnerRequest) GetConsensusMeta() *ConsensusMeta { - if x != nil { - return x.ConsensusMeta - } - return nil -} - -type SlotInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SlotId *uint32 `protobuf:"varint,1,req,name=slot_id,json=slotId" json:"slot_id,omitempty"` - Master *Node `protobuf:"bytes,2,req,name=master" json:"master,omitempty"` - Slaves []*Node `protobuf:"bytes,3,rep,name=slaves" json:"slaves,omitempty"` -} - -func (x *SlotInfo) Reset() { - *x = SlotInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SlotInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SlotInfo) ProtoMessage() {} - -func (x *SlotInfo) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SlotInfo.ProtoReflect.Descriptor instead. -func (*SlotInfo) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{7} -} - -func (x *SlotInfo) GetSlotId() uint32 { - if x != nil && x.SlotId != nil { - return *x.SlotId - } - return 0 -} - -func (x *SlotInfo) GetMaster() *Node { - if x != nil { - return x.Master - } - return nil -} - -func (x *SlotInfo) GetSlaves() []*Node { - if x != nil { - return x.Slaves - } - return nil -} - -// Response message -type InnerResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type *Type `protobuf:"varint,1,req,name=type,enum=InnerMessage.Type" json:"type,omitempty"` - Code *StatusCode `protobuf:"varint,2,req,name=code,enum=InnerMessage.StatusCode" json:"code,omitempty"` - Reply *string `protobuf:"bytes,3,opt,name=reply" json:"reply,omitempty"` - MetaSync *InnerResponse_MetaSync `protobuf:"bytes,4,opt,name=meta_sync,json=metaSync" json:"meta_sync,omitempty"` - DbSync *InnerResponse_DBSync `protobuf:"bytes,5,opt,name=db_sync,json=dbSync" json:"db_sync,omitempty"` - TrySync *InnerResponse_TrySync `protobuf:"bytes,6,opt,name=try_sync,json=trySync" json:"try_sync,omitempty"` - BinlogSync []*InnerResponse_BinlogSync `protobuf:"bytes,7,rep,name=binlog_sync,json=binlogSync" json:"binlog_sync,omitempty"` - RemoveSlaveNode []*InnerResponse_RemoveSlaveNode `protobuf:"bytes,8,rep,name=remove_slave_node,json=removeSlaveNode" json:"remove_slave_node,omitempty"` - // consensus use - ConsensusMeta *ConsensusMeta `protobuf:"bytes,9,opt,name=consensus_meta,json=consensusMeta" json:"consensus_meta,omitempty"` -} - -func (x *InnerResponse) Reset() { - *x = InnerResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InnerResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InnerResponse) ProtoMessage() {} - -func (x *InnerResponse) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InnerResponse.ProtoReflect.Descriptor instead. -func (*InnerResponse) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{8} -} - -func (x *InnerResponse) GetType() Type { - if x != nil && x.Type != nil { - return *x.Type - } - return Type_kMetaSync -} - -func (x *InnerResponse) GetCode() StatusCode { - if x != nil && x.Code != nil { - return *x.Code - } - return StatusCode_kOk -} - -func (x *InnerResponse) GetReply() string { - if x != nil && x.Reply != nil { - return *x.Reply - } - return "" -} - -func (x *InnerResponse) GetMetaSync() *InnerResponse_MetaSync { - if x != nil { - return x.MetaSync - } - return nil -} - -func (x *InnerResponse) GetDbSync() *InnerResponse_DBSync { - if x != nil { - return x.DbSync - } - return nil -} - -func (x *InnerResponse) GetTrySync() *InnerResponse_TrySync { - if x != nil { - return x.TrySync - } - return nil -} - -func (x *InnerResponse) GetBinlogSync() []*InnerResponse_BinlogSync { - if x != nil { - return x.BinlogSync - } - return nil -} - -func (x *InnerResponse) GetRemoveSlaveNode() []*InnerResponse_RemoveSlaveNode { - if x != nil { - return x.RemoveSlaveNode - } - return nil -} - -func (x *InnerResponse) GetConsensusMeta() *ConsensusMeta { - if x != nil { - return x.ConsensusMeta - } - return nil -} - -// slave to master -type InnerRequest_MetaSync struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Node *Node `protobuf:"bytes,1,req,name=node" json:"node,omitempty"` - Auth *string `protobuf:"bytes,2,opt,name=auth" json:"auth,omitempty"` -} - -func (x *InnerRequest_MetaSync) Reset() { - *x = InnerRequest_MetaSync{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InnerRequest_MetaSync) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InnerRequest_MetaSync) ProtoMessage() {} - -func (x *InnerRequest_MetaSync) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InnerRequest_MetaSync.ProtoReflect.Descriptor instead. -func (*InnerRequest_MetaSync) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{6, 0} -} - -func (x *InnerRequest_MetaSync) GetNode() *Node { - if x != nil { - return x.Node - } - return nil -} - -func (x *InnerRequest_MetaSync) GetAuth() string { - if x != nil && x.Auth != nil { - return *x.Auth - } - return "" -} - -// slave to master -type InnerRequest_TrySync struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Node *Node `protobuf:"bytes,1,req,name=node" json:"node,omitempty"` - Slot *Slot `protobuf:"bytes,2,req,name=slot" json:"slot,omitempty"` - BinlogOffset *BinlogOffset `protobuf:"bytes,3,req,name=binlog_offset,json=binlogOffset" json:"binlog_offset,omitempty"` -} - -func (x *InnerRequest_TrySync) Reset() { - *x = InnerRequest_TrySync{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InnerRequest_TrySync) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InnerRequest_TrySync) ProtoMessage() {} - -func (x *InnerRequest_TrySync) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InnerRequest_TrySync.ProtoReflect.Descriptor instead. -func (*InnerRequest_TrySync) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{6, 1} -} - -func (x *InnerRequest_TrySync) GetNode() *Node { - if x != nil { - return x.Node - } - return nil -} - -func (x *InnerRequest_TrySync) GetSlot() *Slot { - if x != nil { - return x.Slot - } - return nil -} - -func (x *InnerRequest_TrySync) GetBinlogOffset() *BinlogOffset { - if x != nil { - return x.BinlogOffset - } - return nil -} - -// slave to master -type InnerRequest_DBSync struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Node *Node `protobuf:"bytes,1,req,name=node" json:"node,omitempty"` - Slot *Slot `protobuf:"bytes,2,req,name=slot" json:"slot,omitempty"` - BinlogOffset *BinlogOffset `protobuf:"bytes,3,req,name=binlog_offset,json=binlogOffset" json:"binlog_offset,omitempty"` -} - -func (x *InnerRequest_DBSync) Reset() { - *x = InnerRequest_DBSync{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InnerRequest_DBSync) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InnerRequest_DBSync) ProtoMessage() {} - -func (x *InnerRequest_DBSync) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InnerRequest_DBSync.ProtoReflect.Descriptor instead. -func (*InnerRequest_DBSync) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{6, 2} -} - -func (x *InnerRequest_DBSync) GetNode() *Node { - if x != nil { - return x.Node - } - return nil -} - -func (x *InnerRequest_DBSync) GetSlot() *Slot { - if x != nil { - return x.Slot - } - return nil -} - -func (x *InnerRequest_DBSync) GetBinlogOffset() *BinlogOffset { - if x != nil { - return x.BinlogOffset - } - return nil -} - -type InnerRequest_BinlogSync struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Node *Node `protobuf:"bytes,1,req,name=node" json:"node,omitempty"` - DbName *string `protobuf:"bytes,2,req,name=db_name,json=dbName" json:"db_name,omitempty"` - SlotId *uint32 `protobuf:"varint,3,req,name=slot_id,json=slotId" json:"slot_id,omitempty"` - AckRangeStart *BinlogOffset `protobuf:"bytes,4,req,name=ack_range_start,json=ackRangeStart" json:"ack_range_start,omitempty"` - AckRangeEnd *BinlogOffset `protobuf:"bytes,5,req,name=ack_range_end,json=ackRangeEnd" json:"ack_range_end,omitempty"` - SessionId *int32 `protobuf:"varint,6,req,name=session_id,json=sessionId" json:"session_id,omitempty"` - FirstSend *bool `protobuf:"varint,7,req,name=first_send,json=firstSend" json:"first_send,omitempty"` -} - -func (x *InnerRequest_BinlogSync) Reset() { - *x = InnerRequest_BinlogSync{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InnerRequest_BinlogSync) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InnerRequest_BinlogSync) ProtoMessage() {} - -func (x *InnerRequest_BinlogSync) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InnerRequest_BinlogSync.ProtoReflect.Descriptor instead. -func (*InnerRequest_BinlogSync) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{6, 3} -} - -func (x *InnerRequest_BinlogSync) GetNode() *Node { - if x != nil { - return x.Node - } - return nil -} - -func (x *InnerRequest_BinlogSync) GetDbName() string { - if x != nil && x.DbName != nil { - return *x.DbName - } - return "" -} - -func (x *InnerRequest_BinlogSync) GetSlotId() uint32 { - if x != nil && x.SlotId != nil { - return *x.SlotId - } - return 0 -} - -func (x *InnerRequest_BinlogSync) GetAckRangeStart() *BinlogOffset { - if x != nil { - return x.AckRangeStart - } - return nil -} - -func (x *InnerRequest_BinlogSync) GetAckRangeEnd() *BinlogOffset { - if x != nil { - return x.AckRangeEnd - } - return nil -} - -func (x *InnerRequest_BinlogSync) GetSessionId() int32 { - if x != nil && x.SessionId != nil { - return *x.SessionId - } - return 0 -} - -func (x *InnerRequest_BinlogSync) GetFirstSend() bool { - if x != nil && x.FirstSend != nil { - return *x.FirstSend - } - return false -} - -type InnerRequest_RemoveSlaveNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Node *Node `protobuf:"bytes,1,req,name=node" json:"node,omitempty"` - Slot *Slot `protobuf:"bytes,2,req,name=slot" json:"slot,omitempty"` -} - -func (x *InnerRequest_RemoveSlaveNode) Reset() { - *x = InnerRequest_RemoveSlaveNode{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InnerRequest_RemoveSlaveNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InnerRequest_RemoveSlaveNode) ProtoMessage() {} - -func (x *InnerRequest_RemoveSlaveNode) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InnerRequest_RemoveSlaveNode.ProtoReflect.Descriptor instead. -func (*InnerRequest_RemoveSlaveNode) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{6, 4} -} - -func (x *InnerRequest_RemoveSlaveNode) GetNode() *Node { - if x != nil { - return x.Node - } - return nil -} - -func (x *InnerRequest_RemoveSlaveNode) GetSlot() *Slot { - if x != nil { - return x.Slot - } - return nil -} - -// master to slave -type InnerResponse_MetaSync struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ClassicMode *bool `protobuf:"varint,1,req,name=classic_mode,json=classicMode" json:"classic_mode,omitempty"` - DbsInfo []*InnerResponse_MetaSync_DBInfo `protobuf:"bytes,2,rep,name=dbs_info,json=dbsInfo" json:"dbs_info,omitempty"` - RunId *string `protobuf:"bytes,3,req,name=run_id,json=runId" json:"run_id,omitempty"` - ReplicationId *string `protobuf:"bytes,4,opt,name=replication_id,json=replicationId" json:"replication_id,omitempty"` -} - -func (x *InnerResponse_MetaSync) Reset() { - *x = InnerResponse_MetaSync{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InnerResponse_MetaSync) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InnerResponse_MetaSync) ProtoMessage() {} - -func (x *InnerResponse_MetaSync) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InnerResponse_MetaSync.ProtoReflect.Descriptor instead. -func (*InnerResponse_MetaSync) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{8, 0} -} - -func (x *InnerResponse_MetaSync) GetClassicMode() bool { - if x != nil && x.ClassicMode != nil { - return *x.ClassicMode - } - return false -} - -func (x *InnerResponse_MetaSync) GetDbsInfo() []*InnerResponse_MetaSync_DBInfo { - if x != nil { - return x.DbsInfo - } - return nil -} - -func (x *InnerResponse_MetaSync) GetRunId() string { - if x != nil && x.RunId != nil { - return *x.RunId - } - return "" -} - -func (x *InnerResponse_MetaSync) GetReplicationId() string { - if x != nil && x.ReplicationId != nil { - return *x.ReplicationId - } - return "" -} - -// master to slave -type InnerResponse_TrySync struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ReplyCode *InnerResponse_TrySync_ReplyCode `protobuf:"varint,1,req,name=reply_code,json=replyCode,enum=InnerMessage.InnerResponse_TrySync_ReplyCode" json:"reply_code,omitempty"` - Slot *Slot `protobuf:"bytes,2,req,name=slot" json:"slot,omitempty"` - BinlogOffset *BinlogOffset `protobuf:"bytes,3,opt,name=binlog_offset,json=binlogOffset" json:"binlog_offset,omitempty"` - SessionId *int32 `protobuf:"varint,4,opt,name=session_id,json=sessionId" json:"session_id,omitempty"` -} - -func (x *InnerResponse_TrySync) Reset() { - *x = InnerResponse_TrySync{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InnerResponse_TrySync) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InnerResponse_TrySync) ProtoMessage() {} - -func (x *InnerResponse_TrySync) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InnerResponse_TrySync.ProtoReflect.Descriptor instead. -func (*InnerResponse_TrySync) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{8, 1} -} - -func (x *InnerResponse_TrySync) GetReplyCode() InnerResponse_TrySync_ReplyCode { - if x != nil && x.ReplyCode != nil { - return *x.ReplyCode - } - return InnerResponse_TrySync_kOk -} - -func (x *InnerResponse_TrySync) GetSlot() *Slot { - if x != nil { - return x.Slot - } - return nil -} - -func (x *InnerResponse_TrySync) GetBinlogOffset() *BinlogOffset { - if x != nil { - return x.BinlogOffset - } - return nil -} - -func (x *InnerResponse_TrySync) GetSessionId() int32 { - if x != nil && x.SessionId != nil { - return *x.SessionId - } - return 0 -} - -type InnerResponse_DBSync struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Slot *Slot `protobuf:"bytes,1,req,name=slot" json:"slot,omitempty"` - SessionId *int32 `protobuf:"varint,2,req,name=session_id,json=sessionId" json:"session_id,omitempty"` -} - -func (x *InnerResponse_DBSync) Reset() { - *x = InnerResponse_DBSync{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InnerResponse_DBSync) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InnerResponse_DBSync) ProtoMessage() {} - -func (x *InnerResponse_DBSync) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InnerResponse_DBSync.ProtoReflect.Descriptor instead. -func (*InnerResponse_DBSync) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{8, 2} -} - -func (x *InnerResponse_DBSync) GetSlot() *Slot { - if x != nil { - return x.Slot - } - return nil -} - -func (x *InnerResponse_DBSync) GetSessionId() int32 { - if x != nil && x.SessionId != nil { - return *x.SessionId - } - return 0 -} - -// master to slave -type InnerResponse_BinlogSync struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Slot *Slot `protobuf:"bytes,1,req,name=slot" json:"slot,omitempty"` - BinlogOffset *BinlogOffset `protobuf:"bytes,2,req,name=binlog_offset,json=binlogOffset" json:"binlog_offset,omitempty"` - Binlog []byte `protobuf:"bytes,3,req,name=binlog" json:"binlog,omitempty"` - SessionId *int32 `protobuf:"varint,4,req,name=session_id,json=sessionId" json:"session_id,omitempty"` -} - -func (x *InnerResponse_BinlogSync) Reset() { - *x = InnerResponse_BinlogSync{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InnerResponse_BinlogSync) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InnerResponse_BinlogSync) ProtoMessage() {} - -func (x *InnerResponse_BinlogSync) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InnerResponse_BinlogSync.ProtoReflect.Descriptor instead. -func (*InnerResponse_BinlogSync) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{8, 3} -} - -func (x *InnerResponse_BinlogSync) GetSlot() *Slot { - if x != nil { - return x.Slot - } - return nil -} - -func (x *InnerResponse_BinlogSync) GetBinlogOffset() *BinlogOffset { - if x != nil { - return x.BinlogOffset - } - return nil -} - -func (x *InnerResponse_BinlogSync) GetBinlog() []byte { - if x != nil { - return x.Binlog - } - return nil -} - -func (x *InnerResponse_BinlogSync) GetSessionId() int32 { - if x != nil && x.SessionId != nil { - return *x.SessionId - } - return 0 -} - -type InnerResponse_RemoveSlaveNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Node *Node `protobuf:"bytes,1,req,name=node" json:"node,omitempty"` - Slot *Slot `protobuf:"bytes,2,req,name=slot" json:"slot,omitempty"` -} - -func (x *InnerResponse_RemoveSlaveNode) Reset() { - *x = InnerResponse_RemoveSlaveNode{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InnerResponse_RemoveSlaveNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InnerResponse_RemoveSlaveNode) ProtoMessage() {} - -func (x *InnerResponse_RemoveSlaveNode) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InnerResponse_RemoveSlaveNode.ProtoReflect.Descriptor instead. -func (*InnerResponse_RemoveSlaveNode) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{8, 4} -} - -func (x *InnerResponse_RemoveSlaveNode) GetNode() *Node { - if x != nil { - return x.Node - } - return nil -} - -func (x *InnerResponse_RemoveSlaveNode) GetSlot() *Slot { - if x != nil { - return x.Slot - } - return nil -} - -type InnerResponse_MetaSync_DBInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - DbName *string `protobuf:"bytes,1,req,name=db_name,json=dbName" json:"db_name,omitempty"` - SlotNum *int32 `protobuf:"varint,2,req,name=slot_num,json=slotNum" json:"slot_num,omitempty"` - DbInstanceNum *int32 `protobuf:"varint,3,req,name=db_instance_num,json=dbInstanceNum" json:"db_instance_num,omitempty"` -} - -func (x *InnerResponse_MetaSync_DBInfo) Reset() { - *x = InnerResponse_MetaSync_DBInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_pika_inner_message_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InnerResponse_MetaSync_DBInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InnerResponse_MetaSync_DBInfo) ProtoMessage() {} - -func (x *InnerResponse_MetaSync_DBInfo) ProtoReflect() protoreflect.Message { - mi := &file_pika_inner_message_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InnerResponse_MetaSync_DBInfo.ProtoReflect.Descriptor instead. -func (*InnerResponse_MetaSync_DBInfo) Descriptor() ([]byte, []int) { - return file_pika_inner_message_proto_rawDescGZIP(), []int{8, 0, 0} -} - -func (x *InnerResponse_MetaSync_DBInfo) GetDbName() string { - if x != nil && x.DbName != nil { - return *x.DbName - } - return "" -} - -func (x *InnerResponse_MetaSync_DBInfo) GetSlotNum() int32 { - if x != nil && x.SlotNum != nil { - return *x.SlotNum - } - return 0 -} - -func (x *InnerResponse_MetaSync_DBInfo) GetDbInstanceNum() int32 { - if x != nil && x.DbInstanceNum != nil { - return *x.DbInstanceNum - } - return 0 -} - -var File_pika_inner_message_proto protoreflect.FileDescriptor - -var file_pika_inner_message_proto_rawDesc = []byte{ - 0x0a, 0x18, 0x70, 0x69, 0x6b, 0x61, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x49, 0x6e, 0x6e, 0x65, - 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x6a, 0x0a, 0x0c, 0x42, 0x69, 0x6e, 0x6c, - 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x65, - 0x6e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0d, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x65, 0x6e, - 0x75, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x02, - 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, - 0x72, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x74, 0x65, 0x72, 0x6d, 0x12, 0x14, - 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x69, - 0x6e, 0x64, 0x65, 0x78, 0x22, 0x2a, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x70, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x12, 0x0a, 0x04, - 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x02, 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, - 0x22, 0x38, 0x0a, 0x04, 0x53, 0x6c, 0x6f, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x06, 0x64, 0x62, 0x4e, 0x61, 0x6d, - 0x65, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x6c, 0x6f, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x02, - 0x28, 0x0d, 0x52, 0x06, 0x73, 0x6c, 0x6f, 0x74, 0x49, 0x64, 0x22, 0x57, 0x0a, 0x06, 0x44, 0x42, - 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x06, 0x64, 0x62, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, - 0x08, 0x73, 0x6c, 0x6f, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0d, 0x52, - 0x07, 0x73, 0x6c, 0x6f, 0x74, 0x4e, 0x75, 0x6d, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x6c, 0x6f, 0x74, - 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x07, 0x73, 0x6c, 0x6f, 0x74, - 0x49, 0x64, 0x73, 0x22, 0x3b, 0x0a, 0x08, 0x50, 0x69, 0x6b, 0x61, 0x4d, 0x65, 0x74, 0x61, 0x12, - 0x2f, 0x0a, 0x08, 0x64, 0x62, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x2e, 0x44, 0x42, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x07, 0x64, 0x62, 0x49, 0x6e, 0x66, 0x6f, 0x73, - 0x22, 0xda, 0x01, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x4d, 0x65, - 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x04, 0x74, 0x65, 0x72, 0x6d, 0x12, 0x39, 0x0a, 0x0a, 0x6c, 0x6f, 0x67, 0x5f, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x49, 0x6e, 0x6e, - 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x42, 0x69, 0x6e, 0x6c, 0x6f, 0x67, - 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x09, 0x6c, 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x12, 0x32, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x2e, 0x42, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x06, 0x63, - 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x2e, 0x0a, - 0x04, 0x68, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x49, 0x6e, - 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x42, 0x69, 0x6e, 0x6c, 0x6f, - 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x04, 0x68, 0x69, 0x6e, 0x74, 0x22, 0xe6, 0x09, - 0x0a, 0x0c, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, - 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x49, - 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, - 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x40, 0x0a, 0x09, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, - 0x79, 0x6e, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x49, 0x6e, 0x6e, 0x65, - 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x08, - 0x6d, 0x65, 0x74, 0x61, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x3d, 0x0a, 0x08, 0x74, 0x72, 0x79, 0x5f, - 0x73, 0x79, 0x6e, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x49, 0x6e, 0x6e, - 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x72, 0x79, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x07, - 0x74, 0x72, 0x79, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x3a, 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x73, 0x79, - 0x6e, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x2e, 0x44, 0x42, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x06, 0x64, 0x62, 0x53, - 0x79, 0x6e, 0x63, 0x12, 0x46, 0x0a, 0x0b, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x5f, 0x73, 0x79, - 0x6e, 0x63, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x52, - 0x0a, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x56, 0x0a, 0x11, 0x72, - 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x73, 0x6c, 0x61, 0x76, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, - 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x6c, 0x61, 0x76, 0x65, 0x4e, 0x6f, - 0x64, 0x65, 0x52, 0x0f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x6c, 0x61, 0x76, 0x65, 0x4e, - 0x6f, 0x64, 0x65, 0x12, 0x42, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, - 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x49, 0x6e, - 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x65, - 0x6e, 0x73, 0x75, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, - 0x73, 0x75, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x1a, 0x46, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x53, - 0x79, 0x6e, 0x63, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x61, - 0x75, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x75, 0x74, 0x68, 0x1a, - 0x9a, 0x01, 0x0a, 0x07, 0x54, 0x72, 0x79, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x26, 0x0a, 0x04, 0x6e, - 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, - 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, - 0x6f, 0x64, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x02, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, 0x3f, 0x0a, 0x0d, 0x62, - 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x02, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x2e, 0x42, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x0c, - 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x1a, 0x99, 0x01, 0x0a, - 0x06, 0x44, 0x42, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, - 0x01, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x12, - 0x26, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, - 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x6c, 0x6f, - 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, 0x3f, 0x0a, 0x0d, 0x62, 0x69, 0x6e, 0x6c, 0x6f, - 0x67, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x1a, - 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x42, 0x69, - 0x6e, 0x6c, 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x0c, 0x62, 0x69, 0x6e, 0x6c, - 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x1a, 0xa8, 0x02, 0x0a, 0x0a, 0x42, 0x69, 0x6e, - 0x6c, 0x6f, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, - 0x01, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x12, - 0x17, 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x02, 0x28, 0x09, - 0x52, 0x06, 0x64, 0x62, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x6c, 0x6f, 0x74, - 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x02, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x6c, 0x6f, 0x74, 0x49, - 0x64, 0x12, 0x42, 0x0a, 0x0f, 0x61, 0x63, 0x6b, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x18, 0x04, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x49, 0x6e, 0x6e, - 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x42, 0x69, 0x6e, 0x6c, 0x6f, 0x67, - 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x0d, 0x61, 0x63, 0x6b, 0x52, 0x61, 0x6e, 0x67, 0x65, - 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x3e, 0x0a, 0x0d, 0x61, 0x63, 0x6b, 0x5f, 0x72, 0x61, 0x6e, - 0x67, 0x65, 0x5f, 0x65, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x49, - 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x42, 0x69, 0x6e, 0x6c, - 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x0b, 0x61, 0x63, 0x6b, 0x52, 0x61, 0x6e, - 0x67, 0x65, 0x45, 0x6e, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x02, 0x28, 0x05, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x73, 0x65, - 0x6e, 0x64, 0x18, 0x07, 0x20, 0x02, 0x28, 0x08, 0x52, 0x09, 0x66, 0x69, 0x72, 0x73, 0x74, 0x53, - 0x65, 0x6e, 0x64, 0x1a, 0x61, 0x0a, 0x0f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x6c, 0x61, - 0x76, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, - 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x26, - 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, - 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x6c, 0x6f, 0x74, - 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x22, 0x7b, 0x0a, 0x08, 0x53, 0x6c, 0x6f, 0x74, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x6c, 0x6f, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x02, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x6c, 0x6f, 0x74, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x06, 0x6d, - 0x61, 0x73, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, - 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, - 0x06, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x6c, 0x61, 0x76, 0x65, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x06, 0x73, 0x6c, 0x61, - 0x76, 0x65, 0x73, 0x22, 0xd2, 0x0b, 0x0a, 0x0d, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, - 0x02, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2c, 0x0a, - 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x49, 0x6e, - 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, - 0x65, 0x70, 0x6c, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x72, 0x65, 0x70, 0x6c, - 0x79, 0x12, 0x41, 0x0a, 0x09, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x53, 0x79, 0x6e, 0x63, 0x12, 0x3b, 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x2e, 0x44, 0x42, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x06, 0x64, 0x62, 0x53, 0x79, 0x6e, - 0x63, 0x12, 0x3e, 0x0a, 0x08, 0x74, 0x72, 0x79, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x2e, 0x54, 0x72, 0x79, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x07, 0x74, 0x72, 0x79, 0x53, 0x79, 0x6e, - 0x63, 0x12, 0x47, 0x0a, 0x0b, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x5f, 0x73, 0x79, 0x6e, 0x63, - 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x0a, - 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x57, 0x0a, 0x11, 0x72, 0x65, - 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x73, 0x6c, 0x61, 0x76, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, - 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x6c, 0x61, 0x76, 0x65, 0x4e, 0x6f, - 0x64, 0x65, 0x52, 0x0f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x6c, 0x61, 0x76, 0x65, 0x4e, - 0x6f, 0x64, 0x65, 0x12, 0x42, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, - 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x49, 0x6e, - 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x65, - 0x6e, 0x73, 0x75, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, - 0x73, 0x75, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x1a, 0x99, 0x02, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, - 0x53, 0x79, 0x6e, 0x63, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x63, 0x5f, - 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x08, 0x52, 0x0b, 0x63, 0x6c, 0x61, 0x73, - 0x73, 0x69, 0x63, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x46, 0x0a, 0x08, 0x64, 0x62, 0x73, 0x5f, 0x69, - 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x49, 0x6e, 0x6e, 0x65, - 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x53, 0x79, 0x6e, 0x63, 0x2e, - 0x44, 0x42, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x07, 0x64, 0x62, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x12, - 0x15, 0x0a, 0x06, 0x72, 0x75, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x02, 0x28, 0x09, 0x52, - 0x05, 0x72, 0x75, 0x6e, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, - 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x1a, 0x64, 0x0a, - 0x06, 0x44, 0x42, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x06, 0x64, 0x62, 0x4e, 0x61, 0x6d, 0x65, - 0x12, 0x19, 0x0a, 0x08, 0x73, 0x6c, 0x6f, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x02, - 0x28, 0x05, 0x52, 0x07, 0x73, 0x6c, 0x6f, 0x74, 0x4e, 0x75, 0x6d, 0x12, 0x26, 0x0a, 0x0f, 0x64, - 0x62, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x03, - 0x20, 0x02, 0x28, 0x05, 0x52, 0x0d, 0x64, 0x62, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, - 0x4e, 0x75, 0x6d, 0x1a, 0xaf, 0x02, 0x0a, 0x07, 0x54, 0x72, 0x79, 0x53, 0x79, 0x6e, 0x63, 0x12, - 0x4c, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, - 0x02, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x2e, 0x54, 0x72, 0x79, 0x53, 0x79, 0x6e, 0x63, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x43, 0x6f, - 0x64, 0x65, 0x52, 0x09, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x26, 0x0a, - 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, - 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, - 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, 0x3f, 0x0a, 0x0d, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x5f, - 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x49, - 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x42, 0x69, 0x6e, 0x6c, - 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x0c, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, - 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x4e, 0x0a, 0x09, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x43, 0x6f, - 0x64, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x6b, 0x4f, 0x6b, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x6b, - 0x53, 0x79, 0x6e, 0x63, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x42, 0x65, 0x50, 0x75, 0x72, 0x67, 0x65, - 0x64, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x6b, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x6f, 0x69, 0x6e, - 0x74, 0x4c, 0x61, 0x72, 0x67, 0x65, 0x72, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x6b, 0x45, 0x72, - 0x72, 0x6f, 0x72, 0x10, 0x04, 0x1a, 0x4f, 0x0a, 0x06, 0x44, 0x42, 0x53, 0x79, 0x6e, 0x63, 0x12, - 0x26, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, - 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x6c, 0x6f, - 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x02, 0x28, 0x05, 0x52, 0x09, 0x73, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x1a, 0xac, 0x01, 0x0a, 0x0a, 0x42, 0x69, 0x6e, 0x6c, 0x6f, - 0x67, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x26, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x01, 0x20, - 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, 0x3f, 0x0a, - 0x0d, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, - 0x20, 0x02, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x2e, 0x42, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x52, 0x0c, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x16, - 0x0a, 0x06, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x18, 0x03, 0x20, 0x02, 0x28, 0x0c, 0x52, 0x06, - 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x02, 0x28, 0x05, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x1a, 0x61, 0x0a, 0x0f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, - 0x6c, 0x61, 0x76, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, - 0x18, 0x01, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, - 0x12, 0x26, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x12, - 0x2e, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x6c, - 0x6f, 0x74, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x2a, 0x66, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x0d, 0x0a, 0x09, 0x6b, 0x4d, 0x65, 0x74, 0x61, 0x53, 0x79, 0x6e, 0x63, 0x10, 0x01, 0x12, - 0x0c, 0x0a, 0x08, 0x6b, 0x54, 0x72, 0x79, 0x53, 0x79, 0x6e, 0x63, 0x10, 0x02, 0x12, 0x0b, 0x0a, - 0x07, 0x6b, 0x44, 0x42, 0x53, 0x79, 0x6e, 0x63, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x6b, 0x42, - 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x53, 0x79, 0x6e, 0x63, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x6b, - 0x48, 0x65, 0x61, 0x74, 0x42, 0x65, 0x61, 0x74, 0x10, 0x05, 0x12, 0x14, 0x0a, 0x10, 0x6b, 0x52, - 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x6c, 0x61, 0x76, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x10, 0x06, - 0x2a, 0x2d, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x07, - 0x0a, 0x03, 0x6b, 0x4f, 0x6b, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x6b, 0x45, 0x72, 0x72, 0x6f, - 0x72, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x6b, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x10, 0x03, 0x42, - 0x0f, 0x5a, 0x0d, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x69, 0x6e, 0x6e, 0x65, 0x72, -} - -var ( - file_pika_inner_message_proto_rawDescOnce sync.Once - file_pika_inner_message_proto_rawDescData = file_pika_inner_message_proto_rawDesc -) - -func file_pika_inner_message_proto_rawDescGZIP() []byte { - file_pika_inner_message_proto_rawDescOnce.Do(func() { - file_pika_inner_message_proto_rawDescData = protoimpl.X.CompressGZIP(file_pika_inner_message_proto_rawDescData) - }) - return file_pika_inner_message_proto_rawDescData -} - -var file_pika_inner_message_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_pika_inner_message_proto_msgTypes = make([]protoimpl.MessageInfo, 20) -var file_pika_inner_message_proto_goTypes = []any{ - (Type)(0), // 0: InnerMessage.Type - (StatusCode)(0), // 1: InnerMessage.StatusCode - (InnerResponse_TrySync_ReplyCode)(0), // 2: InnerMessage.InnerResponse.TrySync.ReplyCode - (*BinlogOffset)(nil), // 3: InnerMessage.BinlogOffset - (*Node)(nil), // 4: InnerMessage.Node - (*Slot)(nil), // 5: InnerMessage.Slot - (*DBInfo)(nil), // 6: InnerMessage.DBInfo - (*PikaMeta)(nil), // 7: InnerMessage.PikaMeta - (*ConsensusMeta)(nil), // 8: InnerMessage.ConsensusMeta - (*InnerRequest)(nil), // 9: InnerMessage.InnerRequest - (*SlotInfo)(nil), // 10: InnerMessage.SlotInfo - (*InnerResponse)(nil), // 11: InnerMessage.InnerResponse - (*InnerRequest_MetaSync)(nil), // 12: InnerMessage.InnerRequest.MetaSync - (*InnerRequest_TrySync)(nil), // 13: InnerMessage.InnerRequest.TrySync - (*InnerRequest_DBSync)(nil), // 14: InnerMessage.InnerRequest.DBSync - (*InnerRequest_BinlogSync)(nil), // 15: InnerMessage.InnerRequest.BinlogSync - (*InnerRequest_RemoveSlaveNode)(nil), // 16: InnerMessage.InnerRequest.RemoveSlaveNode - (*InnerResponse_MetaSync)(nil), // 17: InnerMessage.InnerResponse.MetaSync - (*InnerResponse_TrySync)(nil), // 18: InnerMessage.InnerResponse.TrySync - (*InnerResponse_DBSync)(nil), // 19: InnerMessage.InnerResponse.DBSync - (*InnerResponse_BinlogSync)(nil), // 20: InnerMessage.InnerResponse.BinlogSync - (*InnerResponse_RemoveSlaveNode)(nil), // 21: InnerMessage.InnerResponse.RemoveSlaveNode - (*InnerResponse_MetaSync_DBInfo)(nil), // 22: InnerMessage.InnerResponse.MetaSync.DBInfo -} -var file_pika_inner_message_proto_depIdxs = []int32{ - 6, // 0: InnerMessage.PikaMeta.db_infos:type_name -> InnerMessage.DBInfo - 3, // 1: InnerMessage.ConsensusMeta.log_offset:type_name -> InnerMessage.BinlogOffset - 3, // 2: InnerMessage.ConsensusMeta.commit:type_name -> InnerMessage.BinlogOffset - 3, // 3: InnerMessage.ConsensusMeta.hint:type_name -> InnerMessage.BinlogOffset - 0, // 4: InnerMessage.InnerRequest.type:type_name -> InnerMessage.Type - 12, // 5: InnerMessage.InnerRequest.meta_sync:type_name -> InnerMessage.InnerRequest.MetaSync - 13, // 6: InnerMessage.InnerRequest.try_sync:type_name -> InnerMessage.InnerRequest.TrySync - 14, // 7: InnerMessage.InnerRequest.db_sync:type_name -> InnerMessage.InnerRequest.DBSync - 15, // 8: InnerMessage.InnerRequest.binlog_sync:type_name -> InnerMessage.InnerRequest.BinlogSync - 16, // 9: InnerMessage.InnerRequest.remove_slave_node:type_name -> InnerMessage.InnerRequest.RemoveSlaveNode - 8, // 10: InnerMessage.InnerRequest.consensus_meta:type_name -> InnerMessage.ConsensusMeta - 4, // 11: InnerMessage.SlotInfo.master:type_name -> InnerMessage.Node - 4, // 12: InnerMessage.SlotInfo.slaves:type_name -> InnerMessage.Node - 0, // 13: InnerMessage.InnerResponse.type:type_name -> InnerMessage.Type - 1, // 14: InnerMessage.InnerResponse.code:type_name -> InnerMessage.StatusCode - 17, // 15: InnerMessage.InnerResponse.meta_sync:type_name -> InnerMessage.InnerResponse.MetaSync - 19, // 16: InnerMessage.InnerResponse.db_sync:type_name -> InnerMessage.InnerResponse.DBSync - 18, // 17: InnerMessage.InnerResponse.try_sync:type_name -> InnerMessage.InnerResponse.TrySync - 20, // 18: InnerMessage.InnerResponse.binlog_sync:type_name -> InnerMessage.InnerResponse.BinlogSync - 21, // 19: InnerMessage.InnerResponse.remove_slave_node:type_name -> InnerMessage.InnerResponse.RemoveSlaveNode - 8, // 20: InnerMessage.InnerResponse.consensus_meta:type_name -> InnerMessage.ConsensusMeta - 4, // 21: InnerMessage.InnerRequest.MetaSync.node:type_name -> InnerMessage.Node - 4, // 22: InnerMessage.InnerRequest.TrySync.node:type_name -> InnerMessage.Node - 5, // 23: InnerMessage.InnerRequest.TrySync.slot:type_name -> InnerMessage.Slot - 3, // 24: InnerMessage.InnerRequest.TrySync.binlog_offset:type_name -> InnerMessage.BinlogOffset - 4, // 25: InnerMessage.InnerRequest.DBSync.node:type_name -> InnerMessage.Node - 5, // 26: InnerMessage.InnerRequest.DBSync.slot:type_name -> InnerMessage.Slot - 3, // 27: InnerMessage.InnerRequest.DBSync.binlog_offset:type_name -> InnerMessage.BinlogOffset - 4, // 28: InnerMessage.InnerRequest.BinlogSync.node:type_name -> InnerMessage.Node - 3, // 29: InnerMessage.InnerRequest.BinlogSync.ack_range_start:type_name -> InnerMessage.BinlogOffset - 3, // 30: InnerMessage.InnerRequest.BinlogSync.ack_range_end:type_name -> InnerMessage.BinlogOffset - 4, // 31: InnerMessage.InnerRequest.RemoveSlaveNode.node:type_name -> InnerMessage.Node - 5, // 32: InnerMessage.InnerRequest.RemoveSlaveNode.slot:type_name -> InnerMessage.Slot - 22, // 33: InnerMessage.InnerResponse.MetaSync.dbs_info:type_name -> InnerMessage.InnerResponse.MetaSync.DBInfo - 2, // 34: InnerMessage.InnerResponse.TrySync.reply_code:type_name -> InnerMessage.InnerResponse.TrySync.ReplyCode - 5, // 35: InnerMessage.InnerResponse.TrySync.slot:type_name -> InnerMessage.Slot - 3, // 36: InnerMessage.InnerResponse.TrySync.binlog_offset:type_name -> InnerMessage.BinlogOffset - 5, // 37: InnerMessage.InnerResponse.DBSync.slot:type_name -> InnerMessage.Slot - 5, // 38: InnerMessage.InnerResponse.BinlogSync.slot:type_name -> InnerMessage.Slot - 3, // 39: InnerMessage.InnerResponse.BinlogSync.binlog_offset:type_name -> InnerMessage.BinlogOffset - 4, // 40: InnerMessage.InnerResponse.RemoveSlaveNode.node:type_name -> InnerMessage.Node - 5, // 41: InnerMessage.InnerResponse.RemoveSlaveNode.slot:type_name -> InnerMessage.Slot - 42, // [42:42] is the sub-list for method output_type - 42, // [42:42] is the sub-list for method input_type - 42, // [42:42] is the sub-list for extension type_name - 42, // [42:42] is the sub-list for extension extendee - 0, // [0:42] is the sub-list for field type_name -} - -func init() { file_pika_inner_message_proto_init() } -func file_pika_inner_message_proto_init() { - if File_pika_inner_message_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_pika_inner_message_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*BinlogOffset); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pika_inner_message_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*Node); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pika_inner_message_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*Slot); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pika_inner_message_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*DBInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pika_inner_message_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*PikaMeta); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pika_inner_message_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*ConsensusMeta); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pika_inner_message_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*InnerRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pika_inner_message_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*SlotInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pika_inner_message_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*InnerResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pika_inner_message_proto_msgTypes[9].Exporter = func(v any, i int) any { - switch v := v.(*InnerRequest_MetaSync); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pika_inner_message_proto_msgTypes[10].Exporter = func(v any, i int) any { - switch v := v.(*InnerRequest_TrySync); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pika_inner_message_proto_msgTypes[11].Exporter = func(v any, i int) any { - switch v := v.(*InnerRequest_DBSync); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pika_inner_message_proto_msgTypes[12].Exporter = func(v any, i int) any { - switch v := v.(*InnerRequest_BinlogSync); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pika_inner_message_proto_msgTypes[13].Exporter = func(v any, i int) any { - switch v := v.(*InnerRequest_RemoveSlaveNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pika_inner_message_proto_msgTypes[14].Exporter = func(v any, i int) any { - switch v := v.(*InnerResponse_MetaSync); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pika_inner_message_proto_msgTypes[15].Exporter = func(v any, i int) any { - switch v := v.(*InnerResponse_TrySync); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pika_inner_message_proto_msgTypes[16].Exporter = func(v any, i int) any { - switch v := v.(*InnerResponse_DBSync); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pika_inner_message_proto_msgTypes[17].Exporter = func(v any, i int) any { - switch v := v.(*InnerResponse_BinlogSync); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pika_inner_message_proto_msgTypes[18].Exporter = func(v any, i int) any { - switch v := v.(*InnerResponse_RemoveSlaveNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pika_inner_message_proto_msgTypes[19].Exporter = func(v any, i int) any { - switch v := v.(*InnerResponse_MetaSync_DBInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_pika_inner_message_proto_rawDesc, - NumEnums: 3, - NumMessages: 20, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_pika_inner_message_proto_goTypes, - DependencyIndexes: file_pika_inner_message_proto_depIdxs, - EnumInfos: file_pika_inner_message_proto_enumTypes, - MessageInfos: file_pika_inner_message_proto_msgTypes, - }.Build() - File_pika_inner_message_proto = out.File - file_pika_inner_message_proto_rawDesc = nil - file_pika_inner_message_proto_goTypes = nil - file_pika_inner_message_proto_depIdxs = nil -} diff --git a/tools/pika_cdc/pika/proto/rsync/rsync_service.pb.go b/tools/pika_cdc/pika/proto/rsync/rsync_service.pb.go deleted file mode 100644 index 15663f01aa..0000000000 --- a/tools/pika_cdc/pika/proto/rsync/rsync_service.pb.go +++ /dev/null @@ -1,702 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.1 -// source: rsync_service.proto - -package rsync - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Type int32 - -const ( - Type_kRsyncMeta Type = 1 - Type_kRsyncFile Type = 2 -) - -// Enum value maps for Type. -var ( - Type_name = map[int32]string{ - 1: "kRsyncMeta", - 2: "kRsyncFile", - } - Type_value = map[string]int32{ - "kRsyncMeta": 1, - "kRsyncFile": 2, - } -) - -func (x Type) Enum() *Type { - p := new(Type) - *p = x - return p -} - -func (x Type) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Type) Descriptor() protoreflect.EnumDescriptor { - return file_rsync_service_proto_enumTypes[0].Descriptor() -} - -func (Type) Type() protoreflect.EnumType { - return &file_rsync_service_proto_enumTypes[0] -} - -func (x Type) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Do not use. -func (x *Type) UnmarshalJSON(b []byte) error { - num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) - if err != nil { - return err - } - *x = Type(num) - return nil -} - -// Deprecated: Use Type.Descriptor instead. -func (Type) EnumDescriptor() ([]byte, []int) { - return file_rsync_service_proto_rawDescGZIP(), []int{0} -} - -type StatusCode int32 - -const ( - StatusCode_kOk StatusCode = 1 - StatusCode_kErr StatusCode = 2 -) - -// Enum value maps for StatusCode. -var ( - StatusCode_name = map[int32]string{ - 1: "kOk", - 2: "kErr", - } - StatusCode_value = map[string]int32{ - "kOk": 1, - "kErr": 2, - } -) - -func (x StatusCode) Enum() *StatusCode { - p := new(StatusCode) - *p = x - return p -} - -func (x StatusCode) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (StatusCode) Descriptor() protoreflect.EnumDescriptor { - return file_rsync_service_proto_enumTypes[1].Descriptor() -} - -func (StatusCode) Type() protoreflect.EnumType { - return &file_rsync_service_proto_enumTypes[1] -} - -func (x StatusCode) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Do not use. -func (x *StatusCode) UnmarshalJSON(b []byte) error { - num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) - if err != nil { - return err - } - *x = StatusCode(num) - return nil -} - -// Deprecated: Use StatusCode.Descriptor instead. -func (StatusCode) EnumDescriptor() ([]byte, []int) { - return file_rsync_service_proto_rawDescGZIP(), []int{1} -} - -type MetaResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Filenames []string `protobuf:"bytes,1,rep,name=filenames" json:"filenames,omitempty"` -} - -func (x *MetaResponse) Reset() { - *x = MetaResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_rsync_service_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MetaResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MetaResponse) ProtoMessage() {} - -func (x *MetaResponse) ProtoReflect() protoreflect.Message { - mi := &file_rsync_service_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MetaResponse.ProtoReflect.Descriptor instead. -func (*MetaResponse) Descriptor() ([]byte, []int) { - return file_rsync_service_proto_rawDescGZIP(), []int{0} -} - -func (x *MetaResponse) GetFilenames() []string { - if x != nil { - return x.Filenames - } - return nil -} - -type FileRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Filename *string `protobuf:"bytes,1,req,name=filename" json:"filename,omitempty"` - Count *uint64 `protobuf:"varint,2,req,name=count" json:"count,omitempty"` - Offset *uint64 `protobuf:"varint,3,req,name=offset" json:"offset,omitempty"` -} - -func (x *FileRequest) Reset() { - *x = FileRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_rsync_service_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FileRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FileRequest) ProtoMessage() {} - -func (x *FileRequest) ProtoReflect() protoreflect.Message { - mi := &file_rsync_service_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FileRequest.ProtoReflect.Descriptor instead. -func (*FileRequest) Descriptor() ([]byte, []int) { - return file_rsync_service_proto_rawDescGZIP(), []int{1} -} - -func (x *FileRequest) GetFilename() string { - if x != nil && x.Filename != nil { - return *x.Filename - } - return "" -} - -func (x *FileRequest) GetCount() uint64 { - if x != nil && x.Count != nil { - return *x.Count - } - return 0 -} - -func (x *FileRequest) GetOffset() uint64 { - if x != nil && x.Offset != nil { - return *x.Offset - } - return 0 -} - -type FileResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Eof *int32 `protobuf:"varint,1,req,name=eof" json:"eof,omitempty"` - Count *uint64 `protobuf:"varint,2,req,name=count" json:"count,omitempty"` - Offset *uint64 `protobuf:"varint,3,req,name=offset" json:"offset,omitempty"` - Data []byte `protobuf:"bytes,4,req,name=data" json:"data,omitempty"` - Checksum *string `protobuf:"bytes,5,req,name=checksum" json:"checksum,omitempty"` - Filename *string `protobuf:"bytes,6,req,name=filename" json:"filename,omitempty"` -} - -func (x *FileResponse) Reset() { - *x = FileResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_rsync_service_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FileResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FileResponse) ProtoMessage() {} - -func (x *FileResponse) ProtoReflect() protoreflect.Message { - mi := &file_rsync_service_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FileResponse.ProtoReflect.Descriptor instead. -func (*FileResponse) Descriptor() ([]byte, []int) { - return file_rsync_service_proto_rawDescGZIP(), []int{2} -} - -func (x *FileResponse) GetEof() int32 { - if x != nil && x.Eof != nil { - return *x.Eof - } - return 0 -} - -func (x *FileResponse) GetCount() uint64 { - if x != nil && x.Count != nil { - return *x.Count - } - return 0 -} - -func (x *FileResponse) GetOffset() uint64 { - if x != nil && x.Offset != nil { - return *x.Offset - } - return 0 -} - -func (x *FileResponse) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -func (x *FileResponse) GetChecksum() string { - if x != nil && x.Checksum != nil { - return *x.Checksum - } - return "" -} - -func (x *FileResponse) GetFilename() string { - if x != nil && x.Filename != nil { - return *x.Filename - } - return "" -} - -type RsyncRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type *Type `protobuf:"varint,1,req,name=type,enum=RsyncService.Type" json:"type,omitempty"` - ReaderIndex *int32 `protobuf:"varint,2,req,name=reader_index,json=readerIndex" json:"reader_index,omitempty"` - DbName *string `protobuf:"bytes,3,req,name=db_name,json=dbName" json:"db_name,omitempty"` - SlotId *uint32 `protobuf:"varint,4,req,name=slot_id,json=slotId" json:"slot_id,omitempty"` - FileReq *FileRequest `protobuf:"bytes,5,opt,name=file_req,json=fileReq" json:"file_req,omitempty"` -} - -func (x *RsyncRequest) Reset() { - *x = RsyncRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_rsync_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RsyncRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RsyncRequest) ProtoMessage() {} - -func (x *RsyncRequest) ProtoReflect() protoreflect.Message { - mi := &file_rsync_service_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RsyncRequest.ProtoReflect.Descriptor instead. -func (*RsyncRequest) Descriptor() ([]byte, []int) { - return file_rsync_service_proto_rawDescGZIP(), []int{3} -} - -func (x *RsyncRequest) GetType() Type { - if x != nil && x.Type != nil { - return *x.Type - } - return Type_kRsyncMeta -} - -func (x *RsyncRequest) GetReaderIndex() int32 { - if x != nil && x.ReaderIndex != nil { - return *x.ReaderIndex - } - return 0 -} - -func (x *RsyncRequest) GetDbName() string { - if x != nil && x.DbName != nil { - return *x.DbName - } - return "" -} - -func (x *RsyncRequest) GetSlotId() uint32 { - if x != nil && x.SlotId != nil { - return *x.SlotId - } - return 0 -} - -func (x *RsyncRequest) GetFileReq() *FileRequest { - if x != nil { - return x.FileReq - } - return nil -} - -type RsyncResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type *Type `protobuf:"varint,1,req,name=type,enum=RsyncService.Type" json:"type,omitempty"` - ReaderIndex *int32 `protobuf:"varint,2,req,name=reader_index,json=readerIndex" json:"reader_index,omitempty"` - SnapshotUuid *string `protobuf:"bytes,3,req,name=snapshot_uuid,json=snapshotUuid" json:"snapshot_uuid,omitempty"` - DbName *string `protobuf:"bytes,4,req,name=db_name,json=dbName" json:"db_name,omitempty"` - SlotId *uint32 `protobuf:"varint,5,req,name=slot_id,json=slotId" json:"slot_id,omitempty"` - Code *StatusCode `protobuf:"varint,6,req,name=code,enum=RsyncService.StatusCode" json:"code,omitempty"` - MetaResp *MetaResponse `protobuf:"bytes,7,opt,name=meta_resp,json=metaResp" json:"meta_resp,omitempty"` - FileResp *FileResponse `protobuf:"bytes,8,opt,name=file_resp,json=fileResp" json:"file_resp,omitempty"` -} - -func (x *RsyncResponse) Reset() { - *x = RsyncResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_rsync_service_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RsyncResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RsyncResponse) ProtoMessage() {} - -func (x *RsyncResponse) ProtoReflect() protoreflect.Message { - mi := &file_rsync_service_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RsyncResponse.ProtoReflect.Descriptor instead. -func (*RsyncResponse) Descriptor() ([]byte, []int) { - return file_rsync_service_proto_rawDescGZIP(), []int{4} -} - -func (x *RsyncResponse) GetType() Type { - if x != nil && x.Type != nil { - return *x.Type - } - return Type_kRsyncMeta -} - -func (x *RsyncResponse) GetReaderIndex() int32 { - if x != nil && x.ReaderIndex != nil { - return *x.ReaderIndex - } - return 0 -} - -func (x *RsyncResponse) GetSnapshotUuid() string { - if x != nil && x.SnapshotUuid != nil { - return *x.SnapshotUuid - } - return "" -} - -func (x *RsyncResponse) GetDbName() string { - if x != nil && x.DbName != nil { - return *x.DbName - } - return "" -} - -func (x *RsyncResponse) GetSlotId() uint32 { - if x != nil && x.SlotId != nil { - return *x.SlotId - } - return 0 -} - -func (x *RsyncResponse) GetCode() StatusCode { - if x != nil && x.Code != nil { - return *x.Code - } - return StatusCode_kOk -} - -func (x *RsyncResponse) GetMetaResp() *MetaResponse { - if x != nil { - return x.MetaResp - } - return nil -} - -func (x *RsyncResponse) GetFileResp() *FileResponse { - if x != nil { - return x.FileResp - } - return nil -} - -var File_rsync_service_proto protoreflect.FileDescriptor - -var file_rsync_service_proto_rawDesc = []byte{ - 0x0a, 0x13, 0x72, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x52, 0x73, 0x79, 0x6e, 0x63, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x22, 0x2c, 0x0a, 0x0c, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, - 0x73, 0x22, 0x57, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x02, - 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x52, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x02, - 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x22, 0x9a, 0x01, 0x0a, 0x0c, 0x46, - 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, - 0x6f, 0x66, 0x18, 0x01, 0x20, 0x02, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6f, 0x66, 0x12, 0x14, 0x0a, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x52, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, - 0x02, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, - 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x02, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, - 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x18, 0x05, 0x20, 0x02, 0x28, - 0x09, 0x52, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x66, - 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x02, 0x28, 0x09, 0x52, 0x08, 0x66, - 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xc1, 0x01, 0x0a, 0x0c, 0x52, 0x73, 0x79, 0x6e, - 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x01, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x52, 0x73, 0x79, 0x6e, 0x63, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, - 0x18, 0x02, 0x20, 0x02, 0x28, 0x05, 0x52, 0x0b, 0x72, 0x65, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, - 0x64, 0x65, 0x78, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, - 0x20, 0x02, 0x28, 0x09, 0x52, 0x06, 0x64, 0x62, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07, - 0x73, 0x6c, 0x6f, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x02, 0x28, 0x0d, 0x52, 0x06, 0x73, - 0x6c, 0x6f, 0x74, 0x49, 0x64, 0x12, 0x34, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x72, 0x65, - 0x71, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x52, 0x73, 0x79, 0x6e, 0x63, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x22, 0xd1, 0x02, 0x0a, 0x0d, - 0x52, 0x73, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x52, 0x73, - 0x79, 0x6e, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, - 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x02, 0x28, 0x05, 0x52, 0x0b, 0x72, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x6e, 0x61, 0x70, - 0x73, 0x68, 0x6f, 0x74, 0x5f, 0x75, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x02, 0x28, 0x09, 0x52, - 0x0c, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x55, 0x75, 0x69, 0x64, 0x12, 0x17, 0x0a, - 0x07, 0x64, 0x62, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x02, 0x28, 0x09, 0x52, 0x06, - 0x64, 0x62, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x6c, 0x6f, 0x74, 0x5f, 0x69, - 0x64, 0x18, 0x05, 0x20, 0x02, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x6c, 0x6f, 0x74, 0x49, 0x64, 0x12, - 0x2c, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x06, 0x20, 0x02, 0x28, 0x0e, 0x32, 0x18, 0x2e, - 0x52, 0x73, 0x79, 0x6e, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x37, 0x0a, - 0x09, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1a, 0x2e, 0x52, 0x73, 0x79, 0x6e, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x4d, 0x65, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x6d, 0x65, - 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x12, 0x37, 0x0a, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x72, - 0x65, 0x73, 0x70, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x52, 0x73, 0x79, 0x6e, - 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x2a, - 0x26, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x0a, 0x6b, 0x52, 0x73, 0x79, 0x6e, - 0x63, 0x4d, 0x65, 0x74, 0x61, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x6b, 0x52, 0x73, 0x79, 0x6e, - 0x63, 0x46, 0x69, 0x6c, 0x65, 0x10, 0x02, 0x2a, 0x1f, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x6b, 0x4f, 0x6b, 0x10, 0x01, 0x12, 0x08, - 0x0a, 0x04, 0x6b, 0x45, 0x72, 0x72, 0x10, 0x02, 0x42, 0x0f, 0x5a, 0x0d, 0x2e, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x73, 0x79, 0x6e, 0x63, -} - -var ( - file_rsync_service_proto_rawDescOnce sync.Once - file_rsync_service_proto_rawDescData = file_rsync_service_proto_rawDesc -) - -func file_rsync_service_proto_rawDescGZIP() []byte { - file_rsync_service_proto_rawDescOnce.Do(func() { - file_rsync_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_rsync_service_proto_rawDescData) - }) - return file_rsync_service_proto_rawDescData -} - -var file_rsync_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_rsync_service_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_rsync_service_proto_goTypes = []any{ - (Type)(0), // 0: RsyncService.Type - (StatusCode)(0), // 1: RsyncService.StatusCode - (*MetaResponse)(nil), // 2: RsyncService.MetaResponse - (*FileRequest)(nil), // 3: RsyncService.FileRequest - (*FileResponse)(nil), // 4: RsyncService.FileResponse - (*RsyncRequest)(nil), // 5: RsyncService.RsyncRequest - (*RsyncResponse)(nil), // 6: RsyncService.RsyncResponse -} -var file_rsync_service_proto_depIdxs = []int32{ - 0, // 0: RsyncService.RsyncRequest.type:type_name -> RsyncService.Type - 3, // 1: RsyncService.RsyncRequest.file_req:type_name -> RsyncService.FileRequest - 0, // 2: RsyncService.RsyncResponse.type:type_name -> RsyncService.Type - 1, // 3: RsyncService.RsyncResponse.code:type_name -> RsyncService.StatusCode - 2, // 4: RsyncService.RsyncResponse.meta_resp:type_name -> RsyncService.MetaResponse - 4, // 5: RsyncService.RsyncResponse.file_resp:type_name -> RsyncService.FileResponse - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name -} - -func init() { file_rsync_service_proto_init() } -func file_rsync_service_proto_init() { - if File_rsync_service_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_rsync_service_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*MetaResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_rsync_service_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*FileRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_rsync_service_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*FileResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_rsync_service_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*RsyncRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_rsync_service_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*RsyncResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_rsync_service_proto_rawDesc, - NumEnums: 2, - NumMessages: 5, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_rsync_service_proto_goTypes, - DependencyIndexes: file_rsync_service_proto_depIdxs, - EnumInfos: file_rsync_service_proto_enumTypes, - MessageInfos: file_rsync_service_proto_msgTypes, - }.Build() - File_rsync_service_proto = out.File - file_rsync_service_proto_rawDesc = nil - file_rsync_service_proto_goTypes = nil - file_rsync_service_proto_depIdxs = nil -} diff --git a/tools/pika_cdc/pika/rsync_service.proto b/tools/pika_cdc/pika/rsync_service.proto deleted file mode 100644 index abaf7671ae..0000000000 --- a/tools/pika_cdc/pika/rsync_service.proto +++ /dev/null @@ -1,53 +0,0 @@ -syntax = "proto2"; -package RsyncService; - -option go_package = "./proto/rsync"; - -enum Type { - kRsyncMeta = 1; - kRsyncFile = 2; -} - -enum StatusCode { - kOk = 1; - kErr = 2; -} - -message MetaResponse { - repeated string filenames = 1; -} - -message FileRequest { - required string filename = 1; - required uint64 count = 2; - required uint64 offset = 3; -} - -message FileResponse { - required int32 eof = 1; - required uint64 count = 2; - required uint64 offset = 3; - required bytes data = 4; - required string checksum = 5; - required string filename = 6; -} - -message RsyncRequest { - required Type type = 1; - required int32 reader_index = 2; - required string db_name = 3; - required uint32 slot_id = 4; - optional FileRequest file_req = 5; -} - -message RsyncResponse { - required Type type = 1; - required int32 reader_index = 2; - required string snapshot_uuid = 3; - required string db_name = 4; - required uint32 slot_id = 5; - required StatusCode code = 6; - optional MetaResponse meta_resp = 7; - optional FileResponse file_resp = 8; -} - From 152695a84c3d62347cb4c2cc49d9c746a4699959 Mon Sep 17 00:00:00 2001 From: LeeHao <1838249551@qq.com> Date: Thu, 8 Aug 2024 23:12:34 +0800 Subject: [PATCH 8/9] feat-cdc:use multi chann communication between consumer and pika master Signed-off-by: LeeHao <1838249551@qq.com> --- tools/pika_cdc/README.md | 25 ++++- tools/pika_cdc/conf/cdc.yml | 2 + tools/pika_cdc/conf/conf.go | 1 + tools/pika_cdc/consumer/consumer.go | 12 ++- tools/pika_cdc/consumer/kafka.go | 129 +++++++++++------------ tools/pika_cdc/consumer/protocol.go | 13 ++- tools/pika_cdc/consumer/redis.go | 62 +++++++---- tools/pika_cdc/main.go | 4 +- tools/pika_cdc/pika/replprotocol.go | 77 ++++++++------ tools/pika_cdc/pika/replprotocol_test.go | 13 --- tools/pika_cdc/pika/server.go | 43 +++++--- 11 files changed, 216 insertions(+), 165 deletions(-) diff --git a/tools/pika_cdc/README.md b/tools/pika_cdc/README.md index db06c9357b..5dbdab746f 100644 --- a/tools/pika_cdc/README.md +++ b/tools/pika_cdc/README.md @@ -1,6 +1,23 @@ +# Pika cdc +**A tool for incremental synchronization of pika command** + +By imitating a pika slave + # Build -## generate proto file +**Make sure the system has protoc installed** ```bash -cd pika -protoc --go_out=. *.proto -``` \ No newline at end of file +brew install protobuf +go install google.golang.org/protobuf/cmd/protoc-gen-go@latest +go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest +``` + +## Build pika cdc +```bash +make +``` + +## Todo: + +Consumer side: +- [x] redis +- [ ] kafka \ No newline at end of file diff --git a/tools/pika_cdc/conf/cdc.yml b/tools/pika_cdc/conf/cdc.yml index 68d12c8375..9d2c4f8d70 100644 --- a/tools/pika_cdc/conf/cdc.yml +++ b/tools/pika_cdc/conf/cdc.yml @@ -14,6 +14,8 @@ retries : 0 # retry interval while send message failed(ms) retry_interval: 10 parallel_thread_size: 1 +# the size of the cached channel in pika cdc +buffer_msg_numbers: 10 diff --git a/tools/pika_cdc/conf/conf.go b/tools/pika_cdc/conf/conf.go index 1f3fb58b8f..70b48f9b5c 100644 --- a/tools/pika_cdc/conf/conf.go +++ b/tools/pika_cdc/conf/conf.go @@ -21,6 +21,7 @@ type PikaCdcConfig struct { Retries int `yaml:"retries"` RetryInterval int `yaml:"retry_interval"` ParallelThreadSize int `yaml:"parallel_thread_size"` + BufferMsgNumbers int `yaml:"buffer_msg_numbers"` } var ConfigInstance = PikaCdcConfig{} diff --git a/tools/pika_cdc/consumer/consumer.go b/tools/pika_cdc/consumer/consumer.go index a00e0aab09..f944a51370 100644 --- a/tools/pika_cdc/consumer/consumer.go +++ b/tools/pika_cdc/consumer/consumer.go @@ -5,7 +5,7 @@ import ( ) type Consumer interface { - SendCmdMessage(msg []byte) error + SendCmdMessage(dbName string, msg []byte) error Name() string Close() error Run() @@ -14,12 +14,16 @@ type Consumer interface { type Factory struct{} -func GenerateConsumers(config conf.PikaCdcConfig, msgChan *chan []byte) ([]Consumer, error) { +func GenerateConsumers(config conf.PikaCdcConfig, msgChanns map[string]chan []byte) ([]Consumer, error) { var consumers []Consumer - kafka, _ := NewKafka(config.KafkaServers, config.Topic, config.Retries) + + // kafka + kafka, _ := NewKafka(config.KafkaServers, config.Topic, config.Retries, msgChanns) consumers = append(consumers, kafka) + + // redis for _, r := range config.RedisServers { - newRedis, _ := NewRedis(r, msgChan) + newRedis, _ := NewRedis(r, msgChanns) consumers = append(consumers, newRedis) } return consumers, nil diff --git a/tools/pika_cdc/consumer/kafka.go b/tools/pika_cdc/consumer/kafka.go index 68eb408e1d..24fa4741cf 100644 --- a/tools/pika_cdc/consumer/kafka.go +++ b/tools/pika_cdc/consumer/kafka.go @@ -1,97 +1,90 @@ package consumer import ( - "context" - "errors" "github.com/segmentio/kafka-go" - "github.com/sirupsen/logrus" - "log" "sync" - "time" ) type Kafka struct { - servers []string - topic string - retries int - conns []*kafka.Conn - wg sync.WaitGroup - messageChan chan kafka.Message - stopChan chan bool - once sync.Once - protocol Protocol + servers []string + topic string + retries int + conns []*kafka.Conn + wg sync.WaitGroup + msgChanns map[string]chan []byte + stopChan chan bool + once sync.Once + protocol Protocol } -func (k *Kafka) SendCmdMessage(msg []byte) error { - select { - case k.messageChan <- kafka.Message{Value: k.protocol.ToConsumer(msg)}: - return nil - case <-time.After(2 * time.Second): - e := errors.New("send pika cmd timeout") - logrus.Warn("{}", e) - return e - } -} - -func (k *Kafka) sendMessage() { - for { - select { - case msg := <-k.messageChan: - for _, conn := range k.conns { - _, _ = conn.WriteMessages(msg) - } - case _ = <-k.stopChan: - return - } - } +func (k *Kafka) SendCmdMessage(dbName string, msg []byte) error { + //retries := k.retries + //select { + //case *k.messageChan <- k.protocol.ToConsumer(msg): + // return nil + //case <-time.After(2 * time.Second): + // e := errors.New("send pika cmd timeout and retry send pika cmd") + // logrus.Warn("{}", e) + // retries-- + // if retries <= 0 { + // break + // } + //} + return nil } func (k *Kafka) Name() string { return "Kafka" } -func NewKafka(servers []string, topic string, retries int) (*Kafka, error) { +func NewKafka(servers []string, topic string, retries int, msgChanns map[string]chan []byte) (*Kafka, error) { k := &Kafka{} - k.protocol = &KafkaProtocol{} - for _, server := range servers { - conn, err := kafka.DialLeader(context.Background(), "tcp", server, topic, 0) - if err != nil { - return k, err - } else { - conn.SetWriteDeadline(time.Now().Add(10 * time.Second)) - k.conns = append(k.conns, conn) - } - } - k.messageChan = make(chan kafka.Message) - k.stopChan = make(chan bool) - go k.sendMessage() + //k.protocol = &KafkaProtocol{} + //for _, server := range servers { + // conn, err := kafka.DialLeader(context.Background(), "tcp", server, topic, 0) + // if err != nil { + // return k, err + // } else { + // conn.SetWriteDeadline(time.Now().Add(10 * time.Second)) + // k.conns = append(k.conns, conn) + // } + //} + //k.messageChan = msgChanns + //k.stopChan = make(chan bool) + //k.retries = retries return k, nil } func (k *Kafka) close() error { - k.stopChan <- true - close(k.stopChan) - close(k.messageChan) - for _, conn := range k.conns { - err := conn.Close() - if err != nil { - log.Println(err) - return err - } - } + //k.stopChan <- true + //close(k.stopChan) + //close(*k.messageChan) + //for _, conn := range k.conns { + // err := conn.Close() + // if err != nil { + // logrus.Warn(err) + // return err + // } + //} return nil } func (k *Kafka) Close() error { - var err error - err = nil - k.once.Do(func() { - err = k.close() - }) - return err + //var err error + //err = nil + //k.once.Do(func() { + // err = k.close() + //}) + //return err + return nil } func (k *Kafka) Run() { - + //select { + //case msg := <-*k.messageChan: + // k.SendCmdMessage(msg) + //case <-k.stopChan: + // return + //} } func (k *Kafka) Stop() { - + k.stopChan <- true } diff --git a/tools/pika_cdc/consumer/protocol.go b/tools/pika_cdc/consumer/protocol.go index 7ce8da1aad..2c77b8d15e 100644 --- a/tools/pika_cdc/consumer/protocol.go +++ b/tools/pika_cdc/consumer/protocol.go @@ -1,5 +1,10 @@ package consumer +import ( + "fmt" + "strconv" +) + type Protocol interface { ToConsumer(msg []byte) []byte } @@ -8,9 +13,15 @@ type RedisProtocol struct{} func (rp RedisProtocol) ToConsumer(msg []byte) []byte { return msg } +func (rp RedisProtocol) Select(dbName string) []byte { + db, _ := strconv.Atoi(dbName[len(dbName)-1:]) + dbStr := strconv.Itoa(db) + msg := fmt.Sprintf("*2\r\n$6\r\nSELECT\r\n$%d\r\n%s\r\n", len(dbStr), dbStr) + return []byte(msg) +} type KafkaProtocol struct{} func (kp KafkaProtocol) ToConsumer(msg []byte) []byte { - return nil + return msg } diff --git a/tools/pika_cdc/consumer/redis.go b/tools/pika_cdc/consumer/redis.go index 7951c83028..ff50cdf17f 100644 --- a/tools/pika_cdc/consumer/redis.go +++ b/tools/pika_cdc/consumer/redis.go @@ -4,27 +4,33 @@ import ( "bufio" "fmt" "net" + "sync" "time" ) type Redis struct { - protocol Protocol - conn net.Conn - msgChan *chan []byte + redisProtocol RedisProtocol + conns map[string]net.Conn + msgChanns map[string]chan []byte + stopChan chan bool } -func NewRedis(addr string, msgChan *chan []byte) (*Redis, error) { - r := &Redis{protocol: RedisProtocol{}, msgChan: msgChan} +func NewRedis(addr string, msgChanns map[string]chan []byte) (*Redis, error) { + r := &Redis{redisProtocol: RedisProtocol{}, conns: make(map[string]net.Conn), msgChanns: msgChanns, stopChan: make(chan bool)} var err error - r.conn, err = net.Dial("tcp", addr) - if err != nil { - return nil, fmt.Errorf("failed to connect to Redis server: %v", err) + for dbName, _ := range msgChanns { + r.conns[dbName], err = net.Dial("tcp", addr) + if err != nil { + return nil, fmt.Errorf("failed to connect to Redis server: %v", err) + } + selectCmdBytes := r.redisProtocol.Select(dbName) + r.conns[dbName].Write(selectCmdBytes) } return r, nil } -func (r *Redis) SendCmdMessage(msg []byte) error { - _, err := r.sendRedisData(msg) +func (r *Redis) SendCmdMessage(dbName string, msg []byte) error { + _, err := r.sendRedisData(dbName, msg) return err } @@ -32,31 +38,43 @@ func (r *Redis) Name() string { return string("Redis") } func (r *Redis) Close() error { - return r.conn.Close() + for _, conn := range r.conns { + conn.Close() + } + return nil } -func (r *Redis) sendRedisData(data []byte) (string, error) { - - r.conn.SetDeadline(time.Now().Add(5 * time.Second)) - - _, err := r.conn.Write(data) +func (r *Redis) sendRedisData(dbName string, data []byte) (string, error) { + r.conns[dbName].SetDeadline(time.Now().Add(5 * time.Second)) + _, err := r.conns[dbName].Write(data) if err != nil { return "", fmt.Errorf("failed to send data to Redis server: %v", err) } - - reader := bufio.NewReader(r.conn) + reader := bufio.NewReader(r.conns[dbName]) response, err := reader.ReadString('\n') if err != nil { return "", fmt.Errorf("failed to read response from Redis server: %v", err) } - return response, nil } func (r *Redis) Run() { - for msg := range *r.msgChan { - r.sendRedisData(msg) + var wg sync.WaitGroup + for dbName, chann := range r.msgChanns { + wg.Add(1) + go func(dbName string, ch chan []byte) { + defer wg.Done() + for { + select { + case msg := <-ch: + r.sendRedisData(dbName, msg) + case <-r.stopChan: + return + } + } + }(dbName, chann) } + wg.Wait() } func (r *Redis) Stop() { - + r.stopChan <- true } diff --git a/tools/pika_cdc/main.go b/tools/pika_cdc/main.go index 2f8dac15fb..74705436a9 100644 --- a/tools/pika_cdc/main.go +++ b/tools/pika_cdc/main.go @@ -8,10 +8,10 @@ import ( ) func main() { - if pikaServer, err := pika.New(conf.ConfigInstance.PikaServer, nil); err != nil { + if pikaServer, err := pika.New(conf.ConfigInstance.PikaServer, conf.ConfigInstance.BufferMsgNumbers); err != nil { logrus.Fatal("failed to connect pika server, {}", err) } else { - if consumers, err := consumer.GenerateConsumers(conf.ConfigInstance, pikaServer.MsgChan); err != nil { + if consumers, err := consumer.GenerateConsumers(conf.ConfigInstance, pikaServer.MsgChanns); err != nil { logrus.Fatal("failed to generate consumers, {}", err) } else { for _, c := range consumers { diff --git a/tools/pika_cdc/pika/replprotocol.go b/tools/pika_cdc/pika/replprotocol.go index 6674b77228..f2cc2d9545 100644 --- a/tools/pika_cdc/pika/replprotocol.go +++ b/tools/pika_cdc/pika/replprotocol.go @@ -16,7 +16,7 @@ const HeaderLength = 4 type ReplProtocol struct { writer *bufio.Writer reader *bufio.Reader - binlogSyncInfos []binlogSyncInfo + binlogSyncInfos map[string]binlogSyncInfo dbMetaInfo *inner.InnerResponse_MetaSync ip string port int32 @@ -34,9 +34,9 @@ func (repl *ReplProtocol) GetSyncWithPika() error { if err := repl.sendMetaSyncRequest(); err != nil { return err } - metaResp := repl.getResponse() - if metaResp == nil { - logrus.Fatal("Failed to get metaResp") + metaResp, err := repl.getResponse() + if err != nil { + logrus.Fatal("Failed to get metaResp:", err) } repl.dbMetaInfo = metaResp.MetaSync @@ -46,6 +46,7 @@ func (repl *ReplProtocol) GetSyncWithPika() error { replDBs := metaResp.MetaSync.DbsInfo var a uint64 = 0 var b uint32 = 0 + repl.binlogSyncInfos = make(map[string]binlogSyncInfo) for _, dbInfo := range replDBs { newMetaInfo := binlogSyncInfo{ binlogOffset: &inner.BinlogOffset{ @@ -81,8 +82,8 @@ func (repl *ReplProtocol) GetSyncWithPika() error { return err } - trySyncResp := repl.getResponse() - if trySyncResp == nil || *trySyncResp.Code != inner.StatusCode_kOk { + trySyncResp, err := repl.getResponse() + if err != nil || trySyncResp == nil || *trySyncResp.Code != inner.StatusCode_kOk { logrus.Fatal("Failed to get TrySync Response Msg") } startOffset := trySyncResp.TrySync.GetBinlogOffset() @@ -91,17 +92,17 @@ func (repl *ReplProtocol) GetSyncWithPika() error { if err := repl.sendReplReq(trySync); err != nil { return err } - trySyncResp = repl.getResponse() + trySyncResp, err = repl.getResponse() newMetaInfo.binlogOffset = startOffset newMetaInfo.sessionId = *trySyncResp.TrySync.SessionId newMetaInfo.isFirst = true - repl.binlogSyncInfos = append(repl.binlogSyncInfos, newMetaInfo) + repl.binlogSyncInfos[dbInfo.GetDbName()] = newMetaInfo } // todo(leehao): Can find ways to optimize using coroutines here. May be use goroutine - for index, dbInfo := range repl.binlogSyncInfos { - slotId := uint32(*repl.dbMetaInfo.DbsInfo[index].SlotNum) + for dbName, dbInfo := range repl.binlogSyncInfos { + var slotId uint32 = 0 binlogSyncReq := &inner.InnerRequest{ Type: &binlogSyncType, MetaSync: nil, @@ -112,7 +113,7 @@ func (repl *ReplProtocol) GetSyncWithPika() error { Ip: &repl.ip, Port: &repl.port, }, - DbName: repl.dbMetaInfo.DbsInfo[index].DbName, + DbName: &dbName, SlotId: &slotId, AckRangeStart: dbInfo.binlogOffset, AckRangeEnd: dbInfo.binlogOffset, @@ -125,35 +126,40 @@ func (repl *ReplProtocol) GetSyncWithPika() error { if err := repl.sendReplReq(binlogSyncReq); err != nil { return err } - repl.binlogSyncInfos[index].isFirst = false } return nil } -func (repl *ReplProtocol) GetBinlogSync() ([]byte, error) { +func (repl *ReplProtocol) GetBinlogSync() (map[string][]byte, error) { binlogSyncType := inner.Type_kBinlogSync - var binlogByte []byte + // This is a collection of binlogs for all DB's + binlogBytes := make(map[string][]byte) // todo(leehao): Receive multiple binlog sync responses simultaneously - binlogSyncResp := repl.getResponse() + binlogSyncResp, err := repl.getResponse() + if err != nil { + return nil, err + } if binlogSyncResp == nil || *binlogSyncResp.Code != inner.StatusCode_kOk || *binlogSyncResp.Type != inner.Type_kBinlogSync || binlogSyncResp.BinlogSync == nil { logrus.Fatal("get binlog sync response failed") } else { - for index, item := range binlogSyncResp.BinlogSync { - slotId := uint32(*repl.dbMetaInfo.DbsInfo[index].SlotNum) - binlogOffset := repl.binlogSyncInfos[index].binlogOffset - if len(item.Binlog) == 0 { + for _, item := range binlogSyncResp.BinlogSync { + slotId := *item.Slot.SlotId + dbName := *item.Slot.DbName + binlogInfo := repl.binlogSyncInfos[dbName] + binlogInfo.isFirst = false + binlogOffset := item.BinlogOffset + if len(item.Binlog) == 0 || (*binlogOffset.Offset == binlogInfo.offset && *binlogOffset.Filenum == binlogInfo.fileNum) { *binlogOffset.Filenum = 0 *binlogOffset.Offset = 0 - logrus.Println("receive binlog response keep alive") } else { - binlogOffset = item.BinlogOffset - repl.binlogSyncInfos[index].binlogOffset = binlogOffset + binlogInfo.binlogOffset = binlogOffset if binlogItem, err := repl.decodeBinlogItem(item.Binlog); err != nil { logrus.Fatal(err) } else { - binlogByte = binlogItem.Content + logrus.Info("recv binlog db:", dbName, " ,size:", len(item.Binlog)) + binlogBytes[dbName] = binlogItem.Content } } err := repl.sendReplReq(&inner.InnerRequest{ @@ -166,23 +172,24 @@ func (repl *ReplProtocol) GetBinlogSync() ([]byte, error) { Ip: &repl.ip, Port: &repl.port, }, - DbName: repl.dbMetaInfo.DbsInfo[index].DbName, + DbName: &dbName, SlotId: &slotId, AckRangeStart: binlogOffset, AckRangeEnd: binlogOffset, - SessionId: &repl.binlogSyncInfos[index].sessionId, - FirstSend: &repl.binlogSyncInfos[index].isFirst, + SessionId: &binlogInfo.sessionId, + FirstSend: &binlogInfo.isFirst, }, RemoveSlaveNode: nil, ConsensusMeta: nil, }) + repl.binlogSyncInfos[dbName] = binlogInfo if err != nil { - logrus.Warn("Failed to send binlog sync, {}", err) + logrus.Warn("Failed to send binlog sync, ", err) return nil, err } } } - return binlogByte, nil + return binlogBytes, nil } func (repl *ReplProtocol) Ping() string { @@ -202,7 +209,6 @@ func (repl *ReplProtocol) Ping() string { } func (repl *ReplProtocol) sendMetaSyncRequest() error { - logrus.Info("sendMetaSyncRequest") metaSyncType := inner.Type_kMetaSync request := &inner.InnerRequest{ Type: &metaSyncType, @@ -232,14 +238,14 @@ func (repl *ReplProtocol) sendReplReq(request *inner.InnerRequest) error { return nil } -func (repl *ReplProtocol) getResponse() *inner.InnerResponse { +func (repl *ReplProtocol) getResponse() (*inner.InnerResponse, error) { header := make([]byte, HeaderLength) _, err := repl.reader.Read(header) if err != nil { if err != io.EOF { logrus.Fatal("Error reading header:", err) } - return nil + return nil, err } // Convert the header to an integer @@ -248,22 +254,23 @@ func (repl *ReplProtocol) getResponse() *inner.InnerResponse { err = binary.Read(buffer, binary.BigEndian, &bodyLength) if err != nil { logrus.Fatal("Error converting header to integer:", err) - return nil + return nil, err } // Read the body body := make([]byte, bodyLength) _, err = repl.reader.Read(body) if err != nil { logrus.Fatal("Error reading body:", err) - return nil + return nil, err } res := &inner.InnerResponse{} err = proto.Unmarshal(body, res) if err != nil { - logrus.Fatal("Error Deserialization:", err) + logrus.Warn("Error Deserialization:", err) + return nil, err } - return res + return res, nil } func (repl *ReplProtocol) buildInternalTag(resp []byte) (tag string) { diff --git a/tools/pika_cdc/pika/replprotocol_test.go b/tools/pika_cdc/pika/replprotocol_test.go index 13b7e01787..a163ecca82 100644 --- a/tools/pika_cdc/pika/replprotocol_test.go +++ b/tools/pika_cdc/pika/replprotocol_test.go @@ -30,19 +30,6 @@ func TestConnect(t *testing.T) { fmt.Println(client.Get(cxt, "key")) } -//func getPort(addr string) int32 { -// portStr := addr[strings.LastIndex(addr, ":")+1:] -// port, _ := strconv.Atoi(portStr) -// return int32(port) -//} -//func getIP(addr string) string { -// index := strings.LastIndex(addr, ":") -// if index == -1 { -// return addr -// } -// return addr[:index] -//} - func TestSendMetaSync(t *testing.T) { ip := string("127.0.0.1") listener, e := net.Listen("tcp", ":0") diff --git a/tools/pika_cdc/pika/server.go b/tools/pika_cdc/pika/server.go index dc1bcde4ae..280f356392 100644 --- a/tools/pika_cdc/pika/server.go +++ b/tools/pika_cdc/pika/server.go @@ -3,7 +3,6 @@ package pika import ( "bufio" "github.com/sirupsen/logrus" - "log" "net" "strconv" "strings" @@ -14,13 +13,14 @@ type Server struct { stop chan bool pikaConn net.Conn pikaAddr string - MsgChan *chan []byte + bufferMsgNumber int + MsgChanns map[string]chan []byte pikaReplProtocol ReplProtocol writer *bufio.Writer reader *bufio.Reader } -// Use todo(leehao): add middleware here +// Use todo(leehao): middleware can be added here in the future func Use() { } @@ -37,16 +37,14 @@ func getIP(addr string) string { return addr[:index] } -func New(s string, msgChan *chan []byte) (Server, error) { +func New(s string, bufferMsgNumber int) (Server, error) { server := Server{} - if msgChan == nil { - ch := make(chan []byte, 10) - server.MsgChan = &ch - } + server.MsgChanns = make(map[string]chan []byte) conn, err := net.Dial("tcp", s) if err != nil { - log.Fatal("Error connecting to Pika server:", err) + logrus.Fatal("Error connecting to Pika server:", err) } + server.bufferMsgNumber = bufferMsgNumber server.pikaConn = conn server.writer = bufio.NewWriter(server.pikaConn) server.reader = bufio.NewReader(server.pikaConn) @@ -57,8 +55,15 @@ func New(s string, msgChan *chan []byte) (Server, error) { port: getPort(conn.LocalAddr().String()), } err = server.CreateSyncWithPika() + server.buildMsgChann() return server, err } +func (s *Server) buildMsgChann() { + dbMetaInfo := s.pikaReplProtocol.dbMetaInfo + for _, dbInfo := range dbMetaInfo.DbsInfo { + s.MsgChanns[*dbInfo.DbName] = make(chan []byte, s.bufferMsgNumber) + } +} // Run This method will block execution until an error occurs func (s *Server) Run() { @@ -67,10 +72,16 @@ func (s *Server) Run() { case <-s.stop: return case <-time.After(100 * time.Millisecond): - bytes, _ := s.pikaReplProtocol.GetBinlogSync() - if len(bytes) != 0 { - logrus.Info("get a pika binlog send to msg chan") - *s.MsgChan <- bytes + binlogBytes, _ := s.pikaReplProtocol.GetBinlogSync() + if len(binlogBytes) != 0 { + for dbName, binlog := range binlogBytes { + chann, exists := s.MsgChanns[dbName] + if !exists { + chann = make(chan []byte, s.bufferMsgNumber) + s.MsgChanns[dbName] = chann + } + chann <- binlog + } } } } @@ -79,11 +90,11 @@ func (s *Server) Run() { func (s *Server) Exit() { s.stop <- true close(s.stop) - close(*s.MsgChan) + for _, chann := range s.MsgChanns { + close(chann) + } } func (s *Server) CreateSyncWithPika() error { - //ping := s.pikaReplProtocol.Ping() - //logrus.Info(ping) return s.pikaReplProtocol.GetSyncWithPika() } From f4f52bcc8a6ae7b3ade19c982ea412120508e375 Mon Sep 17 00:00:00 2001 From: LeeHao <1838249551@qq.com> Date: Tue, 20 Aug 2024 23:39:24 +0800 Subject: [PATCH 9/9] feat-cdc:add consumer kafka Signed-off-by: LeeHao <1838249551@qq.com> --- tools/pika_cdc/README.md | 5 +- tools/pika_cdc/conf/cdc.yml | 5 +- tools/pika_cdc/conf/conf.go | 1 - tools/pika_cdc/consumer/consumer.go | 6 +- tools/pika_cdc/consumer/kafka.go | 85 +++++++++++++++-------------- 5 files changed, 52 insertions(+), 50 deletions(-) diff --git a/tools/pika_cdc/README.md b/tools/pika_cdc/README.md index 5dbdab746f..d2923924f0 100644 --- a/tools/pika_cdc/README.md +++ b/tools/pika_cdc/README.md @@ -19,5 +19,6 @@ make ## Todo: Consumer side: -- [x] redis -- [ ] kafka \ No newline at end of file +- [x] **redis** +- [x] **kafka** Create a topic of the same name for each pika's DB +- [ ] **bifrost** \ No newline at end of file diff --git a/tools/pika_cdc/conf/cdc.yml b/tools/pika_cdc/conf/cdc.yml index 9d2c4f8d70..e09d827b06 100644 --- a/tools/pika_cdc/conf/cdc.yml +++ b/tools/pika_cdc/conf/cdc.yml @@ -1,14 +1,13 @@ # pika_server pika_server : 127.0.0.1:11221 +# For data from one DB of one pika, a separate MQ topic is created, +# and the name of the topic is the dbname of the pika kafka_servers: - 127.0.0.1:9092 redis_servers: - 127.0.0.1:6379 pulsar_servers: - 127.0.0.1:6650 -# will create this topic, if this topic not exist -# and all servers will use same name topic -topic : test # retry times while send message failed retries : 0 # retry interval while send message failed(ms) diff --git a/tools/pika_cdc/conf/conf.go b/tools/pika_cdc/conf/conf.go index 70b48f9b5c..6cee119d0d 100644 --- a/tools/pika_cdc/conf/conf.go +++ b/tools/pika_cdc/conf/conf.go @@ -17,7 +17,6 @@ type PikaCdcConfig struct { KafkaServers []string `yaml:"kafka_servers"` RedisServers []string `yaml:"redis_servers"` PulsarServers []string `yaml:"pulsar_servers"` - Topic string `yaml:"topic"` Retries int `yaml:"retries"` RetryInterval int `yaml:"retry_interval"` ParallelThreadSize int `yaml:"parallel_thread_size"` diff --git a/tools/pika_cdc/consumer/consumer.go b/tools/pika_cdc/consumer/consumer.go index f944a51370..fc102d637d 100644 --- a/tools/pika_cdc/consumer/consumer.go +++ b/tools/pika_cdc/consumer/consumer.go @@ -18,8 +18,10 @@ func GenerateConsumers(config conf.PikaCdcConfig, msgChanns map[string]chan []by var consumers []Consumer // kafka - kafka, _ := NewKafka(config.KafkaServers, config.Topic, config.Retries, msgChanns) - consumers = append(consumers, kafka) + for _, k := range config.KafkaServers { + kafka, _ := NewKafka(k, config.Retries, msgChanns) + consumers = append(consumers, kafka) + } // redis for _, r := range config.RedisServers { diff --git a/tools/pika_cdc/consumer/kafka.go b/tools/pika_cdc/consumer/kafka.go index 24fa4741cf..3fdcd243a8 100644 --- a/tools/pika_cdc/consumer/kafka.go +++ b/tools/pika_cdc/consumer/kafka.go @@ -1,35 +1,25 @@ package consumer import ( + "context" "github.com/segmentio/kafka-go" "sync" ) type Kafka struct { - servers []string - topic string - retries int - conns []*kafka.Conn - wg sync.WaitGroup - msgChanns map[string]chan []byte - stopChan chan bool - once sync.Once - protocol Protocol + servers string + topics []string + retries int + kafkaConns map[string]*kafka.Conn + wg sync.WaitGroup + msgChanns map[string]chan []byte + stopChan chan bool + once sync.Once + protocol KafkaProtocol } func (k *Kafka) SendCmdMessage(dbName string, msg []byte) error { - //retries := k.retries - //select { - //case *k.messageChan <- k.protocol.ToConsumer(msg): - // return nil - //case <-time.After(2 * time.Second): - // e := errors.New("send pika cmd timeout and retry send pika cmd") - // logrus.Warn("{}", e) - // retries-- - // if retries <= 0 { - // break - // } - //} + k.kafkaConns[dbName].Write(k.protocol.ToConsumer(msg)) return nil } @@ -37,21 +27,22 @@ func (k *Kafka) Name() string { return "Kafka" } -func NewKafka(servers []string, topic string, retries int, msgChanns map[string]chan []byte) (*Kafka, error) { +func NewKafka(server string, retries int, msgChanns map[string]chan []byte) (*Kafka, error) { k := &Kafka{} - //k.protocol = &KafkaProtocol{} - //for _, server := range servers { - // conn, err := kafka.DialLeader(context.Background(), "tcp", server, topic, 0) - // if err != nil { - // return k, err - // } else { - // conn.SetWriteDeadline(time.Now().Add(10 * time.Second)) - // k.conns = append(k.conns, conn) - // } - //} - //k.messageChan = msgChanns - //k.stopChan = make(chan bool) - //k.retries = retries + k.protocol = KafkaProtocol{} + k.kafkaConns = make(map[string]*kafka.Conn) + k.msgChanns = make(map[string]chan []byte) + for dbname, chann := range msgChanns { + conn, err := kafka.DialLeader(context.Background(), "tcp", server, dbname, 0) + if err != nil { + return k, err + } else { + k.kafkaConns[dbname] = conn + } + k.msgChanns[dbname] = chann + } + k.stopChan = make(chan bool) + k.retries = retries return k, nil } @@ -59,7 +50,7 @@ func (k *Kafka) close() error { //k.stopChan <- true //close(k.stopChan) //close(*k.messageChan) - //for _, conn := range k.conns { + //for _, conn := range k.kafkaConns { // err := conn.Close() // if err != nil { // logrus.Warn(err) @@ -78,12 +69,22 @@ func (k *Kafka) Close() error { return nil } func (k *Kafka) Run() { - //select { - //case msg := <-*k.messageChan: - // k.SendCmdMessage(msg) - //case <-k.stopChan: - // return - //} + var wg sync.WaitGroup + for dbName, chann := range k.msgChanns { + wg.Add(1) + go func(dbName string, ch chan []byte) { + defer wg.Done() + for { + select { + case msg := <-ch: + k.SendCmdMessage(dbName, msg) + case <-k.stopChan: + return + } + } + }(dbName, chann) + } + wg.Wait() } func (k *Kafka) Stop() { k.stopChan <- true