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

Logic errror causes infinite loop in HRegion.bulkLoadHFiles(List)

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      the wrong logic is here:
      when a ColumnFamily does not exist, it gets a null store object, then ioes.add(ioe); failures.add(p)
      but the code below, if (failures.size() != 0), it prints a warn log and return false, so it will never go into the code if (ioes.size() != 0) below, and IOException will not be thrown, then the client will keep retry forever.
      there is the same situation when doing store.assertBulkLoadHFileOk, if any WrongRegionException is caught and failures.add(p), then all the other IOException thrown by assertBulkLoadHFileOk will be ignored.

      so i think if (failures.size() != 0) {} should be dealt with after if (ioes.size() !=0) {}

      for (Pair<byte[], String> p : familyPaths) {
          byte[] familyName = p.getFirst();
          String path = p.getSecond();
      
          Store store = getStore(familyName);
          if (store == null) {
              IOException ioe = new DoNotRetryIOException(
                      "No such column family " + Bytes.toStringBinary(familyName));
              ioes.add(ioe);
              failures.add(p);
          } else {
              try {
                  store.assertBulkLoadHFileOk(new Path(path));
              } catch (WrongRegionException wre) {
                  // recoverable (file doesn't fit in region)
                  failures.add(p);
              } catch (IOException ioe) {
                  // unrecoverable (hdfs problem)
                  ioes.add(ioe);
              }
          }
      }
      
      
      // validation failed, bail out before doing anything permanent.
      if (failures.size() != 0) {
          StringBuilder list = new StringBuilder();
          for (Pair<byte[], String> p : failures) {
              list.append("\n").append(Bytes.toString(p.getFirst())).append(" : ")
                  .append(p.getSecond());
          }
          // problem when validating
          LOG.warn("There was a recoverable bulk load failure likely due to a" +
                  " split.  These (family, HFile) pairs were not loaded: " + list);
          return false;
      }
      
      // validation failed because of some sort of IO problem.
      if (ioes.size() != 0) {
          LOG.error("There were IO errors when checking if bulk load is ok.  " +
                  "throwing exception!");
          throw MultipleIOException.createIOException(ioes);
      }
      

      Attachments

        1. 8192.txt
          2 kB
          Chenghao Jiang
        2. 8192-94-v8.patch
          4 kB
          Jonathan Hsieh
        3. 8192-v2-with-a-test-case.txt
          4 kB
          Chenghao Jiang
        4. 8192-v3-with-a-test-case.txt
          4 kB
          Chenghao Jiang
        5. 8192-v4-with-a-test-case.txt
          4 kB
          Chenghao Jiang
        6. 8192-v5-with-a-test-case.txt
          4 kB
          Chenghao Jiang
        7. 8192-v6-with-a-test-case.txt
          4 kB
          Chenghao Jiang
        8. 8192-v7-with-a-test-case.txt
          4 kB
          Ted Yu
        9. 8192-v8-with-a-test-case.txt
          4 kB
          Chenghao Jiang

        Activity

          People

            cythelia Chenghao Jiang
            cythelia Chenghao Jiang
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: