| 53 | buffer_pool_capacity_(0) {} |
| 54 | |
| 55 | Status TestEnv::Init() { |
| 56 | // Always use aggressive decommit for backend tests |
| 57 | FLAGS_tcmalloc_aggressive_memory_decommit = true; |
| 58 | RETURN_IF_ERROR(MallocUtil::GetInstance()->Init()); |
| 59 | if (static_metrics_ == NULL) { |
| 60 | static_metrics_.reset(new MetricGroup("test-env-static-metrics")); |
| 61 | ImpaladMetrics::CreateMetrics(static_metrics_.get()); |
| 62 | RETURN_IF_ERROR(RegisterMemoryMetrics(static_metrics_.get(), true, nullptr, nullptr)); |
| 63 | ImpaladMetrics::CreateMetrics( |
| 64 | static_metrics_->GetOrCreateChildGroup("impala-server")); |
| 65 | } |
| 66 | |
| 67 | exec_env_.reset(new ExecEnv); |
| 68 | // Populate the ExecEnv state that the backend tests need. |
| 69 | RETURN_IF_ERROR(exec_env_->disk_io_mgr()->Init()); |
| 70 | RETURN_IF_ERROR(exec_env_->InitHadoopConfig()); |
| 71 | exec_env_->tmp_file_mgr_.reset(new TmpFileMgr); |
| 72 | if (have_tmp_file_mgr_args_) { |
| 73 | RETURN_IF_ERROR(tmp_file_mgr()->InitCustom(tmp_dirs_, one_tmp_dir_per_device_, |
| 74 | tmp_file_mgr_compression_, tmp_file_mgr_punch_holes_, metrics())); |
| 75 | } else { |
| 76 | RETURN_IF_ERROR(tmp_file_mgr()->Init(metrics())); |
| 77 | } |
| 78 | if (enable_buffer_pool_) { |
| 79 | exec_env_->InitBufferPool(buffer_pool_min_buffer_len_, buffer_pool_capacity_, |
| 80 | static_cast<int64_t>(0.1 * buffer_pool_capacity_)); |
| 81 | } |
| 82 | if (process_mem_tracker_use_metrics_) { |
| 83 | exec_env_->InitMemTracker(process_mem_limit_); |
| 84 | } else { |
| 85 | exec_env_->mem_tracker_.reset(new MemTracker(process_mem_limit_, "Process")); |
| 86 | } |
| 87 | |
| 88 | // Initialize RpcMgr and control service. |
| 89 | IpAddr ip_address; |
| 90 | RETURN_IF_ERROR(HostnameToIpAddr(FLAGS_hostname, &ip_address)); |
| 91 | exec_env_->krpc_address_.set_hostname(ip_address); |
| 92 | RETURN_IF_ERROR(exec_env_->rpc_mgr_->Init(exec_env_->krpc_address_)); |
| 93 | exec_env_->control_svc_.reset(new ControlService(exec_env_->rpc_metrics_)); |
| 94 | RETURN_IF_ERROR(exec_env_->control_svc_->Init()); |
| 95 | |
| 96 | return Status::OK(); |
| 97 | } |
| 98 | |
| 99 | void TestEnv::SetTmpFileMgrArgs(const vector<string>& tmp_dirs, bool one_dir_per_device, |
| 100 | const string& compression, bool punch_holes) { |
no test coverage detected