Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit a5bdcc8

Browse files
authored
Merge pull request #512 from kuba--/upgrade-vitess
Upgrade vitess to v1.2.1
2 parents c12111a + e358c62 commit a5bdcc8

File tree

4 files changed

+30
-50
lines changed

4 files changed

+30
-50
lines changed

go.mod

Lines changed: 5 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,14 @@
11
module gopkg.in/src-d/go-mysql-server.v0
22

33
require (
4-
github.com/BurntSushi/toml v0.3.1 // indirect
5-
github.com/CAFxX/gcnotifier v0.0.0-20170518020117-39b0596a2da3 // indirect
6-
github.com/DataDog/datadog-go v0.0.0-20180822151419-281ae9f2d895 // indirect
7-
github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f // indirect
8-
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da // indirect
9-
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect
10-
github.com/boltdb/bolt v1.3.1
11-
github.com/cespare/xxhash v1.1.0 // indirect
12-
github.com/circonus-labs/circonus-gometrics v2.2.4+incompatible // indirect
13-
github.com/circonus-labs/circonusllhist v0.0.0-20180430145027-5eb751da55c6 // indirect
14-
github.com/go-ole/go-ole v1.2.1 // indirect
15-
github.com/gogo/protobuf v1.1.1 // indirect
16-
github.com/google/go-cmp v0.2.0 // indirect
17-
github.com/gorilla/context v1.1.1 // indirect
18-
github.com/gorilla/handlers v1.4.0 // indirect
19-
github.com/gorilla/mux v1.6.2 // indirect
20-
github.com/hashicorp/consul v1.2.3 // indirect
21-
github.com/hashicorp/go-cleanhttp v0.5.0 // indirect
22-
github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
23-
github.com/hashicorp/go-msgpack v0.0.0-20150518234257-fa3f63826f7c // indirect
24-
github.com/hashicorp/go-multierror v1.0.0 // indirect
25-
github.com/hashicorp/go-retryablehttp v0.0.0-20180718195005-e651d75abec6 // indirect
26-
github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86 // indirect
27-
github.com/hashicorp/memberlist v0.1.0 // indirect
28-
github.com/hashicorp/serf v0.8.1 // indirect
29-
github.com/hashicorp/yamux v0.0.0-20180917205041-7221087c3d28 // indirect
30-
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
31-
github.com/miekg/dns v1.0.12 // indirect
324
github.com/mitchellh/hashstructure v1.0.0
335
github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852
346
github.com/opentracing/opentracing-go v1.0.2
35-
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c // indirect
36-
github.com/pelletier/go-toml v1.2.0 // indirect
37-
github.com/pilosa/pilosa v1.1.0
387
github.com/pkg/errors v0.8.0 // indirect
39-
github.com/prometheus/client_golang v0.8.0 // indirect
40-
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 // indirect
41-
github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e // indirect
42-
github.com/prometheus/procfs v0.0.0-20180920065004-418d78d0b9a7 // indirect
43-
github.com/satori/go.uuid v1.2.0 // indirect
44-
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect
45-
github.com/shirou/gopsutil v2.17.12+incompatible // indirect
46-
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect
47-
github.com/sirupsen/logrus v1.1.0
48-
github.com/spf13/cast v1.2.0
49-
github.com/stretchr/testify v1.2.2
50-
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 // indirect
51-
golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3 // indirect
52-
google.golang.org/grpc v1.15.0 // indirect
8+
github.com/sirupsen/logrus v1.1.1
9+
github.com/spf13/cast v1.3.0
10+
golang.org/x/net v0.0.0-20181029044818-c44066c5c816 // indirect
11+
google.golang.org/grpc v1.16.0 // indirect
5312
gopkg.in/src-d/go-errors.v1 v1.0.0
54-
gopkg.in/src-d/go-vitess.v1 v1.1.0
55-
gopkg.in/vmihailenco/msgpack.v2 v2.9.1 // indirect
56-
gopkg.in/yaml.v2 v2.2.1
13+
gopkg.in/src-d/go-vitess.v1 v1.2.1
5714
)

server/handler.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,20 @@ func (h *Handler) ComQuery(
135135
return callback(r)
136136
}
137137

138+
// WarningCount is called at the end of each query to obtain
139+
// the value to be returned to the client in the EOF packet.
140+
// Note that this will be called either in the context of the
141+
// ComQuery callback if the result does not contain any fields,
142+
// or after the last ComQuery call completes.
143+
func (h *Handler) WarningCount(c *mysql.Conn) uint16 {
144+
sess, ok := h.sm.sessions[c.ConnectionID]
145+
if !ok {
146+
return 0
147+
}
148+
149+
return sess.WarningCount()
150+
}
151+
138152
func (h *Handler) handleKill(conn *mysql.Conn, query string) (bool, error) {
139153
q := strings.ToLower(query)
140154
s := regKillCmd.FindStringSubmatch(q)

sql/session.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ type Session interface {
3939
Warnings() []*Warning
4040
// ClearWarnings cleans up session warnings
4141
ClearWarnings()
42+
// WarningCount returns a number of session warnings
43+
WarningCount() uint16
4244
}
4345

4446
// BaseSession is the basic session type.
@@ -122,6 +124,13 @@ func (s *BaseSession) ClearWarnings() {
122124
}
123125
}
124126

127+
// WarningCount returns a number of session warnings
128+
func (s *BaseSession) WarningCount() uint16 {
129+
s.mu.RLock()
130+
defer s.mu.RUnlock()
131+
return uint16(len(s.warnings))
132+
}
133+
125134
type (
126135
// TypedValue is a value along with its type.
127136
TypedValue struct {

sql/session_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ func TestSessionConfig(t *testing.T) {
2222
require.Equal(Int64, typ)
2323
require.Equal(1, v)
2424

25-
require.Equal(0, len(sess.Warnings()))
25+
require.Equal(uint16(0), sess.WarningCount())
2626

2727
sess.Warn(&Warning{Code: 1})
2828
sess.Warn(&Warning{Code: 2})
2929
sess.Warn(&Warning{Code: 3})
3030

31-
require.Equal(3, len(sess.Warnings()))
31+
require.Equal(uint16(3), sess.WarningCount())
3232

3333
require.Equal(3, sess.Warnings()[0].Code)
3434
require.Equal(2, sess.Warnings()[1].Code)

0 commit comments

Comments
 (0)