@Override public Scanner call() { return delegate.scan(start, stop, filter); } });
@Override public Scanner scan(@Nullable byte[] start, @Nullable byte[] stop, @Nullable FuzzyRowFilter filter) { Scanner v2Scan = null; if (v2HBaseTable != null) { try { v2Scan = v2HBaseTable.scan(start, stop, filter); } catch (Exception e) { handleV2TableException(e, "Scan", getV2MetricsTableDatasetId().getDataset()); } } Scanner v3Scan = v3HBaseTable.scan(start, stop, filter); return new CombinedMetricsScanner(v2Scan, v3Scan, getV2MetricsTableDatasetId(), datasetFramework); }
try (Scanner scanner = v2MetricsTable.scan(null, null, null)) { LOG.info("Starting Metrics Data Migration from {} to {} with {}ms sleep between records", v2MetricsTableName, v3MetricsTableName, sleepMillisBetweenRecords);
private Scanner getScanner(FactScan scan) { // sort the measures based on their entity ids and based on that get the start and end row key metric names List<String> measureNames = getSortedMeasures(scan.getMeasureNames()); byte[] startRow = codec.createStartRowKey(scan.getDimensionValues(), measureNames.isEmpty() ? null : measureNames.get(0), scan.getStartTs(), false); byte[] endRow = codec.createEndRowKey(scan.getDimensionValues(), measureNames.isEmpty() ? null : measureNames.get(measureNames.size() - 1), scan.getEndTs(), false); byte[][] columns; if (Arrays.equals(startRow, endRow)) { // If on the same timebase, we only need subset of columns long timeBase = scan.getStartTs() / rollTime * rollTime; int startCol = (int) (scan.getStartTs() - timeBase) / resolution; int endCol = (int) (scan.getEndTs() - timeBase) / resolution; columns = new byte[endCol - startCol + 1][]; for (int i = 0; i < columns.length; i++) { columns[i] = Bytes.toBytes((short) (startCol + i)); } } endRow = Bytes.stopKeyForPrefix(endRow); FuzzyRowFilter fuzzyRowFilter = measureNames.isEmpty() ? createFuzzyRowFilter(scan, startRow) : createFuzzyRowFilter(scan, measureNames); if (LOG.isTraceEnabled()) { LOG.trace("Scanning fact table {} with scan: {}; constructed startRow: {}, endRow: {}, fuzzyRowFilter: {}", timeSeriesTable, scan, Bytes.toHexString(startRow), endRow == null ? null : Bytes.toHexString(endRow), fuzzyRowFilter); } return timeSeriesTable.scan(startRow, endRow, fuzzyRowFilter); }
private Scanner getScanner(FactScan scan) { // sort the measures based on their entity ids and based on that get the start and end row key metric names List<String> measureNames = getSortedMeasures(scan.getMeasureNames()); byte[] startRow = codec.createStartRowKey(scan.getDimensionValues(), measureNames.isEmpty() ? null : measureNames.get(0), scan.getStartTs(), false); byte[] endRow = codec.createEndRowKey(scan.getDimensionValues(), measureNames.isEmpty() ? null : measureNames.get(measureNames.size() - 1), scan.getEndTs(), false); byte[][] columns; if (Arrays.equals(startRow, endRow)) { // If on the same timebase, we only need subset of columns long timeBase = scan.getStartTs() / rollTime * rollTime; int startCol = (int) (scan.getStartTs() - timeBase) / resolution; int endCol = (int) (scan.getEndTs() - timeBase) / resolution; columns = new byte[endCol - startCol + 1][]; for (int i = 0; i < columns.length; i++) { columns[i] = Bytes.toBytes((short) (startCol + i)); } } endRow = Bytes.stopKeyForPrefix(endRow); FuzzyRowFilter fuzzyRowFilter = measureNames.isEmpty() ? createFuzzyRowFilter(scan, startRow) : createFuzzyRowFilter(scan, measureNames); if (LOG.isTraceEnabled()) { LOG.trace("Scanning fact table {} with scan: {}; constructed startRow: {}, endRow: {}, fuzzyRowFilter: {}", timeSeriesTable, scan, Bytes.toHexString(startRow), endRow == null ? null : Bytes.toHexString(endRow), fuzzyRowFilter); } return timeSeriesTable.scan(startRow, endRow, fuzzyRowFilter); }
try (Scanner scanner = timeSeriesTable.scan(startRow, endRow, fuzzyRowFilter)) { Row rowResult; while ((rowResult = scanner.next()) != null) {
private static int countRange(MetricsTable table, Integer start, Integer stop) throws Exception { Scanner scanner = table.scan(start == null ? null : Bytes.toBytes(start), stop == null ? null : Bytes.toBytes(stop), null); int count = 0; while (scanner.next() != null) { count++; } return count; }
try (Scanner scanner = timeSeriesTable.scan(startRow, endRow, fuzzyRowFilter)) { Row rowResult; while ((rowResult = scanner.next()) != null) {
Scanner scanner = table.scan(null, null, filter); int count = 0; while (true) {