Permalink
Newer
100644
216 lines (168 sloc)
8.33 KB
3
- [Prerequisites](#prerequisites)
4
- [Getting and Building](#getting-and-building)
5
- [Style Guide](#style-guide)
6
- [Code Review Workflow](#code-review-workflow)
7
- [Debugging](#debugging)
8
11
Before you start contributing, review these [basic
12
guidelines](https://www.cockroachlabs.com/docs/stable/contribute-to-cockroachdb.html)
13
on finding a project, determining its complexity, and learning what to
14
expect in your collaboration with the Cockroach Labs team.
16
If you *really* want to dig deep into our processes and mindset, you may also
17
want to peruse our extensive [first PR guide], which is part of our on-boarding for
18
new engineers.
19
23
24
- Either a working Docker install able to run GNU/Linux binaries
25
(e.g. Docker on Linux, macOS, Windows), so you can reuse our
26
pre-populated Docker image with all necessary development
27
dependencies; or
28
29
- The tools needed to build CockroachDB from scratch:
30
31
- A C++ compiler that supports C++11. Note that GCC prior to 6.0 doesn't
32
work due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48891
33
- The standard C/C++ development headers on your system.
34
- A Go environment with a recent 64-bit version of the toolchain. Note that
35
the Makefile enforces the specific version required, as it is updated
36
frequently.
37
- Git 1.9+
38
- Bash (4+ is preferred)
39
- GNU Make (3.81+ is known to work)
40
- CMake 3.1+
41
- Autoconf 2.68+
42
- Optional: NodeJS 6.x and Yarn 0.22.0+. Required when compiling protocol
43
buffers.
56
If you wish to reuse our builder image instead of installing all the
57
dependencies manually, prefix the `make` command with
58
`build/builder.sh`; for example `build/builder.sh make build`.
59
60
Note that the first time you run `make`, it can take some time to
61
download and install various dependencies. After running `make build`,
62
the `cockroach` executable will be in your current directory and can
63
be run as shown in the [README](README.md).
67
- The default binary contains core open-source functionally covered by
68
the Apache License 2 (APL2) and enterprise functionality covered by
69
the CockroachDB Community License (CCL). To build a pure open-source
70
(APL2) version excluding enterprise functionality, use `make
71
buildoss`. See this [blog post] for more details.
72
73
[blog post]: https://www.cockroachlabs.com/blog/how-were-building-a-business-to-last/
75
- If you edit a `.proto` or `.ts` file, you will need to manually
76
regenerate the associated `.pb.{go,cc,h}` or `.js` files using `make
77
generate`.
79
- You can also run `build/builder.sh make generate` from the
80
repository root to get the intended result.
84
- To add or update a Go dependency:
85
- See [`build/README.md`](build/README.md) for details on adding or updating
86
dependencies.
96
- All contributors need to sign the [Contributor License
97
Agreement](https://cla-assistant.io/cockroachdb/cockroach).
99
- Create a local feature branch to do work on, ideally on one thing at
100
a time. If you are working on your own fork, see [this
101
tip](http://blog.campoy.cat/2014/03/github-and-go-forking-pull-requests-and.html)
102
on forking in Go, which ensures that Go import paths will be
103
correct.
123
# Run a specific sql logic subtest
124
make test PKG=./pkg/sql TESTS='TestLogic$$/select$$'
129
Logs are disabled during tests by default. To enable them, include
130
`TESTFLAGS="-v -show-logs"` as an argument the test command:
131
132
```shell
133
make test ... TESTFLAGS="-v -show-logs"
134
```
135
136
When you're ready to commit, be sure to write a Good Commit Message™. Consult
137
https://github.com/erlang/otp/wiki/Writing-good-commit-messages if you're
138
not sure what constitutes a Good Commit Message™.
139
In addition to the general rules referenced above, please also prefix your
140
commit subject line with the affected package, if one can easily be chosen.
141
For example, the subject line of a commit mostly affecting the
142
`server/serverpb` package might read: "server/serverpb: made great again".
143
Commits which affect many packages as a result of a shared dependency change
144
should probably begin their subjects with the name of the shared dependency.
145
Finally, some commits may need to affect many packages in a way which does
146
not point to a specific package; those commits may begin with "*:" or "all:"
147
to indicate their reach.
158
and contain a substantial (but not overwhelming) unit of work. You may also
159
want to `git fetch origin` and run
168
- Then [create a pull request using GitHub’s
169
UI](https://help.github.com/articles/creating-a-pull-request). If
170
you know of another GitHub user particularly suited to reviewing
171
your pull request, be sure to mention them in the pull request
172
body. If you possess the necessary GitHub privileges, please also
173
[assign them to the pull request using GitHub's
174
UI](https://help.github.com/articles/assigning-issues-and-pull-requests-to-other-github-users/).
177
- Address test failures and feedback by amending your commits. If your
178
change contains multiple commits, address each piece of feedback by
179
amending that commit to which the particular feedback is aimed. Wait
180
(or ask) for new feedback on those commits if they are not
181
straightforward. An `LGTM` ("looks good to me") by someone qualified
182
is usually posted when you're free to go ahead and merge. Most new
183
contributors aren't allowed to merge themselves; in that case, we'll
184
do it for you.
190
- the [net/trace](https://godoc.org/golang.org/x/net/trace) endpoint
191
at `/debug/requests`. It has a breakdown of the recent traced
192
requests, in particularly slow ones. Two families are traced: `node`
193
and `coord`, the former (and likely more interesting one) containing
194
what happens inside of `Node`/`Store`/`Replica` and the other inside
195
of the coordinator (`TxnCoordSender`).
196
- [pprof](https://golang.org/pkg/net/http/pprof/) gives us (among
197
other things) heap and cpu profiles; [this golang blog
198
post](http://blog.golang.org/profiling-go-programs) explains it
199
extremely well and [this one by Dmitry
200
Vuykov](https://software.intel.com/en-us/blogs/2014/05/10/debugging-performance-issues-in-go-programs)
207
make acceptance TESTS='TestPut$$' TESTFLAGS='-v -d 1200s -l .' TESTTIMEOUT=1210s
208
```
209