public static BTreePage newPage(BTreeSpec btreeSpec, PageBufferManager buffer, KernelContext kContext) throws ChaiDBException {
int txnId = kContext.getLocker();
boolean needLog = kContext.getNeedLog();
BTreePage newPage = new BTreePage(btreeSpec, buffer);
Page freePageInfo = buffer.getFreePage(btreeSpec, false, kContext);
newPage.setLogInfo(txnId, needLog);
/* begin:added by marriane 2001-9-29 for logging newPage log record */
if (needLog) {
int newPageNo = freePageInfo.getPageNumber().getPageNumber();
BTreeNewPageLogRecord logRec = new BTreeNewPageLogRecord(freePageInfo.getPageNumber().getTreeId(), newPageNo, txnId, 1, -1, btreeSpec.btree.getType());
logRec.log();
}
/* end:added by marriane for logging newPage log record */
newPage.page = freePageInfo.getPageData();
newPage.setPageNumber(freePageInfo.getPageNumber());
//the following code may generate log records.
newPage.setLogInfo(txnId, false);
newPage.setInternal();
newPage.setNextPage(new PageNumber(BTreeSpec.INVALID_PAGENO));