Protect checkpoint from MMXLOG record insertion.
Originally, `CheckpointStartLock` prevent any MMXLOG insert between
collecting persistent table objects information
(mmxlog_append_checkpoint_data) through XLogInsert of checkpoint record.
Since `CheckpointStartLock` is removed from upstream, to prevent error
in MMXLOG replay on standby, we have to add protection back.
For the same reason, we used PersistentObjLock in SHARED mode to
prevent any update between mmxlog_append_checkpoint_data and XLogInsert
for checkpoint record.
Here is a broken scenario before this patch:
- Create standby like `gpinitstandby -s localhost -P 12345 -F pg_system:/tmp/standby/ps,fs1:/tmp/standby/fs1`
- Create two connections c1 and c2
- c2:
- `create tablespace ts1 filespace fs1;`: double check the new folder created under filespace fs1 (`/tmp/standby/fs1`) on standby.
- `begin;`
- `drop tablespace ts1;`
- set breakpoint to connection c2 on function: `PersistentTablespace_Dropped`
- c2: `commit;`: At this moment, we are ready to write a XLOG for the tablespace drop, but haven't done so. We will let checkpoint record this extra tablespace.
- Switch to connection c1:
- set breakpoint to connection c1 on function: `getTwoPhasePreparedTransactionData`: This will pause the `checkpoint` right after we collect the persistent objects information for mmxlog.
- for lldb, make sure do `pro hand -p true -s false SIGINT` to pass the signal.
- Switch back to connection c2, and continue from the breakpoint `PersistentTablespace_Dropped`, and let it finish.
- Switch back to connection c1, and let the checkpoint finish.
- Now, check the `/tmp/standby/fs1`, you will see the left behind tablespace which is already deleted from master.
Signed-off-by: NXin Zhang <xzhang@pivotal.io>
Showing
想要评论请 注册 或 登录