FTS is a very important component in Pivotal Greenplum (GPDB).
The following topics are covered in this article:
gp_segment_configuration
On the GPDB master host, there is a fault prober process that is forked and monitored from the postmaster postgres process. This fault prober process is also called the FTS (fault tolerance server) process. This process is restarted by the postmaster if it fails.
The FTS is in a continuous loop, with sleep between each loop based on the settings below:
gp_segment_configuration
table. If the connection cannot be made or if a reply is not received from a connection in the timeout period, then a retry is attempted to that segment database. The number of retries is controlled by a setting. gp_segment_configuration
table marking the segment as down and transitioning the mirror to be the primary. The FTS server will also update the gp_configuration_history
table with the operations performed.In order to bring up a down mirror, the gprecoverseg
utility command is run. This command defaults to incremental recovery and puts the mirror into resync mode, thereby starting to recover the changes from the primary to a mirror. If an incremental recovery cannot be completed, the recovery will fail and the gprecoverseg
command should be run again with the "-F" option. This will indicate full recovery and cause the primary to copy all the data over to the mirror to get it in sync mode.
Refer to this article for more information.
The modes, change tracking, resync, insync, can be seen for each segment, as well as the status up or down in the gp_segment_configuration
table. Check this article for more information.
There are also columns in gp_segment_configuration
called 'role' and 'preferred_role'. These can have the values of either 'p' for primary or 'm' for the mirror. The 'role' shows the current role of a segment database and the 'preferred_role' shows the original role of the segment. In a balanced system the 'role' and 'preferred_role' will match for all segments. If they do not match, this indicates there may be a skew in the number of active primaries on each hardware host. To rebalance the segments and bring all the segments into their preferred role, the gprecoverseg command can be run with the "-r" option.
Additionally, there is another set of events that could cause a mirror to be marked as down. As data is written from a primary segment to a mirror segment, the primary segment will detect if it is not able to send the data to its mirror pair. The data is queued up and after the 'gp_segment_connect_timeout' seconds is passed, and the primary has not been able to send more data to the mirror, the primary will indicate a mirror failure and cause the mirror to be marked down and the primary to go into change tracking mode.