Class TransactionStatePage


  • public class TransactionStatePage
    extends java.lang.Object
    This class wraps the transaction-state page to provide basic operations necessary for reading and storing essential values. The values stored in the transaction-state file are as follows:
    • Next Transaction ID. This is the next transaction ID, as recorded by the database at the last point this file was saved.
    • First Log Sequence Number (LSN). This is the LSN in the write-ahead log (WAL) where recovery should start from. It denotes a point in time where all table files and the WAL are completely in sync with each other. Since NanoDB doesn't support checkpointing (yet), this value is usually updated after recovery is completed, and also upon proper shutdown of the database.
    • Next LSN. This value is one byte past the last valid WAL record that has been successfully written and sync'd to the write-ahead log. Note that this value may be behind the WALManager.nextLSN value stored in memory.
    • Field Detail

      • OFFSET_NEXT_TXN_ID

        public static final int OFFSET_NEXT_TXN_ID
        The offset in the checkpoint page where the "Next Transaction ID" value is stored. This value is a signed int (4 bytes).
        See Also:
        Constant Field Values
      • OFFSET_FIRST_LSN_FILENUM

        public static final int OFFSET_FIRST_LSN_FILENUM
        The offset in the checkpoint page where the "First Log Sequence Number" file-number is stored. This value is an unsigned short (2 bytes).
        See Also:
        Constant Field Values
      • OFFSET_FIRST_LSN_OFFSET

        public static final int OFFSET_FIRST_LSN_OFFSET
        The offset in the checkpoint page where the "First Log Sequence Number" file-offset is stored. This value is a signed int (4 bytes).
        See Also:
        Constant Field Values
      • OFFSET_NEXT_LSN_FILENUM

        public static final int OFFSET_NEXT_LSN_FILENUM
        The offset in the checkpoint page where the "Next Log Sequence Number" file-number is stored. This value is an unsigned short (2 bytes).
        See Also:
        Constant Field Values
      • OFFSET_NEXT_LSN_OFFSET

        public static final int OFFSET_NEXT_LSN_OFFSET
        The offset in the checkpoint page where the "Next Log Sequence Number" file-offset is stored. This value is a signed int (4 bytes).
        See Also:
        Constant Field Values
      • dbPage

        private DBPage dbPage
    • Constructor Detail

      • TransactionStatePage

        public TransactionStatePage​(DBPage dbPage)
    • Method Detail

      • getNextTransactionID

        public int getNextTransactionID()
      • setNextTransactionID

        public void setNextTransactionID​(int nextTransactionID)