SsTable test: test_task2_concat_iterator of week2_day1 is actually better than test_sst_seek_key of week1_day4.
Consider this scenario:
I didn't set first_key in SstTableBuilder after replacing old builder with new builder because old builder is full.
- In
test_sst_seek_key of wee1_day4, I will get a wrong meta, where the wrong first key is the next key of the right first key:
add block first key b"key_005"
add block last key b"key_008"
add block first key b"key_010" -> wrong (correct: key_009)
add block last key b"key_012"
add block first key b"key_014" -> wrong (correct: key_013)
add block last key b"key_016"
...
But I can still get the right key and value, so I pass the test.
- In
test_task2_concat_iterator of week2_day1, I will get a meta, where some first key are b"". So I can't pass the test:
add block first key b"00010"
add block last key b"00018"
add block first key b"" -> wrong
add block last key b"00019"
add block first key b"00020"
add block last key b"00028"
add block first key b"" -> wrong
add block last key b"00029"
add block first key b"00030"
add block last key b"00038"
add block first key b"" -> wrong
add block last key b"00039"
add block first key b"00040"
add block last key b"00048"
...
The reason that behind this is directly building the table after replacing a block.
I don't know if there is need to copy the test to sstable in week1 day4 or this is just an undefined behavior.
SsTable test:
test_task2_concat_iteratorof week2_day1 is actually better thantest_sst_seek_keyof week1_day4.Consider this scenario:
I didn't set
first_keyinSstTableBuilderafter replacing old builder with new builder because old builder is full.test_sst_seek_keyof wee1_day4, I will get a wrong meta, where the wrong first key is the next key of the right first key:But I can still get the right key and value, so I pass the test.
test_task2_concat_iteratorof week2_day1, I will get a meta, where some first key are b"". So I can't pass the test:The reason that behind this is directly building the table after replacing a block.
I don't know if there is need to copy the test to sstable in week1 day4 or this is just an undefined behavior.