[ 
https://issues.apache.org/jira/browse/HDFS-9959?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

yunjiong zhao updated HDFS-9959:
--------------------------------
    Attachment: HDFS-9959.3.withtest.patch
                HDFS-9959.3.patch

Update patch according to the comments.
I use below code to do a test, but I'm not sure whether I should add this test 
case since I verify it manually on the output, let me know that we can mock 
logger. So I added two patches, one with test case, one didn't.
{code}
  @Test
  public void testMissingBlockLog () {
    BlocksMap.MissingBlockLog.init();
    for (Long l = 1l; l < 32L; l++) {
      BlocksMap.MissingBlockLog.add(new Block(l));
    }
    BlocksMap.MissingBlockLog.log(new DatanodeID("127.0.0.1", "localhost",
        "uuid-9959", 9959, 9960, 9961, 9962));
  }
{code}

And the output which this test case generated is like below:
{quote}
$cat org.apache.hadoop.hdfs.server.blockmanagement.TestBlocksMap-output.txt
2016-03-22 11:34:25,758 [main] WARN  BlockStateChange (BlocksMap.java:log(73)) 
- After removed 127.0.0.1:9959, no live nodes contain the following 10 blocks: 
blk_1_0 blk_2_0 blk_3_0 blk_4_0 blk_5_0 blk_6_0 blk_7_0 blk_8_0 blk_9_0 blk_10_0
2016-03-22 11:34:25,761 [main] WARN  BlockStateChange (BlocksMap.java:log(73)) 
- After removed 127.0.0.1:9959, no live nodes contain the following 10 blocks: 
blk_11_0 blk_12_0 blk_13_0 blk_14_0 blk_15_0 blk_16_0 blk_17_0 blk_18_0 
blk_19_0 blk_20_0
2016-03-22 11:34:25,761 [main] WARN  BlockStateChange (BlocksMap.java:log(73)) 
- After removed 127.0.0.1:9959, no live nodes contain the following 10 blocks: 
blk_21_0 blk_22_0 blk_23_0 blk_24_0 blk_25_0 blk_26_0 blk_27_0 blk_28_0 
blk_29_0 blk_30_0
2016-03-22 11:34:25,761 [main] WARN  BlockStateChange (BlocksMap.java:log(81)) 
- After removed 127.0.0.1:9959, no live nodes contain the following 1 blocks: 
blk_31_0
{quote}
Thanks.

> add log when block removed from last live datanode
> --------------------------------------------------
>
>                 Key: HDFS-9959
>                 URL: https://issues.apache.org/jira/browse/HDFS-9959
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: namenode
>            Reporter: yunjiong zhao
>            Assignee: yunjiong zhao
>            Priority: Minor
>         Attachments: HDFS-9959.1.patch, HDFS-9959.2.patch, HDFS-9959.3.patch, 
> HDFS-9959.3.withtest.patch, HDFS-9959.patch
>
>
> Add logs like "BLOCK* No live nodes contain block blk_1073741825_1001, last 
> datanode contain it is node: 127.0.0.1:65341" in BlockStateChange should help 
> to identify which datanode should be fixed first to recover missing blocks.



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

Reply via email to