当前位置:网站首页>View the thread stack according to the lwtid of opengauss/mogdb.
View the thread stack according to the lwtid of opengauss/mogdb.
2022-07-28 20:34:00 【Ink Sky Wheel】
stay openGauss/MogDB database THREAD_WAIT_STATUS、PG_THREAD_WAIT_STATUS、GLOBAL_THREAD_WAIT_STATUS、LOCAL_ACTIVE_SESSION There are several views in lwtid This column , It is the lightweight thread number of the current thread . You can pass through according to this column pstack Command to grab the stack , Analysis of supply problems .
As shown below , It can be used pg_stat_activity and dbe_perf.thread_wait_status combination , Query some currently running SQL, adopt
MogDB=# select pid,lwtid,state,wait_event,query from pg_stat_activity a,dbe_perf.thread_wait_status s where a.pid=s.tid; pid | lwtid | state | wait_event | query ----------------+---------+--------+------------+------------------------------------------------------------------------------------------------------------------- 23043933468416 | 1724740 | active | none | select pid,lwtid,state,wait_event,query from pg_stat_activity a,dbe_perf.thread_wait_status s where a.pid=s.tid; 23044103272192 | 1724300 | active | none | select pg_sleep(30); 23044453037824 | 1526848 | | none | 23044479776512 | 1526847 | | none | 23044508612352 | 1526846 | active | none | WLM fetch collect info from data nodes 23044674287360 | 1526842 | idle | none | 23044771804928 | 1526839 | idle | none | 23044739823360 | 1526840 | active | none | 23044698928896 | 1526841 | active | none | 23044832098048 | 1526837 | | none | 23044928567040 | 1526834 | active | none | (11 rows)We go through pstack Go check the top lwtid=1724300 Corresponding select pg_sleep(30); The stack .
[[email protected] ~]$ pstack 1724300Thread 1 (Thread 0x14f55f96f700 (LWP 1724300)):#0 0x000014f98e8d829f in select () from /lib64/libc.so.6#1 0x0000555ba97ae25d in pg_usleep(long) ()#2 0x0000555ba87cef4a in pg_sleep(FunctionCallInfoData*) ()#3 0x0000555ba8fad525 in ?? ()#4 0x0000555ba8fadb59 in ExecProject(ProjectionInfo*, ExprDoneCond*) ()#5 0x0000555ba8ffb948 in ExecResult(ResultState*) ()#6 0x0000555ba8f9c6ee in ExecProcNode(PlanState*) ()#7 0x0000555ba8f95318 in standard_ExecutorRun(QueryDesc*, ScanDirection, long) ()#8 0x0000555ba8e25ed5 in ?? ()#9 0x0000555ba8f956ad in ExecutorRun(QueryDesc*, ScanDirection, long) ()#10 0x0000555ba8f148b3 in ?? ()#11 0x0000555ba8f14fa0 in PortalRun(PortalData*, long, bool, _DestReceiver*, _DestReceiver*, char*) ()#12 0x0000555ba8f095a2 in ?? ()#13 0x0000555ba8f0ce97 in PostgresMain(int, char**, char const*, char const*) ()#14 0x0000555ba8e6b501 in ?? ()#15 0x0000555ba8e89fb8 in int GaussDbThreadMain<(knl_thread_role)1>(knl_thread_arg*) ()#16 0x0000555ba8e6b585 in ?? ()#17 0x000014f98ebb117a in start_thread () from /lib64/libpthread.so.0#18 0x000014f98e8e0dc3 in clone () from /lib64/libc.so.6Can be seen clearly , Stack from PostgresMain Later, I called pg_sleep Every part of , And later pg_usleep Dormant part .
It can also be based on lwtid Find some key threads you want to analyze , For example, some threads with special functions , Such as WDRSnapshot、ASP、CheckPointer etc. 、 Or it is running for a long time in the database SQL And the thread corresponding to the waiting event that needs to be analyzed .
node_name | db_name | thread_name | query_id | tid | sessionid | lwtid | psessionid | tlevel | smpid | wait_status | wait_event | locktag | lockmode | block_sessionid | global_sessionid -----------+----------+------------------------+------------------+----------------+----------------+---------+------------+--------+-------+-------------+------------+---------+----------+-----------------+------------------ dn_6001 | postgres | gsql | 1407374883636205 | 23044103272192 | 23044103272192 | 1724935 | | 0 | 0 | none | none | | | | 0:0#0 dn_6001 | postgres | WLMArbiter | 0 | 23044453037824 | 23044453037824 | 1526848 | | 0 | 0 | none | none | | | | 0:0#0 dn_6001 | postgres | WorkloadMonitor | 0 | 23044479776512 | 23044479776512 | 1526847 | | 0 | 0 | none | none | | | | 0:0#0 dn_6001 | postgres | workload | 0 | 23044508612352 | 23044508612352 | 1526846 | | 0 | 0 | none | none | | | | 0:0#0 dn_6001 | postgres | statement flush thread | 0 | 23044674287360 | 23044674287360 | 1526842 | | 0 | 0 | none | none | | | | 0:0#0 dn_6001 | postgres | WDRSnapshot | 1407374883553280 | 23044771804928 | 23044771804928 | 1526839 | | 0 | 0 | none | none | | | | 0:0#0 dn_6001 | postgres | PercentileJob | 0 | 23044739823360 | 23044739823360 | 1526840 | | 0 | 0 | none | none | | | | 0:0#0 dn_6001 | postgres | Asp | 0 | 23044698928896 | 23044698928896 | 1526841 | | 0 | 0 | none | none | | | | 0:0#0 dn_6001 | postgres | ApplyLauncher | 0 | 23044832098048 | 23044832098048 | 1526837 | | 0 | 0 | none | none | | | | 0:0#0 dn_6001 | postgres | JobScheduler | 0 | 23044928567040 | 23044928567040 | 1526834 | | 0 | 0 | none | none | | | | 0:0#0(10 rows)As shown below , You can see lwtid=1526839 The corresponding is WDRSnapshot The current stack condition of the thread .
[[email protected] ~]$ pstack 1526839Thread 1 (Thread 0x14f5876ff700 (LWP 1526839)):#0 0x000014f98e8d829f in select () from /lib64/libc.so.6#1 0x0000555ba97ae25d in pg_usleep(long) ()#2 0x0000555ba8a83e83 in SnapshotNameSpace::SubSnapshotMain() ()#3 0x0000555ba8a843c5 in SnapshotMain() ()#4 0x0000555ba8e87e41 in int GaussDbThreadMain<(knl_thread_role)35>(knl_thread_arg*) ()#5 0x0000555ba8e6b585 in ?? ()#6 0x000014f98ebb117a in start_thread () from /lib64/libpthread.so.0#7 0x000014f98e8e0dc3 in clone () from /lib64/libc.so.6边栏推荐
- CNN convolution neural network learning process (weight update)
- Why is customer support important to SaaS?
- Use of DDR3 (axi4) in Xilinx vivado (5) board test
- Durham High Lord (classic DP)
- Voice controlled robot based on ROS (II): implementation of upper computer
- Introduction to seven kinds of polling (practice link attached)
- 树行表达方式
- Wust-ctf2021-re school match WP
- MySQL batch update data
- LeetCode_ Bit operation_ Medium_ 260. Number III that appears only once
猜你喜欢

一碰撞就自燃,谁来关心电池安全?上汽通用有话说

上海交大牵手淘宝成立媒体计算实验室:推动视频超分等关键技术发展

Windows系统下Mysql数据库定时备份

Raspberry pie 4B uses MNN to deploy yolov5 Lite

Solutions to the environment created by Anaconda that cannot be displayed in pycharm

C语言数据 3(2)

Install keras, tensorflow, and add the virtual environment to the Jupiter notebook

Residual network RESNET source code analysis - pytoch version

Merge sort template

类与对象(中)
随机推荐
Install keras, tensorflow, and add the virtual environment to the Jupiter notebook
Soft raid
产品力大幅提升 新款福特探险者发布
Raspberry connects EC20 for PPP dialing
Use of DDR3 (axi4) in Xilinx vivado (1) create an IP core
为什么客户支持对SaaS公司很重要?
Storage of C language data in memory (1)
CNN convolution neural network learning process (weight update)
[task01: getting familiar with database and SQL]
Introduction to seven kinds of polling (practice link attached)
About IP address
字符设备驱动结构
Network shell
3D激光SLAM:LeGO-LOAM论文解读---简介部分
Maximum exchange [greedy thought & monotonic stack implementation]
The product power is greatly improved, and the new Ford Explorer is released
LVS deployment Dr cluster
关于链接到其他页面的标题
LVM logical volume
一碰撞就自燃,谁来关心电池安全?上汽通用有话说