Skip to content

Commit

Permalink
proxy: refine sqlserver.SQLServer (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhebox authored Aug 8, 2022
1 parent 94aadce commit 1c4b17f
Show file tree
Hide file tree
Showing 13 changed files with 400 additions and 396 deletions.
19 changes: 2 additions & 17 deletions cmd/weirproxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"github.com/pingcap/TiProxy/pkg/config"
"github.com/pingcap/TiProxy/pkg/server"
"github.com/pingcap/TiProxy/pkg/util/cmd"
"github.com/pingcap/TiProxy/pkg/util/waitgroup"
"github.com/spf13/cobra"
"go.uber.org/zap"
)
Expand Down Expand Up @@ -74,22 +73,8 @@ func main() {

<-cmd.Context().Done()

var wg waitgroup.WaitGroup
var errs []zap.Field
wg.Run(func() {
for {
err, ok := <-srv.ErrChan()
if !ok {
break
}
errs = append(errs, zap.Error(err))
}
})
srv.Close()
wg.Wait()

if len(errs) > 0 {
logger.Error("shutdown with errors", errs...)
if err = srv.Close(); err != nil {
logger.Error("shutdown with errors", zap.Error(err))
} else {
logger.Info("gracefully shutdown")
}
Expand Down
61 changes: 30 additions & 31 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ module github.com/pingcap/TiProxy
go 1.18

require (
github.com/gin-contrib/pprof v1.3.0
github.com/gin-contrib/pprof v1.4.0
github.com/gin-contrib/zap v0.0.2
github.com/gin-gonic/gin v1.7.7
github.com/goccy/go-yaml v1.8.2
github.com/gin-gonic/gin v1.8.1
github.com/go-mysql-org/go-mysql v1.6.0
github.com/goccy/go-yaml v1.9.5
github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c
github.com/pingcap/tidb v1.1.0-beta.0.20220721063709-a1b38f8fb476
github.com/pingcap/tidb/parser v0.0.0-20220721063709-a1b38f8fb476
github.com/pingcap/tidb v1.1.0-beta.0.20220804075006-e071841317c5
github.com/pingcap/tidb/parser v0.0.0-20220804082206-fff748348776
github.com/prometheus/client_golang v1.12.2
github.com/siddontang/go-mysql v1.1.0
github.com/spf13/cobra v1.4.0
github.com/stretchr/testify v1.7.2-0.20220504104629-106ec21d14df
go.etcd.io/etcd/api/v3 v3.5.4
go.etcd.io/etcd/client/v3 v3.5.4
go.etcd.io/etcd/server/v3 v3.5.4
github.com/spf13/cobra v1.5.0
github.com/stretchr/testify v1.8.0
go.etcd.io/etcd/api/v3 v3.5.2
go.etcd.io/etcd/client/v3 v3.5.2
go.etcd.io/etcd/server/v3 v3.5.2
go.uber.org/atomic v1.9.0
go.uber.org/zap v1.21.0
google.golang.org/grpc v1.45.0
Expand All @@ -39,9 +39,10 @@ require (
github.com/form3tech-oss/jwt-go v3.2.5+incompatible // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-playground/locales v0.13.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-playground/validator/v10 v10.8.0 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.10.0 // indirect
github.com/goccy/go-json v0.9.7 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
Expand All @@ -64,6 +65,7 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/opentracing/basictracer-go v1.0.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.1 // indirect
github.com/pingcap/failpoint v0.0.0-20220423142525-ae43b7f4e5c3 // indirect
github.com/pingcap/kvproto v0.0.0-20220711062932-08b02befd813 // indirect
github.com/pingcap/log v1.1.0 // indirect
Expand All @@ -75,28 +77,27 @@ require (
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
github.com/satori/go.uuid v1.2.0 // indirect
github.com/shirou/gopsutil/v3 v3.22.4 // indirect
github.com/shirou/gopsutil/v3 v3.22.6 // indirect
github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726 // indirect
github.com/siddontang/go-log v0.0.0-20180807004314-8d05993dda07 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/soheilhy/cmux v0.1.5 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stathat/consistent v1.0.0 // indirect
github.com/tikv/client-go/v2 v2.0.1-0.20220721031657-e38d2b07de3f // indirect
github.com/tikv/pd/client v0.0.0-20220307081149-841fa61e9710 // indirect
github.com/tikv/client-go/v2 v2.0.1-0.20220729034404-e10841f2d158 // indirect
github.com/tikv/pd/client v0.0.0-20220725055910-7187a7ab72db // indirect
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect
github.com/twmb/murmur3 v1.1.3 // indirect
github.com/uber/jaeger-client-go v2.22.1+incompatible // indirect
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
github.com/ugorji/go/codec v1.2.6 // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/v2 v2.305.4 // indirect
go.etcd.io/etcd/pkg/v3 v3.5.4 // indirect
go.etcd.io/etcd/raft/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.2 // indirect
go.etcd.io/etcd/client/v2 v2.305.2 // indirect
go.etcd.io/etcd/pkg/v3 v3.5.2 // indirect
go.etcd.io/etcd/raft/v3 v3.5.2 // indirect
go.opentelemetry.io/contrib v0.20.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0 // indirect
go.opentelemetry.io/otel v0.20.0 // indirect
Expand All @@ -108,20 +109,18 @@ require (
go.opentelemetry.io/otel/trace v0.20.0 // indirect
go.opentelemetry.io/proto/otlp v0.7.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
golang.org/x/exp v0.0.0-20220428152302-39d4317da171 // indirect
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect
golang.org/x/sync v0.0.0-20220513210516-0976fa681c29 // indirect
golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664 // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect
google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)

replace github.com/siddontang/go-mysql => github.com/ibanyu/go-mysql v1.1.0
Loading

0 comments on commit 1c4b17f

Please sign in to comment.