| 657 | } |
| 658 | |
| 659 | Status 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 | |
| 680 | Status DataCache::Partition::Init() { |
| 681 | std::unique_lock<SpinLock> partition_lock(lock_); |
nothing calls this directly
no test coverage detected