lsn_t Class Reference
[How Log Sequence Numbers are Used]

Inherited by sm_save_point_t.

Inheritance diagram for lsn_t:

Inheritance graph
[legend]
Collaboration diagram for lsn_t:

Collaboration graph
[legend]
List of all members.

Detailed Description

Log Sequence Number. See Log Sequence Numbers.

A log sequence number points to a record in the log. It consists of two parts:

All state is stored in a single 64-bit value. This reading or setting is atomic on 64-bit platforms (though updates still need protection).

Warning:
This is NOT atomic on 32-bit platforms.
Because all state fits in 64 bits, there is a trade-off between maximum supported log partition size and number of partitions. Two reasonable choices are:

48-bit offsets are larger, but (slightly) more expensive and likely to wrap sooner. 32-bit offsets are still pretty big, and the chance of wrapping is *much* smaller (though a production system could theoretically hit the limit, since the count persists as long as the database exists. For now we go with the 32-32 split.

lsn_t no longer cares whether the disk can handle the full range it supports. If you support 48-bit partition sizes and the disk can only handle 32-bit offsets, the largest file will just happen to be smaller than lsn_t technically supports.

lsn_t does not cater to unaligned accesses. Log writes, in particular, are expected to be 8-byte aligned. The extra wasted bytes just aren't worth the performance hit of allowing misalignment.

Note:
Once the database runs long enough we will run out of partition numbers (only 64k possible). Fortunately, this is a log, so lsn_t don't last forever. Eventually things become durable and the log partition file gets reclaimed (deleted). As long as the first partition is gone before the last one fills, we can simply wrap and change the sense of lsn_t comparisions.
Examples:

log_exceed.cpp.

Definition at line 237 of file lsn.h.

Public Types

enum  
enum  

Public Member Functions

 lsn_t ()
 lsn_t (w_base_t::uint4_t f, sm_diskaddr_t r)
 lsn_t (const lsn_t &other)
bool valid () const
w_base_t::uint4_t hi () const
w_base_t::uint4_t file () const
sm_diskaddr_t lo () const
sm_diskaddr_t rba () const
void copy_rba (const lsn_t &other)
void set_rba (sm_diskaddr_t &other)
lsn_tadvance (int amt)
lsn_toperator+= (long delta)
lsn_t operator+ (long delta) const
bool operator> (const lsn_t &l) const
bool operator< (const lsn_t &l) const
bool operator>= (const lsn_t &l) const
bool operator<= (const lsn_t &l) const
bool operator== (const lsn_t &l) const
bool operator!= (const lsn_t &l) const

Static Public Member Functions

static w_base_t::uint8_t mask ()

Static Public Attributes

static const int sm_diskaddr_max
static const lsn_t null
static const lsn_t max


The documentation for this class was generated from the following files:
Generated on Wed Jul 7 17:22:43 2010 for Shore Storage Manager by  doxygen 1.4.7