hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adarsh Sharma <adarsh.sha...@orkash.com>
Subject Re: How to apply Patch
Date Thu, 31 Mar 2011 06:37:55 GMT
Thanks a lot for such deep explanation :

I have done it now, but it doesn't help me in my original problem for 
which I'm doing this.

Please if you have some idea comment on it. I attached the problem.

Thanks & best Regards,
Adarsh Sharma

Matthew Foley wrote:
> 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

View raw message