Package org.chaidb.db.log.logrecord

Examples of org.chaidb.db.log.logrecord.BTreeAddRemoveLogRecord.log()


                if (keyLength > 0) {
                    /******************* Add by leon, Sep 30 2001 *************/
                    if (needLog) {
                        int newPageNo = overflowPage.pageNumber.getPageNumber();
                        BTreeAddRemoveLogRecord logRec = new BTreeAddRemoveLogRecord(page.getPageNumber().getTreeId(), newPageNo, txnId, BTreeAddRemoveLogRecord.ADD_FLAG, overflowPage.upperBound, ByteTool.copyByteArray(key, keyStartPos, keyLength), page.btreeSpec.btree.getType());
                        logRec.log();
                    }
                    /*************************************************************/
                    System.arraycopy(key, keyStartPos, overflowPage.page, overflowPage.upperBound, keyLength);
                    keyStartPos += keyLength;
                    keyLeft -= keyLength;
View Full Code Here


                newNode = ByteTool.append(newNode, ByteTool.intToBytes(firstOverflowPageNo.getPageNumber()));
                byte[] oldNode = ByteTool.copyByteArray(page.getPage(), nodeOffset, BTreeSpec.NODE_HEADER_SIZE + 4);
                byte[] emptyNode = new byte[BTreeSpec.NODE_HEADER_SIZE + keySize];
                if (ByteTool.compare(oldNode, 0, emptyNode, 0, BTreeSpec.NODE_HEADER_SIZE + keySize) == 0) {
                    BTreeAddRemoveLogRecord lr = new BTreeAddRemoveLogRecord(page.getPageNumber().getTreeId(), pgno, txnId, BTreeAddRemoveLogRecord.ADD_FLAG, nodeOffset, newNode, page.btreeSpec.btree.getType());
                    lr.log();
                } else if (oldNode != newNode) {
                    BTreeReplLogRecord lr = new BTreeReplLogRecord(page.getPageNumber().getTreeId(), pgno, txnId, nodeOffset, oldNode, newNode, page.btreeSpec.btree.getType());

                    lr.log();
                }
View Full Code Here

                    BTreeAddRemoveLogRecord lr = new BTreeAddRemoveLogRecord(page.getPageNumber().getTreeId(), pgno, txnId, BTreeAddRemoveLogRecord.ADD_FLAG, nodeOffset, newNode, page.btreeSpec.btree.getType());
                    lr.log();
                } else if (oldNode != newNode) {
                    BTreeReplLogRecord lr = new BTreeReplLogRecord(page.getPageNumber().getTreeId(), pgno, txnId, nodeOffset, oldNode, newNode, page.btreeSpec.btree.getType());

                    lr.log();
                }
            }
            /******************************************************************/
            System.arraycopy(this.getHeader(), 0, page.getPage(), nodeOffset, BTreeSpec.NODE_HEADER_SIZE);
            // last pageNumber is the one we need here!!
View Full Code Here

            if (node.isOverflow()) {
                PageNumber overflowPageNumber = new PageNumber(ByteTool.bytesToInt(page, node.getNodeOffset() + BTreeSpec.DATA_NODE_HEADER_SIZE, btreeSpec.isMsbFirst()));
                if (needLog) {
                    byte[] removeData = ByteTool.append(node.getHeader(), ByteTool.intToBytes(overflowPageNumber.getPageNumber()));
                    BTreeAddRemoveLogRecord logRec = new BTreeAddRemoveLogRecord(pageNumber.getTreeId(), pageNumber.getPageNumber(), txnId, BTreeAddRemoveLogRecord.REMOVE_FLAG, node.getNodeOffset(), removeData, btreeSpec.btree.getType());
                    logRec.log();
                }

                overflowPageNumber.setTreeId(btreeSpec.btree.getBtreeId());

                DataPage overflowPage = new DataPage(btreeSpec.btree.getBtreeId(), overflowPageNumber, btreeSpec, buffer);
View Full Code Here

            } else {
                if (needLog) {
                    /* logging remove data log record */
                    byte[] removeData = ByteTool.append(node.getHeader(), node.getData());
                    BTreeAddRemoveLogRecord logRec = new BTreeAddRemoveLogRecord(pageNumber.getTreeId(), pageNumber.getPageNumber(), txnId, BTreeAddRemoveLogRecord.REMOVE_FLAG, node.getNodeOffset(), removeData, btreeSpec.btree.getType());
                    logRec.log();
                }
            }
            // 3. rest clean up, upperBound, nodes
            /* begin:added by marriane 2001-9-29 logging for delete offset and move offset after it*/
            //if this node is the top one, decrease upperbound by page space occupied by this node
View Full Code Here

                    BTreeReplLogRecord logRec = new BTreeReplLogRecord(page.getPageNumber().getTreeId(), newPageNo, txnId, nodeOffset, oldData, newData, page.btreeSpec.btree.getType());
                    logRec.log();
                } else {
                    if (page.btreeSpec.btree.getType() == IDBIndex.HYPER_BTREE) {
                        BTreeAddRemoveLogRecord logRec = new BTreeAddRemoveLogRecord(page.getPageNumber().getTreeId(), newPageNo, txnId, BTreeAddRemoveLogRecord.ADD_FLAG, nodeOffset, newData, page.btreeSpec.btree.getType());
                        logRec.log();
                    }
                }
            }
            // add the new node
            System.arraycopy(this.getHeader(), 0, page.getPage(), nodeOffset, BTreeSpec.DATA_NODE_HEADER_SIZE);
View Full Code Here

                //add the new node
                if (needLog) {
                    int newPageNo = overflowPage.getPageNumber().getPageNumber();
                    byte[] addData = ByteTool.subByteArray(data, dataStartPos, dataLength);
                    BTreeAddRemoveLogRecord logRec = new BTreeAddRemoveLogRecord(overflowPage.getPageNumber().getTreeId(), newPageNo, txnId, BTreeAddRemoveLogRecord.ADD_FLAG, overflowPage.upperBound, addData, overflowPage.btreeSpec.btree.getType());
                    logRec.log();
                }
                // only data left
                System.arraycopy(data, dataStartPos, overflowPage.page, overflowPage.upperBound, dataLength);
                dataStartPos += dataLength;
                dataLeft -= dataLength;
View Full Code Here

            if (oldData != null && (newData != oldData)) {
                BTreeReplLogRecord logRec = new BTreeReplLogRecord(page.getPageNumber().getTreeId(), newPageNo, page.txnId, nodeOffset, oldData, newData, page.btreeSpec.btree.getType());
                logRec.log();
            } else {
                BTreeAddRemoveLogRecord logRec = new BTreeAddRemoveLogRecord(page.getPageNumber().getTreeId(), newPageNo, page.txnId, BTreeAddRemoveLogRecord.ADD_FLAG, nodeOffset, newData, page.btreeSpec.btree.getType());
                logRec.log();
            }
        }
        // add the new node to the current page
        System.arraycopy(this.getHeader(), 0, page.getPage(), nodeOffset, BTreeSpec.DATA_NODE_HEADER_SIZE);
        // last pageNumber is the one we need here!!
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.