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

Method Read

be/src/runtime/io/data-cache.cc:263–276  ·  view source on GitHub ↗

Reads from byte offset 'offset' for 'bytes_to_read' bytes into 'buffer'. Returns true iff read succeeded. Returns false on error or if the file is already closed.

Source from the content-addressed store, hash-verified

261 // Returns true iff read succeeded. Returns false on error or if the file
262 // is already closed.
263 bool Read(int64_t offset, uint8_t* buffer, int64_t bytes_to_read) {
264 DCHECK_EQ(offset % PAGE_SIZE, 0);
265 // Hold the lock in shared mode to check if 'file_' is not closed already.
266 kudu::shared_lock<rw_spinlock> lock(lock_.get_lock());
267 if (UNLIKELY(!file_)) return false;
268 DCHECK_LE(offset + bytes_to_read, current_offset_.Load());
269 kudu::Status status = file_->Read(offset, Slice(buffer, bytes_to_read));
270 if (UNLIKELY(!status.ok())) {
271 LOG(ERROR) << Substitute("Failed to read from $0 at offset $1 for $2 bytes: $3",
272 path_, offset, PrettyPrinter::PrintBytes(bytes_to_read), status.ToString());
273 return false;
274 }
275 return true;
276 }
277
278 // Writes 'buffer' of length 'buffer_len' into byte offset 'offset' in the file.
279 // Returns true iff write succeeded. Returns false on errors or if the file is

Callers 1

LookupMethod · 0.45

Calls 7

SubstituteFunction · 0.85
PrintBytesFunction · 0.85
SliceClass · 0.50
get_lockMethod · 0.45
LoadMethod · 0.45
okMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected