Skip to content

Commit ca26d4f

Browse files
authored
Merge pull request #522 from ajnavarro/configurable-timeout
Configurable timeout
2 parents e5b1d16 + 162795c commit ca26d4f

File tree

135 files changed

+84
-17454
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+84
-17454
lines changed

Gopkg.lock

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

Gopkg.toml

Lines changed: 7 additions & 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 = "120f7d7ae8720f843dca0ce8fbc8429a8952a25a"
3+
revision = "679d33772845593ce5fdf17925f49f2335bc8356"
44

55
[[constraint]]
66
name = "github.com/jessevdk/go-flags"
@@ -75,3 +75,9 @@
7575
[[override]]
7676
name = "github.com/moovweb/rubex"
7777
branch = "go1"
78+
79+
[prune]
80+
[[prune.project]]
81+
name = "gopkg.in/src-d/go-mysql-server.v0"
82+
go-tests = true
83+
non-go = true

cmd/gitbase/command/server.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"runtime"
88
"strconv"
99
"strings"
10+
"time"
1011

1112
"github.com/src-d/gitbase"
1213
"github.com/src-d/gitbase/internal/function"
@@ -46,6 +47,7 @@ type Server struct {
4647
Port int `short:"p" long:"port" default:"3306" description:"Port where the server is going to listen"`
4748
User string `short:"u" long:"user" default:"root" description:"User name used for connection"`
4849
Password string `short:"P" long:"password" default:"" description:"Password used for connection"`
50+
ConnTimeout int `short:"t" long:"timeout" env:"GITBASE_CONNECTION_TIMEOUT" description:"Timeout in seconds used for connections"`
4951
IndexDir string `short:"i" long:"index" default:"/var/lib/gitbase/index" description:"Directory where the gitbase indexes information will be persisted." env:"GITBASE_INDEX_DIR"`
5052
CacheSize cache.FileSize `long:"cache" default:"512" description:"Object cache size in megabytes" env:"GITBASE_CACHESIZE_MB"`
5153
Parallelism uint `long:"parallelism" description:"Maximum number of parallel threads per table. By default, it's the number of CPU cores. 0 means default, 1 means disabled."`
@@ -146,12 +148,15 @@ func (c *Server) Execute(args []string) error {
146148
}
147149

148150
hostString := net.JoinHostPort(c.Host, strconv.Itoa(c.Port))
151+
timeout := time.Duration(c.ConnTimeout) * time.Second
149152
s, err := server.NewServer(
150153
server.Config{
151-
Protocol: "tcp",
152-
Address: hostString,
153-
Auth: auth,
154-
Tracer: tracer,
154+
Protocol: "tcp",
155+
Address: hostString,
156+
Auth: auth,
157+
Tracer: tracer,
158+
ConnReadTimeout: timeout,
159+
ConnWriteTimeout: timeout,
155160
},
156161
c.engine,
157162
gitbase.NewSessionBuilder(c.pool,

docs/using-gitbase/configuration.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
| `GITBASE_LANGUAGE_CACHE_SIZE`| size of the cache for the `language` UDF. The size is the maximum number of elements kept in the cache, 10000 by default |
1515
| `GITBASE_UAST_CACHE_SIZE` | size of the cache for the `uast` and `uast_mode` UDFs. The size is the maximum number of elements kept in the cache, 10000 by default |
1616
| `GITBASE_CACHESIZE_MB` | size of the cache for git objects specified as MB |
17+
| `GITBASE_CONNECTION_TIMEOUT` | timeout in seconds used for client connections on write and reads. No timeout by default. |
1718

1819
### Jaeger tracing variables
1920

@@ -67,18 +68,23 @@ Help Options:
6768
-h, --help Show this help message
6869
6970
[server command options]
70-
-d, --directories= Path where the git repositories are located (standard and siva), multiple directories can be defined. Accepts globs.
71+
-d, --directories= Path where the git repositories are located (standard and siva), multiple directories can be
72+
defined. Accepts globs.
7173
--depth= load repositories looking at less than <depth> nested subdirectories. (default: 1000)
7274
--host= Host where the server is going to listen (default: localhost)
7375
-p, --port= Port where the server is going to listen (default: 3306)
7476
-u, --user= User name used for connection (default: root)
7577
-P, --password= Password used for connection
76-
-i, --index= Directory where the gitbase indexes information will be persisted. (default: /var/lib/gitbase/index) [$GITBASE_INDEX_DIR]
78+
-t, --timeout= Timeout in seconds used for connections [$GITBASE_CONNECTION_TIMEOUT]
79+
-i, --index= Directory where the gitbase indexes information will be persisted. (default:
80+
/var/lib/gitbase/index) [$GITBASE_INDEX_DIR]
7781
--cache= Object cache size in megabytes (default: 512) [$GITBASE_CACHESIZE_MB]
78-
--parallelism= Maximum number of parallel threads per table. By default, it's the number of CPU cores. 0 means default, 1 means disabled.
82+
--parallelism= Maximum number of parallel threads per table. By default, it's the number of CPU cores. 0
83+
means default, 1 means disabled.
7984
--no-squash Disables the table squashing.
8085
--trace Enables jaeger tracing [$GITBASE_TRACE]
81-
-r, --readonly Only allow read queries. This disables creating and deleting indexes as well. [$GITBASE_READONLY]
86+
-r, --readonly Only allow read queries. This disables creating and deleting indexes as well.
87+
[$GITBASE_READONLY]
8288
--no-git disable the load of git standard repositories.
8389
--no-siva disable the load of siva files.
8490
-v Activates the verbose mode

docs/using-gitbase/functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ BigEndianInt32(len(marhsal(node))+marshal(node)+
3232

3333
## Standard functions
3434

35-
You can check standard functions in [`go-mysql-server` documentation](https://github.com/src-d/go-mysql-server/tree/120f7d7ae8720f843dca0ce8fbc8429a8952a25a#custom-functions).
35+
You can check standard functions in [`go-mysql-server` documentation](https://github.com/src-d/go-mysql-server/tree/679d33772845593ce5fdf17925f49f2335bc8356#custom-functions).

docs/using-gitbase/indexes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ Note that you can create an index either **on one or more columns** or **on a si
1010

1111
You can find some more examples in the [examples](./examples.md#create-an-index-for-columns-on-a-table) section.
1212

13-
See [go-mysql-server](https://github.com/src-d/go-mysql-server/tree/120f7d7ae8720f843dca0ce8fbc8429a8952a25a#indexes) documentation for more details
13+
See [go-mysql-server](https://github.com/src-d/go-mysql-server/tree/679d33772845593ce5fdf17925f49f2335bc8356#indexes) documentation for more details
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/120f7d7ae8720f843dca0ce8fbc8429a8952a25a/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/679d33772845593ce5fdf17925f49f2335bc8356/SUPPORTED.md) from [src-d/go-mysql-server](https://github.com/src-d/go-mysql-server).

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

Lines changed: 0 additions & 34 deletions
This file was deleted.

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

Lines changed: 0 additions & 32 deletions
This file was deleted.

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

Lines changed: 0 additions & 61 deletions
This file was deleted.

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

Lines changed: 0 additions & 36 deletions
This file was deleted.

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

Lines changed: 0 additions & 1 deletion
This file was deleted.

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

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)