Something better to know when patch for Hadoop

You now want to contribute some codes to Apache Hadoop, surely there’s re something you might need to aware regarding to how to wrap your codes as a patch.

Open a JIRA

Assume you’re not working on a existing JIRA issue, you may need to open one before start coding stuff. You need a JIRA mainly because you need to document what you’re going to resolve and get some feedback and comments there, and also you need to name your patch, attach and submit your patch there too.

Code in the style

Make sure you’re writing the codes in right style. Check your codes by running:

mvn checkstyle:checkstyle

Write necessary unit tests

You may need to add your own unit test cases, or at least you may need to make sure you’re not breaking the existing ones. Ref. Unit tests development guidelines HowToDevelopUnitTests

Run your unit test case

Assuming you add a unit test case named TestYourPatch.java, you can run it only without being mixed with others by:

mvn -Dtest=TestYourPatch test

Debug your unit test case

Your patch failed with a unit test case! So how to debug it? You can launch the right test case in debug mode as follows, then remote debug it using your IDE.

mvn -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8001" -Dtest=TestYourPatch test

Update the document

You may need to update doc either in API level or user guide part. Check doc by running:

mvn javadoc:javadoc

Create a patch with the right name

Check the files list that should be included in your patch:

svn st

Get the right JIRA you’re working on and name your patch as:

HADOOP-1234.patch

Create the patch

svn diff > HADOOP-1234.patch

Test your patch

dev-support/test-patch.sh /path/to/my.patch

Attach your patch

Attach then your patch file to the JIRA, asking for code reviews.

Submit your patch

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

Reference

Note here’re just some quick points. May not enough so please read the official guide about HowToContribute when necessary.

Advertisements
This entry was posted in Apache, Development, Hadoop and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s