-
Task
-
Resolution: Done
-
Major
-
None
-
None
As per the docs regarding taking snapshots:
Obtain a SHARE UPDATE EXCLUSIVE MODE lock on each of the monitored tables to ensure that no structural changes can occur to any of the tables while the snapshot is taking place. Note that these locks do not prevent table INSERTS, UPDATES and DELETES from taking place during the operation.
If that description is accurate, then SHARE UPDATE EXCLUSIVE is too strong. All that is required and absolutely should be used instead is a lock in ACCESS SHARE MODE.
This is very significant, because ACCESS SHARE only requires read-only access to the tables, which is the only access debezium should have as a replication user. SHARE UPDATE EXCLUSIVE requires that we give write permissions to the debezium user to every table.
PR: https://github.com/debezium/debezium/pull/1083
Straightforward demo:
$ psql postgres=# create table lockme() postgres-# ; CREATE TABLE postgres=# begin; BEGIN postgres=# lock table lockme in access share mode; LOCK TABLE postgres=# \! psql -c 'set lock_timeout to 1000; alter table lockme add column foo int' ERROR: canceling statement due to lock timeout
- is related to
-
DBZ-1591 Investigate the possibility of using temporary replication slot for snapshotting
- Pull Request Sent