parent.promoteValue(transaction, separator, rNode.page.getPageNum());
parent.promoteValue(transaction, separator, rNode);
		public void split(Txn transaction) throws IOException, BTreeException {			Value[] leftVals;			Value[] rightVals;			long[] leftPtrs;			long[] rightPtrs;			Value separator;            			final short vc = ph.getValueCount();			final int pivot = vc / 2;			// Split the node into two nodes			switch (ph.getStatus()) {				case BRANCH :					leftVals = new Value[pivot];					leftPtrs = new long[leftVals.length + 1];					rightVals = new Value[vc - (pivot + 1)];					rightPtrs = new long[rightVals.length + 1];					System.arraycopy(values, 0, leftVals, 0, leftVals.length);					System.arraycopy(ptrs, 0, leftPtrs, 0, leftPtrs.length);					System.arraycopy(values, leftVals.length + 1, rightVals, 0, rightVals.length);					System.arraycopy(ptrs, leftPtrs.length, rightPtrs, 0, rightPtrs.length);					separator = values[leftVals.length];					break;				case LEAF :					leftVals = new Value[pivot];					leftPtrs = new long[leftVals.length];					rightVals = new Value[vc - pivot];					rightPtrs = new long[rightVals.length];					System.arraycopy(values, 0, leftVals, 0, leftVals.length);					System.arraycopy(ptrs, 0, leftPtrs, 0, leftPtrs.length);					System.arraycopy(values, leftVals.length, rightVals, 0, rightVals.length);					System.arraycopy(ptrs, leftPtrs.length, rightPtrs, 0, rightPtrs.length);					separator = leftVals[leftVals.length - 1];					break;				default :					throw new BTreeException("Invalid Page Type In split");			}            // Log the update of the current page            if (transaction != null && isTransactional) {                Loggable log = new UpdatePageLoggable(transaction, fileId, page.getPageNum(), leftVals, leftPtrs);                writeToLog(log, this);            }            			setValues(leftVals);			setPointers(leftPtrs);			recalculateDataLen();			// Promote the pivot to the parent branch            BTreeNode parent = getParent();			if (parent == null) {				// This can only happen if this is the root				parent = createBTreeNode(transaction, BRANCH, null);                                // Log change of the parent page                if (transaction != null && isTransactional) {                    Loggable log = new SetParentLoggable(transaction, fileId, page.getPageNum(),                             parent.page.getPageNum());                    writeToLog(log, this);                }                                setParent(parent);				final BTreeNode rNode = createBTreeNode(transaction, ph.getStatus(), parent);                                // Log update of the right node                if (isTransactional && transaction != null) {                    Loggable log =                         new UpdatePageLoggable(transaction, fileId, rNode.page.getPageNum(), rightVals, rightPtrs);                    writeToLog(log, rNode);                }                				rNode.setValues(rightVals);				rNode.setPointers(rightPtrs);				rNode.recalculateDataLen();				cache.add(rNode);                				parent.setValues(new Value[] { separator });				parent.setPointers(new long[] { page.getPageNum(), rNode.page.getPageNum()});                                // Log update of the parent node                if (isTransactional && transaction != null) {                    Loggable log =                        new UpdatePageLoggable(transaction, fileId, parent.page.getPageNum(), parent.values, parent.ptrs);                    writeToLog(log, parent);                }                				parent.recalculateDataLen();				cache.add(parent);				setRootNode(parent);				if(rNode.mustSplit()) {					LOG.debug(getFile().getName() + " right node requires second split: " + rNode.getDataLen());					rNode.split(transaction);				}			} else {				final BTreeNode rNode = createBTreeNode(transaction, ph.getStatus(), parent);                                // Log update of the right node                if (isTransactional && transaction != null) {                    Loggable log =                         new UpdatePageLoggable(transaction, fileId, rNode.page.getPageNum(), rightVals, rightPtrs);                    writeToLog(log, rNode);                }                				rNode.setValues(rightVals);				rNode.setPointers(rightPtrs);				rNode.recalculateDataLen();				cache.add(rNode);				parent.promoteValue(transaction, separator, rNode.page.getPageNum());				if(rNode.mustSplit()) {					LOG.debug(getFile().getName() + " right node requires second split: " + rNode.getDataLen());					rNode.split(transaction);				}			}            cache.add(this);			if(mustSplit()) {				LOG.debug(getFile().getName() + "left node requires second split: " + getDataLen());				split(transaction);			}		}