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

Method DoOpenFile

be/src/kudu/util/file_cache.cc:510–535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

508
509template <>
510Status FileCache::DoOpenFile(const string& file_name,
511 shared_ptr<internal::Descriptor<RWFile>>* file,
512 bool* created_desc) {
513 shared_ptr<internal::Descriptor<RWFile>> d;
514 bool cd;
515 {
516 std::lock_guard<simple_spinlock> l(lock_);
517 d = FindDescriptorUnlocked(file_name, FindMode::CREATE_IF_NOT_EXIST,
518 &rwf_descs_, &cd);
519 DCHECK(d);
520
521#ifndef NDEBUG
522 // Enforce the invariant that a particular file name may only be used by one
523 // descriptor at a time. This is expensive so it's only done in DEBUG mode.
524 bool ignored;
525 CHECK(!FindDescriptorUnlocked(file_name, FindMode::DONT_CREATE,
526 &raf_descs_, &ignored));
527#endif
528 }
529 if (d->base_.deleted()) {
530 return Status::NotFound(kAlreadyDeleted, file_name);
531 }
532 *file = std::move(d);
533 *created_desc = cd;
534 return Status::OK();
535}
536
537template <>
538Status FileCache::DoOpenFile(const string& file_name,

Callers

nothing calls this directly

Calls 4

NotFoundFunction · 0.85
moveFunction · 0.85
OKFunction · 0.85
deletedMethod · 0.80

Tested by

no test coverage detected