Re: Switching timeline over streaming replication - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Switching timeline over streaming replication
Date
Msg-id 50D30851.2030509@vmware.com
Whole thread Raw
In response to Re: Switching timeline over streaming replication  (Thom Brown <thom@linux.com>)
Responses Re: Switching timeline over streaming replication  (Andres Freund <andres@2ndquadrant.com>)
Re: Switching timeline over streaming replication  (Joshua Berkus <josh@agliodbs.com>)
Re: Switching timeline over streaming replication  (Thom Brown <thom@linux.com>)
List pgsql-hackers
On 17.12.2012 15:05, Thom Brown wrote:
> I just set up 120 chained standbys, and for some reason I'm seeing these
> errors:
>
> LOG:  replication terminated by primary server
> DETAIL:  End of WAL reached on timeline 1
> LOG:  record with zero length at 0/301EC10
> LOG:  fetching timeline history file for timeline 2 from primary server
> LOG:  restarted WAL streaming at 0/3000000 on timeline 1
> LOG:  replication terminated by primary server
> DETAIL:  End of WAL reached on timeline 1
> LOG:  new target timeline is 2
> LOG:  restarted WAL streaming at 0/3000000 on timeline 2
> LOG:  replication terminated by primary server
> DETAIL:  End of WAL reached on timeline 2
> FATAL:  error reading result of streaming command: ERROR:  requested WAL
> segment 000000020000000000000003 has already been removed
>
> ERROR:  requested WAL segment 000000020000000000000003 has already been
> removed
> LOG:  started streaming WAL from primary at 0/3000000 on timeline 2
> ERROR:  requested WAL segment 000000020000000000000003 has already been
> removed

I just committed a patch that should make the "requested WAL segment 
000000020000000000000003 has already been removed" errors go away. The 
trick was for walsenders to not switch to the new timeline until at 
least one record has been replayed on it. That closes the window where 
the walsender already considers the new timeline to be the latest, but 
the WAL file has not been created yet.

- Heikki



pgsql-hackers by date:

Previous
From: "P. Christeas"
Date:
Subject: Re: pg_top
Next
From: "Brett Maton"
Date:
Subject: Re: pg_top