/** * Write the operation to the trace system if debug trace is enabled. * * @param operation the operation performed * @param id the id of the operation */ public void traceOperation(String operation, int id) { if (trace.isDebugEnabled()) { trace.debug("{0} {1}", operation, id); } }
/** * Close without further writing. */ void close() { trace.debug("log close"); if (pageOut != null) { pageOut.close(); pageOut = null; } writeBuffer = null; }
@Override public void close(Session session) { if (trace.isDebugEnabled()) { trace.debug("{0} close", this); } if (delta != null) { delta.clear(); } rowCountDiff = 0; if (sessionRowCount != null) { sessionRowCount.clear(); } // can not close the index because it might get used afterwards, // for example after running recovery writeRowCount(); }
private void storePage() { if (trace.isDebugEnabled()) { trace.debug("pageOut.storePage " + data); } data.write(); }
/** * Remove a server from the list of cluster nodes and disables the cluster * mode. * * @param e the exception (used for debugging) * @param i the index of the server to remove * @param count the retry count index */ public void removeServer(IOException e, int i, int count) { trace.debug(e, "removing server because of exception"); transferList.remove(i); if (transferList.isEmpty() && autoReconnect(count)) { return; } checkClosed(); switchOffCluster(); }
/** * Set the trunk page and data page id of the log. * * @param logKey the log key of the trunk page * @param trunkPageId the trunk page id * @param dataPageId the data page id */ void setLogFirstPage(int logKey, int trunkPageId, int dataPageId) { if (trace.isDebugEnabled()) { trace.debug("setLogFirstPage key: " + logKey + " trunk: "+ trunkPageId +" data: " + dataPageId); } this.logKey = logKey; this.logFirstTrunkPage = trunkPageId; this.logFirstDataPage = dataPageId; writeVariableHeader(); }
@Override public synchronized void writeBack(CacheObject obj) { Page record = (Page) obj; if (trace.isDebugEnabled()) { trace.debug("writeBack " + record); } record.write(); record.setChanged(false); }
@Override public void close(Session session) { if (trace.isDebugEnabled()) { trace.debug("close"); } // can not close the index because it might get used afterwards, // for example after running recovery try { writeRowCount(); } finally { store.incrementChangeCount(); } }
private void traceLock(Session session, boolean exclusive, String s) { if (traceLock.isDebugEnabled()) { traceLock.debug("{0} {1} {2} {3}", session.getId(), exclusive ? "exclusive write lock" : "shared read lock", s, getName()); } }
private int getFirstUncommittedSection() { trace.debug("getFirstUncommittedSection"); Session[] sessions = database.getSessions(true); int firstUncommittedSection = log.getLogSectionId(); for (Session session : sessions) { int firstUncommitted = session.getFirstUncommittedLog(); if (firstUncommitted != Session.LOG_WRITTEN) { if (firstUncommitted < firstUncommittedSection) { firstUncommittedSection = firstUncommitted; } } } return firstUncommittedSection; }
@Override public void remove(Session session) { if (trace.isDebugEnabled()) { trace.debug("remove"); } removeAllRows(); store.free(rootPageId); store.removeMeta(this, session); }
private void traceLock(Session session, boolean exclusive, TraceLockEvent eventEnum, String extraInfo) { if (traceLock.isDebugEnabled()) { traceLock.debug("{0} {1} {2} {3} {4}", session.getId(), exclusive ? "exclusive write lock" : "shared read lock", eventEnum.getEventText(), getName(), extraInfo); } }
@Override public void remove(Session session) { if (trace.isDebugEnabled()) { trace.debug("{0} remove", this); } removeAllRows(); store.free(rootPageId); store.removeMeta(this, session); }
/** * Add a page to the free list. The page is not used, therefore doesn't need * to be overwritten. * * @param pageId the page id */ void freeUnused(int pageId) { if (trace.isDebugEnabled()) { trace.debug("freeUnused " + pageId); } cache.remove(pageId); freePage(pageId); freed.set(pageId); }
@Override public void add(Session session, Row row) { if (trace.isDebugEnabled()) { trace.debug("{0} add {1}", getName(), row); } // safe memory SearchRow newRow = getSearchRow(row); try { addRow(newRow); } finally { store.incrementChangeCount(); } }
@Override public void truncate(Session session) { if (trace.isDebugEnabled()) { trace.debug("truncate"); } removeAllRows(); if (tableData.getContainsLargeObject()) { database.getLobStorage().removeAllForTable(table.getId()); } tableData.setRowCount(0); }
/** * Fill the data page with zeros and write it. * This is required for a checkpoint. */ void fillPage() { if (trace.isDebugEnabled()) { trace.debug("pageOut.storePage fill " + data.getPos()); } reserve(data.getRemaining() + 1); reserved -= data.getRemaining(); data.write(); initNextData(); }
@Override public void truncate(Session session) { if (trace.isDebugEnabled()) { trace.debug("{0} truncate", this); } store.logTruncate(session, tableData.getId()); removeAllRows(); if (tableData.getContainsLargeObject() && tableData.isPersistData()) { // unfortunately, the data is gone on rollback session.commit(false); database.getLobStorage().removeAllForTable(table.getId()); } if (multiVersion) { sessionRowCount.clear(); } tableData.setRowCount(0); }
/** * A table is truncated. * * @param session the session * @param tableId the table id */ void logTruncate(Session session, int tableId) { if (trace.isDebugEnabled()) { trace.debug("log truncate s: " + session.getId() + " table: " + tableId); } session.addLogPos(logSectionId, logPos); logPos++; Data buffer = getBuffer(); buffer.writeByte((byte) TRUNCATE); buffer.writeVarInt(session.getId()); buffer.writeVarInt(tableId); write(buffer); }
private void freeLogPages(IntArray pages) { if (trace.isDebugEnabled()) { trace.debug("log frees " + pages.get(0) + ".." + pages.get(pages.size() - 1)); } Data buffer = getBuffer(); buffer.writeByte((byte) FREE_LOG); int size = pages.size(); buffer.writeVarInt(size); for (int i = 0; i < size; i++) { buffer.writeVarInt(pages.get(i)); } write(buffer); }