Skip to content

Commit 8161618

Browse files
authored
Merge pull request #485 from erizocosmico/feature/new-pilosa-driver
*: replace pilosalib with new pilosa driver
2 parents b0c383e + e657a12 commit 8161618

Some content is hidden

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

76 files changed

+1404
-13216
lines changed

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ addons:
1616
- g++-6
1717

1818
before_install:
19-
- docker pull pilosa/pilosa:v1.1.0
20-
- docker run -d --name pilosa -p 127.0.0.1:10101:10101 pilosa/pilosa:v1.1.0
21-
- docker ps -a
2219
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 90
2320
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 90
2421

Gopkg.lock

Lines changed: 2 additions & 16 deletions
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 = "e8316f5430855f55b0da4b5c63fc990d75c2c085"
3+
revision = "255f4a35c69f573b6b19d73f03dd7265961dcba3"
44

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

_testdata/regression.yml

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,50 +25,30 @@
2525
Statements:
2626
- SELECT repository_id,contributor_count FROM (SELECT repository_id, COUNT(DISTINCT commit_author_email) AS contributor_count FROM commits GROUP BY repository_id) AS q ORDER BY contributor_count DESC LIMIT 10
2727
-
28-
ID: 'query5'
28+
ID: 'query6'
2929
Name: 'Create pilosa index on language UDF'
3030
Statements:
3131
- CREATE INDEX language_idx ON files USING pilosa (language(file_path, blob_content)) WITH (async = false)
3232
- DROP INDEX language_idx ON files
3333
-
34-
ID: 'query6'
35-
Name: 'Create pilosalib index on language UDF'
36-
Statements:
37-
- CREATE INDEX language_idx ON files USING pilosalib (language(file_path, blob_content)) WITH (async = false)
38-
- DROP INDEX language_idx ON files
39-
-
40-
ID: 'query7'
34+
ID: 'query8'
4135
Name: 'Query by language using the pilosa index'
4236
Statements:
4337
- CREATE INDEX language_idx ON files USING pilosa (language(file_path, blob_content)) WITH (async = false)
4438
- SELECT file_path FROM files WHERE language(file_path, blob_content) = 'Go'
4539
- DROP INDEX language_idx ON files
46-
-
47-
ID: 'query8'
48-
Name: 'Query by language using the pilosalib index'
49-
Statements:
50-
- CREATE INDEX language_idx ON files USING pilosalib (language(file_path, blob_content)) WITH (async = false)
51-
- SELECT file_path FROM files WHERE language(file_path, blob_content) = 'Go'
52-
- DROP INDEX language_idx ON files
5340
-
5441
ID: 'query9'
5542
Name: 'Query all files from HEAD'
5643
Statements:
5744
- SELECT cf.file_path, f.blob_content FROM ref_commits r NATURAL JOIN commit_files cf NATURAL JOIN files f WHERE r.ref_name = 'HEAD' AND r.history_index = 0
5845
-
59-
ID: 'query10'
46+
ID: 'query11'
6047
Name: 'Get all LICENSE blobs using pilosa index'
6148
Statements:
6249
- CREATE INDEX file_path_idx ON files USING pilosa (file_path) WITH (async = false)
6350
- SELECT blob_content FROM files WHERE file_path = 'LICENSE'
6451
- DROP INDEX file_path_idx ON files
65-
-
66-
ID: 'query11'
67-
Name: 'Get all LICENSE blobs using pilosalib index'
68-
Statements:
69-
- CREATE INDEX file_path_idx ON files USING pilosalib (file_path) WITH (async = false)
70-
- SELECT blob_content FROM files WHERE file_path = 'LICENSE'
71-
- DROP INDEX file_path_idx ON files
7252
-
7353
ID: 'query12'
7454
Name: '10 top repos by file count in HEAD'
@@ -85,28 +65,21 @@
8565
Statements:
8666
- SELECT * FROM (SELECT commit_author_email as author,count(*) as num_commits FROM commits GROUP BY commit_author_email) t ORDER BY num_commits DESC
8767
-
88-
ID: 'query15'
68+
ID: 'query16'
8969
Name: 'Union operation with pilosa index'
9070
Statements:
9171
- CREATE INDEX file_path_idx ON files USING pilosa (file_path) WITH (async = false)
9272
- SELECT blob_content FROM files WHERE file_path = 'LICENSE' OR file_path = 'README.md'
9373
- DROP INDEX file_path_idx ON files
94-
-
95-
ID: 'query16'
96-
Name: 'Union operation with pilosalib index'
97-
Statements:
98-
- CREATE INDEX file_path_idx ON files USING pilosalib (file_path) WITH (async = false)
99-
- SELECT blob_content FROM files WHERE file_path = 'LICENSE' OR file_path = 'README.md'
100-
- DROP INDEX file_path_idx ON files
10174
-
10275
ID: 'query17'
10376
Name: 'Count all commits with NOT operation'
10477
Statements:
10578
- SELECT COUNT(*) FROM commits WHERE NOT(commit_author_email = 'non existing email address');
10679
-
10780
ID: 'query18'
108-
Name: 'Count all commits with NOT operation and pilosalib index'
81+
Name: 'Count all commits with NOT operation and pilosa index'
10982
Statements:
110-
- CREATE INDEX email_idx ON commits USING pilosalib (commit_author_email) WITH (async = false)
83+
- CREATE INDEX email_idx ON commits USING pilosa (commit_author_email) WITH (async = false)
11184
- SELECT COUNT(*) FROM commits WHERE NOT(commit_author_email = 'non existing email address')
11285
- DROP INDEX email_idx ON commits

cmd/gitbase/command/server.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"github.com/src-d/gitbase/internal/rule"
1414

1515
"github.com/opentracing/opentracing-go"
16-
gopilosa "github.com/pilosa/go-pilosa"
1716
"github.com/sirupsen/logrus"
1817
"github.com/uber/jaeger-client-go/config"
1918
"gopkg.in/src-d/go-git.v4/plumbing/cache"
@@ -22,7 +21,6 @@ import (
2221
"gopkg.in/src-d/go-mysql-server.v0/sql"
2322
"gopkg.in/src-d/go-mysql-server.v0/sql/analyzer"
2423
"gopkg.in/src-d/go-mysql-server.v0/sql/index/pilosa"
25-
"gopkg.in/src-d/go-mysql-server.v0/sql/index/pilosalib"
2624
"gopkg.in/src-d/go-vitess.v0/mysql"
2725
)
2826

@@ -48,7 +46,6 @@ type Server struct {
4846
Port int `short:"p" long:"port" default:"3306" description:"Port where the server is going to listen"`
4947
User string `short:"u" long:"user" default:"root" description:"User name used for connection"`
5048
Password string `short:"P" long:"password" default:"" description:"Password used for connection"`
51-
PilosaURL string `long:"pilosa" default:"http://localhost:10101" description:"URL to your pilosa server" env:"PILOSA_ENDPOINT"`
5249
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"`
5350
CacheSize cache.FileSize `long:"cache" default:"512" description:"Object cache size in megabytes" env:"GITBASE_CACHESIZE_MB"`
5451
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."`
@@ -217,14 +214,9 @@ func (c *Server) registerDrivers() error {
217214

218215
logrus.Debug("created index storage")
219216

220-
if client, err := gopilosa.NewClient(c.PilosaURL); err == nil {
221-
logrus.Debug("established connection with pilosa")
222-
c.engine.Catalog.RegisterIndexDriver(pilosa.NewDriver(filepath.Join(c.IndexDir, pilosa.DriverID), client))
223-
} else {
224-
logrus.WithError(err).Warn("cannot connect to pilosa")
225-
}
226-
227-
c.engine.Catalog.RegisterIndexDriver(pilosalib.NewDriver(filepath.Join(c.IndexDir, pilosalib.DriverID)))
217+
c.engine.Catalog.RegisterIndexDriver(
218+
pilosa.NewDriver(filepath.Join(c.IndexDir, pilosa.DriverID)),
219+
)
228220
logrus.Debug("registered pilosa index driver")
229221

230222
return nil

docs/using-gitbase/configuration.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
| Name | Description |
66
|:-----------------------------|:-----------------------------------------------------------------------------------|
77
| `BBLFSH_ENDPOINT` | bblfshd endpoint, default "127.0.0.1:9432" |
8-
| `PILOSA_ENDPOINT` | pilosa endpoint, default "http://localhost:10101" |
98
| `GITBASE_BLOBS_MAX_SIZE` | maximum blob size to return in MiB, default 5 MiB |
109
| `GITBASE_BLOBS_ALLOW_BINARY` | enable retrieval of binary blobs, default `false` |
1110
| `GITBASE_SKIP_GIT_ERRORS` | do not stop queries on git errors, default disabled |
@@ -73,7 +72,6 @@ Help Options:
7372
-p, --port= Port where the server is going to listen (default: 3306)
7473
-u, --user= User name used for connection (default: root)
7574
-P, --password= Password used for connection
76-
--pilosa= URL to your pilosa server (default: http://localhost:10101) [$PILOSA_ENDPOINT]
7775
-i, --index= Directory where the gitbase indexes information will be persisted. (default: /var/lib/gitbase/index) [$GITBASE_INDEX_DIR]
7876
--no-squash Disables the table squashing.
7977
--trace Enables jaeger tracing [$GITBASE_TRACE]

docs/using-gitbase/functions.md

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

1818
## Standard functions
1919

20-
You can check standard functions in [`go-mysql-server` documentation](https://github.com/src-d/go-mysql-server/tree/e8316f5430855f55b0da4b5c63fc990d75c2c085#custom-functions).
20+
You can check standard functions in [`go-mysql-server` documentation](https://github.com/src-d/go-mysql-server/tree/255f4a35c69f573b6b19d73f03dd7265961dcba3#custom-functions).

docs/using-gitbase/getting-started.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
`gitbase` has two optional dependencies that should be running on your system if you're planning on using certain functionality.
66

77
- [bblfsh](https://github.com/bblfsh/bblfshd) >= 2.6.1 (only if you're planning to use the `UAST` functionality provided in gitbase)
8-
- [pilosa](https://github.com/pilosa/pilosa) 0.9.0 (only if you're planning on using indexes)
98

109
## Installing gitbase
1110

@@ -18,16 +17,6 @@ You can use the official image from [docker hub](https://hub.docker.com/r/srcd/g
1817
docker run --rm --name gitbase -p 3306:3306 -v /my/git/repos:/opt/repos srcd/gitbase:latest
1918
```
2019

21-
If you want to speedup gitbase using indexes you must run a pilosa container:
22-
```
23-
docker run -it --rm --name pilosa -p 10101:10101 pilosa/pilosa:v0.9.0
24-
```
25-
26-
Then link the gitbase container to the pilosa one:
27-
```
28-
docker run --rm --name gitbase -p 3306:3306 --link pilosa:pilosa -e PILOSA_ENDPOINT="http://pilosa:10101" -v /my/git/repos:/opt/repos srcd/gitbase:latest
29-
```
30-
3120
**Note:** remember to replace `/my/git/repos` with the local path where your repositories are stored in your computer.
3221

3322
### Download and use the binary

docs/using-gitbase/indexes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
`gitbase` allows you to speed up queries creating indexes.
44

5-
Indexes are implemented as bitmaps using [pilosa](https://github.com/pilosa/pilosa) as a backend storage for them. To run a pilosa instance see the [getting started](./getting-started.md) section.
5+
Indexes are implemented as bitmaps using [pilosa](https://github.com/pilosa/pilosa) as a backend storage for them.
66

77
Thus, to create indexes you must specify pilosa as the type of index. You can find some examples in the [examples](./examples.md#create-an-index-for-columns-on-a-table) section about managing indexes.
88

99
Note that you can create an index either **on one or more columns** or **on a single expression**.
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/e8316f5430855f55b0da4b5c63fc990d75c2c085#indexes) documentation for more details
13+
See [go-mysql-server](https://github.com/src-d/go-mysql-server/tree/255f4a35c69f573b6b19d73f03dd7265961dcba3#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/e8316f5430855f55b0da4b5c63fc990d75c2c085/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/255f4a35c69f573b6b19d73f03dd7265961dcba3/SUPPORTED.md) from [src-d/go-mysql-server](https://github.com/src-d/go-mysql-server).

0 commit comments

Comments
 (0)