Thread: BUG #6037: error on restarting slave - cp: cannot stat `pg_xlog....`: no such file or ...

The following bug has been logged online:

Bug reference:      6037
Logged by:          manish singh
Email address:      delhi.manish@gmail.com
PostgreSQL version: 9.0.3
Operating system:   CentOS release 5.3 (Final)  -  2.6.18-128.el5xen
Description:        error on restarting slave - cp: cannot stat
`pg_xlog....`: no such file or ...
Details:

Hello

I am having a problem with all slaves...i am not sure it's a bug or my side
configuration problem..

When ever i am restarting postgresql slave  (Service postgresql restart -
made a script) or even just stopping and starting a postgresql slave.. it
displays a a message, although slave get's started and working fine...

server starting
cp: cannot stat
`/usr/local/pgsql/data/pg_xlogarch/000000010000000300000026': No such file
or directory
cp: cannot stat
`/usr/local/postgres/data/pg_xlogarch/000000010000000300000026': No such
file or directory


May 24 20:55:34 db-slave2 postgres[25223]: [2-1] LOG:  received fast
shutdown request
May 24 20:55:34 db-slave2 postgres[25223]: [3-1] LOG:  aborting any active
transactions
May 24 20:55:34 db-slave2 postgres[25229]: [3-1] FATAL:  terminating
walreceiver process due to administrator command
May 24 20:55:34 db-slave2 postgres[25226]: [1-1] LOG:  shutting down
May 24 20:55:35 db-slave2 postgres[25226]: [2-1] LOG:  database system is
shut down


May 24 20:55:36 db-slave2 postgres[26769]: [1-1] LOG:  database system was
shut down in recovery at 2011-05-24 20:55:35 IST
May 24 20:55:36 db-slave2 postgres[26769]: [2-1] LOG:  entering standby
mode
May 24 20:55:36 db-slave2 postgres[26769]: [3-1] LOG:  consistent recovery
state reached at 3/2628F3F0
May 24 20:55:36 db-slave2 postgres[26769]: [4-1] LOG:  redo starts at
3/2628F360
May 24 20:55:36 db-slave2 postgres[26769]: [5-1] LOG:  invalid record length
at 3/2628F3F0
May 24 20:55:36 db-slave2 postgres[26768]: [1-1] LOG:  database system is
ready to accept read only connections
May 24 20:55:36 db-slave2 postgres[26774]: [2-1] LOG:  streaming replication
successfully connected to primary

Pl. give any solution for this.

Postgresql Ver. 9.0.3
OS: CentOS release 5.3 (Final)
Kernel: 2.6.18-128.el5xen


pg_controldata
pg_control version number:            903
Catalog version number:               201008051
Database system identifier:           5572911747953590263
Database cluster state:               in archive recovery
pg_control last modified:             Tue 24 May 2011 08:55:36 PM IST
Latest checkpoint location:           3/2628F398
Prior checkpoint location:            3/2628F398
Latest checkpoint's REDO location:    3/2628F360
Latest checkpoint's TimeLineID:       1
Latest checkpoint's NextXID:          0/1102911
Latest checkpoint's NextOID:          1346139
Latest checkpoint's NextMultiXactId:  2
Latest checkpoint's NextMultiOffset:  3
Latest checkpoint's oldestXID:        654
Latest checkpoint's oldestXID's DB:   1
Latest checkpoint's oldestActiveXID:  1102911
Time of latest checkpoint:            Tue 24 May 2011 08:53:52 PM IST
Minimum recovery ending location:     3/2628F3F0
Backup start location:                0/0
Current wal_level setting:            hot_standby
Current max_connections setting:      5000
Current max_prepared_xacts setting:   0
Current max_locks_per_xact setting:   64
Maximum data alignment:               8
Database block size:                  8192
Blocks per segment of large relation: 131072
WAL block size:                       8192
Bytes per WAL segment:                16777216
Maximum length of identifiers:        64
Maximum columns in an index:          32
Maximum size of a TOAST chunk:        1996
Date/time type storage:               64-bit integers
Float4 argument passing:              by value
Float8 argument passing:              by value

Regards
Manish Singh
On 24.05.2011 18:27, manish singh wrote:
> When ever i am restarting postgresql slave  (Service postgresql restart -
> made a script) or even just stopping and starting a postgresql slave.. it
> displays a a message, although slave get's started and working fine...
>
> server starting
> cp: cannot stat
> `/usr/local/pgsql/data/pg_xlogarch/000000010000000300000026': No such file
> or directory
> cp: cannot stat
> `/usr/local/postgres/data/pg_xlogarch/000000010000000300000026': No such
> file or directory

The standby server periodically checks if new WAL has arrived by
executing the restore_command. Your restore_command uses 'cp', which
prints out that message if the target file can't be found.

In other words, your system seems to be working correctly, and those
messages are harmless. You could silence it by replacing plain 'cp' with
a shell script that checks if the file exists first and calls 'cp' only
if it does.

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com