Обсуждение: BUG #17684: pg_rewind ---could not receive data from WAL stream: ERROR: requested WAL segment 00000005000000000

Поиск
Список
Период
Сортировка

BUG #17684: pg_rewind ---could not receive data from WAL stream: ERROR: requested WAL segment 00000005000000000

От
PG Bug reporting form
Дата:
The following bug has been logged on the website:

Bug reference:      17684
Logged by:          强 魏
Email address:      1726002692@qq.com
PostgreSQL version: 14.6
Operating system:   centos 7.6
Description:

Master:192.168.247.110
Standby:192.168.247.100
Faiover On Standby:pg_ctl  promote

On the host 192.168.247.110 :
pg_ctl stop -$PGDATA
pg_rewind --target-pgdata=$PGDATA --source-server='host=192.168.247.100
port=5432 user=postgres password=pass dbname=postgres' -R 
pg_ctl start -D $PGDATA

but ,the  pg instance not started
error log:could not receive data from WAL stream: ERROR:  requested WAL
segment 000000050000000000000029 has already been removed

On the host 192.168.247.100:
ls -l $PGDATA/pg_wal
-rw------- 1 pg14 pg14      126 11月 11 18:02 00000004.history
-rw------- 1 pg14 pg14 16777216 11月 11 18:20 000000050000000000000046
-rw------- 1 pg14 pg14 16777216 11月 11 18:05 000000050000000000000047
-rw------- 1 pg14 pg14 16777216 11月 11 18:05 000000050000000000000048
-rw------- 1 pg14 pg14 16777216 11月 11 18:06 000000050000000000000049
-rw------- 1 pg14 pg14 16777216 11月 11 18:06 00000005000000000000004A
-rw------- 1 pg14 pg14 16777216 11月 11 18:06 00000005000000000000004B
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 00000005000000000000004C
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 00000005000000000000004D
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 00000005000000000000004E
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 00000005000000000000004F
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000050
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000051
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000052
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000053
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000054
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000055
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000056
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000057
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000058
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000059
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 00000005000000000000005A
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 00000005000000000000005B
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 00000005000000000000005C
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 00000005000000000000005D
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 00000005000000000000005E
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 00000005000000000000005F
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000060
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000061
-rw------- 1 pg14 pg14      169 11月 11 18:05 00000005.history


the archivelog director:ll -h /pgdata/archivelog/pg14/
-rw------- 1 pg14 pg14 16777216 11月 11 18:05 000000040000000000000029
-rw------- 1 pg14 pg14 16777216 11月 11 18:05
00000004000000000000002C.partial
-rw------- 1 pg14 pg14 16777216 11月 11 18:05 00000005000000000000002C
-rw------- 1 pg14 pg14 16777216 11月 11 18:06 00000005000000000000002D
-rw------- 1 pg14 pg14 16777216 11月 11 18:06 00000005000000000000002E
-rw------- 1 pg14 pg14 16777216 11月 11 18:06 00000005000000000000002F
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000030
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000031
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000032
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000033
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000034
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000035
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000036
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000037
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000038
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000039
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 00000005000000000000003A
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 00000005000000000000003B
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 00000005000000000000003C
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 00000005000000000000003D
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 00000005000000000000003E
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 00000005000000000000003F
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000040
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000041
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000042
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000043
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000044
-rw------- 1 pg14 pg14 16777216 11月 11 18:07 000000050000000000000045
-rw------- 1 pg14 pg14      169 11月 11 18:05 00000005.history


however,this file(000000050000000000000029) is missing。


At Fri, 11 Nov 2022 10:51:20 +0000, PG Bug reporting form <noreply@postgresql.org> wrote in 
> Master:192.168.247.110
> Standby:192.168.247.100
> Faiover On Standby:pg_ctl  promote
> 
> On the host 192.168.247.110 :
> pg_ctl stop -$PGDATA
> pg_rewind --target-pgdata=$PGDATA --source-server='host=192.168.247.100
> port=5432 user=postgres password=pass dbname=postgres' -R 
> pg_ctl start -D $PGDATA
> 
> but ,the  pg instance not started
> error log:could not receive data from WAL stream: ERROR:  requested WAL
> segment 000000050000000000000029 has already been removed

This report does not have enough information, but it seems like
related to [1]. Namely, pg_rewind removes WAL files in the target that
the source server does not have in pg_wal directory even though some
of the files are required at the first startup. That behavior is not a
bug itself (designed behavior) but could be annoying in some use
cases.

If I'm right, [1] would resolve your trouble.  For the mement, using
primary's archive at the first startup of the standby would be a work
around.

[1] https://www.postgresql.org/message-id/CAAtGL4CM7hA0G4dS-Z_RckMy%2Bpzz_KGV2b%3D8ivDPTgaU4nySGg%40mail.gmail.com

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center