Permalink
Newer
100644
228 lines (176 sloc)
9.31 KB
3
- [Prerequisites](#prerequisites)
4
- [Getting and Building](#getting-and-building)
5
- [Style Guide](#style-guide)
12
Before you start contributing, review these [basic
13
guidelines](https://www.cockroachlabs.com/docs/stable/contribute-to-cockroachdb.html)
14
on finding a project, determining its complexity, and learning what to
15
expect in your collaboration with the Cockroach Labs team.
17
If you *really* want to dig deep into our processes and mindset, you may also
18
want to peruse our extensive [first PR guide], which is part of our on-boarding for
19
new engineers.
20
24
25
- Either a working Docker install able to run GNU/Linux binaries
26
(e.g. Docker on Linux, macOS, Windows), so you can reuse our
27
pre-populated Docker image with all necessary development
28
dependencies; or
29
30
- The tools needed to build CockroachDB from scratch:
31
32
- A C++ compiler that supports C++11. Note that GCC prior to 6.0 doesn't
33
work due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48891
34
- The standard C/C++ development headers on your system.
35
- On GNU/Linux, the terminfo development libraries, which may be
36
part of a ncurses development package (e.g. `libtinfo-dev` on
37
Debian/Ubuntu, but `ncurses-devel` on CentOS).
38
- A Go environment with a recent 64-bit version of the toolchain. Note that
39
the Makefile enforces the specific version required, as it is updated
40
frequently.
41
- Git 1.9+
42
- Bash (4+ is preferred)
43
- GNU Make (3.81+ is known to work)
44
- CMake 3.1+
45
- Autoconf 2.68+
59
If you wish to reuse our builder image instead of installing all the
60
dependencies manually, prefix the `make` command with
61
`build/builder.sh`; for example `build/builder.sh make build`.
62
63
Note that the first time you run `make`, it can take some time to
64
download and install various dependencies. After running `make build`,
65
the `cockroach` executable will be in your current directory and can
66
be run as shown in the [README](README.md).
70
- The default binary contains core open-source functionally covered by
71
the Apache License 2 (APL2) and enterprise functionality covered by
72
the CockroachDB Community License (CCL). To build a pure open-source
73
(APL2) version excluding enterprise functionality, use `make
74
buildoss`. See this [blog post] for more details.
75
76
[blog post]: https://www.cockroachlabs.com/blog/how-were-building-a-business-to-last/
78
- If you edit a `.proto` or `.ts` file, you will need to manually
79
regenerate the associated `.pb.{go,cc,h}` or `.js` files using `make
80
generate`.
82
- If you edit the SQL built-in functions or operators or update the SQL grammar,
83
you will need to manually regenerate the associated `docs/generated` files via
84
`make generate PKG=./docs/...`.
85
86
- You can also run `build/builder.sh make generate` from the
87
repository root to get the intended result.
91
- To add or update a Go dependency:
92
- See [`build/README.md`](build/README.md) for details on adding or updating
93
dependencies.
103
When you're ready to commit, be sure to write a Good Commit Message™.
104
105
Our commit message guidelines are detailed here:
106
https://github.com/cockroachdb/cockroach/wiki/Git-Commit-Messages
107
108
In summary (the wiki page details the rationales and provides further suggestions):
109
- Keep in mind who reads: think of the reviewer, think of the release notes
110
- [Separate subject from body with a blank line](https://github.com/cockroachdb/cockroach/wiki/Git-Commit-Messages#commit-title)
111
- [Use the body to explain *what* and *why* vs. *how*](https://github.com/cockroachdb/cockroach/wiki/Git-Commit-Messages#commit-description)
112
- [Prefix the subject line with the affected package/area](https://github.com/cockroachdb/cockroach/wiki/Git-Commit-Messages#commit-title)
113
- [Include a release note annotation](https://github.com/cockroachdb/cockroach/wiki/Git-Commit-Messages#release-note), in the right position
114
- [Use the imperative mood in the subject line](https://github.com/cockroachdb/cockroach/wiki/Git-Commit-Messages#commit-title)
115
- [Keep the commit title concise but information-rich](https://github.com/cockroachdb/cockroach/wiki/Git-Commit-Messages#commit-title)
116
- [Wrap the body at some consistent width under 100 characters](https://github.com/cockroachdb/cockroach/wiki/Git-Commit-Messages#commit-description)
120
- All contributors need to sign the [Contributor License
121
Agreement](https://cla-assistant.io/cockroachdb/cockroach).
123
- Create a local feature branch to do work on, ideally on one thing at
124
a time. If you are working on your own fork, see [this
125
tip](http://blog.campoy.cat/2014/03/github-and-go-forking-pull-requests-and.html)
126
on forking in Go, which ensures that Go import paths will be
127
correct.
147
# Run a specific sql logic subtest
148
make test PKG=./pkg/sql TESTS='TestLogic$$/select$$'
153
Logs are disabled during tests by default. To enable them, include
154
`TESTFLAGS="-v -show-logs"` as an argument the test command:
155
156
```shell
157
make test ... TESTFLAGS="-v -show-logs"
158
```
159
169
and contain a substantial (but not overwhelming) unit of work. You may also
170
want to `git fetch origin` and run
179
- Then [create a pull request using GitHub’s
180
UI](https://help.github.com/articles/creating-a-pull-request). If
181
you know of another GitHub user particularly suited to reviewing
182
your pull request, be sure to mention them in the pull request
183
body. If you possess the necessary GitHub privileges, please also
184
[assign them to the pull request using GitHub's
185
UI](https://help.github.com/articles/assigning-issues-and-pull-requests-to-other-github-users/).
188
- Address test failures and feedback by amending your commits. If your
189
change contains multiple commits, address each piece of feedback by
190
amending that commit to which the particular feedback is aimed. Wait
191
(or ask) for new feedback on those commits if they are not
192
straightforward. An `LGTM` ("looks good to me") by someone qualified
193
is usually posted when you're free to go ahead and merge. Most new
194
contributors aren't allowed to merge themselves; in that case, we'll
195
do it for you.
201
- the [net/trace](https://godoc.org/golang.org/x/net/trace) endpoint
202
at `/debug/requests`. It has a breakdown of the recent traced
203
requests, in particularly slow ones. Two families are traced: `node`
204
and `coord`, the former (and likely more interesting one) containing
205
what happens inside of `Node`/`Store`/`Replica` and the other inside
206
of the coordinator (`TxnCoordSender`).
207
- [pprof](https://golang.org/pkg/net/http/pprof/) gives us (among
208
other things) heap and cpu profiles; [this wiki page](https://github.com/cockroachdb/cockroach/wiki/pprof)
209
gives an overview and walks you through using it to profile Cockroach.
210
[This golang blog post](http://blog.golang.org/profiling-go-programs)
211
explains it extremely well and [this one by Dmitry
212
Vuykov](https://software.intel.com/en-us/blogs/2014/05/10/debugging-performance-issues-in-go-programs)
219
make acceptance TESTS='TestPut$$' TESTFLAGS='-v -d 1200s -l .' TESTTIMEOUT=1210s
220
```
221