Permalink
Newer
100644
161 lines (126 sloc)
6.95 KB
14
```bash
15
go get -d github.com/cockroachdb/cockroach
16
cd $GOPATH/src/github.com/cockroachdb/cockroach
17
```
19
3. Run `make build`, `make test`, or anything else our Makefile offers. Note
20
that at least 4GB of RAM is required to build from source and run tests. Also,
21
the first time you run `make`, it can take some time to download and install
22
various dependencies.
24
Note that if you edit a `.proto` or `.ts` file, you will need to manually
25
regenerate the associated `.pb.{go,cc,h}` or `.js` files using `go generate
26
./...`.
28
We advise to run `go generate` using our embedded Docker setup.
29
`build/builder.sh` is a wrapper script designed to make this convenient. You can
30
run `build/builder.sh env SKIP_BOOTSTRAP=0 go generate ./...` from the repository
31
root to get the intended result.
33
If you want to run it outside of Docker, `go generate` requires a collection of
34
Node.js modules which are installed via npm.
39
40
- `(cd $GOPATH/src && go get -u ./...)` to update the dependencies or `go get
41
`({package}` to add a dependency
42
- `glock save github.com/cockroachdb/cockroach` to update the GLOCKFILE
43
- `go generate ./...` to update generated files -- prefer
44
`go generate ./the-updated-package` instead of `...` when possible to avoid
54
+ All contributors need to sign the [Contributor License Agreement]
55
(https://cla-assistant.io/cockroachdb/cockroach).
64
+ Hack away and commit your changes locally using `git add` and `git commit`.
65
Remember to write tests! The following are helpful for running specific
69
make test
70
# Run all tests in ./storage
71
make test PKG=./storage
72
# Run all kv tests matching `^TestFoo` with a timeout of 10s
73
make test PKG=./kv TESTS='^TestFoo' TESTTIMEOUT=10s
74
```
76
When you're ready to commit, be sure to write a Good Commit Message™. Consult
77
https://github.com/erlang/otp/wiki/Writing-good-commit-messages if you're
78
not sure what constitutes a Good Commit Message™.
79
In addition to the general rules referenced above, please also prefix your
80
commit subject line with the affected package, if one can easily be chosen.
81
For example, the subject line of a commit mostly affecting the
82
`server/serverpb` package might read: "server/serverpb: made great again".
83
Commits which affect many packages as a result of a shared dependency change
84
should probably begin their subjects with the name of the shared dependency.
85
Finally, some commits may need to affect many packages in a way which does
86
not point to a specific package; those commits may begin with "*:" or "all:"
87
to indicate their reach.
89
+ Run the whole CI test suite locally: `./build/circle-local.sh`. This requires
90
the Docker setup; if you don't have/want that,
93
+ When you’re ready for review, groom your work: each commit should pass tests
94
and contain a substantial (but not overwhelming) unit of work. You may also
95
want to `git fetch origin` and run
96
`git rebase -i --exec "make check test" origin/master` to make sure you're
97
submitting your changes on top of the newest version of our code. Next, push
103
(https://help.github.com/articles/creating-a-pull-request). If you know of
104
another GitHub user particularly suited to reviewing your pull request, be
105
sure to mention them in the pull request body. If you possess the necessary
106
GitHub privileges, please also [assign them to the pull request using
107
GitHub's UI] (https://help.github.com/articles/assigning-issues-and-pull-requests-to-other-github-users/).
108
This will help focus and expedite the code review process.
110
+ If you get a test failure in CircleCI, check the Test Failure tab to see why
111
the test failed. When the failure is logged in `excerpt.txt`, you can find
112
the file from the Artifacts tab and see log messages. (You need to sign in to
115
+ Address feedback by amending your commits. If your change contains multiple
116
commits, address each piece of feedback by amending that commit to which the
117
particular feedback is aimed. Wait (or ask) for new feedback on those
118
commits if they are not straightforward. An `LGTM` ("looks good to me") by
119
someone qualified is usually posted when you're free to go ahead and merge.
120
Most new contributors aren't allowed to merge themselves; in that case, we'll
122
123
### Debugging
124
125
Peeking into a running cluster can be done in several ways:
126
127
* the [net/trace](https://godoc.org/golang.org/x/net/trace) endpoint at
128
`/debug/requests`. It has a breakdown of the recent traced requests, in
129
particularly slow ones. Two families are traced: `node` and `coord`, the
130
former (and likely more interesting one) containing what happens inside of
131
`Node`/`Store`/`Replica` and the other inside of the coordinator
137
(https://software.intel.com/en-us/blogs/2014/05/10/debugging-performance-issues-in-go-programs)
138
goes into even more detail. Two caveats: the `cockroach` binary passed to
139
`pprof` must be the same as the one creating the profile (not true on OSX in
140
acceptance tests!), and the HTTP client used by `pprof` doesn't simply
141
swallow self-signed certs (relevant when using SSL). For the latter, a
143
144
```
145
go tool pprof cockroach <(curl -k https://$(hostname):26257/debug/pprof/profile)
146
```
152
153
```bash
154
make acceptance TESTS='TestPut$$' TESTFLAGS='-v -d 1200s -l .' TESTTIMEOUT=1210s
155
```
156
157
runs the `Put` acceptance test for 20 minutes with logging (useful to look at
158
the stacktrace in case of a node dying). When it starts, all the relevant
159
commands for `pprof`, `trace` and logs are logged to allow for convenient