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