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

Method DeleteUntrackedFiles

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

Source from the content-addressed store, hash-verified

657}
658
659Status DataCache::Partition::DeleteUntrackedFiles() const {
660 DCHECK(!trace_replay_);
661 std::unordered_set<string> tracked_file_paths;
662 for (const auto& file : cache_files_) {
663 tracked_file_paths.insert(file->path());
664 }
665 vector<string> entries;
666 RETURN_IF_ERROR(FileSystemUtil::Directory::GetEntryNames(path_, &entries, 0,
667 FileSystemUtil::Directory::EntryType::DIR_ENTRY_REG));
668 for (const string& entry : entries) {
669 if (entry.find(CACHE_FILE_PREFIX) == 0 || entry == DUMP_FILE_NAME) {
670 const string file_path = JoinPathSegments(path_, entry);
671 if (tracked_file_paths.find(file_path) != tracked_file_paths.end()) continue;
672 KUDU_RETURN_IF_ERROR(kudu::Env::Default()->DeleteFile(file_path),
673 Substitute("Failed to delete old cache file $0", file_path));
674 LOG(INFO) << Substitute("Deleted old cache file $0", file_path);
675 }
676 }
677 return Status::OK();
678}
679
680Status DataCache::Partition::Init() {
681 std::unique_lock<SpinLock> partition_lock(lock_);

Callers

nothing calls this directly

Calls 9

JoinPathSegmentsFunction · 0.85
DefaultClass · 0.85
SubstituteFunction · 0.85
OKFunction · 0.85
pathMethod · 0.80
insertMethod · 0.45
findMethod · 0.45
endMethod · 0.45
DeleteFileMethod · 0.45

Tested by

no test coverage detected