|
| | BlockHandle (BlockManager &block_manager, block_id_t block_id, MemoryTag tag) |
| | BlockHandle (BlockManager &block_manager, block_id_t block_id, MemoryTag tag, unique_ptr< FileBuffer > buffer, DestroyBufferUpon destroy_buffer_upon, idx_t size, BufferPoolReservation &&reservation) |
| BlockManager & | GetBlockManager () const |
| | Returns a reference to the block manager.
|
| block_id_t | BlockId () const |
| | Returns the block id.
|
| idx_t | GetBlockAllocSize () const |
| | Returns the block allocation size of this block.
|
| idx_t | GetBlockHeaderSize () const |
| | Returns the block header size including the 8-byte checksum.
|
| idx_t | GetBlockSize () const |
| | Returns the size of the block that is available for usage, as determined by the block manager that created the block. The block_alloc_size can differ from the memory_usage for blocks managed by the temporary block manager, thus, this should only be called for persistent blocks.
|
| const BlockMemory & | GetMemory () const |
| | Returns a const reference to the memory of a block.
|
| BlockMemory & | GetMemory () |
| | Returns a reference to the memory of a block.
|
| weak_ptr< BlockMemory > | GetMemoryWeak () const |
| | Returns a weak pointer to the memory of a block.
|
| BufferHandle | LoadFromBuffer (BlockLock &l, data_ptr_t data, unique_ptr< FileBuffer > reusable_buffer, BufferPoolReservation reservation) |
| BufferHandle | Load (QueryContext context, unique_ptr< FileBuffer > buffer=nullptr) |
| shared_ptr< BlockHandle > | shared_from_this () |
|
|
BlockManager & | block_manager |
| | The block manager, which loads the block.
|
|
idx_t | block_alloc_size |
| | The block allocation size, which is determined by the block manager creating the block. For non-temporary block managers the block_alloc_size corresponds to the memory_usage. If we are pinning/loading an unloaded block, then we know how much memory to reserve. This is NOT the actual memory available on a block.
|
|
idx_t | block_header_size |
| | The size of the block header, including the checksum.
|
|
const block_id_t | block_id |
| | The block id of the block.
|
|
const shared_ptr< BlockMemory > | memory_p |
| | Pointer to the underlying memory of the block.
|
|
BlockMemory & | memory |
| | Memory for fast access to the block memory.
|
|
| enable_shared_from_this & | operator= (enable_shared_from_this const &) noexcept |
◆ BlockHandle() [1/2]
| duckdb::BlockHandle::BlockHandle |
( |
BlockManager & | block_manager, |
|
|
block_id_t | block_id, |
|
|
MemoryTag | tag ) |
386931}
idx_t block_header_size
The size of the block header, including the checksum.
Definition duckdb.hpp:45910
idx_t block_alloc_size
The block allocation size, which is determined by the block manager creating the block....
Definition duckdb.hpp:45908
const block_id_t block_id
The block id of the block.
Definition duckdb.hpp:45912
BlockManager & block_manager
The block manager, which loads the block.
Definition duckdb.hpp:45902
BlockMemory & memory
Memory for fast access to the block memory.
Definition duckdb.hpp:45917
const shared_ptr< BlockMemory > memory_p
Pointer to the underlying memory of the block.
Definition duckdb.hpp:45915
◆ BlockHandle() [2/2]
386938 memory_p(make_shared_ptr<BlockMemory>(
block_manager.GetBufferManager(), block_id_p, tag_p, std::move(buffer_p),
386939 destroy_buffer_upon_p, size_p, std::move(reservation))),
386941}
◆ ~BlockHandle()
| duckdb::BlockHandle::~BlockHandle |
( |
| ) |
|
386943 {
386944
386946 return;
386947 }
386948 try {
386950 } catch (...) {
386951
386952 }
386953}
◆ GetBlockManager()
| BlockManager & duckdb::BlockHandle::GetBlockManager |
( |
| ) |
const |
|
inline |
Returns a reference to the block manager.
◆ BlockId()
| block_id_t duckdb::BlockHandle::BlockId |
( |
| ) |
const |
|
inline |
◆ GetBlockAllocSize()
| idx_t duckdb::BlockHandle::GetBlockAllocSize |
( |
| ) |
const |
|
inline |
Returns the block allocation size of this block.
◆ GetBlockHeaderSize()
| idx_t duckdb::BlockHandle::GetBlockHeaderSize |
( |
| ) |
const |
|
inline |
Returns the block header size including the 8-byte checksum.
◆ GetBlockSize()
| idx_t duckdb::BlockHandle::GetBlockSize |
( |
| ) |
const |
|
inline |
Returns the size of the block that is available for usage, as determined by the block manager that created the block. The block_alloc_size can differ from the memory_usage for blocks managed by the temporary block manager, thus, this should only be called for persistent blocks.
◆ GetMemory() [1/2]
| const BlockMemory & duckdb::BlockHandle::GetMemory |
( |
| ) |
const |
|
inline |
Returns a const reference to the memory of a block.
◆ GetMemory() [2/2]
Returns a reference to the memory of a block.
◆ GetMemoryWeak()
Returns a weak pointer to the memory of a block.
45891 {
45892 return weak_ptr<BlockMemory>(
memory_p);
45893 }
◆ LoadFromBuffer()
386975 {
386977
386978 D_ASSERT(
memory.GetState() != BlockState::BLOCK_LOADED);
386979 D_ASSERT(
memory.GetReaders() == 0);
386981 memcpy(block->InternalBuffer(), data, block->AllocSize());
386982 memory.GetBuffer() = std::move(block);
386983 memory.SetState(BlockState::BLOCK_LOADED);
386985 memory.GetMemoryCharge() = std::move(reservation);
386986 return BufferHandle(shared_from_this(),
memory.GetBuffer());
386987}
◆ Load()
386989 {
386990 if (
memory.GetState() == BlockState::BLOCK_LOADED) {
386991
386992 D_ASSERT(
memory.GetBuffer());
386993 memory.IncrementReaders();
386994 return BufferHandle(shared_from_this(),
memory.GetBuffer());
386995 }
386996
386997 if (
BlockId() < MAXIMUM_BLOCK) {
387000 memory.GetBuffer() = std::move(block);
387001 } else {
387002 if (!
memory.MustWriteToTemporaryFile()) {
387003
387004 return BufferHandle();
387005 }
387006 auto &buffer_manager =
memory.GetBufferManager();
387007 auto &buffer =
memory.GetBuffer();
387008 buffer = buffer_manager.ReadTemporaryBuffer(QueryContext(),
memory.GetMemoryTag(), *
this,
387009 std::move(reusable_buffer));
387010 }
387011 memory.SetState(BlockState::BLOCK_LOADED);
387013 return BufferHandle(shared_from_this(),
memory.GetBuffer());
387014}
block_id_t BlockId() const
Returns the block id.
Definition duckdb.hpp:45865
The documentation for this class was generated from the following files: