public void createCheckpoint ( Transaction checkpointTx ) { // stop access new tx request and find out active txs by using a write // lock on threadTxNums List < Long > txNums ; // for (Transaction tx : activeTxs) // if (tx.getTransactionNumber() != checkpointTx // .getTransactionNumber()) // txNums.add(tx.getTransactionNumber()); // activeTxsLock.writeLock().lock(); // try { // for (Long l : threadTxNums) { // if (l >= 0) { // txNums.add(l); // } // } // // // flush all buffers // // CT : Pick a tx and call its bufferMgr flushAll, or get // // bufferPoolMgr (init it at VanillaDb) // checkpointTx.bufferMgr().flushAll(); // // wrtie a checkpoint record and flush to disk // LogSeqNum lsn = checkpointTx.recoveryMgr().checkpoint(txNums); // VanillaDb.logMgr().flush(lsn); // System.out.println("Chkpnt :" + txNums); // } finally { // activeTxsLock.writeLock().unlock(); // } // Old method synchronized ( this ) { txNums = new LinkedList < Long > ( activeTxs ) ; checkpointTx . bufferMgr ( ) . flushAll ( ) ; LogSeqNum lsn = checkpointTx . recoveryMgr ( ) . checkpoint ( txNums ) ; VanillaDb . logMgr ( ) . flush ( lsn ) ; } }
Creates non - quiescent checkpoint record .