Impala Public Jenkins has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/12702 )

Change subject: IMPALA-8288: avoid overflow causing DCHECK in PrettyPrint.
......................................................................

IMPALA-8288: avoid overflow causing DCHECK in PrettyPrint.

When PrettyPrinter prints a time measured in seconds, it multiplies the
time by 1000, and prints that value as milliseconds. Because
PrettyPrinter is implemented using templates, the type of the value
depends on the type of the value parameter. For typical values of
seconds the type is an int32_t. When this is multiplied by 1000 it can
therefore overflow, which triggers a DHECK failure in DEBUG builds.

Fix this by instead multiplying the value parameter by the existing
constant 'THOUSAND' which is declared as a int64_t. This produces a
result which is also a int64_t, and which does not overflow so easily.

TESTING:

Add more test cases to pretty-printer-test.cc including cases that
previously caused overflows. Expand the coverage to include cases
printing NanoSeocnds, MillisSeconds and MicroSeconds. These cases are
not supposed to show that PrettyPrinter always behaves consistently, but
to help maintainers avoid regressions when changing PrettyPrinter.

Ran all end-to-end tests.

Change-Id: I00d9769cf34e2ccd796ec1cf88797c8f8250f718
Reviewed-on: http://gerrit.cloudera.org:8080/12702
Reviewed-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com>
---
M be/src/util/pretty-printer-test.cc
M be/src/util/pretty-printer.h
2 files changed, 65 insertions(+), 1 deletion(-)

Approvals:
  Impala Public Jenkins: Looks good to me, approved; Verified

--
To view, visit http://gerrit.cloudera.org:8080/12702
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I00d9769cf34e2ccd796ec1cf88797c8f8250f718
Gerrit-Change-Number: 12702
Gerrit-PatchSet: 3
Gerrit-Owner: Andrew Sherman <asher...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <phi...@cloudera.com>

Reply via email to