| 1693 | } |
| 1694 | |
| 1695 | void BufferPoolTest::TestTmpFileAllocateError( |
| 1696 | const string& compression, bool punch_holes) { |
| 1697 | const int MAX_NUM_BUFFERS = 2; |
| 1698 | const int64_t TOTAL_MEM = TEST_BUFFER_LEN * MAX_NUM_BUFFERS; |
| 1699 | BufferPool pool(test_env_->metrics(), TEST_BUFFER_LEN, TOTAL_MEM, TOTAL_MEM); |
| 1700 | global_reservations_.InitRootTracker(NewProfile(), TOTAL_MEM); |
| 1701 | ClientHandle client; |
| 1702 | ASSERT_OK(pool.RegisterClient("test client", NewFileGroup(), &global_reservations_, |
| 1703 | nullptr, TOTAL_MEM, NewProfile(), &client)); |
| 1704 | ASSERT_TRUE(client.IncreaseReservation(TOTAL_MEM)); |
| 1705 | |
| 1706 | vector<PageHandle> pages; |
| 1707 | CreatePages(&pool, &client, TEST_BUFFER_LEN, TOTAL_MEM, &pages); |
| 1708 | // Unpin a page, which will trigger a write. |
| 1709 | pool.Unpin(&client, pages.data()); |
| 1710 | WaitForAllWrites(&client); |
| 1711 | // Remove permissions to the temporary files - subsequent operations will fail. |
| 1712 | ASSERT_GT(RemoveScratchPerms(test_env_->tmp_file_mgr()->GetTmpDirPath(0)), 0); |
| 1713 | // The write error will happen asynchronously. |
| 1714 | pool.Unpin(&client, &pages[1]); |
| 1715 | |
| 1716 | // Write failure causes future operations like Pin() to fail. |
| 1717 | WaitForAllWrites(&client); |
| 1718 | Status error = pool.Pin(&client, pages.data()); |
| 1719 | EXPECT_EQ(TErrorCode::SCRATCH_ALLOCATION_FAILED, error.code()); |
| 1720 | EXPECT_FALSE(pages[0].is_pinned()); |
| 1721 | |
| 1722 | DestroyAll(&pool, &client, &pages); |
| 1723 | pool.DeregisterClient(&client); |
| 1724 | } |
| 1725 | |
| 1726 | TEST_F(BufferPoolTest, WriteErrorBlacklist) { |
| 1727 | TestWriteErrorBlacklist("", false); |
nothing calls this directly
no test coverage detected