/*****************************/
// fix the current page
page = buffer.getPage(btreeSpec.btree.getBtreeId(), pageNumber);
if (page == null)
throw new ChaiDBException(ErrorCode.BTREE_INVALID_DATAPAGE, "Page is null: " + pageNumber.toHexString() + " of " + btreeSpec.getBtreeName());
//====>>> 1. calculate the place to insert the node
// sort insert
boolean keyExist = nodeOff > 0;
// check mode to replace existing key's value or just return
if (keyExist && mode == IDBIndex.STORE_INSERT) {
// untouch the node, may throw exception later &&&
// unfix this page
buffer.releasePage(pageNumber.getTreeId(), pageNumber, false);
// details -ranjeet
String details = "The key value is " + new String(key) + ".";
throw new ChaiDBException(ErrorCode.ENTRY_ALREADY_EXIST, details);
}
//=====>>> 2. insert / replace key/data pair
DataNode dataNode;
// size in byte of the node needed