hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Taylor (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HBASE-16503) Delay in preScannerNext > rpcTimeout causes scan to fail
Date Thu, 25 Aug 2016 15:48:21 GMT
James Taylor created HBASE-16503:

             Summary: Delay in preScannerNext > rpcTimeout causes scan to fail
                 Key: HBASE-16503
                 URL: https://issues.apache.org/jira/browse/HBASE-16503
             Project: HBase
          Issue Type: Bug
    Affects Versions: 0.98.21
            Reporter: James Taylor

In HBase 0.98, a delay in the preScannerNext coprocessor hook of greater than the RPC timeout
causes the scan to fail. This can happen in Phoenix when a large aggregate is performed without
statistics enabled, in which case the work is done during preScannerNext. The same test works
fine in HBase 1.1.

package org.apache.hadoop.hbase.client.coprocessor;

import static org.junit.Assert.assertNull;

import java.io.IOException;
import java.util.List;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.client.HConnection;
import org.apache.hadoop.hbase.client.HConnectionManager;
import org.apache.hadoop.hbase.client.HTableInterface;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.SimpleRegionObserver;
import org.apache.hadoop.hbase.regionserver.InternalScanner;
import org.junit.Test;

public class TestDelayPreScannerNext {
    private static final long RPC_TIMEOUT = 2000;
    private static final String TABLE_NAME = "foo";
    public void testPreScannerNextDelayCausesScanToFail() throws Exception {
        Configuration conf = HBaseConfiguration.create();
        conf.setLong("hbase.rpc.timeout", RPC_TIMEOUT);
        HBaseTestingUtility utility = new HBaseTestingUtility(conf);
        HTableDescriptor desc = utility.createTableDescriptor(TABLE_NAME);
        utility.createTable(desc, new byte[][]{});
        HConnection connection = HConnectionManager.createConnection(conf);
        HTableInterface table = connection.getTable(TABLE_NAME);
        ResultScanner scanner = table.getScanner(new Scan());
    public static class DelayPreScannerNextRegionObserver extends SimpleRegionObserver {
        public boolean preScannerNext(final ObserverContext<RegionCoprocessorEnvironment>
                final InternalScanner s, final List<Result> results,
                final int limit, final boolean hasMore) throws IOException {
            try {
                Thread.sleep(RPC_TIMEOUT * 2);
            } catch (InterruptedException e) {
                throw new IOException(e);
            return super.preScannerNext(c, s, results, limit, hasMore);

This message was sent by Atlassian JIRA

View raw message