/** * Split the root page if necessary. * * @param p the page * @param writeVersion the write version * @return the new sibling */ protected Page splitRootIfNeeded(Page p, long writeVersion) { if (p.getMemory() <= store.getPageSplitSize() || p.getKeyCount() <= 1) { return p; } int at = p.getKeyCount() / 2; long totalCount = p.getTotalCount(); Object k = p.getKey(at); Page split = p.split(at); Object[] keys = { k }; Page.PageReference[] children = { new Page.PageReference(p, p.getPos(), p.getTotalCount()), new Page.PageReference(split, split.getPos(), split.getTotalCount()), }; p = Page.create(this, writeVersion, keys, null, children, totalCount, 0); return p; }
Page split = c.split(at); p.setChild(index, split); p.insertNode(index, k, c);
/** * Split the root page if necessary. * * @param p the page * @param writeVersion the write version * @return the new sibling */ protected Page splitRootIfNeeded(Page p, long writeVersion) { if (p.getMemory() <= store.getPageSplitSize() || p.getKeyCount() <= 1) { return p; } int at = p.getKeyCount() / 2; long totalCount = p.getTotalCount(); Object k = p.getKey(at); Page split = p.split(at); Object[] keys = { k }; Page.PageReference[] children = { new Page.PageReference(p, p.getPos(), p.getTotalCount()), new Page.PageReference(split, split.getPos(), split.getTotalCount()), }; p = Page.create(this, writeVersion, keys, null, children, totalCount, 0); return p; }
/** * Split the root page if necessary. * * @param p the page * @param writeVersion the write version * @return the new sibling */ protected Page splitRootIfNeeded(Page p, long writeVersion) { if (p.getMemory() <= store.getPageSplitSize() || p.getKeyCount() <= 1) { return p; } int at = p.getKeyCount() / 2; long totalCount = p.getTotalCount(); Object k = p.getKey(at); Page split = p.split(at); Object[] keys = { k }; Page.PageReference[] children = { new Page.PageReference(p, p.getPos(), p.getTotalCount()), new Page.PageReference(split, split.getPos(), split.getTotalCount()), }; p = Page.create(this, writeVersion, keys, null, children, totalCount, 0); return p; }
/** * Split the root page if necessary. * * @param p the page * @param writeVersion the write version * @return the new sibling */ protected Page splitRootIfNeeded(Page p, long writeVersion) { if (p.getMemory() <= store.getPageSplitSize() || p.getKeyCount() <= 1) { return p; } int at = p.getKeyCount() / 2; long totalCount = p.getTotalCount(); Object k = p.getKey(at); Page split = p.split(at); Object[] keys = { k }; Page.PageReference[] children = { new Page.PageReference(p, p.getPos(), p.getTotalCount()), new Page.PageReference(split, split.getPos(), split.getTotalCount()), }; p = Page.create(this, writeVersion, keys, null, children, totalCount, 0); return p; }
Page split = c.split(at); p.setChild(index, split); p.insertNode(index, k, c);
Page split = c.split(at); p.setChild(index, split); p.insertNode(index, k, c);
Page split = c.split(at); p.setChild(index, split); p.insertNode(index, k, c);