暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

PostgreSQL 14 引入WaitLatch(), 避免每次等待时需要 epoll/kqueue 系统调用.

digoal 2020-08-03
1282

作者

digoal

日期

2020-08-03

标签

PostgreSQL , WaitEventSet , WaitLatch , epoll , kqueue


背景

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=e7591fd3cae6c64236ef29d3c87e69b96608a19b

```
+ / Prepare to wait for our latch or data in our socket. /
+ wes = CreateWaitEventSet(CurrentMemoryContext, 3);
+ AddWaitEventToSet(wes, WL_LATCH_SET, PGINVALID_SOCKET, MyLatch, NULL);
+ AddWaitEventToSet(wes, WL_POSTMASTER_DEATH, PGINVALID_SOCKET, NULL, NULL);
+ AddWaitEventToSet(wes, WL_SOCKET_READABLE, pgStatSock, NULL, NULL);

Introduce a WaitEventSet for the stats collector.
author Thomas Munro tmunro@postgresql.org
Thu, 30 Jul 2020 13:25:48 +0800 (17:25 +1200)
committer Thomas Munro tmunro@postgresql.org
Thu, 30 Jul 2020 13:44:28 +0800 (17:44 +1200)
commit e7591fd3cae6c64236ef29d3c87e69b96608a19b
tree 0db0ae04cd129de5682c0765e833567445dc1b7f tree | snapshot
parent e2d394df5df28ab5ee4bfac6b13837e99e24045d commit | diff
Introduce a WaitEventSet for the stats collector.

This avoids avoids some epoll/kqueue system calls for every wait.

Reviewed-by: Kyotaro Horiguchi horikyota.ntt@gmail.com
Discussion: https://postgr.es/m/CA%2BhUKGJAC4Oqao%3DqforhNey20J8CiG2R%3DoBPqvfR0vOJrFysGw%40mail.gmail.com
```

更新,使用waitlatch代替硬编码

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=e2d394df5df28ab5ee4bfac6b13837e99e24045d

``` Use WaitLatch() for condition variables. author Thomas Munro tmunro@postgresql.org
Thu, 30 Jul 2020 13:23:32 +0800 (17:23 +1200) committer Thomas Munro tmunro@postgresql.org
Thu, 30 Jul 2020 13:42:45 +0800 (17:42 +1200) commit e2d394df5df28ab5ee4bfac6b13837e99e24045d tree 05aafff298d20c9bedc55c723826554bb762403f tree | snapshot parent 3347c982bab0dd56d5b6cb784521233ba2bbac27 commit | diff Use WaitLatch() for condition variables.

Previously, condition_variable.c created a long lived WaitEventSet to avoid extra system calls. WaitLatch() now uses something similar internally, so there is no point in wasting an extra kernel descriptor.

Reviewed-by: Kyotaro Horiguchi horikyota.ntt@gmail.com Discussion: https://postgr.es/m/CA%2BhUKGJAC4Oqao%3DqforhNey20J8CiG2R%3DoBPqvfR0vOJrFysGw%40mail.gmail.com ```

引入WaitEventSet, 避免每次等待时需要的epoll/kqueue 系统调用.

PostgreSQL 许愿链接

您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.

9.9元购买3个月阿里云RDS PostgreSQL实例

PostgreSQL 解决方案集合

德哥 / digoal's github - 公益是一辈子的事.

digoal's wechat

文章转载自digoal,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论