xlogrecovery.c: @@ -3460,8 +3490,10 @@ retry: * responsible for the validation. */ if (StandbyMode && + targetPagePtr % 0x100000 == 0 && !XLogReaderValidatePageHeader(xlogreader, targetPagePtr, readBuf)) {
Hmm, I think you meant to use wal_segment_size, because 0x100000 is just 1MB. As a result, currently it works for you by accident.
Thus, I managed to reproduce precisely the same situation as you described utilizing your script with modifications and some core tweaks, and with the change above, I saw that the behavior was fixed. However, for reasons unclear to me, it shows another issue, and I am running out of time and need more caffeine. I'll continue investigating this tomorrow.