Examples of LogRecord


Examples of org.chaidb.db.log.LogRecord

     * Redo operation.
     * @exception ChaiDBException Exception while doing redo operation.
     *
     */
    private void redo() throws ChaiDBException {
        LogRecord cursorLogRecord;
        boolean cont = true;
        int currentProcess = 0;
        int percent;
        while (cont) {
            long start1 = System.currentTimeMillis();

            while (redoStack.size() != 0) {
                cursorLogRecord = (LogRecord) redoStack.pop();
                if (this instanceof CatastrophicTxnRecoverImpl) {
                    redo_current++;
                    percent = redo_current / redo_average;
                    if (percent != currentProcess) {
                        currentProcess++;
                        if (currentProcess <= 5) System.out.print("\r" + (currentProcess + 5) + "0% completed.");
                    }
                }
                try {
                    cursorLogRecord.recover(LogRecord.REDO);
                } catch (ChaiDBException e) {
                    logger.error(e.toString());
                    continue;
                }
            }
View Full Code Here

Examples of org.chaidb.db.log.LogRecord

     * V3.1 should be compatible to V3.0
     */
    protected boolean undo() throws ChaiDBException {
        this.status = UNDO_STAGE;
        Lsn cursorLsn = null;
        LogRecord cursorLogRecord = null;
        int countCkp = 0; //checkpoint count number

        //Gets the lastest lsn in lsn.idb file.
        cursorLsn = txnManager.getLogManager().getLastLsnInFlush();
        boolean isEnd = false;
        Lsn smallestLsn = null;
        while (!isEnd) {
            try {
                cursorLogRecord = txnManager.getLogManager().get(cursorLsn);
            } catch (ChaiDBException e) {
                logger.error(e);
                throw e;
            }
            /* according to different log type to do different handling */
            switch (cursorLogRecord.getType()) {
                case LogRecord.LOG_TXN_CHILD:
                    break;
                case LogRecord.LOG_TXN_CHECKPOINT://V3.0 standard checkpoint consistent state
                    countCkp++;
                    if (countCkp == 1) {
                        this.txnManager.setLastCkp(cursorLsn);
                    } else if (countCkp == 2) {
                        isEnd = true;
                    }
                    break;
                case LogRecord.LOG_TXN_FUZZY_CHECKPOINT://V3.1 fuzzy checkpoint
                    countCkp++;
                    if (countCkp == 1) {
                        this.txnManager.setLastCkp(cursorLsn);
                    } else if (countCkp == 2) {
                        TxnFuzzyCkpLogRecord fuzzyCkpLog = (TxnFuzzyCkpLogRecord) cursorLogRecord;
                        /* V3.1, if no active txn while doing fuzzy checkpoint,
                            smallestLsn is equals to current checkpoint log lsn,if
                            has active txns,it's euqals to smallest first_lsn of all
                            active txns. */
                        smallestLsn = fuzzyCkpLog.getSmallestLsn();
                    }
                    break;
                default:
                    //Adding TxnRegopLogRecord to redostack,and do its redo function for release txn resource of btree.
                    if (cursorLogRecord.getType() == LogRecord.LOG_TXN_REGOP) {
                        Integer txnid = new Integer(cursorLogRecord.getTxnId());
                        redoTable.put(txnid, txnid);
                    }

                    boolean doUNDO = false;
                    if (!redoTable.containsKey(new Integer(cursorLogRecord.getTxnId()))) {
                        doUNDO = true;
                    }

                    if (cursorLogRecord.getType() == LogRecord.LOG_DELETE_FILES) {
                        if (!redoTable.containsKey(new Integer(cursorLogRecord.getTxnId()))) {
                            Integer txnid = new Integer(cursorLogRecord.getTxnId());
                            redoTable.put(txnid, txnid);
                        }
                        doUNDO = false;
                    }

                    if (doUNDO) {
                        try {
                            cursorLogRecord.recover(LogRecord.UNDO);
                        } catch (ChaiDBException ie11) {
                            logger.error(ie11);
                            continue;
                        }
                    } else { //push into redo stack
                        redoStack.push(cursorLogRecord);
                        if (redoStack.size() == STACK_MAXSIZE) {
                            logger.info("Stack change. " + redoStack.size());

                            saveStack(cursorLsn);
                            logger.info(", New=" + redoStack.size() + " Stack" + (++stacks));
                        }

                    }
            }//switch

            if (cursorLsn.getOffset() == LogManager.FIRSTREC_PREVOFFSET || //current lsn is the first lsn of all log files
                    (smallestLsn != null && cursorLsn.compare(smallestLsn) == 0)//current lsn is equal to smallest lsn
                    ) {
                isEnd = true;
            }

            cursorLsn = new Lsn(cursorLsn.getFileId(), cursorLogRecord.getHeader().getPrevOffset());

        }//while

        if (countCkp == 0) {
            this.txnManager.setLastCkp(new Lsn(LogManager.FIRSTREC_LSN));
View Full Code Here

Examples of org.chaidb.db.log.LogRecord

        }
        while (lastTxnList.size() > 0) {
            TransactionLog transactionLog = (TransactionLog) lastTxnList.getFirst();
            byte[] data = transactionLog.pop();
            if (data != null) {
                LogRecord log = RecordFactory.createRecord(data, 0);
                if (log != null) {
                    logCount++;
                    return log;
                }
            }
View Full Code Here

Examples of org.glassfish.admin.rest.logviewer.LogRecord

    List<Serializable> record = srcRecords.get(recordIdx);

    assert (record.size() == fieldHeaders.length);
    //Serializable[] fieldValues = new Serializable[fieldHeaders.length];

    LogRecord rec = new LogRecord();
    int fieldIdx = 0;
    rec.setRecordNumber(((Long) record.get(fieldIdx++)).longValue());
    rec.setLoggedDateTime((Date) record.get(fieldIdx++));
    rec.setLoggedLevel((String) record.get(fieldIdx++));
    rec.setProductName((String) record.get(fieldIdx++));
    rec.setLoggerName((String) record.get(fieldIdx++));
    rec.setNameValuePairs((String) record.get(fieldIdx++));
    rec.setMessageID((String) record.get(fieldIdx++));
    rec.setMessage((String) record.get(fieldIdx++));
    if (type.equals("json")) {
        sb.append(sep);
        sb.append(rec.toJSON());
        sep = ",";
    } else {
        sb.append(rec.toXML());

    }
      }
  }
View Full Code Here

Examples of org.jzonic.jlo.LogRecord

        System.out.println(test);
        assertNotNull("huhu",test);
    }
   
    public String help() {
        LogRecord lr = new LogRecord("Test",Target.trace);
        DefaultFormatter df = new DefaultFormatter("Test");
        String test = df.formatMessage(lr);
        return test;
    }
View Full Code Here

Examples of org.jzonic.jlo.LogRecord

        TestSuite suite = new TestSuite(SimpleFormatterTest.class);
        return suite;
    }
   
    public void testFormat() {
        LogRecord lr = new LogRecord("Test",Target.trace);
        SimpleFormatter sf = new SimpleFormatter("Test");
        String test = sf.formatMessage(lr);
        assertNotNull(test);
    }
View Full Code Here

Examples of org.jzonic.jlo.LogRecord

        String test = sf.formatMessage(lr);
        assertNotNull(test);
    }

    public void testFormat2() {
        LogRecord lr = new LogRecord("Test",Target.trace);
        SimpleFormatter sf = new SimpleFormatter("Test");
        Map params = new HashMap();
        params.put("date","dd.MM.yyyy");
        sf.setParameter(params);
        String test = sf.formatMessage(lr);
View Full Code Here

Examples of org.jzonic.jlo.LogRecord

        TestSuite suite = new TestSuite(DefinedFormatterTest.class);
        return suite;
    }

    public void testFormatter() {
        LogRecord lr = new LogRecord("Testmessage",Target.trace);
        Map params = new HashMap();
        params.put("format","---- ${text} ----");
        DefinedFormatter df = new DefinedFormatter("Test");
        df.setParameter(params);
        String test = df.formatMessage(lr);
View Full Code Here

Examples of org.jzonic.jlo.LogRecord

        String test = df.formatMessage(lr);
        assertEquals("---- Testmessage ----",test);
    }

    public void testFormatter2() {
        LogRecord lr = new LogRecord("Testmessage",Target.trace);
        lr.setSourceClassName(getClass().getName());
        Map params = new HashMap();
        params.put("format","---- ${class} ${shortclass} ${text} ----");
        DefinedFormatter df = new DefinedFormatter("Test");
        df.setParameter(params);
        String test = df.formatMessage(lr);
View Full Code Here

Examples of org.jzonic.jlo.LogRecord

        String test = df.formatMessage(lr);
        assertEquals("---- org.jzonic.jlo.formatter.DefinedFormatterTest DefinedFormatterTest Testmessage ----",test);
    }

    public void testFormatter3() {
        LogRecord lr = new LogRecord("Testmessage",Target.trace);
        lr.setSourceClassName(getClass().getName());
        Map params = new HashMap();
        params.put("format","[${target}] : ${text}");
        DefinedFormatter df = new DefinedFormatter("Test");
        df.setParameter(params);
        String test = df.formatMessage(lr);
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.