/** * @param lowKey inclusive lowest key in the random range; pass null for open range * @param highKey exclusive highest key in the random range; pass null for open range * @return null if no key was found */ private byte[] selectSplitKey(byte[] lowKey, byte[] highKey) throws IOException { // Select a random key from a random source. Tree source = mSources[ThreadLocalRandom.current().nextInt(mSources.length)]; TreeCursor scursor = source.newCursor(Transaction.BOGUS); try { scursor.mKeyOnly = true; scursor.random(lowKey, highKey); return scursor.key(); } finally { scursor.reset(); } }
@Override public Stats analyze(byte[] lowKey, byte[] highKey) throws IOException { TreeCursor cursor = newCursor(Transaction.BOGUS); try { cursor.mKeyOnly = true; cursor.random(lowKey, highKey); return cursor.key() == null ? new Stats(0, 0, 0, 0, 0) : cursor.analyze(); } catch (Throwable e) { cursor.reset(); throw e; } }
@Override public Stats analyze(byte[] lowKey, byte[] highKey) throws IOException { TreeCursor cursor = new TreeCursor(this, Transaction.BOGUS); try { cursor.autoload(false); cursor.random(lowKey, highKey); return cursor.key() == null ? new Stats(0, 0, 0, 0, 0) : cursor.analyze(); } catch (Throwable e) { cursor.reset(); throw e; } }
@Override public Stats analyze(byte[] lowKey, byte[] highKey) throws IOException { TreeCursor cursor = new TreeCursor(this, Transaction.BOGUS); try { cursor.autoload(false); cursor.random(lowKey, highKey); return cursor.key() == null ? new Stats(0, 0, 0, 0, 0) : cursor.analyze(); } catch (Throwable e) { cursor.reset(); throw e; } }