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

Fix spotbugs warnings on branch-2

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      Dodgy code Warnings
      Code	Warning
      UC	Useless condition: it's known that major == true at this point
      Bug type UC_USELESS_CONDITION (click for details)
      In class org.apache.hadoop.hbase.mob.DefaultMobStoreCompactor
      In method org.apache.hadoop.hbase.mob.DefaultMobStoreCompactor.performCompaction(Compactor$FileDetails, InternalScanner, CellSink, long, boolean, ThroughputController, boolean, int)
      Value major == true
      Unreachable code at DefaultMobStoreCompactor.java:[line 210]
      At DefaultMobStoreCompactor.java:[line 210]
      

      https://github.com/apache/hbase/blob/afa9836b87f9c909ac4fc18d904a5b5b0a3dfff6/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java#L211

            if (major) {
              try {
                delFileWriter = mobStore.createDelFileWriterInTmp(new Date(fd.latestPutTs),
                  fd.maxKeyCount, major ? majorCompactionCompression : minorCompactionCompression,
                  store.getRegionInfo().getStartKey());
              } catch (IOException e) {
                LOG.warn(
                  "Failed to create del writer, "
                  + "we will continue the compaction by writing delete markers directly in store files",
                  e);
              }
            }
      

      The 'major ? majorCompactionCompression : minorCompactionCompression' is useless as we have a 'if (major)' test above.

      Attachments

        Issue Links

          Activity

            People

              xiaozhang Xiao Zhang
              zhangduo Duo Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: