This is an automated email from the ASF dual-hosted git repository.
joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
The following commit(s) were added to refs/heads/master by this push:
new ce8078204 IMPALA-13111: Fix the calculation of fragment ids for
impala-gdb.py
ce8078204 is described below
commit ce8078204e5995277f79e226e26fe8b9eaca408b
Author: Joe McDonnell <[email protected]>
AuthorDate: Thu May 30 12:04:22 2024 -0700
IMPALA-13111: Fix the calculation of fragment ids for impala-gdb.py
The gdb helpers in impala-gdb.py provide functions to look on
the stack for the information added in IMPALA-6416 and get the
fragment/query ids. Right now, it is incorrectly using a signed
integer, which leads to incorrect ids like this:
-3cbda1606b3ade7c:f170c4bd00000000
This changes the logic to AND the integer with an 0xFF* sequence
of the right length. This forces the integer to be unsigned,
producing the right query id.
Testing:
- Ran this on a minidump and verified the the listed query ids
were valid (and existed in the profile log)
Change-Id: I59798407e99ee0e9100cac6b4b082cdb85ed43d1
Reviewed-on: http://gerrit.cloudera.org:8080/21472
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
---
lib/python/impala_py_lib/gdb/impala-gdb.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/python/impala_py_lib/gdb/impala-gdb.py
b/lib/python/impala_py_lib/gdb/impala-gdb.py
index 432ce14a8..f5e27569f 100644
--- a/lib/python/impala_py_lib/gdb/impala-gdb.py
+++ b/lib/python/impala_py_lib/gdb/impala-gdb.py
@@ -49,8 +49,9 @@ def get_fragment_instances():
# No valid thread_debug_info
if not tdi:
break
- hi = int(tdi['instance_id_']['hi'])
- lo = int(tdi['instance_id_']['lo'])
+ # ANDing with 0xFFFFFFFFFFFFFFFF forces the value to be
unsigned
+ hi = int(tdi['instance_id_']['hi']) & 0xFFFFFFFFFFFFFFFF
+ lo = int(tdi['instance_id_']['lo']) & 0xFFFFFFFFFFFFFFFF
fi = "%lx:%lx" % (hi, lo)
if fi != "0:0":
fragment_instances[fi.strip('"')].append(thread.num)
@@ -91,7 +92,12 @@ class FindQueryIds(gdb.Command):
query_ids = set()
for fi in fragment_instances:
qid_hi, qid_low = fi.split(':')
+ # The ANDing serves two purposes
+ # - It forces the value to be unsigned
+ # - For the low value, it masks out the fragment-specific bits to
get
+ # the query id
qid_low = format(int(qid_low, 16) & 0xFFFFFFFFFFFF0000, 'x')
+ qid_hi = format(int(qid_hi, 16) & 0xFFFFFFFFFFFFFFFF, 'x')
query_ids.add("{}:{}".format(qid_hi, qid_low))
print('\n'.join(query_ids))