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

PostgreSQL 14 preview - Add a xid argument to the filter_prepare callback for output plugins - logical decoding

digoal 2021-01-03
193

作者

digoal

日期

2021-03-30

标签

PostgreSQL , xid , gid , filter_prepare_cb , 逻辑decode , output plugin


背景

select txid_current(); 100102 prepare transaction '100102';

PostgreSQL 14 增强: logical decode filter_prepare_cb 可以通过xid选择需要decode的2PC事务内容, 结合业务的2PC ID用于识别2PC事务.

filter_prepare_cb 以前的版本只支持gid.

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

```
Add a xid argument to the filter_prepare callback for output plugins.

author Amit Kapila akapila@postgresql.org
Tue, 30 Mar 2021 05:04:43 +0000 (10:34 +0530)
committer Amit Kapila akapila@postgresql.org
Tue, 30 Mar 2021 05:04:43 +0000 (10:34 +0530)
commit f64ea6dc5c8ccaec9a3d3d39695ca261febb6883
tree 6fd006f6239df0b955d390f27189ffbd68b8df05 tree
parent bc2797ebb14bae663da1ee7845774dd98716c0d0 commit | diff

Add a xid argument to the filter_prepare callback for output plugins.

Along with gid, this provides a different way to identify the transaction.
The users that use xid in some way to prepare the transactions can use it
to filter prepare transactions. The later commands COMMIT PREPARED or
ROLLBACK PREPARED carries both identifiers, providing an output plugin the
choice of what to use.

Author: Markus Wanner
Reviewed-by: Vignesh C, Amit Kapila
Discussion: https://postgr.es/m/ee280000-7355-c4dc-e47b-2436e7be959c@enterprisedb.com
```

```
+ The ctx parameter has the same contents as for
+ the other callbacks. The parameters xid
+ and gid provide two different ways to identify
+ the transaction. The later COMMIT PREPARED or
+ ROLLBACK PREPARED carries both identifiers,
+ providing an output plugin the choice of what to use.

  • The callback may be invoked multiple times per transaction to decode
  • and must provide the same static answer for a given pair of
  • xid and gid every time
  • it is called.

  • Optionally the output plugin can define filtering rules via

  • filter_prepare_cb to decode only specific transaction
  • in two phases. This can be achieved by pattern matching on the
  • gid or via lookups using the
  • xid.
    ```

PostgreSQL 许愿链接

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

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

PostgreSQL 解决方案集合

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

digoal's wechat

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

评论