def test_L0_compaction(): table_name = "test_table" lsm = LSMStorage(72, 4) lsm.build_memtable(table_name) records = get_8_records(True) lower, upper = records[0].id, records[-1].id lsm.write_records_to_level_SST(records, table_name, lower, upper, "L0") recs2 = get_8_records(True)[0:4] recs2[0].client_name = "newname1" recs2[1].client_name = "newname2" lower, upper = recs2[0].id, recs2[-1].id lsm.write_records_to_level_SST(recs2, table_name, lower, upper, "L0") lsm.compact_L0(table_name)
def test_L1_search(): table_name = "test_table" lsm = LSMStorage(72, 4) lsm.build_memtable(table_name) records = get_8_records(True) lower, upper = records[0].id, records[-1].id lsm.write_records_to_level_SST(records, table_name, lower, upper, "L0") recs2 = get_8_records(True)[0:4] recs2[0].client_name = "newname1" recs2[1].client_name = "newname2" lower, upper = recs2[0].id, recs2[-1].id lsm.write_records_to_level_SST(recs2, table_name, lower, upper, "L0") lsm.compact_L0(table_name) rec, ss = lsm.get_record(1, table_name) rec2, ss2 = lsm.get_record(5, table_name) print(rec) print(ss) print(rec2) print(ss2)