Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump github.com/valyala/fasthttp from 1.31.0 to 1.34.0 #10

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ scripts/codecov-token
profile.out
coverage.txt
codecov.yml
pkg/raft/testdata
5 changes: 3 additions & 2 deletions app/pipeline/message/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ func (msg *Message) reset() {
// Pool reuse message object
var Pool = sync.Pool{
New: func() interface{} {
return &Message{
}
return new(Message)
//return &Message{
//}
},
}

Expand Down
4 changes: 2 additions & 2 deletions app/pipeline/message/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ func TestMessage(t *testing.T) {
t.Error(err)
}

msg.Content = &Content{
Head: &Head{
msg.Content = Content{
Head: Head{
Type: "",
Time: 0,
Database: "",
Expand Down
14 changes: 14 additions & 0 deletions app/server/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"github.com/jin06/binlogo/pkg/raft"
"sync"
"time"

Expand Down Expand Up @@ -37,6 +38,7 @@ type Node struct {
leaderRunMutex sync.Mutex
pipeManager *manager_pipe.Manager
eventManager *manager_event.Manager
raftNode *raft.RaftNode
}

type NodeMode byte
Expand Down Expand Up @@ -102,12 +104,18 @@ func (n *Node) Run(ctx context.Context) (err error) {
}
cancel()
}()
logrus.Errorln(123)
err = n.startRaftNode(myCtx)
if err != nil {
return
}
err = n.refreshNode()
if err != nil {
return
}
nodeCtx := n._mustRun(myCtx)
n._leaderRun(myCtx)

select {
case <-ctx.Done():
{
Expand Down Expand Up @@ -245,3 +253,9 @@ func (n *Node) _mustRun(ctx context.Context) (resCtx context.Context) {
}()
return
}

func (n *Node) startRaftNode(ctx context.Context) error {
var err error
n.raftNode, err = raft.NewRaftNode(ctx, n.Name, "0.0.0.0", 13001, "~/tmp/test/data")
return err
}
1 change: 1 addition & 0 deletions cmd/server/app/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func RunNode(c context.Context) (resCtx context.Context, err error) {
Version: configs.VERSITON,
CreateTime: time.Now(),
Role: node.Role{Master: true, Admin: true, Worker: true},
Port: configs.NodePort,
}
nModel.IP = configs.NodeIP
n, err := dao_node.GetNode(nModel.Name)
Expand Down
5 changes: 5 additions & 0 deletions configs/binlogo.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
env: production
cluster:
name: cluster1
nodes:
- 127.0.0.1:50001
- 127.0.0.1:50002

# node configs. Different node should have different name.
node:
name: node1
port: 50001
# console configs
console:
port: 9999
Expand Down
3 changes: 3 additions & 0 deletions configs/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ var NodeName string

// NodeIP current node's ip
var NodeIP net.IP

// NodePort current node's port
var NodePort int
1 change: 1 addition & 0 deletions configs/viper.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func initViperFromEnv() {
func initConst() {
ENV = Env(viper.GetString("env"))
NodeName = viper.GetString("node.name")
NodePort = viper.GetInt("node.port")
NodeIP, _ = ip.LocalIp()
}

Expand Down
6 changes: 6 additions & 0 deletions docs/1.0.*/zh/mysql-replication.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,9 @@ MySql Replication (MySql的主从复制)
>
#### 4.2 一个伪装成slave的中间件对于原有的Mysql主从复制的影响

> 同步复制:MySQL需要等待所有的从库同步完成后才会返回给客户端 <br>
> 显而易见的问题是此时增加一个从库中间件势必会影响MySQL的响应时间 <br>
> 半同步复制:MySQL需要等待至少一个从库同步完成 <br>
> 此时的影响在于中间件如果对同步的binlog进行确认,如果Mysql还有其他的从库,此时 <br>
> 其他从库并没有完成数据同步并且主库崩溃,那么就会影响到其他的从服务器的一致性

45 changes: 28 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ go 1.18
// replace google.golang.org/grpc => google.golang.org/grpc v1.25.1

require (
github.com/Jille/raft-grpc-example v0.0.0-20221116163510-ca5c7e145c0f
github.com/Jille/raft-grpc-leader-rpc v1.1.0
github.com/Jille/raft-grpc-transport v1.3.0
github.com/Jille/raftadmin v1.2.0
github.com/Shopify/sarama v1.30.0
github.com/aliyunmq/mq-http-go-sdk v1.0.3
github.com/gin-gonic/gin v1.7.4
Expand All @@ -15,6 +19,8 @@ require (
github.com/go-sql-driver/mysql v1.6.0
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
github.com/hashicorp/consul/api v1.11.0
github.com/hashicorp/raft v1.3.11
github.com/hashicorp/raft-boltdb v0.0.0-20220329195025-15018e9b97e0
github.com/prometheus/client_golang v1.11.0
github.com/shirou/gopsutil/v3 v3.21.10
github.com/sirupsen/logrus v1.8.1
Expand All @@ -23,14 +29,17 @@ require (
github.com/streadway/amqp v1.0.0
go.etcd.io/etcd/api/v3 v3.5.1
go.etcd.io/etcd/client/v3 v3.5.1
google.golang.org/grpc v1.50.1
google.golang.org/protobuf v1.28.1
)

require (
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/andybalholm/brotli v1.0.2 // indirect
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/boltdb/bolt v1.3.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
Expand All @@ -40,7 +49,7 @@ require (
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect
github.com/fatih/color v1.9.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
Expand All @@ -52,12 +61,15 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
github.com/hashicorp/go-hclog v0.12.0 // indirect
github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
github.com/hashicorp/go-hclog v1.3.1 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-msgpack v1.1.5 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/serf v0.9.5 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
Expand All @@ -67,12 +79,12 @@ require (
github.com/jcmturner/gokrb5/v8 v8.4.2 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/klauspost/compress v1.15.0 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mattn/go-colorable v0.1.6 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.4.2 // indirect
Expand All @@ -83,6 +95,7 @@ require (
github.com/pingcap/errors v0.11.5-0.20201126102027-b0a155152ca3 // indirect
github.com/pingcap/log v0.0.0-20210317133921-96f4fcab92a4 // indirect
github.com/pingcap/parser v0.0.0-20210415081931-48e7f467fd74 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
Expand All @@ -100,18 +113,16 @@ require (
github.com/tklauser/numcpus v0.3.0 // indirect
github.com/ugorji/go/codec v1.1.7 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.31.0 // indirect
github.com/valyala/fasthttp v1.34.0 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.1 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.17.0 // indirect
golang.org/x/crypto v0.0.0-20210920023735-84f357641f63 // indirect
golang.org/x/net v0.0.0-20211029224645-99673261e6eb // indirect
golang.org/x/sys v0.0.0-20211013075003-97ac67df715c // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71 // indirect
google.golang.org/grpc v1.42.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
golang.org/x/net v0.2.0 // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/text v0.4.0 // indirect
google.golang.org/genproto v0.0.0-20221114212237-e4508ebdbee1 // indirect
gopkg.in/ini.v1 v1.63.2 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading