MinLSN is the LSN of the oldest uncommitted transaction.
This is not exactly true
LSN stands for Log Sequence Number.
Each log record has a LSN and each new log record is written to the logical end of the log with a higher LSN than the previous LSN.
Using this simplified Log Sequence:
80 Begin Tran 1
82 Begin Tran 2
83 Update Tran 2
84 Check Point
85 Update 1
86 Commit Tran 1
87 Check Point
88 Update Tran 2
Next LSNs will be 89, 90, ...
The Log Sequence Number of the first log record that is required to successfully perform a full recovery of the database is recorded in checkpoint records. This LSN is called Minimum recovery LSN or MinLSN.
MinLSN is the minimun of:
- LSN of the beginning of the oldest active transaction
- LSN of the start of the last checkpoint
- LSN of the beginning of the oldest replication transaction that has not yet been replicated
If we look at the above LSN records, MinLSN candidates are:
- Oldest active transaction =
Begin Tran 2 with
- LSN of the last checkpoint =
Therefore MinLSN is
- What exactly does Active Log hold?
The list of LSNs starting at MinLSN and up to the last recorded LSN is called the
Active Log. Here Active log is composed of LSN 82 to 88. MinLSN is just the first LSN of the Active Log.
- Isn't it suppose to hold all the uncommitted transactions?
- Does it hold any other log records which are already committed?
You can see that the Active Log still contains already commited transactions (TRAN 1) because their LSNs are bigger than the MinLSN.
- What happens to MinLSN and Active Log when a CHECKPOINT happens?
When a new checkpoint occurs and is recorded: