mini-lsm
mini-lsm copied to clipboard
Added print functionality to iters to allow simpler debugging
What This PR Does
- Adds print functionality to all iterators
- Ensures proper formatting for each iterator
Sample output for a two merge iterator shown below
xxxxxxxxxx TWO_MERGE_ITERATOR xxxxxxxxxx
---------- ITERATOR A ----------
---------- Merge Iterator ----------
Current Iterator (Index 1):
---------- Memtable Iterator ----------
Key : "00"
Value : "2333"
---------- End Memtable Iterator ----------
Iterators in Heap: 1
Iterator Index 0: Valid
---------- Memtable Iterator ----------
Key : "1"
Value : ""
---------- End Memtable Iterator ----------
---------- End Merge Iterator ----------
---------- END ITERATOR A ----------
---------- ITERATOR B ----------
---------- Merge Iterator ----------
Current Iterator (Index 1):
---------- SST_ITERATOR ----------
Current Block Index: 0
---------- Block Iterator ----------
First Key : "0"
Current Key : "0"
Current Value : "2333333"
Key Index : 0
========== Block ==========
Index : 0
Key : 0
Value : 2333333
--------------------
Index : 1
Key : 00
Value : 2333333
--------------------
Index : 2
Key : 4
Value : 23
--------------------
Offsets: [0, 14, 28]
========== End Block ==========
---------- Block Iterator End ----------
---------- SST_ITERATOR_END ----------
Iterators in Heap: 1
Iterator Index 0: Valid
---------- SST_ITERATOR ----------
Current Block Index: 0
---------- Block Iterator ----------
First Key : "4"
Current Key : "4"
Current Value : ""
Key Index : 0
========== Block ==========
Index : 0
Key : 4
Value :
--------------------
Offsets: [0]
========== End Block ==========
---------- Block Iterator End ----------
---------- SST_ITERATOR_END ----------
---------- End Merge Iterator ----------
---------- END ITERATOR B ----------
xxxxxxxxxx END TWO_MERGE_ITERATOR xxxxxxxxxx
Questions
- One point to note is that the decoding scheme used for a block is the compressed key format implemented on week 1 day 7. Should that be the decoding scheme while printing?
- Should this be left as an exercise for the student since they are expected to implement an encoding decoding scheme anyway?