public void remove(long p) { RecordPos rec = findRecord(p);  int startOffset = rec.offset - 2; DOMFilePageHeader ph = rec.page.getPageHeader(); short l = ByteConversion.byteToShort(rec.page.data, rec.offset); rec.offset += 2; if(ItemId.isLink(rec.tid)) { throw new RuntimeException("Cannot remove link ...");
public void remove(Value key) { try { long p = findValue(key); if (p == KEY_NOT_FOUND) return; remove(key, p); } catch (BTreeException bte) { LOG.debug(bte); } catch (IOException ioe) { LOG.debug(ioe);
    public void remove(long p) {        RecordPos rec = findRecord(p);//        LOG.debug("removing value " + rec.tid + " from " + rec.page.getPageNum() + "; " + rec.page.page.hashCode());        int startOffset = rec.offset - 2;        DOMFilePageHeader ph = rec.page.getPageHeader();        short l = ByteConversion.byteToShort(rec.page.data, rec.offset);        rec.offset += 2;        if(ItemId.isLink(rec.tid)) {        	throw new RuntimeException("Cannot remove link ...");        }        if(ItemId.isRelocated(rec.tid)) {            long backLink = ByteConversion.byteToLong(rec.page.data, rec.offset);            removeLink(backLink);            rec.offset += 8;            l += 8;        }        if (l == OVERFLOW) {            // remove overflow value            long pnum = ByteConversion                    .byteToLong(rec.page.data, rec.offset);            rec.offset += 8;            try {                OverflowDOMPage overflow = new OverflowDOMPage(pnum);                overflow.delete();            } catch (IOException e) {                LOG.error("io error while removing overflow page", e);            }            l += 8;        }        int end = startOffset + 4 + l;        int len = ph.getDataLength();        // remove old value        System.arraycopy(rec.page.data, end, rec.page.data, startOffset, len                - end);        ph.setDirty(true);        len = len - l - 4;        ph.setDataLength(len);        rec.page.len = len;        rec.page.setDirty(true);        ph.decRecordCount();        if (rec.page.len == 0) {            removePage(rec.page);            rec.page = null;        } else            dataCache.add(rec.page);    }