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

Method Wait

be/src/util/thread-pool.h:273–291  ·  view source on GitHub ↗

Wait for the operation to complete or time out with the specified limit 'timeout_millis' given that the caller has already waited 'time_used_millis'. If the operation times out, it returns TErrorCode::THREAD_POOL_TASK_TIMED_OUT. Otherwise, it returns the status returned by Execute().

Source from the content-addressed store, hash-verified

271 /// If the operation times out, it returns TErrorCode::THREAD_POOL_TASK_TIMED_OUT.
272 /// Otherwise, it returns the status returned by Execute().
273 Status Wait(int64_t timeout_millis, int64_t time_used_millis) {
274 // If the time used has already exceeded the timeout, go directly to returning
275 // THREAD_POOL_TASK_TIMED_OUT.
276 bool timed_out = (time_used_millis >= timeout_millis);
277 Status status;
278 if (!timed_out) {
279 int64_t timeout_left_millis = timeout_millis - time_used_millis;
280 status = done_promise_.Get(timeout_left_millis, &timed_out);
281 }
282 if (timed_out) {
283 // IMPALA-7946: Always throw an error using the original timeout, not the
284 // timeout remaining.
285 Status timeout_status = Status(TErrorCode::THREAD_POOL_TASK_TIMED_OUT,
286 GetDescription(), timeout_millis / MILLIS_PER_SEC);
287 LOG(WARNING) << timeout_status.GetDetail();
288 return timeout_status;
289 }
290 return status;
291 }
292
293 // Set to the return status of ExecuteImpl() upon completion
294 Promise<Status> done_promise_;

Callers 2

DrainAndShutdownMethod · 0.45
SynchronousOfferMethod · 0.45

Calls 3

GetDetailMethod · 0.80
StatusClass · 0.70
GetMethod · 0.45

Tested by

no test coverage detected