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

Method VerifyAndCreate

be/src/runtime/tmp-file-mgr.cc:755–793  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

753}
754
755Status TmpDirLocal::VerifyAndCreate(MetricGroup* metrics,
756 vector<bool>* is_tmp_dir_on_disk, bool need_local_buffer_dir, TmpFileMgr* tmp_mgr) {
757 DCHECK(!parsed_raw_path_.empty());
758 // The path must be a writable directory.
759 Status status = FileSystemUtil::VerifyIsDirectory(parsed_raw_path_);
760 if (!status.ok()) {
761 LOG(WARNING) << "Cannot use directory " << parsed_raw_path_
762 << " for scratch: " << status.msg().msg();
763 return status;
764 }
765
766 // Find the disk id of path. Add the scratch directory if there isn't another directory
767 // on the same disk (or if we don't know which disk it is on).
768 int disk_id = DiskInfo::disk_id(parsed_raw_path_.c_str());
769 if (!tmp_mgr->one_dir_per_device_ || disk_id < 0 || !(*is_tmp_dir_on_disk)[disk_id]) {
770 uint64_t available_space;
771 RETURN_IF_ERROR(
772 FileSystemUtil::GetSpaceAvailable(parsed_raw_path_, &available_space));
773 if (available_space < AVAILABLE_SPACE_THRESHOLD_MB * 1024 * 1024) {
774 LOG(WARNING) << "Filesystem containing scratch directory " << parsed_raw_path_
775 << " has less than " << AVAILABLE_SPACE_THRESHOLD_MB
776 << "MB available.";
777 }
778 RETURN_IF_ERROR(CreateLocalDirectory(
779 metrics, is_tmp_dir_on_disk, need_local_buffer_dir, disk_id, tmp_mgr));
780 if (tmp_mgr->punch_holes_) {
781 // Make sure hole punching is supported for the directory.
782 // IMPALA-9798: this file should *not* be created inside impala-scratch
783 // subdirectory to avoid races with multiple impalads starting up.
784 RETURN_IF_ERROR(FileSystemUtil::CheckHolePunch(parsed_raw_path_));
785 }
786 } else {
787 return Status(Substitute(
788 "The scratch directory $0 is on the same disk with another directory or on "
789 "an unknown disk.",
790 parsed_raw_path_));
791 }
792 return Status::OK();
793}
794
795void TmpDirLocal::LogScratchLocalDirectoryInfo(bool is_local_buffer_dir, int disk_id) {
796 LOG(INFO) << (is_local_buffer_dir ? "Using local buffer directory for scratch space " :

Callers 1

InitCustomMethod · 0.80

Calls 7

SubstituteFunction · 0.85
OKFunction · 0.85
GetHdfsErrorMsgFunction · 0.85
StatusClass · 0.70
emptyMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected