Allocate buffers of varying sizes at most 'max_buffer_size' that add up to 'total_bytes'. Both numbers must be a multiple of the minimum buffer size. If 'randomize_core' is true, will switch thread between cores randomly before each allocation.
| 223 | /// If 'randomize_core' is true, will switch thread between cores randomly before |
| 224 | /// each allocation. |
| 225 | void AllocateBuffers(BufferPool* pool, BufferPool::ClientHandle* client, |
| 226 | int64_t max_buffer_size, int64_t total_bytes, |
| 227 | vector<BufferPool::BufferHandle>* buffers, bool randomize_core = false) { |
| 228 | int64_t curr_buffer_size = max_buffer_size; |
| 229 | int64_t bytes_remaining = total_bytes; |
| 230 | while (bytes_remaining > 0) { |
| 231 | while (curr_buffer_size > client->GetUnusedReservation()) curr_buffer_size /= 2; |
| 232 | if (randomize_core) CpuTestUtil::PinToRandomCore(&rng_); |
| 233 | buffers->emplace_back(); |
| 234 | ASSERT_OK(pool->AllocateBuffer(client, curr_buffer_size, &buffers->back())); |
| 235 | bytes_remaining -= curr_buffer_size; |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | /// Do a temporary test allocation. Return the status of AllocateBuffer(). |
| 240 | Status AllocateAndFree(BufferPool* pool, ClientHandle* client, int64_t len) { |
nothing calls this directly
no test coverage detected