Skip to end of metadata
Go to start of metadata

This page describes the mechanics of how to contribute software to Apache Avro. For ideas about what you might contribute, please look in Avro's JIRA database.

Getting the source code

First of all, you need the Avro source code.

Get the source code on your local drive using SVN. Most development is done on the "trunk":

svn checkout avro-trunk

Making Changes

Before you start, send a message to the Avro developer mailing list, or file a bug report in JIRA. Describe your proposed changes and check that they fit in with what others are doing and have planned for the project. Be patient, it may take folks a while to understand your requirements.

Modify the source code and add some (very) nice features using your favorite IDE.

But take care about the following points

All Languages
  • Contributions should pass existing unit tests.
  • Contributions should document public facing APIs.
  • Contributions should add new tests to demonstrate bug fixes or test new features.
  • All public classes and methods should have informative Javadoc comments.
    • Do not use @author tags.
  • Code should be formatted according to Sun's conventions, with one exception:
    • Indent two spaces per level, not four.
  • JUnit is our test framework:
    • You must implement a class whose class name starts with Test.
  • Define methods within your class and tag them with the @Test annotation. Call JUnit's many assert methods to verify conditions; these methods will be executed when you run mvn test.
  • By default, do not let tests write any temporary files to /tmp. Instead, the tests should write to the location specified by the test.dir system property.
  • Place your class in the src/test/java/ tree.
  • You can run all the unit tests with the command mvn test, or you can run a specific unit test with the command mvn -Dtest=<class name, fully qualified or short name> test (for example mvn -Dtest=TestFoo test)

Generating a patch

Unit Tests

Please make sure that all unit tests succeed before constructing your patch and that no new compiler warnings are introduced by your patch. Each language has its own directory and test process.

> cd avro-trunk/lang/java
> mvn clean test
> cd avro-trunk/lang/py
> ant clean test
> cd avro-trunk/lang/py3
> ./ build test
> cd avro-trunk/lang/c
> ./ clean
> ./ test
> cd avro-trunk/lang/c++
> ./ clean test
> cd avro-trunk/lang/ruby
> gem install echoe
> rake clean test
> cd avro-trunk/lang/php
> ./ clean
> ./ test


Please also check the documentation.

> mvn compile 
> mvn javadoc:aggregate
> firefox target/site/apidocs/index.html

Examine all public classes you've changed to see that documentation is complete, informative, and properly formatted. Your patch must not generate any javadoc warnings.

Creating a patch

Check to see what files you have modified with:

svn stat

Add any new files with:

svn add src/.../
svn add src/.../

In order to create a patch, type:

svn diff > AVRO-1234.patch

This will report all modifications done on Avro sources on your local disk and save them into the AVRO-1234.patch file. Read the patch file.
Make sure it includes ONLY the modifications required to fix a single issue.

Please do not:

  • reformat code unrelated to the bug being fixed: formatting changes should be separate patches/commits.
  • comment out code that is now obsolete: just remove it.
  • insert comments around each change, marking the change: folks can use subversion to figure out what's changed and by whom.
  • make things public which are not required by end users.

Please do:

  • try to adhere to the coding style of files you edit;
  • comment code whose function or rationale is not obvious;
  • update documentation (e.g., package.html files, this wiki, etc.)
  • name the patch file after the JIRA – AVRO-<JIRA#>.patch

If you need to rename files in your patch:

  1. Write a shell script that uses 'svn mv' to rename the original files.
  2. Edit files as needed (e.g., to change package names).
  3. Create a patch file with 'svn diff --no-diff-deleted --notice-ancestry'.
  4. Submit both the shell script and the patch file.

This way other developers can preview your change by running the script and then applying the patch.

Applying a patch

To apply a patch either you generated or found from JIRA, you can issue

patch -p0 < AVRO-<JIRA#>.patch

if you just want to check whether the patch applies you can run patch with --dry-run option

patch -p0 --dry-run < AVRO-<JIRA#>.patch

If you are an Eclipse user, you can apply a patch by:

  1. Right click project name in Package Explorer
  2. Team -> Apply Patch

Contributing your work

Finally, patches should be ''attached'' to an issue report in JIRA via the '''Attach File''' link on the issue's Jira. Please add a comment that asks for a code review following our code review checklist. Please note that the attachment should be granted license to ASF for inclusion in ASF works (as per the Apache License).

When you believe that your patch is ready to be committed, select the '''Submit Patch''' link on the issue's Jira.

Folks should run tests before selecting '''Submit Patch'''. Tests should all pass. Javadoc should report '''no''' warnings or errors. Submitting patches that fail tests is frowned on (unless the failure is not actually due to the patch).

If your patch involves performance optimizations, they should be validated by benchmarks that demonstrate an improvement.

If your patch creates an incompatibility with the latest major release, then you must set the '''Incompatible change''' flag on the issue's Jira 'and' fill in the '''Release Note''' field with an explanation of the impact of the incompatibility and the necessary steps users must take.

If your patch implements a major feature or improvement, then you must fill in the '''Release Note''' field on the issue's Jira with an explanation of the feature that will be comprehensible by the end user.

Once you have submitted your patch, a committer should evaluate it within a few days and either: commit it; or reject it with an explanation.

Please be patient. Committers are busy people too. If no one responds to your patch after a few days, please make friendly reminders. Please incorporate other's suggestions into your patch if you think they're reasonable. Finally, remember that even a patch that is not committed is useful to the community.

Should your patch be rejected, select the '''Resume Progress''' on the issue's Jira, upload a new patch with necessary fixes, and then select the '''Submit Patch''' link again.

In many cases a patch may need to be updated based on review comments. In this case the updated patch should be re-attached to the Jira with the name name. Jira will archive the older version of the patch and make the new patch the active patch. This will enable a history of patches on the Jira. As stated above patch naming is generally AVRO-#.patch where AVRO-# is the id of the Jira issue.

Committers: for non-trivial changes, it is best to get another committer to review your patches before commit. Use Submit Patch link like other contributors, and then wait for a "+1" from another committer before committing. Please also try to frequently review things in the patch queue.

Committing Guidelines for committers

Apply the patch uploaded by the user. Edit the CHANGES.txt file, adding a description of the change, including the bug number it fixes. Add it to the appropriate section - BUGFIXES, IMPROVEMENTS, NEW FEATURES. Please follow the format in CHANGES.txt file. While adding an entry please add it to the end of a section. Use the same entry for the svn commit message.

Changes are normally committed to trunk first, then, if they're back-compatible, merged to a branch.

When you commit a change, resolve the issue in Jira. When resolving, always set the fix version and assign the issue. Set the fix version to either to the next minor release if the change is compatible and will be merged to that branch, or to the next major release if the change is incompatible and will only be committed to trunk. Assign the issue to the primary author of the patch. If the author is not in the list of project contributors, edit their Jira roles and make them an Avro contributor.

Jira Guidelines

Please comment on issues in Jira, making your concerns known. Please also vote for issues that are a high priority for you.

Please refrain from editing descriptions and comments if possible, as edits spam the mailing list and clutter Jira's "All" display, which is otherwise very useful. Instead, preview descriptions and comments using the preview button (on the right) before posting them. Keep descriptions brief and save more elaborate proposals for comments, since descriptions are included in Jira's automatically sent messages. If you change your mind, note this in a new comment, rather than editing an older comment. The issue should preserve this history of the discussion.

Stay involved

Contributors should join the Avro mailing lists. In particular, the commit list (to see changes as they are made), the dev list (to join discussions of changes) and the user list (to help others).

See Also

  • No labels