XC_Watchdog why?
To monitor if each XC component is running, psql is not sufficient because it does not check gtm/gtm_proxy/datanode. Also, psql detection may take time. As discussed in the cluster summit (http://wiki.postgresql.org/wiki/PgCon2012CanadaClusterSummit), watchdog time will be nice for this purpose.
Here's a design of watchdog timer:
- Have separate shared memory for each component,
- Postmaster and gtm/gtm_proxy server main loop increment each watchdog timer,
- ( Timer will be detected by separate command to report any fault
For this purpose, need some GUC and GTM/GTM-Proxy configuration parameters to specify
- If watchdog time is on
- Timer increment interval (maybe in milliseconds)
Shmid for each component will be kept in pg_control, gtm.control and gtm_proxy.control files.
API to attach shared memory for watchdog and read the timer value will be provided too.
Implementation
-
Add GUC
-
xc_watchdog onoff
-
xc_watchdog_interval (in millisecond)
- Add gtm.opt option
- xc_watchdog on/off
- xc_watchdog_interval in millisecond
- Add gtm_proxy.opt option
- xc_watchdog on/off
- xc_watchdog_interval in millisecond
- Write the following
- watchdog structure definition
- function to get, initialize and attach watchdog memory
- Check the magic and node category (coord/datanode/gtm/gtm_proxy)
- function to imcrement the watchdog timer
- Individual functions for coord/datanode/gtm/gtm_proxy to do the following:
- Initialize pointer to the watchdog structure
- Set interval
- Increment the timer (in each server loop)
- Handle status file.
When status file is first read, check shmid of the watchdog structure. If set, try to attach this and check if it is valid. If not set or not valid, then shmget, attach and initialize it, and then write back the status file.
?? When watchdog structure can be removed? ---> When each component terminate gracefully, then the structure can be removed.
- Watchdog detector
- API for
- watchdog detector application to attach and monitor.
- (maybe) some asynchronous means to notify the target failure
- Detect XC cluster configuration and build XC cluster configuration structure.
- various supporting API for c)
- Command to
- Detect a failurem
- Report to external entities --> could be smnp trap, could be pacemaker monitoring tool, could be any others.
- Collect XC cluster configuration and advice what to do when any failure occurs --> Split brain handling will be important here.