Overview

  1. Pick an issue to work on. If you don't have a specific itch to scratch, some possibilities are marked with the low-hanging fruit label in JIRA. 2. Read the relevant parts of Architecture Internals; other resources include the following videos: DataStax Deep Dives into Apache Cassandra internals, Planet Cassandra videos such as this Summit 2013 talk, and Cassandra user group videos like this one from Austin Cassandra. 3. Check if someone else has already created an ticket for the change you have in mind in the issue tracker. 4. If not, create a ticket describing the change you're proposing in the issue tracker. 5. When you're ready to start working on the ticket, if it has not yet been assigned, assign the ticket to yourself in JIRA. This is done using the "Assign" button at the top of the ticket. 6. Clone the latest version of the source code:

Testing and Coverage

There are two major sets of tests for Cassandra: unit tests and dtests. The unit tests are part of the Cassandra repository; dtests are functional tests that are available at https://github.com/riptano/cassandra-dtest.

Running the Unit Tests

Run ant test from the top-level directory of your Cassandra checkout to run all unit tests. To run a specific test class, run ant -Dtest.name=<ClassName>. In this case, ClassName should not be fully qualified. For example, it might be StorageProxyTest. To run a specific test method, run ant testsome -Dtest.name=<ClassName> -Dtest.methods=<comma-separated list of method names>. When using the testsome command, ClassName should be a fully qualified name (like org.apache.cassandra.service.StorageProxyTest).

You can also run tests in parallel: ant test -Dtest.runners=4.

Running the dtests

The dtests use CCM to test a local cluster. If the following instructions don't seem to work, you may find more current instructions in the dtest repository.

  1. Install CCM. You can do this with pip by running pip install ccm.
  2. Install nosetests. With pip, this is pip install nose.
  3. Install Cassandra Python driver. This can be installed using pip install git+git://github.com/datastax/python-driver@cassandra-test. This installs a dedicated test branch driver for new features. If you're working primarily on older versions, pip install cassandra-test may be sufficient.
  4. Clone the dtest repository:
  5. Set $CASSANDRA_DIR to the location of your cassandra checkout. For example: export CASSANDRA_DIR=/home/joe/cassandra. Make sure you've already built Cassandra in this directory. You can build Cassandra by running ant.
  6. Run all tests by running nosetests from the dtest checkout. You can run a specific module like so: nosetests cql_tests.py. You can run a specific test method like this: nosetests cql_tests.py:TestCQL.counters_test.

Running the code coverage task

  1. Run a basic coverage report of unit tests using ant codecoverage.
  2. Alternatively, run any test task with ant jacoco-run -Dtaskname=some_test_taskname. Run more test tasks in this fashion to push more coverage data onto the report in progress. Then manually build the report with ant jacoco-report (the codecoverage task shown above does this automatically).
  3. View the report at build/jacoco/index.html.
  4. When done, clean up JaCoCo data so it doesn't confuse your next coverage report: ant jacoco-cleanup.

Continuous integration

Jenkins runs the Cassandra tests continuously: http://cassci.datastax.com/. For frequent contributors, this Jenkins is set up to build branches from their GitHub repositories. It is likely that your reviewer will use this Jenkins instance to run tests for your patch.

IDE

Most Cassandra developers use an IDE. Instructions to use IntelliJ IDEA or Eclipse for Cassandra development are available.

Committing

Got commit access? Outstanding! Here are the conventions we follow.

Commit messages take the form of

<explanation>

patch by <author>; reviewed by <committer> for CASSANDRA-<ticket>

When committing to multiple branches, start with the most-stable and merge forwards. For instance, if you had a fix to apply to 1.1, 1.2, and trunk, you would first commit to 1.1, and push changes. Then, switch to your 1.2 branch by doing

    git checkout cassandra-1.2
    git merge cassandra-1.1

If there are conflicts, resolve them and commit, followed by a push. Finally, switch to trunk by doing

    git checkout trunk

and run

    git merge cassandra-1.2

again resolve conflicts if the exist, and commit and push.

See http://www.youtube.com/watch?v=AJ-CpGsCpM0 for an in-depth explanation of why fixes should be merged forwards from more-stable branches, rather than backported from trunk.

This workflow also makes it so git knows what commits have been made to earlier branches but not to trunk: if you forget to merge a fix immediately, the next time someone goes to merge from the branch, git will incorporate the forgotten ones too.

Bundled Drivers

A copy of the Python driver is included for use in cqlsh. For instructions on how to package the bundled driver for the Cassandra project, see the instructions here.

https://c.statcounter.com/9397521/0/fe557aad/1/|stats