设为首页 加入收藏

TOP

TRUNCATETABLEHANG(三)
2015-07-24 10:27:41 来源: 作者: 【 】 浏览:6
Tags:TRUNCATETABLEHANG
n | page | tuple | transactionid | classid | objid | objsubid | transaction | pid | mode | granted | mppsessionid | mppiswriter | gp_segment_id ---------------+----------+----------+------+-------+---------------+---------+-------+----------+-------------+-------+---------------------+---------+--------------+ -------------+--------------- relation | 17020 | 11052151 | | | | | | | 1658824590 | 14027 | AccessExclusiveLock | t | 113747736 | t | -1 relation | 17020 | 11051470 | | | | | | | 1658824590 | 14027 | ShareLock | t | 113747736 | t | -1 relation | 17020 | 11051470 | | | | | | | 1658824590 | 14027 | AccessExclusiveLock | t | 113747736 | t | -1 relation | 17020 | 11052150 | | | | | | | 1658824590 | 14027 | ShareLock | t | 113747736 | t | -1 relation | 17020 | 11052150 | | | | | | | 1658824590 | 14027 | AccessExclusiveLock | t | 113747736 | t | -1 transactionid | | | | | 1658824590 | | | | 1658824590 | 14027 | ExclusiveLock | t | 113747736 | t | -1 (6 rows)

根据售后的提示说明做以下检查:
Truncate table would need a execlusive lock on all the segments to make a sucessfull transaction.

It seems like there is a lock on some segments that process cant acquire.

Please follow the below steps and let me know if that helps to identify on which segments is the point of issue.

Idenifity if the process has acquire all the locks on the segments, like for eg.s

select procpid,sess_id,current_query from pg_stat_Activity ;
select * from pg_locks where mppsessionid= and grant='f';

The second query would tell where it has not able to acquire the lock ( like relation ) , once you find it , you can use the query below to know who is holding it on those segments.

select * from pg_locks where relation= and granted='t';

if you find some orphan process on the segments holding locks , try terminating those process ( avoid using kill -9 as it will cause postmaster reset )

根据上述步骤我答复如下:

Thanks, detail info :
On the session 1, truncate the table, still hang:
gtlions=# select pg_backend_pid();
 pg_backend_pid
----------------
          14027
(1 row)
 
gtlions=# truncate table gtlions.cannottruncatetable;
Cancel request sent
ERROR:  canceling statement due to user request
 
On the session 2, check the lock info, not find result for the session:
gtlions=# select procpid,sess_id,current_query from pg_stat_activity  where procpid=14027;
 procpid |  sess_id  |                 current_query                 
---------+-----------+-----------------------------------------------
   14027 | 113747736 | truncate table gtlions.cannottruncatetable;
(1 row)
 
gtlions=# select * from pg_locks where mppsessionid=14027;
 locktype | database | relation | page | tuple | transactionid | classid | objid | objsubid | transaction | pid | mode | granted | mppsessionid | mppiswriter | gp_segm
ent_id
----------+----------+----------+------+-------+---------------+---------+-------+----------+-------------+-----+------+---------+--------------+-------------+--------
-------
(0 rows)
 
gtlions=# select * from pg_locks where mppsessionid=14027;
 locktype | database | relation | page | tuple | transactionid | classid | objid | objsubid | transaction | pid | mode | granted | mppsessionid | mppiswriter | gp_segm
ent_id
----------+----------+----------+------+-------+---------------+---------+-------+----------+-------------+-----+------+---------+--------------+-------------+--------
-------
(0 rows)


Y的,这也太水了吧,我是在搞不清楚mppsessionid怎么会和那个关联起来。由于SR
首页 上一页 1 2 3 4 5 6 下一页 尾页 3/6/6
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇MySQL统计过去12个月的数据(包括.. 下一篇”凉?“的故事

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·C语言中,“指针”用 (2025-12-26 15:20:18)
·在c语言的指针运算中 (2025-12-26 15:20:15)
·C语言-函数指针与函 (2025-12-26 15:20:12)
·求navicat for mysql (2025-12-26 13:21:33)
·有哪位大哥推荐一下m (2025-12-26 13:21:30)