Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add hooks for extensiona, allow custom Table-AM to implement custom x…
…log (#848) Add two hook functions for extension, make custom Table-Am can hook in xlog redo typedef void (*ConsistencyCheck_hook_type) (void); extern PGDLLIMPORT ConsistencyCheck_hook_type xlog_check_consistency_hook; typedef void (*XLOGDropDatabase_hook_type)(Oid dbid); extern XLOGDropDatabase_hook_type XLOGDropDatabase_hook; In cloudberrydb, when mirror instance redo xlog, StartupXLog will start replaying from the latest checkpoint's REDO location in pg_control. When processing the xlog of data writing, we need to write the data in xlog into the data file, but the entire db directory may be deleted due to the drop database xlog that has been replayed last time. XLogDropDatabase and XLogCheckInvalidPages limits the table to be organized in page mode. For custom Table-Am, their data organization is not necessarily in page mode. We need to provide a hook for the implementation of custom wal log to handle this situation. master: \c testdb t1: create table t1(a int); t2: select pg_sleep(checkpoint_timeout); --wait checkpoint_timeout, do checkpoint on mirror; t3: insert into t1 select generate_series(1,10); t4: dropdb testdb t5: pkill postgres -- mirror should redo dropdb and not do next checkpoint on mirror then we restart the cluster, mirror will recovery restart at the xlog of insert sql, but the data path of testdb has been deleted
- Loading branch information