| 660 | } |
| 661 | |
| 662 | Status TmpFileMgr::TmpDirRemoteCtrl::SetUpReadBufferParams() { |
| 663 | bool is_percent; |
| 664 | // If the temporary file size is smaller than the max block size, set the block size |
| 665 | // as the file size |
| 666 | read_buffer_block_size_ = |
| 667 | remote_tmp_file_size_ < MAX_REMOTE_READ_MEM_BLOCK_THRESHOLD_BYTES ? |
| 668 | remote_tmp_file_size_ : |
| 669 | MAX_REMOTE_READ_MEM_BLOCK_THRESHOLD_BYTES; |
| 670 | num_read_buffer_blocks_per_file_ = |
| 671 | static_cast<int>(remote_tmp_file_size_ / read_buffer_block_size_); |
| 672 | max_read_buffer_size_ = |
| 673 | ParseUtil::ParseMemSpec(FLAGS_remote_read_memory_buffer_size, &is_percent, 0); |
| 674 | if (max_read_buffer_size_ <= 0) { |
| 675 | return Status(Substitute("Invalid value of remote_read_memory_buffer_size '$0'", |
| 676 | FLAGS_remote_read_memory_buffer_size)); |
| 677 | } |
| 678 | // Calculate the max allowed bytes for the read buffer. |
| 679 | int64_t max_allow_bytes = CalcMaxReadBufferBytes(); |
| 680 | DCHECK_GE(max_allow_bytes, 0); |
| 681 | if (max_read_buffer_size_ > max_allow_bytes) { |
| 682 | max_read_buffer_size_ = max_allow_bytes; |
| 683 | LOG(WARNING) << "The remote read memory buffer size exceeds the maximum " |
| 684 | "allowed and is reduced to " |
| 685 | << max_allow_bytes << " bytes."; |
| 686 | } |
| 687 | LOG(INFO) << "Using " << max_read_buffer_size_ |
| 688 | << " bytes for the batch reading buffer of TmpFileMgr."; |
| 689 | return Status::OK(); |
| 690 | } |
| 691 | |
| 692 | Status TmpDir::ParseByteLimit(const string& byte_limit) { |
| 693 | bool is_percent; |
no test coverage detected