Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hadoop >> mail # dev >> Which java code(file) generates the heartbeat from the datanode and which code(file) listen that heartbeat on the namenode?


Copy link to this message
-
Re: Which java code(file) generates the heartbeat from the datanode and which code(file) listen that heartbeat on the namenode?
No problem.  Glad to help.  :-)

In the last email, I mentioned the sendHeartbeat method in
NameNodeRpcServer.java.  This is the method that handles receiving a
heartbeat from a datanode.  Even though the method is named "send" instead
of "receive", this is the right place to look.  The reason is that this is
an implementation of a method defined in the DatanodeProtocol interface,
and the protocol's naming convention is from the perspective of the
datanode rather than the namenode.

Block placement decisions are encapsulated behind a BlockPlacementPolicy
interface.  Custom implementations are possible, and the default
implementation is BlockPlacementPolicyDefault.  You'll find code in there
that checks the network topology to decide where to place blocks.  These
files are in
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement.

--Chris
On Fri, Apr 12, 2013 at 3:08 AM, Mohammad Mustaqeem
<[EMAIL PROTECTED]>wrote:

> Chris, thank you :)
> I am using branch 2.
> Can you tell me which code receives the heartbeat?
> and which code selects the random rack for replication?
>
>
> On Fri, Apr 12, 2013 at 12:25 AM, Chris Nauroth <[EMAIL PROTECTED]
> >wrote:
>
> > Hello Mohammad,
> >
> > Which version of the codebase?
> >
> > If it's trunk or branch-2, then for the datanode side, I recommend
> starting
> > from
> >
> >
> hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java.
> >  Look for a method named sendHeartBeat.  On the namenode side, look at
> >
> >
> hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java.
> >  Look for a method named sendHeartbeat.  (Notice the slight difference in
> > capitalization of letter 'b'.)
> >
> > If it's a different branch, let me know, and I'd be happy to provide help
> > on the specifics of that branch.
> >
> > Hope this helps,
> > --Chris
> >
> >
> > On Wed, Apr 10, 2013 at 11:03 PM, Mohammad Mustaqeem <
> > [EMAIL PROTECTED]
> > > wrote:
> >
> > > Which java code(file) generates the heartbeat from the datanode and
> > > which code(file) listen that heartbeat on the namenode?
> > > --
> > > *With regards ---*
> > > *Mohammad Mustaqeem*,
> > > M.Tech (CSE)
> > > MNNIT Allahabad
> > > 9026604270
> > >
> >
>
>
>
> --
> *With regards ---*
> *Mohammad Mustaqeem*,
> M.Tech (CSE)
> MNNIT Allahabad
> 9026604270
>
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB