private byte[] readDelegate(byte[] key) throws IOException { try { if (!getBloomFilter().mightContain(key)) { // bloom filter check failed, the key is not present in this hoplog return null; } } catch (IllegalArgumentException e) { if (IOException.class.isAssignableFrom(e.getCause().getClass())) { throw (IOException) e.getCause(); } else { throw e; } } byte[] valueBytes = null; ByteBuffer bb = get(key); if (bb != null) { valueBytes = new byte[bb.remaining()]; bb.get(valueBytes); } else { stats.getBloom().falsePositive(); } return valueBytes; }
private byte[] readDelegate(byte[] key) throws IOException { try { if (!getBloomFilter().mightContain(key)) { // bloom filter check failed, the key is not present in this hoplog return null; } } catch (IllegalArgumentException e) { if (IOException.class.isAssignableFrom(e.getCause().getClass())) { throw (IOException) e.getCause(); } else { throw e; } } byte[] valueBytes = null; ByteBuffer bb = get(key); if (bb != null) { valueBytes = new byte[bb.remaining()]; bb.get(valueBytes); } else { stats.getBloom().falsePositive(); } return valueBytes; }
@Override public ByteBuffer read(byte[] key) throws IOException { assert key != null; if (logger.finestEnabled()) { logger.finest(String.format("Reading key %s from %s", Hex.toHex(key), path)); } long start = sopConfig.getStatistics().getRead().begin(); try { HFileScanner seek = reader.getScanner(true, true); if (seek.seekTo(key) == 0) { ByteBuffer val = seek.getValue(); sopConfig.getStatistics().getRead().end(val.remaining(), start); return val; } sopConfig.getStatistics().getRead().end(start); sopConfig.getStatistics().getBloom().falsePositive(); return null; } catch (IOException e) { sopConfig.getStatistics().getRead().error(start); throw (IOException) e.fillInStackTrace(); } }