@Override public Result next() throws IOException { Result result = null; while (true) { if (currentRegionScanner == null) { currentRegion++; if (currentRegion >= regions.size()) { return null; } RegionInfo hri = regions.get(currentRegion); currentRegionScanner = new ClientSideRegionScanner(conf, fs, restoreDir, htd, hri, scan, scanMetrics); if (this.scanMetrics != null) { this.scanMetrics.countOfRegions.incrementAndGet(); } } try { result = currentRegionScanner.next(); if (result != null) { return result; } } finally { if (result == null) { currentRegionScanner.close(); currentRegionScanner = null; } } } }
@Override public boolean nextKeyValue() throws IOException, InterruptedException { boolean result = delegate.nextKeyValue(); if (result) { ScanMetrics scanMetrics = delegate.getScanner().getScanMetrics(); if (scanMetrics != null && context != null) { TableRecordReaderImpl.updateCounters(scanMetrics, 0, getCounter, context, 0); } } return result; }
public void close() { if (this.scanner != null) { this.scanner.close(); } } }
public boolean nextKeyValue() throws IOException { result = scanner.next(); if (result == null) { //we are done return false; } if (this.row == null) { this.row = new ImmutableBytesWritable(); } this.row.set(result.getRow()); return true; }
public void initialize(InputSplit split, Configuration conf) throws IOException { this.scan = TableMapReduceUtil.convertStringToScan(split.getScan()); this.split = split; TableDescriptor htd = split.htd; HRegionInfo hri = this.split.getRegionInfo(); FileSystem fs = FSUtils.getCurrentFileSystem(conf); // region is immutable, this should be fine, // otherwise we have to set the thread read point scan.setIsolationLevel(IsolationLevel.READ_UNCOMMITTED); // disable caching of data blocks scan.setCacheBlocks(false); scan.setScanMetricsEnabled(true); scanner = new ClientSideRegionScanner(conf, fs, new Path(split.restoreDir), htd, hri, scan, null); }
public ClientSideRegionScanner(Configuration conf, FileSystem fs, Path rootDir, TableDescriptor htd, RegionInfo hri, Scan scan, ScanMetrics scanMetrics) throws IOException { // region is immutable, set isolation level scan.setIsolationLevel(IsolationLevel.READ_UNCOMMITTED); htd = TableDescriptorBuilder.newBuilder(htd).setReadOnly(true).build(); // open region from the snapshot directory region = HRegion.newHRegion(FSUtils.getTableDir(rootDir, htd.getTableName()), null, fs, conf, hri, htd, null); // we won't initialize the MobFileCache when not running in RS process. so provided an // initialized cache. Consider the case: an CF was set from an mob to non-mob. if we only // initialize cache for MOB region, NPE from HMobStore will still happen. So Initialize the // cache for every region although it may hasn't any mob CF, BTW the cache is very light-weight. region.setMobFileCache(new MobFileCache(conf)); region.initialize(); // create an internal region scanner this.scanner = region.getScanner(scan); values = new ArrayList<>(); if (scanMetrics == null) { initScanMetrics(scan); } else { this.scanMetrics = scanMetrics; } region.startRegionOperation(); }
@Override public void close() { if (currentRegionScanner != null) { currentRegionScanner.close(); } // if snapshotAlreadyRestored is true, then we should invoke cleanup() method by hand. if (!this.snapshotAlreadyRestored) { cleanup(); } }
public boolean nextKeyValue() throws IOException { result = scanner.next(); if (result == null) { //we are done return false; } if (this.row == null) { this.row = new ImmutableBytesWritable(); } this.row.set(result.getRow()); return true; }
public void initialize(InputSplit split, Configuration conf) throws IOException { this.scan = TableMapReduceUtil.convertStringToScan(split.getScan()); this.split = split; HTableDescriptor htd = split.htd; HRegionInfo hri = this.split.getRegionInfo(); FileSystem fs = FSUtils.getCurrentFileSystem(conf); // region is immutable, this should be fine, // otherwise we have to set the thread read point scan.setIsolationLevel(IsolationLevel.READ_UNCOMMITTED); // disable caching of data blocks scan.setCacheBlocks(false); scanner = new ClientSideRegionScanner(conf, fs, new Path(split.restoreDir), htd, hri, scan, null); }
public ClientSideRegionScanner(Configuration conf, FileSystem fs, Path rootDir, HTableDescriptor htd, HRegionInfo hri, Scan scan, ScanMetrics scanMetrics) throws IOException { // region is immutable, set isolation level scan.setIsolationLevel(IsolationLevel.READ_UNCOMMITTED); // open region from the snapshot directory this.region = HRegion.openHRegion(conf, fs, rootDir, hri, htd, null, null, null); // create an internal region scanner this.scanner = region.getScanner(scan); values = new ArrayList<Cell>(); if (scanMetrics == null) { initScanMetrics(scan); } else { this.scanMetrics = scanMetrics; } region.startRegionOperation(); }
@Override public Result next() throws IOException { Result result = null; while (true) { if (currentRegionScanner == null) { currentRegion++; if (currentRegion >= regions.size()) { return null; } HRegionInfo hri = regions.get(currentRegion); currentRegionScanner = new ClientSideRegionScanner(conf, fs, restoreDir, htd, hri, scan, scanMetrics); if (this.scanMetrics != null) { this.scanMetrics.countOfRegions.incrementAndGet(); } } try { result = currentRegionScanner.next(); if (result != null) { return result; } } finally { if (result == null) { currentRegionScanner.close(); currentRegionScanner = null; } } } }
public void close() { if (this.scanner != null) { this.scanner.close(); } } }
public boolean nextKeyValue() throws IOException { result = scanner.next(); if (result == null) { //we are done return false; } if (this.row == null) { this.row = new ImmutableBytesWritable(); } this.row.set(result.getRow()); return true; }
public void initialize(InputSplit split, Configuration conf) throws IOException { this.scan = TableMapReduceUtil.convertStringToScan(split.getScan()); this.split = split; TableDescriptor htd = split.htd; HRegionInfo hri = this.split.getRegionInfo(); FileSystem fs = FSUtils.getCurrentFileSystem(conf); // region is immutable, this should be fine, // otherwise we have to set the thread read point scan.setIsolationLevel(IsolationLevel.READ_UNCOMMITTED); // disable caching of data blocks scan.setCacheBlocks(false); scan.setScanMetricsEnabled(true); scanner = new ClientSideRegionScanner(conf, fs, new Path(split.restoreDir), htd, hri, scan, null); }
@Override public boolean nextKeyValue() throws IOException, InterruptedException { boolean result = delegate.nextKeyValue(); if (result) { ScanMetrics scanMetrics = delegate.getScanner().getScanMetrics(); if (scanMetrics != null && context != null) { TableRecordReaderImpl.updateCounters(scanMetrics, 0, getCounter, context, 0); } } return result; }
public void close() { if (this.scanner != null) { this.scanner.close(); } } }
public boolean nextKeyValue() throws IOException { result = scanner.next(); if (result == null) { //we are done return false; } if (this.row == null) { this.row = new ImmutableBytesWritable(); } this.row.set(result.getRow()); return true; }
public void initialize(InputSplit split, Configuration conf) throws IOException { this.scan = TableMapReduceUtil.convertStringToScan(split.getScan()); this.split = split; TableDescriptor htd = split.htd; HRegionInfo hri = this.split.getRegionInfo(); FileSystem fs = FSUtils.getCurrentFileSystem(conf); // region is immutable, this should be fine, // otherwise we have to set the thread read point scan.setIsolationLevel(IsolationLevel.READ_UNCOMMITTED); // disable caching of data blocks scan.setCacheBlocks(false); scan.setScanMetricsEnabled(true); scanner = new ClientSideRegionScanner(conf, fs, new Path(split.restoreDir), htd, hri, scan, null); }
@Override public boolean nextKeyValue() throws IOException, InterruptedException { boolean result = delegate.nextKeyValue(); if (result) { ScanMetrics scanMetrics = delegate.getScanner().getScanMetrics(); if (scanMetrics != null && context != null) { TableRecordReaderImpl.updateCounters(scanMetrics, 0, getCounter, context, 0); } } return result; }
public void close() { if (this.scanner != null) { this.scanner.close(); } } }