Thanks for your response. >>There are two lag types to consider about in case of a normal >>streaming replication - delivery lag and replay lag. The secondary >>will completely catch up to what have been delivered, but what have >>not been is going to be lost. See [1][2].
Ok, I understand. I want to understand exact sequence of events that will happen. Lets say I have specified the following in my recovery.conf trigger_file =/tmp/pgsql.failover I detect that the master has failed and immediately I do the following on the standby touch /tmp/pgsql.failover Lets suppose at this point there is 0 delivery lag but XXXX bytes of replay lag. a) Will the replay complete before the standby stops replicating (because it sees the trigger file) ? b) If I want to run this as new master and attach other secondaries to point to this master, can I do it soon after "touch /tmp/pgsql.failover" OR should I wait till the secondary has finished replaying all the delivered stream ? c) How do I know if the replay is over and it is ready for a standalone operation ? Thanks for your help Anupama.