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

Scan time limit not work if the filter always filter row key

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.0-alpha-1, 2.0.0-beta-2
    • 2.0.0-beta-2, 2.0.0
    • None
    • None

    Description

      https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java

      nextInternal() method.

      // Check if rowkey filter wants to exclude this row. If so, loop to next.
       // Technically, if we hit limits before on this row, we don't need this call.
       if (filterRowKey(current)) {
       incrementCountOfRowsFilteredMetric(scannerContext);
       // early check, see HBASE-16296
       if (isFilterDoneInternal()) {
       return scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
       }
       // Typically the count of rows scanned is incremented inside #populateResult. However,
       // here we are filtering a row based purely on its row key, preventing us from calling
       // #populateResult. Thus, perform the necessary increment here to rows scanned metric
       incrementCountOfRowsScannedMetric(scannerContext);
       boolean moreRows = nextRow(scannerContext, current);
       if (!moreRows) {
       return scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
       }
       results.clear();
       continue;
       }
      
      // Ok, we are good, let's try to get some results from the main heap.
       populateResult(results, this.storeHeap, scannerContext, current);
       if (scannerContext.checkAnyLimitReached(LimitScope.BETWEEN_CELLS)) {
       if (hasFilterRow) {
       throw new IncompatibleFilterException(
       "Filter whose hasFilterRow() returns true is incompatible with scans that must "
       + " stop mid-row because of a limit. ScannerContext:" + scannerContext);
       }
       return true;
       }
      
      

      If filterRowKey always return ture, then it skip to checkAnyLimitReached. For batch/size limit, it is ok to skip as we don't read anything. But for time limit, it is not right. If the filter always filter row key, we will stuck here for a long time.

      Attachments

        1. HBASE-19818.master.003.patch
          20 kB
          Guanghao Zhang
        2. HBASE-19818.branch-2.patch
          20 kB
          Guanghao Zhang

        Issue Links

          Activity

            People

              zghao Guanghao Zhang
              zghao Guanghao Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: