Skip to content

Update smallest and largest Key value in SSTIndex file #42

@kkli08

Description

@kkli08

Update page information in Index.sst, and should pass the following unit test once the issue has been solved.

TEST(SSTIndexTest, UpdateExistingSSTInIndex) {
    SSTIndex* index = new SSTIndex();
    index->set_path("test_db");

    index->addSST("sst_1.sst", 10, 100);
    index->addSST("sst_1.sst", 50, 150); // Update with new keys

    std::deque<SSTInfo*> sst_index = index->getSSTsIndex();
    ASSERT_EQ(sst_index.size(), 1);
    EXPECT_EQ(sst_index[0]->filename, "sst_1.sst");
    EXPECT_EQ(sst_index[0]->smallest_key, 50);
    EXPECT_EQ(sst_index[0]->largest_key, 150);

    delete index;
    fs::remove_all("test_db");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions