背景
PostgreSQL逻辑备份,如何保证备份数据的一致性呢,例如备份的同时,数据被纂改或者有新增的数据,如何保证在全库视角,备份出来的数据是在备份开始时看到的一致数据。
一致性逻辑备份分析
可以追溯到1999年的代码,早期PostgreSQL通过serializable隔离级别来保证备份的一致性。
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=bcb5aac81dec14d892fae18b446315367563be4c
Add keywords to implement Vadim's transaction isolation
and lock syntax as fully parsed tokens.
Two keywords for isolation are non-reserved SQL92
(COMMITTED, SERIALIZABLE).
All other new keywords are non-reserved Postgres (not SQL92)
(ACCESS, EXCLUSIVE, MODE, SHARE).
Add syntax to allow CREATE [GLOBAL|LOCAL] TEMPORARY TABLE, throwing an
error if GLOBAL