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()
|
* @see java.util.concurrent.Callable#call()
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public Result [] call() throws IOException {
|
public Result [] call() throws IOException {
|
||||||
if (closed) {
|
if (closed) {
|
||||||
if (scannerId != -1) {
|
if (scannerId != -1) {
|
||||||
|
@ -199,7 +200,8 @@ public class ScannerCallable extends RegionServerCallable<Result[]> {
|
||||||
updateResultsMetrics(rrs);
|
updateResultsMetrics(rrs);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
if (logScannerActivity) {
|
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;
|
IOException ioe = e;
|
||||||
if (e instanceof RemoteException) {
|
if (e instanceof RemoteException) {
|
||||||
|
|
|
@ -2707,8 +2707,7 @@ public class HRegionServer implements ClientProtos.ClientService.BlockingInterfa
|
||||||
protected long addScanner(RegionScanner s) throws LeaseStillHeldException {
|
protected long addScanner(RegionScanner s) throws LeaseStillHeldException {
|
||||||
long scannerId = -1;
|
long scannerId = -1;
|
||||||
while (true) {
|
while (true) {
|
||||||
scannerId = rand.nextLong();
|
scannerId = Math.abs(rand.nextLong() << 24) ^ startcode;
|
||||||
if (scannerId == -1) continue;
|
|
||||||
String scannerName = String.valueOf(scannerId);
|
String scannerName = String.valueOf(scannerId);
|
||||||
RegionScannerHolder existing = scanners.putIfAbsent(scannerName, new RegionScannerHolder(s));
|
RegionScannerHolder existing = scanners.putIfAbsent(scannerName, new RegionScannerHolder(s));
|
||||||
if (existing == null) {
|
if (existing == null) {
|
||||||
|
|
Loading…
Reference in New Issue