Hello hackers,
I have read the community mail from 'postgrespro' which the link below ①, a summary for the patch, it generals a CSN by timestamp when a transaction is committed and assigns a special value as CSN for abort transaction, and record them in CSN SLRU file. Now we can judge if a xid available in a snapshot with a CSN value instead of by xmin,xmax and xip array so that if we hold CSN as a snapshot which can be export and import. CSN may be a correct direction and an important part to implement distributed of PostgreSQL because it delivers few data among cross-nodes for snapshot, so the patch is meant to do some research. We want to implement Clock-SI base on the patch.However the patch is too old, and I rebase the infrastructure part of the patch to recently commit(7dc37ccea85). The origin patch does not support csn alive among database restart because it will clean csnlog at every time the database restart, it works well until a prepared transaction occurs due to the csn of prepare transaction cleaned by a database restart. So I add wal support for csnlog then csn can alive all the time, and move the csnlog clean work to auto vacuum. It comes to another issue, now it can't switch from a xid-base snapshot to csn-base snapshot if a prepare transaction exists because it can not find csn for the prepare transaction produced during xid-base snapshot. To solve it, if the database restart with snapshot change to csn-base I record an 'xmin_for_csn' where start to check with csn snapshot. Some issues known about the current patch: 1. The CSN-snapshot support repeatable read isolation level only, we should try to support other isolation levels. 2. We can not switch fluently from xid-base->csn-base, if there be prepared transaction in database. What do you think about it, I want try to test and improve the patch step by step. ①https://www.postgresql.org/message-id/21BC916B-80A1-43BF-8650-3363CCDAE09C%40postgrespro.ru ----------- Regards, Highgo Software (Canada/China/Pakistan) URL : http://www.highgo.ca/ EMAIL: mailto:movead(dot)li(at)highgo(dot)ca
0001-CSN-base-snapshot.patch
Description: Binary data
0002-Wal-for-csn.patch
Description: Binary data