Search in sources :

Example 6 with Loggable

use of org.apache.derby.iapi.store.raw.Loggable in project derby by apache.

the class LoggableAllocActions method actionCompressSpaceOperation.

/**
 * Compress free pages.
 * <p>
 * Compress the free pages at the end of the range maintained by
 * this allocation page.  All pages being compressed should be FREE.
 * Only pages in the last allocation page can be compressed.
 * <p>
 *
 * @param t				        The transaction
 * @param allocPage		        the allocation page to do compress on.
 * @param new_highest_page      The new highest page on this allocation
 *                              page.  The number is the offset of the page
 *                              in the array of pages maintained by this
 *                              allocation page, for instance a value of 0
 *                              indicates all page except the first one are
 *                              to be truncated.  If all pages are
 *                              truncated then the offset is set to -1.
 * @param num_pages_truncated   The number of allocated pages in this
 *                              allocation page prior to the truncate.
 *                              Note that all pages from NewHighestPage+1
 *                              through newHighestPage+num_pages_truncated
 *                              should be FREE.
 *
 * @exception  StandardException  Standard exception policy.
 */
public void actionCompressSpaceOperation(RawTransaction t, BasePage allocPage, int new_highest_page, int num_pages_truncated) throws StandardException {
    Loggable lop = null;
    // passing null to feature argument.
    if (t.getLogFactory().checkVersion(RawStoreFactory.DERBY_STORE_MAJOR_VERSION_10, RawStoreFactory.DERBY_STORE_MINOR_VERSION_3, null)) {
        lop = new CompressSpacePageOperation((AllocPage) allocPage, new_highest_page, num_pages_truncated);
    } else {
        lop = new CompressSpacePageOperation10_2((AllocPage) allocPage, new_highest_page, num_pages_truncated);
    }
    allocPage.preDirty();
    t.logAndDo(lop);
}
Also used : Loggable(org.apache.derby.iapi.store.raw.Loggable)

Example 7 with Loggable

use of org.apache.derby.iapi.store.raw.Loggable in project derby by apache.

the class LogToFile method findCheckpoint.

/*
		Find a checkpoint log record at the checkpointInstant

		<P> MT- read only
	*/
private CheckpointOperation findCheckpoint(long checkpointInstant, FileLogger logger) throws IOException, StandardException, ClassNotFoundException {
    StreamLogScan scan = (StreamLogScan) openForwardsScan(checkpointInstant, (LogInstant) null);
    // estimated size of a checkpoint log record, which contains 3 longs
    // and assorted other log record overhead
    Loggable lop = logger.readLogRecord(scan, 100);
    scan.close();
    if (lop instanceof CheckpointOperation)
        return (CheckpointOperation) lop;
    else
        return null;
}
Also used : LogInstant(org.apache.derby.iapi.store.raw.log.LogInstant) Loggable(org.apache.derby.iapi.store.raw.Loggable)

Aggregations

Loggable (org.apache.derby.iapi.store.raw.Loggable)7 LogRecord (org.apache.derby.impl.store.raw.log.LogRecord)3 TransactionId (org.apache.derby.iapi.store.raw.xact.TransactionId)2 ArrayInputStream (org.apache.derby.iapi.services.io.ArrayInputStream)1 Compensation (org.apache.derby.iapi.store.raw.Compensation)1 Undoable (org.apache.derby.iapi.store.raw.Undoable)1 LogInstant (org.apache.derby.iapi.store.raw.log.LogInstant)1 LogCounter (org.apache.derby.impl.store.raw.log.LogCounter)1 StreamLogScan (org.apache.derby.impl.store.raw.log.StreamLogScan)1 StandardException (org.apache.derby.shared.common.error.StandardException)1