[ 
https://issues.apache.org/jira/browse/HDFS-7284?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14971179#comment-14971179
 ] 

Yongjun Zhang commented on HDFS-7284:
-------------------------------------

Hi [~jojochuang],

It's important to have consistent block name appear in the log, so people can 
analyze the actions happened to a given block across the board by searching for 
the "blk_id_timestamp" or "blk_id".

I'd suggest adding the following code to Block.java:

{code}
  /**
   */
  public static String toString(final Block b) {
    return b.getBlockName() + "_" + b.getGenerationStamp();
  }
  
  /**
   */
  @Override
  public String toString() {
    return toString(this);
  }
{code}

and change the message you are working on to
{code}
     NameNode.blockStateChangeLog.debug("BLOCK* Removing stale replica {}"
                  + " of {}", r, Block.toString(r));
{code}

Hi [~andrew.wang], does this sound good to you? I think the replica state that 
comes with {{ReplicaUnderConstruction#toString}} would help debugging.

Thanks.


> Add more debug info to 
> BlockInfoUnderConstruction#setGenerationStampAndVerifyReplicas
> -------------------------------------------------------------------------------------
>
>                 Key: HDFS-7284
>                 URL: https://issues.apache.org/jira/browse/HDFS-7284
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: namenode
>    Affects Versions: 2.5.1
>            Reporter: Hu Liu,
>            Assignee: Wei-Chiu Chuang
>         Attachments: HDFS-7284.001.patch, HDFS-7284.002.patch
>
>
> When I was looking at some replica loss issue, I got the following info from 
> log
> {code}
> 2014-10-13 01:54:53,104 INFO BlockStateChange: BLOCK* Removing stale replica 
> from location x.x.x.x
> {code}
> I could just know that a replica is removed, but I don't know which block and 
> its timestamp. I need to know the id and timestamp of the block from the log 
> file.
> So it's better to add more info including block id and timestamp to the code 
> snippet
> {code}
>     for (ReplicaUnderConstruction r : replicas) {
>       if (genStamp != r.getGenerationStamp()) {
>         r.getExpectedLocation().removeBlock(this);
>         NameNode.blockStateChangeLog.info("BLOCK* Removing stale replica "
>             + "from location: " + r.getExpectedLocation());
>       }
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to