Skip to content

Commit cb45efd

Browse files
authored
Merge branch 'master' into doc-724
2 parents 6568a22 + cae4ea7 commit cb45efd

33 files changed

+436
-2381
lines changed

Dockerfile

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,25 @@ RUN make static-build
2020
#=================================
2121
FROM alpine:3.8
2222

23+
RUN apk add --no-cache mysql-client
24+
2325
RUN mkdir -p /opt/repos
2426

25-
ENV GITBASE_USER=root
26-
ENV GITBASE_PASSWORD=""
27-
ENV GITBASE_REPOS=/opt/repos
2827
EXPOSE 3306
2928

3029
ENV TINI_VERSION v0.18.0
3130
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static-amd64 /tini
3231
RUN chmod +x /tini
3332
ENTRYPOINT ["/tini", "--"]
3433

34+
ENV GITBASE_USER=root
35+
ENV GITBASE_PASSWORD=""
36+
ENV GITBASE_REPOS=/opt/repos
37+
ENV MYSQL_HOST=127.0.0.1
38+
3539
# copy build artifacts
3640
COPY --from=builder /bin/gitbase /bin/gitbase
41+
ADD init.sh ./init.sh
42+
RUN chmod +x ./init.sh
3743

38-
CMD /bin/gitbase server -v \
39-
--host=0.0.0.0 \
40-
--port=3306 \
41-
--user="$GITBASE_USER" \
42-
--password="$GITBASE_PASSWORD" \
43-
--directories="$GITBASE_REPOS"
44+
ENTRYPOINT ["./init.sh"]

Gopkg.lock

Lines changed: 10 additions & 10 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 = "b32d2fdea095e2743d13f3ab4da5ae83aef55bc7"
3+
revision = "0093a7562ad1cf31f179396dfa5be32893059dbb"
44

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

docs/using-gitbase/functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,4 @@ Also, if you want to retrieve values from a non common property, you can pass it
9595
9696
## Standard functions
9797

98-
You can check standard functions in [`go-mysql-server` documentation](https://github.com/src-d/go-mysql-server/tree/b32d2fdea095e2743d13f3ab4da5ae83aef55bc7#custom-functions).
98+
You can check standard functions in [`go-mysql-server` documentation](https://github.com/src-d/go-mysql-server/tree/0093a7562ad1cf31f179396dfa5be32893059dbb#custom-functions).

docs/using-gitbase/indexes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ and for the second query also two indexes will be used and the result will be a
2626

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

29-
See [go-mysql-server](https://github.com/src-d/go-mysql-server/tree/b32d2fdea095e2743d13f3ab4da5ae83aef55bc7#indexes) documentation for more details
29+
See [go-mysql-server](https://github.com/src-d/go-mysql-server/tree/0093a7562ad1cf31f179396dfa5be32893059dbb#indexes) documentation for more details

docs/using-gitbase/optimize-queries.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Even though in each release performance improvements are included to make gitbas
55
There are two ways to optimize a gitbase query:
66
- Create an index for some parts.
77
- Making sure the joined tables are squashed.
8+
- Making sure not squashed joins are performed in memory.
89

910
## Assessing performance bottlenecks
1011

@@ -57,6 +58,24 @@ Some performance issues might not be obvious, but there are a few that really st
5758

5859
- Joins not squashed. If you performed some joins between tables and instead of a `SquashedTable` node you see `Join` and `Table` nodes, it means the joins were not successfully squashed. There is a more detailed explanation about this in next sections of this document.
5960
- Indexes not used. If you can't see the indexes in your table nodes, it means somehow those indexes are not being used by the table. There is a more detailed explanation about this in next sections of this document.
61+
- Joins not squashed that are not being executed in memory. There is a more detailed explanation about this in the next sections of this document.
62+
63+
## In-memory joins
64+
65+
There are two modes in which gitbase can execute an inner join:
66+
67+
- Multipass: it fully iterates the right side of the join one time for each row in the left side. This is really expensive, but avoids having to load one side fully in memory.
68+
- In-memory: loads the whole right side in memory and iterates the left side. Both sides are iterated exactly once, thus it makes the query much faster, but it has the disadvantage of potentially requiring a lot of memory.
69+
70+
The default mode is multipass, unless the right side fits in memory (there's a more elaborate explanation about this below).
71+
72+
In-memory joins can be enabled at the user request, either with the `EXPERIMENTAL_IN_MEMORY_JOIN=on` environment variable or executing `SET inmemory_joins = 1`. The last method only enables it for the current connection.
73+
74+
Even if they are not globally enabled for all queries, there is an optimization that checks if the join could be performed in memory and if it can't, switches to multipass mode.
75+
As long as the whole gitbase server memory usage is under the 20% of all available physical (not counting other memory used by other processes) memory in the machine, the join will be performed in memory. When this limit is passed, the multipass mode will be used instead.
76+
20% is just a default value that can be changed using the `MAX_MEMORY_INNER_JOIN` environment variable to the maximum amount of bytes the gitbase server can be using before switching to multipass mode. It can also be changed per session using `SET max_memory_joins=<MAX BYTES>`.
77+
78+
So, as a good rule of thumb, the right side of an inner join should always be the smaller one, because that way, it has bigger chances of being executed in memory and it will be faster.
6079

6180
## Indexes
6281

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
## Supported clients
22

3-
To see the supported MySQL clients and examples about how to use them, take a look [here](https://github.com/src-d/go-mysql-server/blob/b32d2fdea095e2743d13f3ab4da5ae83aef55bc7/SUPPORTED_CLIENTS.md).
3+
To see the supported MySQL clients and examples about how to use them, take a look [here](https://github.com/src-d/go-mysql-server/blob/0093a7562ad1cf31f179396dfa5be32893059dbb/SUPPORTED_CLIENTS.md).
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/b32d2fdea095e2743d13f3ab4da5ae83aef55bc7/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/0093a7562ad1cf31f179396dfa5be32893059dbb/SUPPORTED.md) from [src-d/go-mysql-server](https://github.com/src-d/go-mysql-server).

init.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
3+
cat <<EOT >> "$HOME/.my.cnf"
4+
[client]
5+
user=${GITBASE_USER}
6+
password=${GITBASE_PASSWORD}
7+
EOT
8+
9+
/tini -s -- /bin/gitbase server -v \
10+
--host=0.0.0.0 \
11+
--port=3306 \
12+
--user="$GITBASE_USER" \
13+
--password="$GITBASE_PASSWORD" \
14+
--directories="$GITBASE_REPOS"

vendor/github.com/moovweb/rubex/AUTHOR

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

0 commit comments

Comments
 (0)