@Test public void testScanWithFilter() throws IOException { prepareScanData(TRANSACTION_COLUMNS); writeData(COLUMN, lastTs(prewriteTs), ANOTHER_VALUE); ValueFilter valueFilter = new ValueFilter(CompareOp.EQUAL, new BinaryComparator(ANOTHER_VALUE)); PrefixFilter prefixFilter = new PrefixFilter(ANOTHER_ROW); FilterList filterList = new FilterList(); filterList.addFilter(valueFilter); filterList.addFilter(prefixFilter); ThemisScanner scanner = prepareScanner(TRANSACTION_COLUMNS, filterList); checkAndCloseScanner(scanner); filterList = new FilterList(Operator.MUST_PASS_ONE); filterList.addFilter(valueFilter); filterList.addFilter(prefixFilter); scanner = prepareScanner(TRANSACTION_COLUMNS, filterList); checkScanRow(new ColumnCoordinate[]{COLUMN_WITH_ANOTHER_ROW}, scanner.next()); Assert.assertEquals(1, scanner.next().size()); checkAndCloseScanner(scanner); }
public Result next() throws IOException { long beginTs = System.nanoTime(); Result pResult = null; boolean lockClean = false; try { pResult = this.scanner.next(); if (pResult == null) { return null; } if (ThemisCpUtil.isLockResult(pResult)) { lockClean = true; Get rowGet = createGetFromScan(scan, pResult.getRow()); pResult = transaction.tryToCleanLockAndGetAgain(tableName, rowGet, pResult.list()); if (pResult.isEmpty()) { return next(); } else { return pResult; } } return pResult; } finally { ThemisStatistics.updateLatency(ThemisStatistics.getStatistics().nextLatency, beginTs); ThemisStatistics.logSlowOperation("themisNext", beginTs, "row=" + pResult + ", lockClean=" + lockClean); } }
ThemisScanner extends AbstractClientScanner { public Result next() throws IOException { long beginTs = System.nanoTime(); Result pResult = null; boolean lockClean = false; try { pResult = this.scanner.next(); if (pResult == null) { return null; } if (ThemisCpUtil.isLockResult(pResult)) { lockClean = true; Get rowGet = createGetFromScan(scan, pResult.getRow()); pResult = transaction.tryToCleanLockAndGetAgain(tableName, rowGet, pResult.list()); if (pResult.isEmpty()) { return next(); } else { return pResult; } } return pResult; } finally { ThemisStatistics.updateLatency(ThemisStatistics.getStatistics().nextLatency, beginTs); ThemisStatistics.logSlowOperation("themisNext", beginTs, "row=" + pResult + ", lockClean=" + lockClean); } } }
ThemisScanner extends AbstractClientScanner { public Result next() throws IOException { long beginTs = System.nanoTime(); Result pResult = null; boolean lockClean = false; try { pResult = this.scanner.next(); if (pResult == null) { return null; } if (ThemisCpUtil.isLockResult(pResult)) { lockClean = true; Get rowGet = createGetFromScan(scan, pResult.getRow()); pResult = transaction.tryToCleanLockAndGetAgain(tableName, rowGet, pResult.list()); if (pResult.isEmpty()) { return next(); } else { return pResult; } } return pResult; } finally { ThemisStatistics.updateLatency(ThemisStatistics.getStatistics().nextLatency, beginTs); ThemisStatistics.logSlowOperation("themisNext", beginTs, "row=" + pResult + ", lockClean=" + lockClean); } } ThemisScanner(final byte[] tableName, final Scan scan, final Transaction transaction); }
ThemisScanner extends AbstractClientScanner { public Result next() throws IOException { long beginTs = System.nanoTime(); Result pResult = null; boolean lockClean = false; try { pResult = this.scanner.next(); if (pResult == null) { return null; } if (ThemisCpUtil.isLockResult(pResult)) { lockClean = true; Get rowGet = createGetFromScan(scan, pResult.getRow()); pResult = transaction.tryToCleanLockAndGetAgain(tableName, rowGet, pResult.list()); if (pResult.isEmpty()) { return next(); } else { return pResult; } } return pResult; } finally { ThemisStatistics.updateLatency(ThemisStatistics.getStatistics().nextLatency, beginTs); ThemisStatistics.logSlowOperation("themisNext", beginTs, "row=" + pResult + ", lockClean=" + lockClean); } } ThemisScanner(final byte[] tableName, final Scan scan, final Transaction transaction); static Get createGetFromScan(Scan scan, byte[] rowkey); Result next(); void close(); @Override Result[] next(int nbRows); }
ThemisScanner extends AbstractClientScanner { public Result next() throws IOException { long beginTs = System.nanoTime(); Result pResult = null; boolean lockClean = false; try { pResult = this.scanner.next(); if (pResult == null) { return null; } if (ThemisCpUtil.isLockResult(pResult)) { lockClean = true; Get rowGet = createGetFromScan(scan, pResult.getRow()); pResult = transaction.tryToCleanLockAndGetAgain(tableName, rowGet, pResult.list()); if (pResult.isEmpty()) { return next(); } else { return pResult; } } return pResult; } finally { ThemisStatistics.updateLatency(ThemisStatistics.getStatistics().nextLatency, beginTs); ThemisStatistics.logSlowOperation("themisNext", beginTs, "row=" + pResult + ", lockClean=" + lockClean); } } ThemisScanner(final byte[] tableName, final Scan scan, final Transaction transaction); static Get createGetFromScan(Scan scan, byte[] rowkey); Result next(); void close(); @Override Result[] next(int nbRows);  }