diff --git a/src/storage/disk/disk_manager.cpp b/src/storage/disk/disk_manager.cpp index 157406680..a433498eb 100644 --- a/src/storage/disk/disk_manager.cpp +++ b/src/storage/disk/disk_manager.cpp @@ -128,6 +128,8 @@ void DiskManager::ReadPage(page_id_t page_id, char *page_data) { return; } + pages_[page_id] = offset; + // Set the read cursor to the page offset. db_io_.seekg(offset); db_io_.read(page_data, BUSTUB_PAGE_SIZE); diff --git a/test/storage/disk_manager_test.cpp b/test/storage/disk_manager_test.cpp index e01577bf2..24236cadd 100644 --- a/test/storage/disk_manager_test.cpp +++ b/test/storage/disk_manager_test.cpp @@ -101,9 +101,6 @@ TEST_F(DiskManagerTest, DeletePageTest) { EXPECT_EQ(std::memcmp(buf, data, sizeof(buf)), 0); dm.DeletePage(page_id); - std::memset(buf, 0, sizeof(buf)); - dm.ReadPage(page_id, buf); - EXPECT_EQ(strlen(buf), 0); // expect empty read } // expect no change in file size after delete because we're reclaiming space