---
# System prepended metadata

title: Notes 04/19/2022

---

# Notes 04/19/2022

## Forwarding Address

Maintained properties of Slots (Pair of Offset and Length)

- Offset >= 0
    - It can be zero if it is the first record
- Length >= 0
    - It can be zero if the record is empty (I think)
    - Also [the Piazza post](https://piazza.com/class/l18drq3gvwq4rf?cid=28) says so

To redirect, we want to store a RID instead, which is a pair of PageNum and SlotNum.

- PageNum >= 0
    - [PageNum starts at 0](https://github.com/shumbo/CSE181-PJ2/blob/47344a26c1f0e8de5adc188d406eacf817a6260e/rbf/rbfm.cc#L72-L93)
- SlotNum
    - Starts at 0?

A slot might be in the following three status:

1. Record is on the page
1. Record has been deleted
    - Sign of offset is negative (e.g. -1)
    - Return error for operations on this RID
3. Record is a forwarding address
    - Sign of length is negative
    - `Slot::Offset` has `PageNum`
    - `Slot::Length` has `-(SlotNum + 1)`

Add a field for unused slots in page header(Offset to free space, # of slots, # of unused slots)