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

Method DeleteFile

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

Source from the content-addressed store, hash-verified

619}
620
621Status FileCache::DeleteFile(const string& file_name) {
622 // Mark any outstanding descriptor as deleted. Because there may only be one
623 // descriptor per file name, we can short circuit the search if we find a
624 // descriptor in the first map.
625 {
626 std::lock_guard<simple_spinlock> l(lock_);
627 bool ignored;
628 {
629 auto d = FindDescriptorUnlocked(file_name, FindMode::DONT_CREATE,
630 &rwf_descs_, &ignored);
631 if (d) {
632 if (d->base_.deleted()) {
633 return Status::NotFound(kAlreadyDeleted, file_name);
634 }
635 d->base_.MarkDeleted();
636 return Status::OK();
637 }
638 }
639 {
640 auto d = FindDescriptorUnlocked(file_name, FindMode::DONT_CREATE,
641 &raf_descs_, &ignored);
642 if (d) {
643 if (d->base_.deleted()) {
644 return Status::NotFound(kAlreadyDeleted, file_name);
645 }
646 d->base_.MarkDeleted();
647 return Status::OK();
648 }
649 }
650 }
651
652 // There are no outstanding descriptors. Delete the file now.
653 //
654 // Make sure it's been fully evicted from the cache (perhaps it was opened
655 // previously?) so that the filesystem can reclaim the file data instantly.
656 cache_->Erase(file_name);
657 return env_->DeleteFile(file_name);
658}
659
660void FileCache::Invalidate(const string& file_name) {
661 // Ensure that there are invalidated descriptors in both maps for this

Callers 15

KinitMethod · 0.45
DoWriteStringToFileFunction · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45
~BaseDescriptorMethod · 0.45
CompressFileMethod · 0.45
ConsumerThreadMethod · 0.45
TEST_FFunction · 0.45
WritePBToPathFunction · 0.45
WritePBContainerToPathFunction · 0.45

Calls 5

NotFoundFunction · 0.85
OKFunction · 0.85
deletedMethod · 0.80
MarkDeletedMethod · 0.80
EraseMethod · 0.45

Tested by 7

KinitMethod · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
ConsumerThreadMethod · 0.36
TEST_FFunction · 0.36
TYPED_TESTFunction · 0.36
TEST_PFunction · 0.36