Package org.chaidb.db.log.logrecord

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


                byte[] oldNode = ByteTool.copyByteArray(page.getPage(), nodeOffset, BTreeSpec.NODE_HEADER_SIZE + keySize);
                byte[] emptyNode = new byte[BTreeSpec.NODE_HEADER_SIZE + keySize];
                if ((ByteTool.compare(oldNode, 0, emptyNode, 0, BTreeSpec.NODE_HEADER_SIZE + keySize) != 0) && 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);
            System.arraycopy(key, 0, page.getPage(), nodeOffset + BTreeSpec.NODE_HEADER_SIZE, keySize);
View Full Code Here


                    System.arraycopy(ByteTool.intToBytes(4), 0, newV, BTreeSpec.OFF_FLAGS, 4);
                    System.arraycopy(ByteTool.shortToBytes((short) (overflowPage.upperBound - requireSpace)), 0, newV, BTreeSpec.OFF_UPPERBOUND, 2);
                    System.arraycopy(ByteTool.intToBytes(i == 0 ? page.pageNumber.getPageNumber() : last.pageNumber.getPageNumber()), 0, newV, BTreeSpec.OFF_PREVPAGE, 4);
                    if (ByteTool.compare(newV, 0, oldV, 0, oldV.length) != 0) {
                        BTreeReplLogRecord lr = new BTreeReplLogRecord(overflowPage.getPageNumber().getTreeId(), pgno, txnId, 0, oldV, newV, overflowPage.btreeSpec.btree.getType());
                        lr.log();
                    }
                }
                overflowPage.setOverflow();
                overflowPage.setUpperBound((short) (overflowPage.upperBound - requireSpace));
                if (i == 0) {
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

        /***************** Add by Leon Zhu,2002-8-21  ********************/
        if (needLog) {
            int pgno = pageNumber.getPageNumber();
            BTreeReplLogRecord lr = new BTreeReplLogRecord(pageNumber.getTreeId(), pgno, txnId, BTreeSpec.OFF_LOWERBOUND, ByteTool.shortToBytes(this.nodes), ByteTool.shortToBytes(nodes), btreeSpec.btree.getType());

            lr.log();
        }
        /******************************************************************/
        this.nodes = nodes;
        System.arraycopy(ByteTool.shortToBytes(nodes), 0, page, BTreeSpec.OFF_LOWERBOUND, 2);

View Full Code Here

            short oldV = this.upperBound;
            short newV = upperBound;
            if (newV != oldV) {
                BTreeReplLogRecord lr = new BTreeReplLogRecord(pageNumber.getTreeId(), pgno, txnId, BTreeSpec.OFF_UPPERBOUND, ByteTool.shortToBytes(oldV), ByteTool.shortToBytes(newV), btreeSpec.btree.getType());

                lr.log();
            }
        }
        /******************************************************************/
        this.upperBound = upperBound;
        System.arraycopy(ByteTool.shortToBytes(this.upperBound), 0, this.page, BTreeSpec.OFF_UPPERBOUND, 2);
View Full Code Here

        int newV = prevPage.getPageNumber();
        if (needLog && (oldV != newV)) {
            int pgno = pageNumber.getPageNumber();
            BTreeReplLogRecord lr = new BTreeReplLogRecord(pageNumber.getTreeId(), pgno, txnId, BTreeSpec.OFF_PREVPAGE, ByteTool.intToBytes(oldV, btreeSpec.isMsbFirst()), ByteTool.intToBytes(newV, btreeSpec.isMsbFirst()), btreeSpec.btree.getType());

            lr.log();
        }
        /******************************************************************/
        this.prevPage.setPageNumber(prevPage);
        System.arraycopy(ByteTool.intToBytes(this.prevPage.getPageNumber()), 0, this.page, BTreeSpec.OFF_PREVPAGE, 4);

View Full Code Here

        int newV = nextPage.getPageNumber();
        if (needLog && (oldV != newV)) {
            int pgno = pageNumber.getPageNumber();
            BTreeReplLogRecord lr = new BTreeReplLogRecord(pageNumber.getTreeId(), pgno, txnId, BTreeSpec.OFF_NEXTPAGE, ByteTool.intToBytes(oldV, btreeSpec.isMsbFirst()), ByteTool.intToBytes(newV, btreeSpec.isMsbFirst()), btreeSpec.btree.getType());

            lr.log();
        }
        /******************************************************************/
        this.nextPage.setPageNumber(nextPage);
        System.arraycopy(ByteTool.intToBytes(this.nextPage.getPageNumber()), 0, this.page, BTreeSpec.OFF_NEXTPAGE, 4);
    }
View Full Code Here

        if (needLog) {
            int pgno = pageNumber.getPageNumber();

            BTreeReplLogRecord lr = new BTreeReplLogRecord(pageNumber.getTreeId(), pgno, txnId, BTreeSpec.OFF_DOCID, oldV, newV, btreeSpec.btree.getType());

            lr.log();
        }
        /******************************************************************/
        docid = docID;
        System.arraycopy(newV, 0, this.page, BTreeSpec.OFF_DOCID, BTree.DOCID_SIZE);
    }
View Full Code Here

        if (needLog && (oldV != newV)) {
            int pgno = pageNumber.getPageNumber();

            BTreeReplLogRecord lr = new BTreeReplLogRecord(pageNumber.getTreeId(), pgno, txnId, BTreeSpec.OFF_FLAGS, ByteTool.intToBytes(oldV, btreeSpec.isMsbFirst()), ByteTool.intToBytes(newV, btreeSpec.isMsbFirst()), btreeSpec.btree.getType());

            lr.log();
        }
        /******************************************************************/

        this.flags = flags;
        System.arraycopy(ByteTool.intToBytes(this.flags), 0, this.page, BTreeSpec.OFF_FLAGS, 4);
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.