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

Upgrade vitess to v1.2.1 #512

Merged
merged 2 commits into from
Oct 31, 2018
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 5 additions & 48 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,57 +1,14 @@
module gopkg.in/src-d/go-mysql-server.v0

require (
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/CAFxX/gcnotifier v0.0.0-20170518020117-39b0596a2da3 // indirect
github.com/DataDog/datadog-go v0.0.0-20180822151419-281ae9f2d895 // indirect
github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f // indirect
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da // indirect
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect
github.com/boltdb/bolt v1.3.1
github.com/cespare/xxhash v1.1.0 // indirect
github.com/circonus-labs/circonus-gometrics v2.2.4+incompatible // indirect
github.com/circonus-labs/circonusllhist v0.0.0-20180430145027-5eb751da55c6 // indirect
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/gogo/protobuf v1.1.1 // indirect
github.com/google/go-cmp v0.2.0 // indirect
github.com/gorilla/context v1.1.1 // indirect
github.com/gorilla/handlers v1.4.0 // indirect
github.com/gorilla/mux v1.6.2 // indirect
github.com/hashicorp/consul v1.2.3 // indirect
github.com/hashicorp/go-cleanhttp v0.5.0 // indirect
github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
github.com/hashicorp/go-msgpack v0.0.0-20150518234257-fa3f63826f7c // indirect
github.com/hashicorp/go-multierror v1.0.0 // indirect
github.com/hashicorp/go-retryablehttp v0.0.0-20180718195005-e651d75abec6 // indirect
github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86 // indirect
github.com/hashicorp/memberlist v0.1.0 // indirect
github.com/hashicorp/serf v0.8.1 // indirect
github.com/hashicorp/yamux v0.0.0-20180917205041-7221087c3d28 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/miekg/dns v1.0.12 // indirect
github.com/mitchellh/hashstructure v1.0.0
github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852
github.com/opentracing/opentracing-go v1.0.2
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c // indirect
github.com/pelletier/go-toml v1.2.0 // indirect
github.com/pilosa/pilosa v1.1.0
github.com/pkg/errors v0.8.0 // indirect
github.com/prometheus/client_golang v0.8.0 // indirect
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 // indirect
github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e // indirect
github.com/prometheus/procfs v0.0.0-20180920065004-418d78d0b9a7 // indirect
github.com/satori/go.uuid v1.2.0 // indirect
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect
github.com/shirou/gopsutil v2.17.12+incompatible // indirect
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect
github.com/sirupsen/logrus v1.1.0
github.com/spf13/cast v1.2.0
github.com/stretchr/testify v1.2.2
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 // indirect
golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3 // indirect
google.golang.org/grpc v1.15.0 // indirect
github.com/sirupsen/logrus v1.1.1
github.com/spf13/cast v1.3.0
golang.org/x/net v0.0.0-20181029044818-c44066c5c816 // indirect
google.golang.org/grpc v1.16.0 // indirect
gopkg.in/src-d/go-errors.v1 v1.0.0
gopkg.in/src-d/go-vitess.v1 v1.1.0
gopkg.in/vmihailenco/msgpack.v2 v2.9.1 // indirect
gopkg.in/yaml.v2 v2.2.1
gopkg.in/src-d/go-vitess.v1 v1.2.1
)
14 changes: 14 additions & 0 deletions server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,20 @@ func (h *Handler) ComQuery(
return callback(r)
}

// WarningCount is called at the end of each query to obtain
// the value to be returned to the client in the EOF packet.
// Note that this will be called either in the context of the
// ComQuery callback if the result does not contain any fields,
// or after the last ComQuery call completes.
func (h *Handler) WarningCount(c *mysql.Conn) uint16 {
sess, ok := h.sm.sessions[c.ConnectionID]
if !ok {
return 0
}

return sess.WarningCount()
}

func (h *Handler) handleKill(conn *mysql.Conn, query string) (bool, error) {
q := strings.ToLower(query)
s := regKillCmd.FindStringSubmatch(q)
Expand Down
9 changes: 9 additions & 0 deletions sql/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ type Session interface {
Warnings() []*Warning
// ClearWarnings cleans up session warnings
ClearWarnings()
// WarningCount returns a number of session warnings
WarningCount() uint16
}

// BaseSession is the basic session type.
Expand Down Expand Up @@ -122,6 +124,13 @@ func (s *BaseSession) ClearWarnings() {
}
}

// WarningCount returns a number of session warnings
func (s *BaseSession) WarningCount() uint16 {
s.mu.RLock()
defer s.mu.RUnlock()
return uint16(len(s.warnings))
}

type (
// TypedValue is a value along with its type.
TypedValue struct {
Expand Down
4 changes: 2 additions & 2 deletions sql/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ func TestSessionConfig(t *testing.T) {
require.Equal(Int64, typ)
require.Equal(1, v)

require.Equal(0, len(sess.Warnings()))
require.Equal(uint16(0), sess.WarningCount())

sess.Warn(&Warning{Code: 1})
sess.Warn(&Warning{Code: 2})
sess.Warn(&Warning{Code: 3})

require.Equal(3, len(sess.Warnings()))
require.Equal(uint16(3), sess.WarningCount())

require.Equal(3, sess.Warnings()[0].Code)
require.Equal(2, sess.Warnings()[1].Code)
Expand Down