private void panic(Throwable cause) { try { getDatabase().close(cause); } catch (Throwable e) { // Ignore. } }
private void panic(Throwable cause) { try { getDatabase().close(cause); } catch (Throwable e) { // Ignore. } }
private void panic(Throwable cause) { try { getDatabase().close(cause); } catch (Throwable e) { // Ignore. } }
private void cleanupSplit(Throwable cause, Node newNode, Split split) { if (split != null) { cleanupFragments(cause, split.fragmentedKey()); } try { getDatabase().deleteNode(newNode); } catch (Throwable e) { cause.addSuppressed(e); panic(cause); } }
private void cleanupFragments(Throwable cause, byte[] fragmented) { if (fragmented != null) { /*P*/ byte[] copy = p_transfer(fragmented); try { getDatabase().deleteFragments(copy, 0, fragmented.length); } catch (Throwable e) { cause.addSuppressed(e); panic(cause); } finally { p_delete(copy); } } }
private void cleanupSplit(Throwable cause, Node newNode, Split split) { if (split != null) { cleanupFragments(cause, split.fragmentedKey()); } try { // No need to prepare for delete because node contents are unreferenced. getDatabase().finishDeleteNode(newNode); } catch (Throwable e) { Utils.suppress(cause, e); panic(cause); } }
private void cleanupFragments(Throwable cause, byte[] fragmented) { if (fragmented != null) { /*P*/ byte[] copy = p_transfer(fragmented); try { getDatabase().deleteFragments(copy, 0, fragmented.length); } catch (Throwable e) { Utils.suppress(cause, e); panic(cause); } finally { p_delete(copy); } } }
private void cleanupSplit(Throwable cause, Node newNode, Split split) { if (split != null) { cleanupFragments(cause, split.fragmentedKey()); } try { // No need to prepare for delete because node contents are unreferenced. getDatabase().finishDeleteNode(newNode); } catch (Throwable e) { Utils.suppress(cause, e); panic(cause); } }
void cleanupFragments(Throwable cause, byte[] fragmented) { if (fragmented != null) { /*P*/ byte[] copy = p_transfer(fragmented, false); try { getDatabase().deleteFragments(copy, 0, fragmented.length); } catch (Throwable e) { Utils.suppress(cause, e); panic(cause); } finally { p_delete(copy); } } }
/** * @param pos position as provided by binarySearch; must be positive * @param stats {@literal [0]: full length, [1]: number of pages (>0 if fragmented)} */ void retrieveKeyStats(int pos, long[] stats) throws IOException { final /*P*/ byte[] page = mPage; int loc = p_ushortGetLE(page, searchVecStart() + pos); int keyLen = p_byteGet(page, loc++); if (keyLen >= 0) { keyLen++; } else { int header = keyLen; keyLen = ((keyLen & 0x3f) << 8) | p_ubyteGet(page, loc++); if ((header & ENTRY_FRAGMENTED) != 0) { getDatabase().reconstruct(page, loc, keyLen, stats); return; } } stats[0] = keyLen; stats[1] = 0; }
/** * @param pos position as provided by binarySearch; must be positive * @param stats [0]: full length, [1]: number of pages (>0 if fragmented) */ void retrieveKeyStats(int pos, long[] stats) throws IOException { final /*P*/ byte[] page = mPage; int loc = p_ushortGetLE(page, searchVecStart() + pos); int keyLen = p_byteGet(page, loc++); if (keyLen >= 0) { keyLen++; } else { int header = keyLen; keyLen = ((keyLen & 0x3f) << 8) | p_ubyteGet(page, loc++); if ((header & ENTRY_FRAGMENTED) != 0) { getDatabase().reconstruct(page, loc, keyLen, stats); return; } } stats[0] = keyLen; stats[1] = 0; }
/** * @param pos position as provided by binarySearch; must be positive * @param stats [0]: full length, [1]: number of pages (>0 if fragmented) */ void retrieveKeyStats(int pos, long[] stats) throws IOException { final /*P*/ byte[] page = mPage; int loc = p_ushortGetLE(page, searchVecStart() + pos); int keyLen = p_byteGet(page, loc++); if (keyLen >= 0) { keyLen++; } else { int header = keyLen; keyLen = ((keyLen & 0x3f) << 8) | p_ubyteGet(page, loc++); if ((header & ENTRY_FRAGMENTED) != 0) { getDatabase().reconstruct(page, loc, keyLen, stats); return; } } stats[0] = keyLen; stats[1] = 0; }
/** * @param pos position as provided by binarySearch; must be positive */ int compareKey(int pos, byte[] rightKey) throws IOException { final /*P*/ byte[] page = mPage; int loc = p_ushortGetLE(page, searchVecStart() + pos); int keyLen = p_byteGet(page, loc++); if (keyLen >= 0) { keyLen++; } else { int header = keyLen; keyLen = ((keyLen & 0x3f) << 8) | p_ubyteGet(page, loc++); if ((header & ENTRY_FRAGMENTED) != 0) { // Note: An optimized version wouldn't need to copy the whole key. byte[] leftKey = getDatabase().reconstructKey(page, loc, keyLen); return compareUnsigned(leftKey, 0, leftKey.length, rightKey, 0, rightKey.length); } } return p_compareKeysPageToArray(page, loc, keyLen, rightKey, 0, rightKey.length); }
/** * @param pos position as provided by binarySearch; must be positive */ int compareKey(int pos, byte[] rightKey) throws IOException { final /*P*/ byte[] page = mPage; int loc = p_ushortGetLE(page, searchVecStart() + pos); int keyLen = p_byteGet(page, loc++); if (keyLen >= 0) { keyLen++; } else { int header = keyLen; keyLen = ((keyLen & 0x3f) << 8) | p_ubyteGet(page, loc++); if ((header & ENTRY_FRAGMENTED) != 0) { // Note: An optimized version wouldn't need to copy the whole key. byte[] leftKey = getDatabase().reconstructKey(page, loc, keyLen); return compareUnsigned(leftKey, 0, leftKey.length, rightKey, 0, rightKey.length); } } return p_compareKeysPageToArray(page, loc, keyLen, rightKey, 0, rightKey.length); }
final LocalDatabase db = getDatabase(); Node childNode = db.nodeMapGet(childId);
/** * @param pos position as provided by binarySearch; must be positive */ int compareKey(int pos, byte[] rightKey) throws IOException { final /*P*/ byte[] page = mPage; int loc = p_ushortGetLE(page, searchVecStart() + pos); int keyLen = p_byteGet(page, loc++); if (keyLen >= 0) { keyLen++; } else { int header = keyLen; keyLen = ((keyLen & 0x3f) << 8) | p_ubyteGet(page, loc++); if ((header & ENTRY_FRAGMENTED) != 0) { // Note: An optimized version wouldn't need to copy the whole key. byte[] leftKey = getDatabase().reconstructKey(page, loc, keyLen); return compareUnsigned(leftKey, 0, leftKey.length, rightKey, 0, rightKey.length); } } return p_compareKeysPageToArray(page, loc, keyLen, rightKey, 0, rightKey.length); }
getDatabase().reconstruct(page, loc, len, stats); return;
getDatabase().reconstruct(page, loc, len, stats); return;
getDatabase().reconstruct(page, loc, len, stats); return;
keyLen = ((header & 0x3f) << 8) | p_ubyteGet(page, loc++); if ((header & ENTRY_FRAGMENTED) != 0) { key = getDatabase().reconstructKey(page, loc, keyLen); break copyKey;