hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tsz Wo Nicholas Sze (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-9959) add log when block removed from last live datanode
Date Sat, 19 Mar 2016 01:28:33 GMT

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

Tsz Wo Nicholas Sze commented on HDFS-9959:
-------------------------------------------

> ... We don't want to keep more state in the NN than necessary. Also access to missingBlocks
needs to be synchronized in some way.  I am not sure this is worth the effort and risk, tbh.

The missing block info seems useful as [~zhaoyunjiong] described.  How about implementing
the logging using a ThreadLocal variable?  For example, we may add the following static class
to BlocksMap and then call init() and log(..) outside the lock.
{code}
//BlocksMap
  /** For logging missing blocks */
  static class MissingBlockLog {
    private static final ThreadLocal<List<Block>> missingBlocks4Logging = new
ThreadLocal<>(); 

    static void init() {
      missingBlocks4Logging.set(new LinkedList<Block>());
    }
    
    static void add(Block b) {
      final List<Block> missing = missingBlocks4Logging.get();
      if (missing != null) {
        missing.add(b);
      }
    }
    
    static void log(Object name) {
      final List<Block> missing = missingBlocks4Logging.get();
      missingBlocks4Logging.set(null);

      final int size = missing.size();
      if (size > 0) {
        NameNode.blockStateChangeLog.warn("After removed " + name
            + ", no live nodes contain the following " + size + " blocks: "
            + missing);
      }
    }
  }
{code}


> 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.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)

Mime
View raw message