HBASE-9821 Scanner id could collide
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1535198 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1280a4431f
commit
f4c98563b6
|
@ -146,6 +146,7 @@ public class ScannerCallable extends RegionServerCallable<Result[]> {
|
|||
/**
|
||||
* @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<Result[]> {
|
|||
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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue