Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-18273

hbase_rotate_log in hbase-daemon.sh script not working for some JDK

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • 1.2.6, 1.1.11, 2.0.0-alpha-1
    • None
    • None
    • None

    Description

      When restarting a hbase process, hbase_rotate_log $HBASE_LOGGC will rotate GC logs.
      the code looks like this,

      if [ -f "$log" ]; then # rotate logs
      while [ $num -gt 1 ]; do
      prev=`expr $num - 1`
      [ -f "$log.$prev" ] && mv -f "$log.$prev" "$log.$num"
      num=$prev
      done

      But, some version JDK will add a suffix (.0) to the gc file, like hbase-xxx.gc.0, rather than hbase-xxx.gc.

      So I add a check before rotate,

      if [ ! -f "$log" ]; then #for some jdk, gc log has a postfix 0
      if [ -f "$log.0" ]; then
      mv -f "$log.0" "$log";
      fi
      fi

      Attachments

        1. HBASE-18273.0.patch
          0.5 kB
          Fangyuan Deng
        2. HBASE-18273.1.patch
          0.5 kB
          Fangyuan Deng
        3. HBASE-18273.2.patch
          0.4 kB
          Fangyuan Deng

        Activity

          People

            whisper_deng Fangyuan Deng
            whisper_deng Fangyuan Deng
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: