Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
#include <buffered-block-mgr.h>
Classes | |
class | Block |
struct | BufferDescriptor |
Descriptor for a single memory buffer in the pool. More... | |
struct | Client |
Public Member Functions | |
~BufferedBlockMgr () | |
Status | RegisterClient (int num_reserved_buffers, MemTracker *tracker, RuntimeState *state, Client **client) |
void | ClearReservations (Client *client) |
Clears all reservations for this client. More... | |
bool | TryAcquireTmpReservation (Client *client, int num_buffers) |
void | ClearTmpReservation (Client *client) |
Sets tmp reservation to 0 on this client. More... | |
Status | GetNewBlock (Client *client, Block *unpin_block, Block **block, int64_t len=-1) |
void | Cancel () |
std::string | DebugString (Client *client=NULL) |
Dumps block mgr state. Grabs lock. If client is not NULL, also dumps its state. More... | |
bool | ConsumeMemory (Client *client, int64_t size) |
void | ReleaseMemory (Client *client, int64_t size) |
int64_t | available_buffers (Client *client) const |
Status | MemLimitTooLowError (Client *client) |
int | available_allocated_buffers () const |
int | num_free_buffers () const |
int | num_pinned_buffers (Client *client) const |
int | num_reserved_buffers_remaining (Client *client) const |
MemTracker * | get_tracker (Client *client) const |
int64_t | max_block_size () const |
int64_t | bytes_allocated () const |
RuntimeProfile * | profile () |
int | writes_issued () const |
Static Public Member Functions | |
static Status | Create (RuntimeState *state, MemTracker *parent, RuntimeProfile *profile, int64_t mem_limit, int64_t buffer_size, boost::shared_ptr< BufferedBlockMgr > *block_mgr) |
static int | GetNumReservedBlocks () |
Return the number of blocks a block manager will reserve for its I/O buffers. More... | |
Private Types | |
typedef boost::unordered_map < TUniqueId, boost::weak_ptr < BufferedBlockMgr > > | BlockMgrsMap |
Private Member Functions | |
BufferedBlockMgr (RuntimeState *state, int64_t block_size) | |
void | Init (DiskIoMgr *io_mgr, RuntimeProfile *profile, MemTracker *parent_tracker, int64_t mem_limit) |
Initializes the block mgr. Idempotent and thread-safe. More... | |
Status | InitTmpFiles () |
Status | PinBlock (Block *block, bool *pinned, Block *src, bool unpin) |
Status | UnpinBlock (Block *block) |
Status | DeleteBlock (Block *block) |
Status | DeleteOrUnpinBlock (Block *block, bool unpin) |
Status | TransferBuffer (Block *dst, Block *src, bool unpin) |
int64_t | remaining_unreserved_buffers () const |
Status | FindBufferForBlock (Block *block, bool *in_mem) |
Status | FindBuffer (boost::unique_lock< boost::mutex > &lock, BufferDescriptor **buffer) |
Status | WriteUnpinnedBlocks () |
Status | WriteUnpinnedBlock (Block *block) |
Issues the write for this block to the DiskIoMgr. More... | |
void | WriteComplete (Block *block, const Status &write_status) |
void | ReturnUnusedBlock (Block *block) |
Block * | GetUnusedBlock (Client *client) |
bool | Validate () const |
Used to debug the state of the block manager. Lock must already be taken. More... | |
std::string | DebugInternal () const |
Status | Encrypt (Block *block, uint8_t **outbuf) |
void | EncryptDone (Block *block) |
Deallocates temporary buffer alloced in Encrypt(). More... | |
Status | Decrypt (Block *block) |
Decrypts the contents of buffer() in place. More... | |
void | SetHash (Block *block) |
Takes a cryptographic hash of the data and sets hash_ with it. More... | |
Status | VerifyHash (Block *block) |
Verifies that the contents of buffer() match those that were set by SetHash() More... | |
Private Attributes | |
const int64_t | max_block_size_ |
Size of the largest/default block in bytes. More... | |
const int | block_write_threshold_ |
const bool | disable_spill_ |
const TUniqueId | query_id_ |
ObjectPool | obj_pool_ |
boost::scoped_ptr< MemTracker > | mem_tracker_ |
Track buffers allocated by the block manager. More... | |
boost::mutex | lock_ |
bool | initialized_ |
If true, Init() has been called. More... | |
int | unfullfilled_reserved_buffers_ |
The total number of reserved buffers across all clients that are not pinned. More... | |
int | total_pinned_buffers_ |
The total number of pinned buffers across all clients. More... | |
int | non_local_outstanding_writes_ |
boost::condition_variable | buffer_available_cv_ |
Signal availability of free buffers. More... | |
InternalQueue< Block > | unpinned_blocks_ |
InternalQueue< Block > | unused_blocks_ |
InternalQueue< BufferDescriptor > | free_io_buffers_ |
std::list< BufferDescriptor * > | all_io_buffers_ |
All allocated io-sized buffers. More... | |
boost::ptr_vector < TmpFileMgr::File > | tmp_files_ |
int | next_block_index_ |
DiskIoMgr * | io_mgr_ |
DiskIoMgr handles to read and write blocks. More... | |
DiskIoMgr::RequestContext * | io_request_context_ |
bool | is_cancelled_ |
boost::scoped_ptr< RuntimeProfile > | profile_ |
Counters and timers to track behavior. More... | |
RuntimeProfile::Counter * | mem_limit_counter_ |
These have a fixed value for the lifetime of the manager and show memory usage. More... | |
RuntimeProfile::Counter * | block_size_counter_ |
RuntimeProfile::Counter * | created_block_counter_ |
Total number of blocks created. More... | |
RuntimeProfile::Counter * | recycled_blocks_counter_ |
Number of deleted blocks reused. More... | |
RuntimeProfile::Counter * | buffered_pin_counter_ |
Number of Pin() calls that did not require a disk read. More... | |
RuntimeProfile::Counter * | disk_read_timer_ |
Time taken for disk reads. More... | |
RuntimeProfile::Counter * | buffer_wait_timer_ |
Time spent waiting for a free buffer. More... | |
RuntimeProfile::Counter * | bytes_written_counter_ |
Number of bytes written to disk (includes writes still queued in the IO manager). More... | |
RuntimeProfile::Counter * | outstanding_writes_counter_ |
Number of writes outstanding (issued but not completed). More... | |
RuntimeProfile::Counter * | encryption_timer_ |
Time spent in disk spill encryption and decryption. More... | |
RuntimeProfile::Counter * | integrity_check_timer_ |
Time spent in disk spill integrity generation and checking. More... | |
int | writes_issued_ |
Number of writes issued. More... | |
const bool | encryption_ |
const bool | check_integrity_ |
Static Private Attributes | |
static SpinLock | static_block_mgrs_lock_ |
Protects query_to_block_mgrs_. More... | |
static BlockMgrsMap | query_to_block_mgrs_ |
Friends | |
struct | Client |
The BufferedBlockMgr is used to allocate and manage blocks of data using a fixed memory budget. Available memory is split into a pool of fixed-size memory buffers. When a client allocates or requests a block, the block is assigned a buffer from this pool and is 'pinned' in memory. Clients can also unpin a block, allowing the manager to reassign its buffer to a different block. The BufferedBlockMgr typically allocates blocks in IO buffer size to get maximal IO efficiency when spilling. Clients can also request smaller buffers that cannot spill (note that it would be possible to spill small buffers, but we currently do not allow it). This is useful to present the same block API and mem tracking for clients (one can use the block mgr API to mem track non-spillable (smaller) buffers). Clients that do partitioning (e.g. PHJ and PAGG) will start with these smaller buffer sizes to reduce the minimum buffering requirements and grow to max sized buffers as the input grows. For simplicity, these small buffers are not recycled (there's also not really a need since they are allocated all at once on query startup). These buffers are not counted against the reservation. The BufferedBlockMgr reserves one buffer per disk ('block_write_threshold_') for itself. When the number of free buffers falls below 'block_write_threshold', unpinned blocks are flushed in Last-In-First-Out order. (It is assumed that unpinned blocks are re-read in FIFO order). The TmpFileMgr is used to obtain file handles to write to within the tmp directories configured for Impala. It is expected to have one BufferedBlockMgr per query. All allocations that can grow proportional to the input size and that might need to spill to disk should allocate from the same BufferedBlockMgr. A client must pin a block in memory to read/write its contents and unpin it when it is no longer in active use. The BufferedBlockMgr guarantees that: a) The memory buffer assigned to a block is not removed or released while it is pinned. b) The contents of an unpinned block will be available on a subsequent call to pin. The Client supports the following operations: GetNewBlock(): Returns a new pinned block. Close(): Frees all memory and disk space. Called when a query is closed or cancelled. Close() is idempotent. A Block supports the following operations: Pin(): Pins a block to a buffer in memory, and reads its contents from disk if necessary. If there are no free buffers, waits for a buffer to become available. Invoked before the contents of a block are read or written. The block will be maintained in memory until Unpin() is called. Unpin(): Invoked to indicate the block is not in active use. The block is added to a list of unpinned blocks. Unpinned blocks are only written when the number of free blocks falls below the 'block_write_threshold'. Delete(): Invoked to deallocate a block. The buffer associated with the block is immediately released and its on-disk location (if any) reused. The block manager is thread-safe with the following caveat: A single block cannot be used simultaneously by multiple clients in any capacity. However, the block manager client is not thread-safe. That is, the block manager allows multiple single-threaded block manager clients. TODO: When a block is read from disk, data is copied from the IOMgr buffer to the block manager's buffer. This should be avoided in the common case where these buffers are of the same size. TODO: See if the one big lock is a bottleneck. Break it up. This object is shared by all operators within a query (across fragments), see IMPALA-1883. TODO: No reason we can't spill the smaller buffers. Add it if we need to (it's likely just removing dchecks). TODO: The requirements on this object has grown organically. Consider a major reworking.
Definition at line 92 of file buffered-block-mgr.h.
|
private |
All per-query BufferedBlockMgr objects that are in use. For memory management, this map contains only weak ptrs. BufferedBlockMgrs that are handed out are shared ptrs. When all the shared ptrs are no longer referenced, the BufferedBlockMgr d'tor will be called at which point the weak ptr will be removed from the map.
Definition at line 620 of file buffered-block-mgr.h.
impala::BufferedBlockMgr::~BufferedBlockMgr | ( | ) |
Definition at line 481 of file buffered-block-mgr.cc.
References all_io_buffers_, impala::BufferedBlockMgr::BufferDescriptor::buffer, DebugInternal(), io_mgr_, io_request_context_, impala::BufferedBlockMgr::BufferDescriptor::len, mem_tracker_, non_local_outstanding_writes_, query_id_, query_to_block_mgrs_, impala::TmpFileMgr::File::Remove(), static_block_mgrs_lock_, tmp_files_, and impala::DiskIoMgr::UnregisterContext().
|
private |
Definition at line 182 of file buffered-block-mgr.cc.
Referenced by Create().
|
inline |
TODO: Remove these two. Not clear what the sorter really needs. TODO: Those are dirty, dangerous reads to two lists whose all other accesses are protected by the lock_. Using those two functions is looking for trouble.
Definition at line 380 of file buffered-block-mgr.h.
References all_io_buffers_.
Referenced by impala::Sorter::InputDone(), and impala::Sorter::MergeIntermediateRuns().
int64_t impala::BufferedBlockMgr::available_buffers | ( | Client * | client | ) | const |
The number of buffers available for client. That is, if all other clients were stopped, the number of buffers this client could get.
Definition at line 221 of file buffered-block-mgr.cc.
References impala::BufferedBlockMgr::Client::num_pinned_buffers_, impala::BufferedBlockMgr::Client::num_reserved_buffers_, impala::BufferedBlockMgr::Client::num_tmp_reserved_buffers_, and remaining_unreserved_buffers().
Referenced by TryAcquireTmpReservation().
int64_t impala::BufferedBlockMgr::bytes_allocated | ( | ) | const |
Definition at line 510 of file buffered-block-mgr.cc.
References mem_tracker_.
void impala::BufferedBlockMgr::Cancel | ( | ) |
Cancels the block mgr. All subsequent calls fail with Status::CANCELLED. Idempotent.
Definition at line 359 of file buffered-block-mgr.cc.
References impala::DiskIoMgr::CancelContext(), io_mgr_, io_request_context_, is_cancelled_, and lock_.
Referenced by impala::BufferedBlockMgrTest::TestRandomInternalImpl().
void impala::BufferedBlockMgr::ClearReservations | ( | Client * | client | ) |
Clears all reservations for this client.
Definition at line 244 of file buffered-block-mgr.cc.
References lock_, impala::BufferedBlockMgr::Client::num_pinned_buffers_, impala::BufferedBlockMgr::Client::num_reserved_buffers_, impala::BufferedBlockMgr::Client::num_tmp_reserved_buffers_, and unfullfilled_reserved_buffers_.
Referenced by impala::PartitionedHashJoinNode::Close(), impala::PartitionedAggregationNode::Close(), and impala::Sorter::~Sorter().
void impala::BufferedBlockMgr::ClearTmpReservation | ( | Client * | client | ) |
Sets tmp reservation to 0 on this client.
Definition at line 272 of file buffered-block-mgr.cc.
References lock_, impala::BufferedBlockMgr::Client::num_tmp_reserved_buffers_, and unfullfilled_reserved_buffers_.
Consumes 'size' bytes from the buffered block mgr. This is used by callers that want the memory to come from the block mgr pool (and therefore trigger spilling) but need the allocation to be more flexible than blocks. Returns false if there was not enough memory. TODO: this is added specifically to support the Buckets structure in the hash table which does not map well to Blocks. Revisit this.
Definition at line 278 of file buffered-block-mgr.cc.
References impala::BufferedBlockMgr::BufferDescriptor::all_buffers_it, all_io_buffers_, impala::BufferedBlockMgr::BufferDescriptor::block, impala::BufferedBlockMgr::BufferDescriptor::buffer, impala::BufferedBlockMgr::Block::buffer_desc_, impala::BitUtil::Ceil(), impala::MemTracker::ConsumeLocal(), DebugInternal(), FindBuffer(), lock_, impala::RuntimeState::LogError(), max_block_size(), mem_tracker_, impala::Status::msg(), impala::BufferedBlockMgr::Client::num_tmp_reserved_buffers_, impala::Status::OK, impala::Status::ok(), query_id_, impala::BufferedBlockMgr::Client::query_tracker_, remaining_unreserved_buffers(), impala::BufferedBlockMgr::Client::state_, impala::BufferedBlockMgr::Client::tracker_, unfullfilled_reserved_buffers_, Validate(), VLOG_QUERY, and WriteUnpinnedBlocks().
Referenced by impala::HashTable::Init(), and impala::HashTable::ResizeBuckets().
|
static |
Create a block manager with the specified mem_limit. If a block mgr with the same query id has already been created, that block mgr is returned.
Definition at line 199 of file buffered-block-mgr.cc.
References BufferedBlockMgr(), impala::RuntimeState::io_mgr(), impala::Status::OK, profile(), impala::RuntimeState::query_id(), query_to_block_mgrs_, and static_block_mgrs_lock_.
Referenced by impala::RuntimeState::CreateBlockMgr(), impala::SimpleTupleStreamTest::CreateMgr(), and impala::BufferedBlockMgrTest::CreateMgr().
|
private |
Definition at line 1090 of file buffered-block-mgr.cc.
References block_write_threshold_, free_io_buffers_, max_block_size_, mem_tracker_, outstanding_writes_counter_, remaining_unreserved_buffers(), total_pinned_buffers_, unfullfilled_reserved_buffers_, unpinned_blocks_, and impala::RuntimeProfile::Counter::value().
Referenced by ConsumeMemory(), DebugString(), DeleteBlock(), FindBuffer(), FindBufferForBlock(), MemLimitTooLowError(), UnpinBlock(), Validate(), WriteComplete(), WriteUnpinnedBlocks(), and ~BufferedBlockMgr().
string impala::BufferedBlockMgr::DebugString | ( | Client * | client = NULL | ) |
Dumps block mgr state. Grabs lock. If client is not NULL, also dumps its state.
Definition at line 1082 of file buffered-block-mgr.cc.
References DebugInternal(), impala::BufferedBlockMgr::Client::DebugString(), and lock_.
Referenced by impala::BufferedTupleStream::NextBlockForRead(), impala::BufferedTupleStream::PinStream(), and impala::BufferedBlockMgr::Block::Validate().
Decrypts the contents of buffer() in place.
Definition at line 1239 of file buffered-block-mgr.cc.
References impala::BufferedBlockMgr::Block::buffer(), encryption_, encryption_timer_, impala::BufferedBlockMgr::Block::iv_, impala::BufferedBlockMgr::Block::key_, impala::Status::OK, impala::OpenSSLErr(), SCOPED_TIMER, and impala::BufferedBlockMgr::Block::valid_data_len_.
Referenced by PinBlock().
Definition at line 783 of file buffered-block-mgr.cc.
References impala::BufferedBlockMgr::BufferDescriptor::block, impala::BufferedBlockMgr::BufferDescriptor::buffer, buffer_available_cv_, impala::BufferedBlockMgr::Block::buffer_desc_, impala::Status::CANCELLED, impala::BufferedBlockMgr::Block::client_, DebugInternal(), impala::BufferedBlockMgr::Block::DebugString(), free_io_buffers_, impala::BufferedBlockMgr::Block::in_write_, is_cancelled_, impala::BufferedBlockMgr::Block::is_deleted_, impala::BufferedBlockMgr::Block::is_max_size(), impala::BufferedBlockMgr::Block::is_pinned_, impala::BufferedBlockMgr::BufferDescriptor::len, lock_, max_block_size_, impala::BufferedBlockMgr::Client::num_pinned_buffers_, impala::BufferedBlockMgr::Client::num_reserved_buffers_, impala::Status::OK, impala::MemTracker::Release(), ReturnUnusedBlock(), total_pinned_buffers_, impala::BufferedBlockMgr::Client::tracker_, unfullfilled_reserved_buffers_, impala::BufferedBlockMgr::Client::UnpinBuffer(), unpinned_blocks_, impala::BufferedBlockMgr::Block::Validate(), and Validate().
If the 'block' is NULL, checks if cancelled and returns. Otherwise, depending on 'unpin' calls either DeleteBlock() or UnpinBlock(), which both first check for cancellation. It should be called without the lock_ acquired.
Definition at line 528 of file buffered-block-mgr.cc.
References impala::Status::CANCELLED, impala::BufferedBlockMgr::Block::Delete(), is_cancelled_, lock_, impala::Status::OK, and impala::BufferedBlockMgr::Block::Unpin().
Referenced by PinBlock().
Takes the data in buffer(), allocates encrypted_write_buffer_, and returns a pointer to the encrypted data in outbuf.
Definition at line 1183 of file buffered-block-mgr.cc.
References impala::BufferedBlockMgr::Block::buffer(), impala::BufferedBlockMgr::Block::encrypted_write_buffer_, encryption_, encryption_timer_, impala::BufferedBlockMgr::Block::in_write_, impala::BufferedBlockMgr::Block::is_pinned_, impala::BufferedBlockMgr::Block::iv_, impala::BufferedBlockMgr::Block::key_, impala::Status::OK, impala::OpenSSLErr(), SCOPED_TIMER, and impala::BufferedBlockMgr::Block::valid_data_len_.
Referenced by WriteUnpinnedBlock().
|
private |
Deallocates temporary buffer alloced in Encrypt().
Definition at line 1233 of file buffered-block-mgr.cc.
References impala::BufferedBlockMgr::Block::encrypted_write_buffer_, and encryption_.
Referenced by WriteComplete().
|
private |
Returns a new buffer that can be used. *buffer is set to NULL if there was no memory. Otherwise, this function gets a new buffer by:
Definition at line 936 of file buffered-block-mgr.cc.
References impala::ObjectPool::Add(), all_io_buffers_, block_write_threshold_, buffer_available_cv_, buffer_wait_timer_, impala::Status::CANCELLED, DebugInternal(), disable_spill_, free_io_buffers_, is_cancelled_, max_block_size_, mem_tracker_, non_local_outstanding_writes_, obj_pool_, impala::Status::OK, RETURN_IF_ERROR, SCOPED_TIMER, unpinned_blocks_, and WriteUnpinnedBlocks().
Referenced by ConsumeMemory(), and FindBufferForBlock().
Finds a buffer for a block and pins it. If the block's buffer has not been evicted, it removes the block from the unpinned list and sets *in_mem = true. If the block is not in memory, it will call FindBuffer() that may block. If we can't get a buffer (e.g. no more memory, nothing in the unpinned and free lists) this function returns with the block unpinned. Uses the lock_, the caller should not have already acquired the lock_.
Definition at line 836 of file buffered-block-mgr.cc.
References impala::RuntimeProfile::Counter::Add(), impala::Status::AddDetail(), impala::BufferedBlockMgr::BufferDescriptor::block, impala::BufferedBlockMgr::Block::buffer_desc_, buffered_pin_counter_, impala::Status::CANCELLED, impala::BufferedBlockMgr::Block::client_, DebugInternal(), impala::BufferedBlockMgr::Client::DebugString(), impala::BufferedBlockMgr::Block::DebugString(), FindBuffer(), free_io_buffers_, impala::GetStackTrace(), impala::BufferedBlockMgr::Block::in_write_, is_cancelled_, impala::BufferedBlockMgr::Block::is_deleted_, impala::BufferedBlockMgr::Block::is_pinned_, lock_, impala::Status::MEM_LIMIT_EXCEEDED, impala::BufferedBlockMgr::Client::num_pinned_buffers_, impala::BufferedBlockMgr::Client::num_reserved_buffers_, impala::BufferedBlockMgr::Client::num_tmp_reserved_buffers_, impala::Status::OK, impala::BufferedBlockMgr::Client::PinBuffer(), query_id_, remaining_unreserved_buffers(), RETURN_IF_ERROR, total_pinned_buffers_, unfullfilled_reserved_buffers_, unpinned_blocks_, impala::BufferedBlockMgr::Block::Validate(), Validate(), VLOG_QUERY, VLOG_QUERY_IS_ON, and WriteUnpinnedBlocks().
Referenced by GetNewBlock(), and PinBlock().
MemTracker * impala::BufferedBlockMgr::get_tracker | ( | Client * | client | ) | const |
Definition at line 522 of file buffered-block-mgr.cc.
References impala::BufferedBlockMgr::Client::tracker_.
Referenced by impala::BufferedTupleStream::GetRows().
Status impala::BufferedBlockMgr::GetNewBlock | ( | Client * | client, |
Block * | unpin_block, | ||
Block ** | block, | ||
int64_t | len = -1 |
||
) |
Return a new pinned block. If there is no memory for this block, *block will be set to NULL. If len > 0, GetNewBlock() will return a block with a buffer of size len. len must be less than max_block_size and this block cannot be unpinned. This function will try to allocate new memory for the block up to the limit. Otherwise it will (conceptually) write out an unpinned block and use that memory. The caller can pass a non-NULL 'unpin_block' to transfer memory from 'unpin_block' to the new block. If 'unpin_block' is non-NULL, the new block can never fail to get a buffer. The semantics of this are:
Definition at line 382 of file buffered-block-mgr.cc.
References impala::ObjectPool::Add(), impala::BufferedBlockMgr::BufferDescriptor::block, impala::BufferedBlockMgr::Block::buffer_desc_, impala::Status::CANCELLED, impala::BufferedBlockMgr::Block::client_, impala::BufferedBlockMgr::Block::DebugString(), FindBufferForBlock(), GetUnusedBlock(), is_cancelled_, impala::BufferedBlockMgr::Block::is_deleted_, impala::BufferedBlockMgr::Block::is_pinned(), impala::BufferedBlockMgr::Block::is_pinned_, lock_, max_block_size_, obj_pool_, impala::Status::OK, impala::BufferedBlockMgr::Client::PinBuffer(), RETURN_IF_ERROR, ReturnUnusedBlock(), total_pinned_buffers_, impala::BufferedBlockMgr::Client::tracker_, TransferBuffer(), impala::MemTracker::TryConsume(), impala::BufferedBlockMgr::Block::Unpin(), and impala::BufferedBlockMgr::Block::Validate().
Referenced by impala::BufferedBlockMgrTest::AllocateBlocks(), impala::BufferedBlockMgrTest::GetFreeBlock(), impala::HashTable::GrowNodeArray(), impala::BufferedTupleStream::NewBlockForWrite(), and impala::BufferedBlockMgrTest::TestRandomInternalImpl().
|
inlinestatic |
Return the number of blocks a block manager will reserve for its I/O buffers.
Definition at line 331 of file buffered-block-mgr.h.
References impala::TmpFileMgr::num_tmp_devices().
|
private |
Checks unused_blocks_ for an unused block object, else allocates a new one. Non-blocking and needs no lock_.
Definition at line 979 of file buffered-block-mgr.cc.
References impala::ObjectPool::Add(), impala::RuntimeProfile::Counter::Add(), impala::BufferedBlockMgr::Block::client_, created_block_counter_, impala::BufferedBlockMgr::Block::Init(), obj_pool_, recycled_blocks_counter_, and unused_blocks_.
Referenced by GetNewBlock().
|
private |
Initializes the block mgr. Idempotent and thread-safe.
Definition at line 1105 of file buffered-block-mgr.cc.
References ADD_COUNTER, ADD_TIMER, impala::RuntimeProfile::AddChild(), block_size_counter_, buffer_wait_timer_, buffered_pin_counter_, bytes_written_counter_, created_block_counter_, disk_read_timer_, encryption_, encryption_timer_, initialized_, integrity_check_timer_, io_request_context_, lock_, max_block_size_, mem_limit_counter_, mem_tracker_, obj_pool_, outstanding_writes_counter_, profile(), profile_, recycled_blocks_counter_, impala::DiskIoMgr::RegisterContext(), and impala::RuntimeProfile::Counter::Set().
|
private |
Initializes tmp_files_. This is initialized the first time we need to write to disk. Must be called with lock_ taken.
Definition at line 1147 of file buffered-block-mgr.cc.
References impala::TmpFileMgr::GetFile(), next_block_index_, impala::TmpFileMgr::num_tmp_devices(), impala::Status::OK, query_id_, RETURN_IF_ERROR, and tmp_files_.
Referenced by WriteUnpinnedBlock().
|
inline |
Definition at line 386 of file buffered-block-mgr.h.
References max_block_size_.
Referenced by ConsumeMemory(), impala::HashTable::GrowNodeArray(), impala::Sorter::Init(), impala::BufferedTupleStream::Init(), impala::BufferedBlockMgr::Block::is_max_size(), MemLimitTooLowError(), impala::BufferedTupleStream::NewBlockForWrite(), remaining_unreserved_buffers(), and impala::BufferedTupleStream::SwitchToIoBuffers().
Returns a MEM_LIMIT_EXCEEDED error which includes the minimum memory required by this client.
Definition at line 369 of file buffered-block-mgr.cc.
References impala::Status::AddDetail(), DebugInternal(), impala::BufferedBlockMgr::Client::DebugString(), impala::GetStackTrace(), max_block_size(), impala::Status::MEM_LIMIT_EXCEEDED, impala::BufferedBlockMgr::Client::num_reserved_buffers_, impala::PrettyPrinter::Print(), query_id_, and VLOG_QUERY.
Referenced by impala::BufferedTupleStream::Init(), impala::PartitionedHashJoinNode::SpillPartition(), and impala::PartitionedAggregationNode::SpillPartition().
|
inline |
Definition at line 381 of file buffered-block-mgr.h.
References free_io_buffers_.
Referenced by impala::Sorter::InputDone().
int impala::BufferedBlockMgr::num_pinned_buffers | ( | Client * | client | ) | const |
Definition at line 514 of file buffered-block-mgr.cc.
References impala::BufferedBlockMgr::Client::num_pinned_buffers_.
Referenced by impala::PartitionedAggregationNode::NextPartition().
int impala::BufferedBlockMgr::num_reserved_buffers_remaining | ( | Client * | client | ) | const |
Definition at line 518 of file buffered-block-mgr.cc.
References impala::BufferedBlockMgr::Client::num_pinned_buffers_, and impala::BufferedBlockMgr::Client::num_reserved_buffers_.
Referenced by impala::PartitionedAggregationNode::CreateHashPartitions().
|
private |
PinBlock(), UnpinBlock(), DeleteBlock() perform the actual work of Block::Pin(), Unpin() and Delete(). Must be called with the lock_ taken.
Definition at line 536 of file buffered-block-mgr.cc.
References impala::ObjectPool::Add(), impala::DiskIoMgr::AddScanRanges(), impala::BufferedBlockMgr::Block::buffer(), impala::DiskIoMgr::BufferDescriptor::buffer(), impala::BufferedBlockMgr::Block::buffer_desc_, check_integrity_, impala::BufferedBlockMgr::Block::client_, impala::BufferedBlockMgr::Block::DebugString(), Decrypt(), DeleteOrUnpinBlock(), impala::DiskIoMgr::RequestRange::disk_id(), disk_read_timer_, encryption_, impala::DiskIoMgr::BufferDescriptor::eosr(), impala::DiskIoMgr::RequestRange::file(), FindBufferForBlock(), free_io_buffers_, impala::DiskIoMgr::ScanRange::GetNext(), impala::BufferedBlockMgr::Block::in_write_, io_mgr_, io_request_context_, impala::BufferedBlockMgr::Block::is_deleted_, impala::BufferedBlockMgr::Block::is_pinned_, impala::DiskIoMgr::BufferDescriptor::len(), impala::DiskIoMgr::RequestRange::len(), lock_, impala::DiskIoMgr::ScanRange::NEVER_CACHE, obj_pool_, offset, impala::DiskIoMgr::RequestRange::offset(), impala::Status::OK, impala::BufferedBlockMgr::Client::PinBuffer(), impala::DiskIoMgr::ScanRange::Reset(), impala::DiskIoMgr::BufferDescriptor::Return(), RETURN_IF_ERROR, SCOPED_TIMER, total_pinned_buffers_, TransferBuffer(), unpinned_blocks_, impala::BufferedBlockMgr::Block::valid_data_len_, VerifyHash(), impala::BufferedBlockMgr::Block::write_range_, and WriteUnpinnedBlocks().
|
inline |
Definition at line 388 of file buffered-block-mgr.h.
References profile_.
Status impala::BufferedBlockMgr::RegisterClient | ( | int | num_reserved_buffers, |
MemTracker * | tracker, | ||
RuntimeState * | state, | ||
Client ** | client | ||
) |
Registers a client with num_reserved_buffers. The returned client is owned by the BufferedBlockMgr and has the same lifetime as it. We allow oversubscribing the reserved buffers. It is likely that the num_reserved_buffers will be very pessimistic for small queries and we don't want to fail all of them with mem limit exceeded. The min reserved buffers is often independent of data size and we still want to run small queries with very small limits. If tracker is non-NULL, buffers used by this client are reflected in tracker. TODO: The fact that we allow oversubscription is problematic. as the code expects the reservations to always be granted (currently not the case).
Definition at line 235 of file buffered-block-mgr.cc.
References impala::ObjectPool::Add(), Client, lock_, obj_pool_, impala::Status::OK, and unfullfilled_reserved_buffers_.
Referenced by impala::Sorter::Init(), impala::AnalyticEvalNode::Open(), impala::PartitionedHashJoinNode::Prepare(), impala::PartitionedAggregationNode::Prepare(), and impala::BufferedBlockMgrTest::TestRandomInternalImpl().
void impala::BufferedBlockMgr::ReleaseMemory | ( | Client * | client, |
int64_t | size | ||
) |
All successful allocates bytes from ConsumeMemory() must have a corresponding ReleaseMemory() call.
Definition at line 354 of file buffered-block-mgr.cc.
References mem_tracker_, impala::BufferedBlockMgr::Client::query_tracker_, impala::MemTracker::ReleaseLocal(), and impala::BufferedBlockMgr::Client::tracker_.
Referenced by impala::HashTable::Close(), and impala::HashTable::ResizeBuckets().
|
private |
Returns the total number of unreserved buffers. This is the sum of unpinned, free and buffers we can still allocate minus the total number of reserved buffers that are not pinned. Note this can be negative if the buffers are oversubscribed. Must be called with lock_ taken.
Definition at line 227 of file buffered-block-mgr.cc.
References free_io_buffers_, max_block_size(), mem_tracker_, non_local_outstanding_writes_, unfullfilled_reserved_buffers_, and unpinned_blocks_.
Referenced by available_buffers(), ConsumeMemory(), DebugInternal(), and FindBufferForBlock().
|
private |
Returns a deleted block to the list of free blocks. Assumes the block's buffer has already been returned to the free buffers list. Non-blocking. Thread-safe and does not need the lock_ acquired.
Definition at line 828 of file buffered-block-mgr.cc.
References impala::BufferedBlockMgr::Block::buffer_desc_, impala::BufferedBlockMgr::Block::DebugString(), impala::BufferedBlockMgr::Block::Init(), impala::BufferedBlockMgr::Block::is_deleted_, impala::BufferedBlockMgr::Block::is_pinned_, and unused_blocks_.
Referenced by DeleteBlock(), GetNewBlock(), TransferBuffer(), and WriteComplete().
|
private |
Takes a cryptographic hash of the data and sets hash_ with it.
Definition at line 1275 of file buffered-block-mgr.cc.
References impala::BufferedBlockMgr::Block::buffer(), check_integrity_, impala::BufferedBlockMgr::Block::encrypted_write_buffer_, encryption_, impala::BufferedBlockMgr::Block::hash_, integrity_check_timer_, SCOPED_TIMER, and impala::BufferedBlockMgr::Block::valid_data_len_.
Referenced by WriteUnpinnedBlock().
Transfers the buffer from 'src' to 'dst'. 'src' must be pinned. If unpin == false, 'src' is simply deleted. If unpin == true, 'src' is unpinned and it may block until the write of 'src' is completed. In that case it will use the lock_ for the condvar. Thus, the lock_ needs to not have been taken when this function is called.
Definition at line 440 of file buffered-block-mgr.cc.
References impala::BufferedBlockMgr::BufferDescriptor::block, impala::BufferedBlockMgr::Block::buffer_desc_, impala::Status::CANCELLED, impala::BufferedBlockMgr::Block::client_local_, impala::BufferedBlockMgr::Block::in_write_, is_cancelled_, impala::BufferedBlockMgr::Block::is_deleted_, impala::BufferedBlockMgr::Block::is_pinned_, impala::BufferedBlockMgr::BufferDescriptor::len, lock_, max_block_size_, impala::Status::OK, impala::Status::ok(), ReturnUnusedBlock(), impala::BufferedBlockMgr::Block::write_complete_cv_, and WriteUnpinnedBlock().
Referenced by GetNewBlock(), and PinBlock().
Tries to acquire a one-time reservation of num_buffers. The semantics are:
Definition at line 257 of file buffered-block-mgr.cc.
References available_buffers(), lock_, impala::BufferedBlockMgr::Client::num_pinned_buffers_, impala::BufferedBlockMgr::Client::num_reserved_buffers_, impala::BufferedBlockMgr::Client::num_tmp_reserved_buffers_, and unfullfilled_reserved_buffers_.
Referenced by impala::BufferedTupleStream::PinStream().
Definition at line 618 of file buffered-block-mgr.cc.
References impala::BufferedBlockMgr::Block::buffer_desc_, impala::Status::CANCELLED, impala::BufferedBlockMgr::Block::client_, DebugInternal(), impala::BufferedBlockMgr::Block::DebugString(), impala::BufferedBlockMgr::Block::in_write_, is_cancelled_, impala::BufferedBlockMgr::Block::is_deleted_, impala::BufferedBlockMgr::Block::is_pinned_, impala::BufferedBlockMgr::BufferDescriptor::len, lock_, max_block_size_, impala::BufferedBlockMgr::Client::num_pinned_buffers_, impala::BufferedBlockMgr::Client::num_reserved_buffers_, impala::Status::OK, RETURN_IF_ERROR, total_pinned_buffers_, unfullfilled_reserved_buffers_, impala::BufferedBlockMgr::Client::UnpinBuffer(), unpinned_blocks_, impala::BufferedBlockMgr::Block::Validate(), Validate(), and WriteUnpinnedBlocks().
|
private |
Used to debug the state of the block manager. Lock must already be taken.
Definition at line 995 of file buffered-block-mgr.cc.
References impala::BufferedBlockMgr::BufferDescriptor::all_buffers_it, all_io_buffers_, impala::BufferedBlockMgr::BufferDescriptor::block, block_write_threshold_, impala::BufferedBlockMgr::Block::buffer_desc_, DebugInternal(), impala::BufferedBlockMgr::Block::DebugString(), disable_spill_, free_io_buffers_, impala::BufferedBlockMgr::Block::in_write_, is_cancelled_, impala::BufferedBlockMgr::Block::is_pinned_, impala::BufferedBlockMgr::BufferDescriptor::len, max_block_size_, impala::InternalQueue< T >::Node::Next(), non_local_outstanding_writes_, total_pinned_buffers_, unpinned_blocks_, and impala::BufferedBlockMgr::Block::Validate().
Referenced by ConsumeMemory(), DeleteBlock(), FindBufferForBlock(), UnpinBlock(), WriteComplete(), and WriteUnpinnedBlocks().
Verifies that the contents of buffer() match those that were set by SetHash()
Definition at line 1290 of file buffered-block-mgr.cc.
References impala::BufferedBlockMgr::Block::buffer(), check_integrity_, impala::BufferedBlockMgr::Block::hash_, integrity_check_timer_, impala::Status::OK, SCOPED_TIMER, and impala::BufferedBlockMgr::Block::valid_data_len_.
Referenced by PinBlock().
Callback used by DiskIoMgr to indicate a block write has completed. write_status is the status of the write. is_cancelled_ is set to true if write_status is not Status::OK or a re-issue of the write fails. Returns the block's buffer to the free buffers list if it is no longer pinned. Returns the block itself to the free blocks list if it has been deleted.
Definition at line 715 of file buffered-block-mgr.cc.
References impala::RuntimeProfile::Counter::Add(), impala::BufferedBlockMgr::BufferDescriptor::block, buffer_available_cv_, impala::BufferedBlockMgr::Block::buffer_desc_, impala::BufferedBlockMgr::Block::client_, impala::BufferedBlockMgr::Block::client_local_, DebugInternal(), impala::BufferedBlockMgr::Block::DebugString(), EncryptDone(), encryption_, free_io_buffers_, impala::BufferedBlockMgr::Block::in_write_, impala::RuntimeState::is_cancelled(), is_cancelled_, impala::BufferedBlockMgr::Block::is_deleted_, impala::BufferedBlockMgr::Block::is_pinned_, impala::BufferedBlockMgr::BufferDescriptor::len, lock_, impala::RuntimeState::LogError(), max_block_size_, impala::Status::msg(), non_local_outstanding_writes_, impala::Status::OK, impala::Status::ok(), outstanding_writes_counter_, query_id_, ReturnUnusedBlock(), impala::BufferedBlockMgr::Client::state_, Validate(), VLOG_QUERY, impala::BufferedBlockMgr::Block::write_complete_cv_, and WriteUnpinnedBlocks().
Referenced by WriteUnpinnedBlock().
|
inline |
Definition at line 389 of file buffered-block-mgr.h.
References writes_issued_.
Issues the write for this block to the DiskIoMgr.
Definition at line 659 of file buffered-block-mgr.cc.
References impala::ObjectPool::Add(), impala::RuntimeProfile::Counter::Add(), impala::DiskIoMgr::AddWriteRange(), impala::TmpFileMgr::File::AllocateSpace(), impala::BufferedBlockMgr::Block::buffer(), impala::BufferedBlockMgr::Block::buffer_desc_, bytes_written_counter_, check_integrity_, impala::BufferedBlockMgr::Block::DebugString(), impala::TmpFileMgr::File::disk_id(), Encrypt(), encryption_, impala::BufferedBlockMgr::Block::in_write_, InitTmpFiles(), io_mgr_, io_request_context_, impala::BufferedBlockMgr::Block::is_pinned_, impala::BufferedBlockMgr::BufferDescriptor::len, max_block_size_, next_block_index_, impala::DiskIoMgr::num_local_disks(), impala::ImpaladMetrics::NUM_QUERIES_SPILLED, obj_pool_, impala::Status::OK, outstanding_writes_counter_, impala::TmpFileMgr::File::path(), RETURN_IF_ERROR, impala::DiskIoMgr::WriteRange::SetData(), SetHash(), tmp_files_, impala::BufferedBlockMgr::Block::valid_data_len_, impala::BufferedBlockMgr::Block::Validate(), impala::BufferedBlockMgr::Block::write_range_, WriteComplete(), and writes_issued_.
Referenced by TransferBuffer(), and WriteUnpinnedBlocks().
|
private |
Writes unpinned blocks via DiskIoMgr until one of the following is true: 1) The number of outstanding writes >= (block_write_threshold_ - num free buffers) 2) There are no more unpinned blocks Must be called with the lock_ already taken. Is not blocking.
Definition at line 643 of file buffered-block-mgr.cc.
References block_write_threshold_, impala::BufferedBlockMgr::Block::client_local_, DebugInternal(), disable_spill_, free_io_buffers_, non_local_outstanding_writes_, impala::Status::OK, RETURN_IF_ERROR, unpinned_blocks_, Validate(), and WriteUnpinnedBlock().
Referenced by ConsumeMemory(), FindBuffer(), FindBufferForBlock(), PinBlock(), UnpinBlock(), and WriteComplete().
|
friend |
Definition at line 392 of file buffered-block-mgr.h.
Referenced by RegisterClient().
|
private |
All allocated io-sized buffers.
Definition at line 556 of file buffered-block-mgr.h.
Referenced by available_allocated_buffers(), ConsumeMemory(), FindBuffer(), Validate(), and ~BufferedBlockMgr().
|
private |
Definition at line 580 of file buffered-block-mgr.h.
Referenced by Init().
|
private |
Unpinned blocks are written when the number of free buffers is below this threshold. Equal to the number of disks.
Definition at line 500 of file buffered-block-mgr.h.
Referenced by DebugInternal(), FindBuffer(), Validate(), and WriteUnpinnedBlocks().
|
private |
Signal availability of free buffers.
Definition at line 534 of file buffered-block-mgr.h.
Referenced by DeleteBlock(), FindBuffer(), and WriteComplete().
|
private |
Time spent waiting for a free buffer.
Definition at line 595 of file buffered-block-mgr.h.
Referenced by FindBuffer(), and Init().
|
private |
Number of Pin() calls that did not require a disk read.
Definition at line 589 of file buffered-block-mgr.h.
Referenced by FindBufferForBlock(), and Init().
|
private |
Number of bytes written to disk (includes writes still queued in the IO manager).
Definition at line 598 of file buffered-block-mgr.h.
Referenced by Init(), and WriteUnpinnedBlock().
|
private |
Set to true if –disk_spill_encryption is true. We can split this into a different flag in the future, but there is little performance overhead in the integrity check and hence no real reason to keep this separate from encryption. When true, blocks will have an integrity check (SHA-256) performed after being read from disk.
Definition at line 647 of file buffered-block-mgr.h.
Referenced by PinBlock(), SetHash(), VerifyHash(), and WriteUnpinnedBlock().
|
private |
Total number of blocks created.
Definition at line 583 of file buffered-block-mgr.h.
Referenced by GetUnusedBlock(), and Init().
|
private |
If true, spilling is disabled. The client calls will fail if there is not enough memory.
Definition at line 504 of file buffered-block-mgr.h.
Referenced by FindBuffer(), Validate(), and WriteUnpinnedBlocks().
|
private |
Time taken for disk reads.
Definition at line 592 of file buffered-block-mgr.h.
Referenced by Init(), and PinBlock().
|
private |
Set to true if –disk_spill_encryption is true. When true, blocks will be encrypted before being written to disk.
Definition at line 641 of file buffered-block-mgr.h.
Referenced by Decrypt(), Encrypt(), EncryptDone(), Init(), PinBlock(), SetHash(), WriteComplete(), and WriteUnpinnedBlock().
|
private |
Time spent in disk spill encryption and decryption.
Definition at line 604 of file buffered-block-mgr.h.
|
private |
List of buffers that can be assigned to a block in Pin() or GetNewBlock(). These buffers either have no block associated with them or are associated with an an unpinned block that has been persisted. That is, either block = NULL or (!block->is_pinned_ && !block->in_write_ && !unpinned_blocks_.Contains(block)). All of these buffers are io sized.
Definition at line 553 of file buffered-block-mgr.h.
Referenced by DebugInternal(), DeleteBlock(), FindBuffer(), FindBufferForBlock(), num_free_buffers(), PinBlock(), remaining_unreserved_buffers(), Validate(), WriteComplete(), and WriteUnpinnedBlocks().
|
private |
If true, Init() has been called.
Definition at line 521 of file buffered-block-mgr.h.
Referenced by Init().
|
private |
Time spent in disk spill integrity generation and checking.
Definition at line 607 of file buffered-block-mgr.h.
Referenced by Init(), SetHash(), and VerifyHash().
|
private |
DiskIoMgr handles to read and write blocks.
Definition at line 567 of file buffered-block-mgr.h.
Referenced by Cancel(), PinBlock(), WriteUnpinnedBlock(), and ~BufferedBlockMgr().
|
private |
Definition at line 568 of file buffered-block-mgr.h.
Referenced by Cancel(), Init(), PinBlock(), WriteUnpinnedBlock(), and ~BufferedBlockMgr().
|
private |
If true, a disk write failed and all API calls return. Status::CANCELLED. Set to true if there was an error writing a block, or if WriteComplete() needed to reissue the write and that failed.
Definition at line 573 of file buffered-block-mgr.h.
Referenced by Cancel(), DeleteBlock(), DeleteOrUnpinBlock(), FindBuffer(), FindBufferForBlock(), GetNewBlock(), TransferBuffer(), UnpinBlock(), Validate(), and WriteComplete().
|
private |
This lock protects the block and buffer lists below, except for unused_blocks_. It also protects the various counters and changes to block state. Additionally, it is used for the blocking condvars: buffer_available_cv_ and block->write_complete_cv_. TODO: We should break the protection of the various structures and usages to different spinlocks and a mutex to be used in the wait()s, see IMPALA-1883.
Definition at line 518 of file buffered-block-mgr.h.
Referenced by Cancel(), ClearReservations(), ClearTmpReservation(), ConsumeMemory(), DebugString(), DeleteBlock(), DeleteOrUnpinBlock(), FindBufferForBlock(), GetNewBlock(), Init(), PinBlock(), RegisterClient(), TransferBuffer(), TryAcquireTmpReservation(), UnpinBlock(), and WriteComplete().
|
private |
Size of the largest/default block in bytes.
Definition at line 496 of file buffered-block-mgr.h.
Referenced by DebugInternal(), DeleteBlock(), FindBuffer(), GetNewBlock(), Init(), max_block_size(), TransferBuffer(), UnpinBlock(), Validate(), WriteComplete(), and WriteUnpinnedBlock().
|
private |
These have a fixed value for the lifetime of the manager and show memory usage.
Definition at line 579 of file buffered-block-mgr.h.
Referenced by Init().
|
private |
Track buffers allocated by the block manager.
Definition at line 511 of file buffered-block-mgr.h.
Referenced by bytes_allocated(), ConsumeMemory(), DebugInternal(), FindBuffer(), Init(), ReleaseMemory(), remaining_unreserved_buffers(), and ~BufferedBlockMgr().
|
private |
Index into tmp_files_ denoting the file to which the next block to be persisted will be written.
Definition at line 564 of file buffered-block-mgr.h.
Referenced by InitTmpFiles(), and WriteUnpinnedBlock().
|
private |
Number of outstanding writes (Writes issued but not completed). This does not include client-local writes.
Definition at line 531 of file buffered-block-mgr.h.
Referenced by FindBuffer(), remaining_unreserved_buffers(), Validate(), WriteComplete(), WriteUnpinnedBlocks(), and ~BufferedBlockMgr().
|
private |
Definition at line 508 of file buffered-block-mgr.h.
Referenced by FindBuffer(), GetNewBlock(), GetUnusedBlock(), Init(), PinBlock(), RegisterClient(), and WriteUnpinnedBlock().
|
private |
Number of writes outstanding (issued but not completed).
Definition at line 601 of file buffered-block-mgr.h.
Referenced by DebugInternal(), Init(), WriteComplete(), and WriteUnpinnedBlock().
|
private |
Counters and timers to track behavior.
Definition at line 576 of file buffered-block-mgr.h.
|
private |
Definition at line 506 of file buffered-block-mgr.h.
Referenced by ConsumeMemory(), FindBufferForBlock(), InitTmpFiles(), MemLimitTooLowError(), WriteComplete(), and ~BufferedBlockMgr().
|
staticprivate |
Definition at line 621 of file buffered-block-mgr.h.
Referenced by Create(), and ~BufferedBlockMgr().
|
private |
Number of deleted blocks reused.
Definition at line 586 of file buffered-block-mgr.h.
Referenced by GetUnusedBlock(), and Init().
|
staticprivate |
Protects query_to_block_mgrs_.
Definition at line 613 of file buffered-block-mgr.h.
Referenced by Create(), and ~BufferedBlockMgr().
|
private |
Temporary physical file handle, (one per tmp device) to which blocks may be written. Blocks are round-robined across these files.
Definition at line 560 of file buffered-block-mgr.h.
Referenced by InitTmpFiles(), WriteUnpinnedBlock(), and ~BufferedBlockMgr().
|
private |
The total number of pinned buffers across all clients.
Definition at line 527 of file buffered-block-mgr.h.
Referenced by DebugInternal(), DeleteBlock(), FindBufferForBlock(), GetNewBlock(), PinBlock(), UnpinBlock(), and Validate().
|
private |
The total number of reserved buffers across all clients that are not pinned.
Definition at line 524 of file buffered-block-mgr.h.
Referenced by ClearReservations(), ClearTmpReservation(), ConsumeMemory(), DebugInternal(), DeleteBlock(), FindBufferForBlock(), RegisterClient(), remaining_unreserved_buffers(), TryAcquireTmpReservation(), and UnpinBlock().
|
private |
List of blocks is_pinned_ = false AND are not on DiskIoMgr's write queue. Blocks are added to and removed from the back of the list. (i.e. in LIFO order). Blocks in this list must have is_pinned_ = false, in_write_ = false, is_deleted_ = false.
Definition at line 540 of file buffered-block-mgr.h.
Referenced by DebugInternal(), DeleteBlock(), FindBuffer(), FindBufferForBlock(), PinBlock(), remaining_unreserved_buffers(), UnpinBlock(), Validate(), and WriteUnpinnedBlocks().
|
private |
List of blocks that have been deleted and are no longer in use. Can be reused in GetNewBlock(). Blocks in this list must be in the Init'ed state, i.e. buffer_desc_ = NULL, is_pinned_ = false, in_write_ = false, is_deleted_ = false, valid_data_len = 0.
Definition at line 546 of file buffered-block-mgr.h.
Referenced by GetUnusedBlock(), and ReturnUnusedBlock().
|
private |
Number of writes issued.
Definition at line 610 of file buffered-block-mgr.h.
Referenced by writes_issued(), and WriteUnpinnedBlock().