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

Avoid using Math.abs when selecting SyncRunner in FSHLog

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.2, 1.2.0, 1.1.2, 1.3.0, 2.0.0
    • Fix Version/s: 1.2.0, 1.3.0, 1.0.3, 1.1.3, 2.0.0
    • Component/s: wal
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      FSHLog.java
      int index = Math.abs(this.syncRunnerIndex++) % this.syncRunners.length;
                try {
                  this.syncRunners[index].offer(sequence, this.syncFutures, this.syncFuturesCount);
                } catch (Exception e) {
                  // Should NEVER get here.
                  requestLogRoll();
                  this.exception = new DamagedWALException("Failed offering sync", e);
                }
      

      Math.abs will return Integer.MIN_VALUE if you pass Integer.MIN_VALUE in since the actual absolute value of Integer.MIN_VALUE is out of range.

      I think this.syncRunnerIndex++ will overflow eventually if we keep the regionserver running for enough time.

        Attachments

        1. HBASE-14759.patch
          4 kB
          Duo Zhang

          Activity

            People

            • Assignee:
              zhangduo Duo Zhang
              Reporter:
              zhangduo Duo Zhang
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: