Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-10753

Method invocation in log can be replaced by variable because the variable's toString method contains more info

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 2.7.2
    • None
    • None

    Description

      Similar to the fix in HADOOP-6419, in file:

      hadoop-rel-release-2.7.2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/CorruptReplicasMap.java

      in line 76, the blk.getBlockName() method invocation is invoked on variable blk. "blk" is the class instance of Block.

      void addToCorruptReplicasMap(Block blk, DatanodeDescriptor dn,
            String reason, Reason reasonCode) {
      ...
      NameNode.blockStateChangeLog.info(
                "BLOCK NameSystem.addToCorruptReplicasMap: {} added as corrupt on "
                    + "{} by {} {}", blk.getBlockName(), dn, Server.getRemoteIp(),
                reasonText);
      

      In file: hadoop-rel-release-2.7.2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/Block.java

        @Override
        public String toString() {
          return getBlockName() + "_" + getGenerationStamp();
        }
      

      The toString() method contain not only getBlockName() but also getGenerationStamp which may be helpful for debugging purpose. Therefore blk.getBlockName() can be replaced by blk

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              chenfsd Nemo Chen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: