5.2 class logrecord



next up previous
Next: 5.3 class shm_log Up: 5 Implementation Previous: 5.1 class lsn_t

5.2 class logrecord

 

Class logrecord declares a buffer which is an array of characters of size . PAGESIZE, the size of a page, is declared in the header file page.h. A normal update can log a modification to an entire page of the database. Thus, the sizes of the before and after images can each be one page. Header information in each log record will add another fraction of a page. Thus, a maximum size of 3 pages suffices. Checkpoint records, however, could potentially be very large. In such situations, the log record can be broken into several pieces, each piece of size less than 3 pages.

The first part of the buffer contains the log record header (described in Section 4.2). The remaining portion is the data. Thus, the entire log record will be stored physically contiguously in the buffer. The logrechead_ptr and data_ptr members point to the start of the buffer and start + sizeof(logrecheader) respectively.

Implementation of the methods of this class also (see logrecord.h and logrecord.C) is straightforward and will not be described.



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