From f4c98563b6b2dcdfb59a9288252265e59edd7540 Mon Sep 17 00:00:00 2001 From: jxiang Date: Wed, 23 Oct 2013 22:18:42 +0000 Subject: [PATCH] HBASE-9821 Scanner id could collide git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1535198 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/hadoop/hbase/client/ScannerCallable.java | 4 +++- .../org/apache/hadoop/hbase/regionserver/HRegionServer.java | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java index 3f25fcb91dc..3c6b36a40df 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java @@ -146,6 +146,7 @@ public class ScannerCallable extends RegionServerCallable { /** * @see java.util.concurrent.Callable#call() */ + @SuppressWarnings("deprecation") public Result [] call() throws IOException { if (closed) { if (scannerId != -1) { @@ -199,7 +200,8 @@ public class ScannerCallable extends RegionServerCallable { updateResultsMetrics(rrs); } catch (IOException e) { if (logScannerActivity) { - LOG.info("Got exception making request " + TextFormat.shortDebugString(request), e); + LOG.info("Got exception making request " + TextFormat.shortDebugString(request) + + " to " + getLocation(), e); } IOException ioe = e; if (e instanceof RemoteException) { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index d746c79334c..8dd38276cc3 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -2707,8 +2707,7 @@ public class HRegionServer implements ClientProtos.ClientService.BlockingInterfa protected long addScanner(RegionScanner s) throws LeaseStillHeldException { long scannerId = -1; while (true) { - scannerId = rand.nextLong(); - if (scannerId == -1) continue; + scannerId = Math.abs(rand.nextLong() << 24) ^ startcode; String scannerName = String.valueOf(scannerId); RegionScannerHolder existing = scanners.putIfAbsent(scannerName, new RegionScannerHolder(s)); if (existing == null) {