Skip to content

Commit 99c828e

Browse files
authored
Merge pull request #362 from kuba--/mysql
Upgrade go-mysql-server
2 parents 64f04c7 + b77589d commit 99c828e

File tree

15 files changed

+212
-37
lines changed

15 files changed

+212
-37
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
deploy:
7676
provider: releases
7777
api_key: $GITHUB_TOKEN
78-
file_glob: true,
78+
file_glob: true
7979
file: build/*darwin_amd64.tar.gz
8080
skip_cleanup: true
8181
on:

Gopkg.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[[constraint]]
22
name = "gopkg.in/src-d/go-mysql-server.v0"
3-
revision = "24a5925748096dd3116b0073833a438ecb0c34f9"
3+
revision = "dcc1c537eb7e2bc20ce69d03732e8aa8feaa8612"
44

55
[[constraint]]
66
name = "github.com/jessevdk/go-flags"

cmd/gitbase/command/server.go

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package command
22

33
import (
4+
"fmt"
45
"net"
56
"os"
67
"path/filepath"
@@ -13,6 +14,7 @@ import (
1314
"github.com/opentracing/opentracing-go"
1415
gopilosa "github.com/pilosa/go-pilosa"
1516
"github.com/sirupsen/logrus"
17+
jaeger "github.com/uber/jaeger-client-go"
1618
"github.com/uber/jaeger-client-go/config"
1719
sqle "gopkg.in/src-d/go-mysql-server.v0"
1820
"gopkg.in/src-d/go-mysql-server.v0/server"
@@ -79,17 +81,17 @@ func (c *Server) Execute(args []string) error {
7981

8082
var tracer opentracing.Tracer
8183
if c.TraceEnabled {
84+
if os.Getenv("JAEGER_SERVICE_NAME") == "" {
85+
os.Setenv("JAEGER_SERVICE_NAME", TracerServiceName)
86+
}
87+
8288
cfg, err := config.FromEnv()
8389
if err != nil {
8490
logrus.WithField("error", err).
8591
Fatal("unable to read jaeger environment")
8692
return err
8793
}
8894

89-
if cfg.ServiceName == "" {
90-
cfg.ServiceName = TracerServiceName
91-
}
92-
9395
logger := &jaegerLogrus{logrus.WithField("subsystem", "jaeger")}
9496

9597
t, closer, err := cfg.NewTracer(
@@ -104,7 +106,18 @@ func (c *Server) Execute(args []string) error {
104106
tracer = t
105107
defer closer.Close()
106108

107-
logrus.Info("tracing enabled")
109+
jaegerHost := os.Getenv("JAEGER_AGENT_HOST")
110+
if jaegerHost == "" {
111+
jaegerHost = jaeger.DefaultUDPSpanServerHost
112+
}
113+
114+
jaegerPort := os.Getenv("JAEGER_AGENT_PORT")
115+
if jaegerPort == "" {
116+
jaegerPort = strconv.Itoa(jaeger.DefaultUDPSpanServerPort)
117+
}
118+
119+
endpoint := fmt.Sprintf("%s:%s", jaegerHost, jaegerPort)
120+
logrus.WithField("endpoint", endpoint).Info("tracing enabled")
108121
}
109122

110123
hostString := net.JoinHostPort(c.Host, strconv.Itoa(c.Port))

docs/using-gitbase/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Usage:
5656
5757
Starts a gitbase server instance
5858
59-
By default when gitbase encounters an error in a repository it
59+
By default when gitbase encounters and error in a repository it
6060
stops the query. With GITBASE_SKIP_GIT_ERRORS variable it won't
6161
complain and just skip those rows or repositories.
6262

docs/using-gitbase/functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ To make some common tasks easier for the user, there are some functions to inter
1414

1515
## Standard functions
1616

17-
You can check standard functions in [`go-mysql-server` documentation](https://github.com/src-d/go-mysql-server/tree/24a5925748096dd3116b0073833a438ecb0c34f9#custom-functions).
17+
You can check standard functions in [`go-mysql-server` documentation](https://github.com/src-d/go-mysql-server/tree/dcc1c537eb7e2bc20ce69d03732e8aa8feaa8612#custom-functions).
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
## Supported syntax
22

3-
To see the SQL subset currently supported take a look at [this list](https://github.com/src-d/go-mysql-server/blob/24a5925748096dd3116b0073833a438ecb0c34f9/SUPPORTED.md) from [src-d/go-mysql-server](https://github.com/src-d/go-mysql-server).
3+
To see the SQL subset currently supported take a look at [this list](https://github.com/src-d/go-mysql-server/blob/dcc1c537eb7e2bc20ce69d03732e8aa8feaa8612/SUPPORTED.md) from [src-d/go-mysql-server](https://github.com/src-d/go-mysql-server).

pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ All PRs must keep the documentation up to date. If this PR changes or adds some
55
- Schema changes
66
- Syntax changes
77
- Add or update examples
8-
- go-mysql-server version hash. Change it on documentation links too.
8+
- ./rev-upgrade.sh "gopkg.in/src-d/go-mysql-server.v0" "the latest go-mysql-server revision"
99
1010
-->

rev-upgrade.sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/bash
2+
#
3+
# Upgrade project's revision
4+
# $ ./rev-upgrade.sh project rev-new
5+
# e.g.:
6+
# ./rev-upgrade.sh "gopkg.in/src-d/go-mysql-server.v0" "0123456789abcdef"
7+
#
8+
#set -x
9+
10+
read -d '' SCRIPT << 'EOF'
11+
BEGIN {
12+
PRJ = ARGV[2]
13+
gsub(/^[ \t\r\n\'\"]+/, "", PRJ)
14+
gsub(/[ \t\r\n\'\"]+$/, "", PRJ)
15+
ARGC = 2
16+
17+
DEPTH = 0
18+
}
19+
20+
/\[\[projects\]\]/ {
21+
DEPTH = 1
22+
}
23+
24+
/name/ {
25+
if (DEPTH == 1) {
26+
split($0, name, "=")
27+
prj = name[2]
28+
gsub(/^[ \t\r\n\'\"]+/, "", prj)
29+
gsub(/[ \t\r\n\'\"]+$/, "", prj)
30+
if (prj == PRJ) {
31+
DEPTH = 2
32+
}
33+
}
34+
}
35+
36+
/revision/ {
37+
if (DEPTH == 2) {
38+
split($0, revision, "=")
39+
gsub(/^[ \t\r\n\'\"]+/, "", revision[2])
40+
gsub(/[ \t\r\n\'\"]+$/, "", revision[2])
41+
print revision[2]
42+
DEPTH = 0
43+
}
44+
}
45+
EOF
46+
47+
GOPKG="$(git rev-parse --show-toplevel)/Gopkg.lock"
48+
PRJ="$1"
49+
shift
50+
REV_NEW="$1"
51+
REV_OLD="$(awk "$SCRIPT" "$GOPKG" "$PRJ")"
52+
53+
echo "Project: $PRJ"
54+
echo "Old rev: $REV_OLD"
55+
echo "New rev: $REV_NEW"
56+
57+
if [ $REV_OLD == $REV_NEW ]; then
58+
exit 0
59+
fi
60+
61+
for file in $(git ls-files | xargs egrep -l $REV_OLD); do
62+
echo "# $file"
63+
sed -i '' "s/$REV_OLD/$REV_NEW/g" $file
64+
done
65+
66+
err=$?
67+
if [ $err -ne 0 ]; then
68+
exit $err
69+
fi
70+
71+
dep ensure -v

vendor/gopkg.in/src-d/go-mysql-server.v0/engine_test.go

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/gopkg.in/src-d/go-mysql-server.v0/sql/analyzer/analyzer.go

Lines changed: 19 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/gopkg.in/src-d/go-mysql-server.v0/sql/analyzer/rules.go

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)