| 131 | } |
| 132 | |
| 133 | void RuntimeState::Init() { |
| 134 | SCOPED_TIMER(profile_->total_time_counter()); |
| 135 | |
| 136 | // Register with the thread mgr |
| 137 | resource_pool_ = ExecEnv::GetInstance()->thread_mgr()->CreatePool(); |
| 138 | DCHECK(resource_pool_ != nullptr); |
| 139 | if (fragment_ != nullptr) { |
| 140 | // Ensure that the planner correctly determined the required threads. |
| 141 | resource_pool_->set_max_required_threads(fragment_->thread_reservation); |
| 142 | } |
| 143 | |
| 144 | total_thread_statistics_ = ADD_THREAD_COUNTERS(runtime_profile(), "TotalThreads"); |
| 145 | total_storage_wait_timer_ = ADD_TIMER(runtime_profile(), "TotalStorageWaitTime"); |
| 146 | total_network_send_timer_ = ADD_TIMER(runtime_profile(), "TotalNetworkSendTime"); |
| 147 | total_network_receive_timer_ = ADD_TIMER(runtime_profile(), "TotalNetworkReceiveTime"); |
| 148 | |
| 149 | instance_mem_tracker_ = obj_pool()->Add(new MemTracker( |
| 150 | runtime_profile(), -1, runtime_profile()->name(), query_mem_tracker())); |
| 151 | |
| 152 | if (instance_buffer_reservation_ != nullptr) { |
| 153 | instance_buffer_reservation_->InitChildTracker(profile_, |
| 154 | query_state_->buffer_reservation(), instance_mem_tracker_, |
| 155 | numeric_limits<int64_t>::max()); |
| 156 | } |
| 157 | |
| 158 | // Find local timezone. |
| 159 | // (For FE tests leave 'local_time_zone_' as default. FE tests don't load the timezone |
| 160 | // db since they don't need any timezone information.) |
| 161 | if (!TestInfo::is_fe_test()) { |
| 162 | const Timezone* tz = TimezoneDatabase::FindTimezone(query_ctx().local_time_zone); |
| 163 | if (tz != nullptr) { |
| 164 | // Use UTCPTR (actually a nullptr) if the timezone is UTC. This makes it easy to |
| 165 | // optimize many code paths for the UTC case. |
| 166 | local_time_zone_ = tz == &TimezoneDatabase::GetUtcTimezone() ? UTCPTR : tz; |
| 167 | } else { |
| 168 | const string msg = Substitute( |
| 169 | "Failed to find local timezone '$0'.Falling back to UTC.", |
| 170 | query_ctx().local_time_zone); |
| 171 | LOG(WARNING) << msg; |
| 172 | LogError(ErrorMsg(TErrorCode::GENERAL, msg)); |
| 173 | local_time_zone_ = UTCPTR; |
| 174 | } |
| 175 | if (query_options().use_local_tz_for_unix_timestamp_conversions) { |
| 176 | time_zone_for_unix_time_conversions_ = local_time_zone_; |
| 177 | } |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | Status RuntimeState::StartSpilling(MemTracker* mem_tracker) { |
| 182 | return query_state_->StartSpilling(this, mem_tracker); |
nothing calls this directly
no test coverage detected