2

I have two postgresql 11.4 running as master and slave nodes.

I am inserting huge volume of data in master to see it get replicated on the slave. Trying to simulate the following case,

  • Insert huge data
  • pause_wal_replay on slave
  • wait for the wal files to get shipped to slave
  • resume_wal_replay on slave
  • promote immediately when there are multiple wal files waiting to be replayed

If a promote signal is issued at this point [ When there are multiple wal - already shipped and waiting to be replayed ], When will slave promote itself?

  1. After replaying all the existing wal files [ shipped and waiting to be replayed ] or

  2. Immediately after receiving promote signal. [ Without replaying the wal files waiting - causing data loss ? ]

If it is (1), what happens if the master node is still sending wal files and I try to promote the slave. Does it ignore the incoming wal and promote itself?

Hoping PG Experts can shed light on this.

PS : I'm issuing promote signal by creating a 'pg_failover_trigger' if its worth mentioning.

1 Answer 1

2

When it is promoted, the standby server shuts down the WAL receiver process and recovers all remaining WAL it has. So we get the behavior from 1.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.