eden/scm/slides/201808-indexedlog/indexedlog.md
Current usage
The single data structure powering most of the vanilla Mercurial.
.i | .d
+------------------+ | +-------------------+
| rev 0 metadata | -- points to -> | rev 0 full text |
+------------------+ | +--------------+----+
| rev 1 metadata | -- points to -> | rev 1 delta |
+------------------+ | +--------------+-+
| rev 2 metadata | -- points to -> | rev 2 delta |
+------------------+ | +----------------+
|
|<--- 64 bytes --->| | |<- variant sized ->|
Problems
The two formats powering Git.
Git does not have Revision Numbers.
Remotefilelog is similar.
Problems
.idx | .pack
|
Level1 Level2 | Similar to
1st byte Sorted SHA1s | revlog.d
+----+ +------+ | +-----------+
| 00 | --> | 0000 | ---------> | full text |
+----+ | 0002 | ---. | +---------+-+
| 01 | | ... | \ .--> | delta |
+----+ | 00ff | -. X | +--------++
| . | +------+ \ / `--> | delta |
| . | X | +--------+----+
| . | +------+ / \.---> | full text |
+----+ | ff01 | -' /\ | +-------+-----+
| ff | --> | ff02 | ---' '--> | delta |
+----+ +------+ | +-------+
Problems
repack to maintain performance
repack can be very expensiveProblems
Complexities
File Storage:
| Revlog | Loose | Pack | |
|---|---|---|---|
| Revnum | :cry: | :smiley: | :smiley: |
| Insertion | :smiley: | :slightly_smiling_face: | :thinking: |
| Lookup | :cry: | :smiley: | :slightly_smiling_face: |
| Space | :slightly_smiling_face: | :scream: | :slightly_smiling_face: |
| Inode # | :cry: | :scream: | :smiley: |
| Maintenance | :smiley: | :smiley: | :cry: |
Obsstore:
Changelog:
Goals
Be general purposed.
.--------------------------------------------.
| File Storage |
| |
| .-----------------------------. |
| | Indexed Log | |
| | | |
| | .-------------------------. | |
| | | Append Only Radix Index | | |
| | | | | |
| | | .-----------------. | | .-------. |
| | | | Integrity Check | | | | Zstd | |
| | | | for append only | | | | Delta | |
| | | | files | | | '-------' |
| | | '-----------------' | | |
| | '-------------------------' | |
| '-----------------------------' |
'--------------------------------------------'
Insert 81c2 | Insert 82ee
|
.----------------------. .------.
| | | | |
v | | | v
+-------------+ | +---+-|-+---+-|-+ +-------------+
| value: 81c2 | | | 1 | * | 2 | * | | value: 82ee |
+-------------+ | +---+---+---+---+ +-------------+
^ | ^
| | |
'---. | '---.
| | |
+---+-|-+ | +---+-|-+
| 8 | * | | | 8 | * |
+---+---+ | +---+---+
Root v1 | Root v2
flush.bytes.entry -> Vec<bytes>)On disk, an IndexedLog is stored as a directory:
log The source of truth.index.{foo} Index "foo".index.{foo}.sum Chunked checksums of Index "foo".meta Pointers to root nodes. Logical file lengths.With every data structure being append-only and controlled by meta. Transactions can be just different meta files ex. meta.tr{name}. This allows multiple on-going transactions.