5.4.2 log::log (The Create Constructor)



next up previous
Next: 5.4.3 log::log (The Open Up: 5.4 class log Previous: 5.4.1 class Rawfile

5.4.2 log::log (The Create Constructor)

 

The create constructor is invoked by a special utility which creates a database. This utility does not run transactions. Also, transactions do not use the database being created until the create utility successfully completes. Therefore, the create constructor does not need to provide the full functionality of an open (see Section 5.4.3). It does not create a shared memory structure or attach to it, and does not allow any of the log methods to be invoked. It simply creates a log file (a Rawfile) of the appropriate size and initializes it. Initialization involves writing the header page (in page 0) which contains a master log record, the size of the log file, and the size of the log tail. This is used in future opens to allocate and initialize the appropriate data structures. The size of the log tail is one page in the current implementation. The master log record contains the LSN of the last checkpoint record that made it to disk. For a new log, there is no checkpoint record. This field, therefore, is set to invalid_lsn.

The create constructor then closes the Rawfile. The log is now ready for future use.



ajitk@cs.wisc.edu, cjin@cs.wisc.edu