Michael Smith has submitted this change and it was merged. (
http://gerrit.cloudera.org:8080/24171 )
Change subject: IMPALA-14876: Use char* for thread name in
impala::Thread::SuperviseThread
......................................................................
IMPALA-14876: Use char* for thread name in impala::Thread::SuperviseThread
impala::Thread::SuperviseThread() runs most of the backend threads. Its
first parameter is the thread name in std::string type. Backtraces in
pstack/gdb usually omit its value by just showing "name=...".
The thread name is important to find the thread of a given fragment
instance, e.g.,
"exec-finstance (finst:594ed4f65014cbd3:4bae840b00000001)",
"query-state-594ed4f65014cbd3:4bae840b00000000",
"scanner-thread (finst:594ed4f65014cbd3:4bae840b00000001, plan-node-id:0,
thread-idx:2)".
This patch improves this by changing the parameter type of 'name' to
const char* so the string can be actually printed. It's unexpected /
unsafe for SuperviseThread() to keep refering to parameters passed by
reference or pointer to it. So a thread local string is used to copy the
thread name and 'name' pointer is updated to point to it. See JIRA
comments for some examples.
Note that I have to add __attribute__((optimize("O0"))) to the method to
avoid 'name' being printed as "<optimized out>". This is a GCC
attribute. For clang, we use [[clang::optnone]].
Tests
- Manually tested pstacks on Rocky 9.7 when running a slow query:
select count(*) from functional.alltypes where sleep(100) < id;
Change-Id: I7fa831d4efd7d8665f9c69fcea960e8e1c47aa2b
Reviewed-on: http://gerrit.cloudera.org:8080/24171
Reviewed-by: Michael Smith <[email protected]>
Reviewed-by: Jason Fehr <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
---
M be/src/util/thread.cc
M be/src/util/thread.h
2 files changed, 31 insertions(+), 8 deletions(-)
Approvals:
Michael Smith: Looks good to me, but someone else must approve
Jason Fehr: Looks good to me, approved
Impala Public Jenkins: Verified
--
To view, visit http://gerrit.cloudera.org:8080/24171
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I7fa831d4efd7d8665f9c69fcea960e8e1c47aa2b
Gerrit-Change-Number: 24171
Gerrit-PatchSet: 3
Gerrit-Owner: Quanlong Huang <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Jason Fehr <[email protected]>
Gerrit-Reviewer: Joe McDonnell <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>