Ejemplo n.º 1
0
 /**
  * Prepare a transaction.
  *
  * @param session the session
  * @param transaction the name of the transaction
  */
 void prepareCommit(Session session, String transaction) {
   if (trace.isDebugEnabled()) {
     trace.debug("log prepare commit s: " + session.getId() + ", " + transaction);
   }
   if (store.getDatabase().getPageStore() == null) {
     // database already closed
     return;
   }
   // store it on a separate log page
   int pageSize = store.getPageSize();
   pageOut.flush();
   pageOut.fillPage();
   Data buffer = getBuffer();
   buffer.writeByte((byte) PREPARE_COMMIT);
   buffer.writeVarInt(session.getId());
   buffer.writeString(transaction);
   if (buffer.length() >= PageStreamData.getCapacity(pageSize)) {
     throw DbException.getInvalidValueException("transaction name (too long)", transaction);
   }
   write(buffer);
   // store it on a separate log page
   flushOut();
   pageOut.fillPage();
   if (store.getDatabase().getFlushOnEachCommit()) {
     flush();
   }
 }
Ejemplo n.º 2
0
 /** Switch to a new log section. */
 void checkpoint() {
   Data buffer = getBuffer();
   buffer.writeByte((byte) CHECKPOINT);
   write(buffer);
   undo = new BitField();
   logSectionId++;
   logPos = 0;
   pageOut.flush();
   pageOut.fillPage();
   int currentDataPage = pageOut.getCurrentDataPageId();
   logSectionPageMap.put(logSectionId, currentDataPage);
 }
Ejemplo n.º 3
0
 private void flushOut() {
   pageOut.flush();
 }