Hi Adarsh, see if the information at http://wiki.apache.org/hadoop/HowToContribute is helpful to you. I'll walk you thru the typical process, but first a couple questions:
Did you get a tar file for the whole source tree of Hadoop, or only the binary distribution? To apply patches you must get the source tree (usually from the Apache svn server), apply the patch, then re-build. Also, if you're just starting out, you might consider using a newer version like 0.22 instead of 0.20. And finally, is the patch you are looking at intended to work with v0.20.2? A patch targeted for 0.22 is only maybe 50% likely to work as intended with a v0.20 version. So, here's a sketch of how to apply a patch (to v0.20.2) and rebuild: Per the instructions at http://wiki.apache.org/hadoop/HowToContribute, create a directory for your hadoop projects, and from within that directory do: svn checkout http://svn.apache.org/repos/asf/hadoop/common/tags/release-0.20.2/ hadoop-0.20.2 In the same projects directory create a "patches" subdirectory (as a sibling to the "hadoop-0.20.2" subdirectory) and save the patch into it (perhaps from your browser while viewing the Jira) Now cd into the HADOOP_HOME directory: cd hadoop-0.20.2 Observe that it has subdirectories like build/, conf/, ivy/, and src/. Now apply the patch: patch -p 0 < ../patches/fix-test-pipes.patch Let's take a look at that last line: patch -p 0 < ../patches/fix-test-pipes.patch ^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | |_where you stored the patch file | | | |_the patch command is funny, you locate yourself at the root of | the source tree, then pipe the patch file contents into the "patch" | command. The target source directory name is not an argument. | |_this "-p 0" argument is generally applicable for patches generated the way we like to do patches in the hadoop dev community. Read the unix man page for "patch", and http://wiki.apache.org/hadoop/HowToContribute if you're interested. Now, re-build hadoop: ant veryclean compile bin-package Of course, that assumes you have installed ant and ivy. Each of those utilities have home pages that are very informative, along with the info on the above HowToContribute page. You can also look at the docs at http://hadoop.apache.org/common/docs/current/ You should now have all the pieces necessary to install and run the patched version of Hadoop. (The jars are in the "build" subdirectory in hadoop-0.20.2) In my experience it is always easier to get a vanilla system installed and running, and then overlay that installation with the new jars, rather than try to install from your build directory, but that's just my personal preference. If you want to work in v21 or higher, you'll have to deal with three hadoop subdirectories instead of one, and use the "ant -Dresolvers=internal mvn-install" invocation to get them to build the patch right across components. But in v20 the above should work fine. If you are going to work with Hadoop long term, you'll want an IDE like Eclipse. So web pages like http://wiki.apache.org/hadoop/EclipseEnvironment may be helpful. Hope this helps, --Matt On Mar 30, 2011, at 9:24 PM, Adarsh Sharma wrote: Thanks Harsh, I am trying the patch command but below error exists : [root@ws-test project]# patch hadoop-0.20.2 fix-test-pipes.patch patch: **** File hadoop-0.20.2 is not a regular file -- can't patch [root@ws-test project]# patch -R hadoop-0.20.2 fix-test-pipes.patch patch: **** File hadoop-0.20.2 is not a regular file -- can't patch [root@ws-test project]# patch -p hadoop-0.20.2 fix-test-pipes.patch patch: **** strip count hadoop-0.20.2 is not a number [root@ws-test project]# Best regards, Adarsh Harsh J wrote: There is a utility available for Unix called 'patch'. You can use that with a suitable -p(num) argument (man patch, for more info). On Thu, Mar 31, 2011 at 9:41 AM, Adarsh Sharma <adarsh.sha...@orkash.com<mailto:adarsh.sha...@orkash.com>> wrote: Dear all, Can Someone Please tell me how to apply a patch on hadoop-0.20.2 package. I attached the patch. Please find the attachment. I just follow below steps for Hadoop : 1. Download Hadoop-0.20.2.tar.gz 2. Extract the file. 3. Set Configurations in site.xml files Thanks & best Regards, Adarsh Sharma