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

Method TmpFileRemote

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

Source from the content-addressed store, hash-verified

1013}
1014
1015TmpFileRemote::TmpFileRemote(TmpFileGroup* file_group, TmpFileMgr::DeviceId device_id,
1016 const std::string& path, const std::string& local_buffer_path, bool expected_local,
1017 const char* hdfs_url)
1018 : TmpFile(file_group, device_id, path, expected_local) {
1019 DCHECK(hdfs_url != nullptr);
1020 hdfs_conn_ = nullptr;
1021 const HdfsFsCache::HdfsConnOptions* options = nullptr;
1022 if (IsHdfsPath(hdfs_url, false)) {
1023 disk_type_ = io::DiskFileType::DFS;
1024 disk_id_ = file_group->io_mgr_->RemoteDfsDiskId();
1025 disk_id_file_op_ = file_group->io_mgr_->RemoteDfsDiskFileOperId();
1026 } else if (IsOzonePath(hdfs_url, false)) {
1027 disk_type_ = io::DiskFileType::DFS;
1028 disk_id_ = file_group->io_mgr_->RemoteOzoneDiskId();
1029 disk_id_file_op_ = file_group->io_mgr_->RemoteDfsDiskFileOperId();
1030 } else if (IsS3APath(hdfs_url, false)) {
1031 disk_type_ = io::DiskFileType::S3;
1032 disk_id_ = file_group->io_mgr_->RemoteS3DiskId();
1033 disk_id_file_op_ = file_group->io_mgr_->RemoteS3DiskFileOperId();
1034 options = file_group_->tmp_file_mgr_->s3a_options();
1035 }
1036 Status status = HdfsFsCache::instance()->GetConnection(
1037 hdfs_url, &hdfs_conn_, &file_group_->tmp_file_mgr_->hdfs_conns_, options);
1038 file_size_ = file_group_->tmp_file_mgr_->GetRemoteTmpFileSize();
1039 local_buffer_path_ = local_buffer_path;
1040 disk_file_ = make_unique<io::DiskFile>(path_, file_group->io_mgr_,
1041 file_group_->tmp_file_mgr_->GetRemoteTmpFileSize(), disk_type_, &hdfs_conn_);
1042 if (file_group_->tmp_file_mgr_->IsRemoteBatchReadingEnabled()) {
1043 read_buffer_block_size_ = file_group_->tmp_file_mgr_->GetReadBufferBlockSize();
1044 int num_of_read_buffers = file_group_->tmp_file_mgr_->GetNumReadBuffersPerFile();
1045 disk_buffer_file_ = make_unique<io::DiskFile>(local_buffer_path_,
1046 file_group_->io_mgr_, file_group_->tmp_file_mgr_->GetRemoteTmpFileSize(),
1047 io::DiskFileType::LOCAL_BUFFER, read_buffer_block_size_, num_of_read_buffers);
1048 disk_read_page_cnts_ = std::make_unique<int64_t[]>(num_of_read_buffers);
1049 DCHECK(disk_read_page_cnts_.get() != nullptr);
1050 memset(disk_read_page_cnts_.get(), 0, num_of_read_buffers * sizeof(int64_t));
1051 for (int i = 0; i < num_of_read_buffers; i++) {
1052 fetch_ranges_.emplace_back(nullptr);
1053 }
1054 } else {
1055 disk_buffer_file_ = make_unique<io::DiskFile>(local_buffer_path_,
1056 file_group_->io_mgr_, file_group_->tmp_file_mgr_->GetRemoteTmpFileSize(),
1057 io::DiskFileType::LOCAL_BUFFER);
1058 }
1059}
1060
1061TmpFileRemote::~TmpFileRemote() {
1062 // Need to return the buffer before deconstruction if buffer space is reserved.

Callers

nothing calls this directly

Calls 15

IsHdfsPathFunction · 0.85
IsOzonePathFunction · 0.85
IsS3APathFunction · 0.85
RemoteDfsDiskIdMethod · 0.80
RemoteOzoneDiskIdMethod · 0.80
RemoteS3DiskIdMethod · 0.80
s3a_optionsMethod · 0.80
GetRemoteTmpFileSizeMethod · 0.80

Tested by

no test coverage detected