impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Impala Public Jenkins (Code Review)" <>
Subject [Impala-ASF-CR] IMPALA-6136: Part 1: Query duration should not be normally negative.
Date Fri, 03 Nov 2017 02:22:22 GMT
Impala Public Jenkins has submitted this change and it was merged. (

Change subject: IMPALA-6136: Part 1: Query duration should not be normally negative.

IMPALA-6136: Part 1: Query duration should not be normally negative.

The second commit for IMPALA-5599, 1640aa97, introduced a regression
where calculating the duration of an in-progress query can result
in negative values. This can happen for two reasons:

1. The value of ClientRequestState::end_time_us_ is not initialized
   in the constructor, and may have some random value until
   ClientRequestState::Done() is called.
2. If ClientRequestState::end_time_us_ happens to have a positive
   value less than ClientRequestState::start_time_us_, the query
   duration will be negative. Here, since the query is still in
   flight, we need to use the local current time as the end time.

The fix has been manually verified by executing long-running queries
and checking the query profiles to ensure the durations are not some
random junks. A new test case will be added to check for sane time
values in a follow-on commit.

Since we are using Unix time (system clock) for time stamps, it is
still possible for end_time_us_ to be less than start_time_us_ if
the system clock gets reset while the query is executing. If there
are clients that assume that a query duration is never negative,
we really should switch to a monotonic clock to time queries.

Change-Id: Ib6f971ebd5f0f00f3e38df0495692ffe9d52ef90
Reviewed-by: Michael Ho <>
Tested-by: Impala Public Jenkins
M be/src/service/
M be/src/service/client-request-state.h
M be/src/service/
M be/src/service/impala-server.h
4 files changed, 13 insertions(+), 2 deletions(-)

  Michael Ho: Looks good to me, approved
  Impala Public Jenkins: Verified

To view, visit
To unsubscribe, visit

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib6f971ebd5f0f00f3e38df0495692ffe9d52ef90
Gerrit-Change-Number: 8430
Gerrit-PatchSet: 4
Gerrit-Owner: Zoram Thanga <>
Gerrit-Reviewer: Dan Hecht <>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Michael Ho <>
Gerrit-Reviewer: Philip Zeyliger <>
Gerrit-Reviewer: Zoram Thanga <>

  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message