12.
Head
Offset
In
Memory
Read-Copy
Update
Stable
LA = 0
Read
Only
LA = ∞
Mutable
Disk
Increasing
Logical
Address
In-Place
Update
ReadOnly
Offset
Logical Address Operation
< Head Offset Issue async IO request
< ReadOnly Offset Copy to tail, CAS-update hash index
< Infinity Update in-place
New Record Add to tail, update hash table
17.
Logical Address Operation
< Head Offset Issue async IO request
< Safe ReadOnly Offset Copy to tail, update hash table
< ReadOnly Offset Go pending
< Infinity Update in-place
New Record Add to tail, update hash table
Stable
Thread
T2’s View
Read
Only
Mutable
Record
Stable
Thread
T1’s View
Read
Only
Mutable
Record
Safe
ReadOnly
Offset
Fuzzy
Region
18.
19. C P R
group commit
in-memory incr. checkpointing
scalable non-blocking
Database
C1
C2
C3
C4
C5
T1T2T3T4
T5T6T7T8
T9T10T11T12
T13T14T15T16
T17T18T19T20
20. Log Compaction
• Many workloads – just truncate old records from head of log
• Scan X% of log from begin (oldest record) onwards
• Build temp table (in-mem hash) of key-values
• Scan rest of log, eliminate unneeded keys from temp table
• Re-insert live “cold” keys to tail of log, truncate first X% of log
BEGIN TAIL