How to debug cockroachdb source code?

Hi, everyone,
I want to learn crdb source code, but i found it’s not an easy thing!
So I want to know how the developers debug crdb source code?

Hello! We’re really happy you’re interested in digging into the code!

We have a couple resources for getting started:
At a high level, how the system works is documents a bit at https://www.cockroachlabs.com/docs/stable/architecture/overview.html
Understanding what’s going on helps when it comes to working though the actual code.

When it comes to the code, the first pr document talks a bit about about the layout and style of the codebase, where to find other docs and resources, etc. It’s focused on how to craft and submit a patch, but includes lots of general information about the code that might be needed to do so: https://github.com/cockroachdb/cockroach/blob/master/docs/first-pr.md

Similarly, there are a couple guided examples of making a change in the code that show where certain steps happen and how to change them. The two we have so far are focused on the SQL features/functionality: https://github.com/cockroachdb/cockroach/tree/master/docs/codelabs

If you have specific places where you get stuck though, we’d love to improve our docs here, as it helps everyone jump in and contribute, so please let us know as you go where we can help!

1 Like

Thx, it seems use log to trace code is the common way.