HBASE-14822; addendum - handle callSeq.

This commit is contained in:
Lars Hofhansl 2015-12-24 12:55:39 -08:00
parent a1a19d9405
commit dfada43e90
2 changed files with 12 additions and 1 deletions

View File

@ -2518,9 +2518,12 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
}
assert scanner != null;
if (request.hasRenew() && request.getRenew()) {
rsh = scanners.get(scannerName);
lease = regionServer.leases.removeLease(scannerName);
if (lease != null && scanners.containsKey(scannerName)) {
if (lease != null && rsh != null) {
regionServer.leases.addLease(lease);
// Increment the nextCallSeq value which is the next expected from client.
rsh.incNextCallSeq();
}
return builder.build();
}

View File

@ -26,10 +26,13 @@ import java.util.Arrays;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.CompatibilityFactory;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.ipc.MetricsHBaseServerSource;
import org.apache.hadoop.hbase.test.MetricsAssertHelper;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.junit.After;
@ -41,6 +44,8 @@ import org.junit.experimental.categories.Category;
@Category(LargeTests.class)
public class TestLeaseRenewal {
public MetricsAssertHelper HELPER = CompatibilityFactory.getInstance(MetricsAssertHelper.class);
final Log LOG = LogFactory.getLog(getClass());
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static byte[] FAMILY = Bytes.toBytes("testFamily");
@ -121,5 +126,8 @@ public class TestLeaseRenewal {
assertFalse(rs.renewLease());
rs.close();
table.close();
MetricsHBaseServerSource serverSource = TEST_UTIL.getMiniHBaseCluster().getRegionServer(0)
.getRpcServer().getMetrics().getMetricsSource();
HELPER.assertCounter("exceptions.OutOfOrderScannerNextException", 0, serverSource);
}
}