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

Method ReadFromMemBuffer

be/src/runtime/io/disk-file.h:414–426  ·  view source on GitHub ↗

Read the spilled data from the memory buffer. Caller should hold the physical file lock of the disk file in case the object is destroyed. Also, caller should guarantee the buffer won't be released during reading, it is good for the caller to have the lock of the read buffer block.

Source from the content-addressed store, hash-verified

412 // destroyed. Also, caller should guarantee the buffer won't be released during reading,
413 // it is good for the caller to have the lock of the read buffer block.
414 Status ReadFromMemBuffer(int64_t offset_to_file, int64_t len, uint8_t* dst,
415 const boost::shared_lock<boost::shared_mutex>& file_lock) {
416 DCHECK(file_lock.mutex() == &physical_file_lock_ && file_lock.owns_lock());
417 int64_t idx = GetReadBufferIndex(offset_to_file);
418 DCheckReadBufferIdx(idx);
419 uint8_t* read_buffer_block = read_buffer_->read_buffer_blocks_[idx]->data();
420 DCHECK(read_buffer_block != nullptr);
421 int64_t offset_to_block = offset_to_file - GetReadBuffStartOffset(idx);
422 DCHECK_GE(offset_to_block, 0);
423 DCHECK_GE(GetReadBuffActualSize(idx), offset_to_block + len);
424 memcpy(dst, read_buffer_block + offset_to_block, len);
425 return Status::OK();
426 }
427
428 // Helper function to allocate the memory for a reading buffer block.
429 // Caller should hold both physical_file_lock_ and the lock of the read buffer block.

Callers 1

DoReadInternalMethod · 0.80

Calls 4

OKFunction · 0.85
owns_lockMethod · 0.80
mutexMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected