private RegionScannerHolder addScanner(String scannerName, RegionScanner s, Shipper shipper, HRegion r, boolean needCursor) throws LeaseStillHeldException { Lease lease = regionServer.leases.createLease(scannerName, this.scannerLeaseTimeoutPeriod, new ScannerListener(scannerName)); RpcCallback shippedCallback = new RegionScannerShippedCallBack(scannerName, shipper, lease); RpcCallback closeCallback; if (s instanceof RpcCallback) { closeCallback = (RpcCallback) s; } else { closeCallback = new RegionScannerCloseCallBack(s); } RegionScannerHolder rsh = new RegionScannerHolder(scannerName, s, r, closeCallback, shippedCallback, needCursor); RegionScannerHolder existing = scanners.putIfAbsent(scannerName, rsh); assert existing == null : "scannerId must be unique within regionserver's whole lifecycle! " + scannerName; return rsh; }
long addScanner(RegionScanner s, Region r) throws LeaseStillHeldException { long scannerId = this.scannerIdGen.incrementAndGet(); String scannerName = String.valueOf(scannerId); RegionScannerHolder existing = scanners.putIfAbsent(scannerName, new RegionScannerHolder(s, r)); assert existing == null : "scannerId must be unique within regionserver's whole lifecycle!"; regionServer.leases.createLease(scannerName, this.scannerLeaseTimeoutPeriod, new ScannerListener(scannerName)); return scannerId; }
protected long addScanner(RegionScanner s) throws LeaseStillHeldException { long scannerId = -1L; scannerId = rand.nextLong(); String scannerName = String.valueOf(scannerId); scanners.put(scannerName, s); this.leases.createLease(scannerName, new ScannerListener(scannerName)); return scannerId; }
protected long addRowLock(Integer r, HRegion region) throws LeaseStillHeldException { long lockId = -1L; lockId = rand.nextLong(); String lockName = String.valueOf(lockId); rowlocks.put(lockName, r); this.leases.createLease(lockName, new RowLockListener(lockName, region)); return lockId; }
long addScanner(RegionScanner s, HRegion r) throws LeaseStillHeldException { long scannerId = this.scannerIdGen.incrementAndGet(); String scannerName = String.valueOf(scannerId); RegionScannerHolder existing = scanners.putIfAbsent(scannerName, new RegionScannerHolder(s, r)); assert existing == null : "scannerId must be unique within regionserver's whole lifecycle!"; regionServer.leases.createLease(scannerName, this.scannerLeaseTimeoutPeriod, new ScannerListener(scannerName)); return scannerId; }
long addPScanner(PRegionScanner s, HRegion r) throws LeaseStillHeldException { long scannerId = this.scannerIdGen.incrementAndGet(); String scannerName = String.valueOf(scannerId); PRegionScannerHolder existing = pscanners.putIfAbsent(scannerName, new PRegionScannerHolder(s, r)); assert existing == null : "scannerId must be unique within regionserver's whole lifecycle!"; //todo: /* regionServer.leases.createLease(scannerName, this.scannerLeaseTimeoutPeriod, new ScannerListener(scannerName));*/ return scannerId; }
protected long addScanner(RegionScanner s, HRegion r) throws LeaseStillHeldException { long scannerId = this.scannerIdGen.incrementAndGet(); String scannerName = String.valueOf(scannerId); RegionScannerHolder existing = scanners.putIfAbsent(scannerName, new RegionScannerHolder(s, r)); assert existing == null : "scannerId must be unique within regionserver's whole lifecycle!"; this.leases.createLease(scannerName, this.scannerLeaseTimeoutPeriod, new ScannerListener(scannerName)); return scannerId; }
private void addScannerLeaseBack(Leases.Lease lease) { try { regionServer.leases.addLease(lease); } catch (LeaseStillHeldException e) { // should not happen as the scanner id is unique. throw new AssertionError(e); } }
protected long addScanner(RegionScanner s, HRegion r) throws LeaseStillHeldException { long scannerId = -1; while (true) { scannerId = Math.abs(rand.nextLong() << 24) ^ startcode; String scannerName = String.valueOf(scannerId); RegionScannerHolder existing = scanners.putIfAbsent(scannerName, new RegionScannerHolder(s, r)); if (existing == null) { this.leases.createLease(scannerName, this.scannerLeaseTimeoutPeriod, new ScannerListener(scannerName)); break; } } return scannerId; }
protected long addRowLock(Integer r, HRegion region) throws LeaseStillHeldException { String lockName = null; long lockId; do { lockId = nextLong(); lockName = String.valueOf(lockId); } while (rowlocks.putIfAbsent(lockName, r) != null); this.leases.createLease(lockName, this.rowLockLeaseTimeoutPeriod, new RowLockListener(lockName, region)); return lockId; }
protected long addScanner(RegionScanner s) throws LeaseStillHeldException { long scannerId = -1; while (true) { scannerId = rand.nextLong(); if (scannerId == -1) continue; String scannerName = String.valueOf(scannerId); RegionScannerHolder existing = scanners.putIfAbsent(scannerName, new RegionScannerHolder(s)); if (existing == null) { this.leases.createLease(scannerName, this.scannerLeaseTimeoutPeriod, new ScannerListener(scannerName)); break; } } return scannerId; }
/** * @param transactionId * @throws IOException */ public void beginTransaction(final long transactionId) throws IOException { checkClosing(); String key = String.valueOf(transactionId); if (transactionsById.get(key) != null) { TransactionState alias = getTransactionState(transactionId); if (alias != null) { alias.setStatus(Status.ABORTED); retireTransaction(alias); } LOG.error("Existing trasaction with id [" + key + "] in region [" + super.getRegionInfo().getRegionNameAsString() + "]"); throw new IOException("Already exiting transaction id: " + key); } TransactionState state = new TransactionState(transactionId, super.getLog().getSequenceNumber(), super.getRegionInfo()); state.setStartSequenceNumber(nextSequenceId.get()); List<TransactionState> commitPendingCopy = new ArrayList<TransactionState>(commitPendingTransactions); for (TransactionState commitPending : commitPendingCopy) { state.addTransactionToCheck(commitPending); } synchronized (transactionsById) { transactionsById.put(key, state); } try { transactionLeases.createLease(getLeaseId(transactionId), new TransactionLeaseListener(key)); } catch (LeaseStillHeldException e) { LOG.error("Lease still held for [" + key + "] in region [" + super.getRegionInfo().getRegionNameAsString() + "]"); throw new RuntimeException(e); } LOG.debug("Begining transaction " + key + " in region " + super.getRegionInfo().getRegionNameAsString()); maybeTriggerOldTransactionFlush(); }
/******************************************************* to support operations parquet related ***************************** * * @author wangxiaoyi * */ long addPScanner(RegionScanner s, HRegion r) throws LeaseStillHeldException { long scannerId = this.scannerIdGen.incrementAndGet(); String scannerName = String.valueOf(scannerId); RegionScannerHolder existing = scanners.putIfAbsent(scannerName, new RegionScannerHolder(s, r)); assert existing == null : "scannerId must be unique within regionserver's whole lifecycle!"; regionServer.leases.createLease(scannerName, this.scannerLeaseTimeoutPeriod, new ScannerListener(scannerName)); return scannerId; }