MCPcopy Create free account
hub / github.com/apache/impala / TestTmpFileAllocateError

Method TestTmpFileAllocateError

be/src/runtime/bufferpool/buffer-pool-test.cc:1695–1724  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1693}
1694
1695void 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
1726TEST_F(BufferPoolTest, WriteErrorBlacklist) {
1727 TestWriteErrorBlacklist("", false);

Callers

nothing calls this directly

Calls 12

InitRootTrackerMethod · 0.80
GetTmpDirPathMethod · 0.80
codeMethod · 0.80
DeregisterClientMethod · 0.80
metricsMethod · 0.45
RegisterClientMethod · 0.45
IncreaseReservationMethod · 0.45
UnpinMethod · 0.45
dataMethod · 0.45
tmp_file_mgrMethod · 0.45
PinMethod · 0.45
is_pinnedMethod · 0.45

Tested by

no test coverage detected