Exemplo n.º 1
0
    synchronized void add(Range failedRange) {
      LOG.warn("FailedRange:" + failedRange);
      if (divide != null) {
        LOG.warn(
            "FailedRange:" + failedRange + "  test:" + divide.test + "  pass:" + divide.testPassed);
        if (divide.testPassed) {
          // test range passed
          // other range would be bad. test it
          failedRange = divide.other;
        } else {
          // test range failed
          // other range would be good.
          failedRange = divide.test;
        }
        // reset
        divide = null;
      }

      if (maxSkipRecords == 0 || failedRange.getLength() <= maxSkipRecords) {
        skipRanges.add(failedRange);
      } else {
        // start dividing the range to narrow down the skipped
        // records until maxSkipRecords are met OR all attempts
        // get exhausted
        divide = new Divide(failedRange);
      }
    }
Exemplo n.º 2
0
 Divide(Range range) {
   long half = range.getLength() / 2;
   test = new Range(range.getStartIndex(), half);
   other = new Range(test.getEndIndex(), range.getLength() - half);
   // construct the skip range from the skipRanges
   skipRange = new SortedRanges();
   for (Range r : skipRanges.getRanges()) {
     skipRange.add(r);
   }
   skipRange.add(new Range(0, test.getStartIndex()));
   skipRange.add(new Range(test.getEndIndex(), (Long.MAX_VALUE - test.getEndIndex())));
 }