On Wed, Sep 14, 2016 at 11:31 AM, Michael Paquier <michael.paqu...@gmail.com> wrote: > On Wed, Sep 14, 2016 at 2:56 PM, Kuntal Ghosh > <kuntalghosh.2...@gmail.com> wrote: >> Master >> --------------- >> - If wal_consistency check is enabled or needs_backup is set in >> XLogRecordAssemble(), we do a fpw. >> - If a fpw is to be done, then fork_flags is set with BKPBLOCK_HAS_IMAGE, >> which in turns set has_image flag while decoding the record. >> - If a fpw needs to be restored during redo, i.e., needs_backup is true, >> then bimg_info is set with BKPIMAGE_IS_REQUIRED_FOR_REDO. > > Here that should be if wal_consistency is true, no? Nope. I'll try to explain using some pseudo-code: XLogRecordAssemble() { .... include_image = needs_backup || wal_consistency[rmid]; if (include_image) { .... set XLogRecordBlockHeader.fork_flags |= BKPBLOCK_HAS_IMAGE; if (needs_backup) set XLogRecordBlockImageHeader.bimg_info |= BKPIMAGE_IS_REQUIRED_FOR_REDO; .... } ..... }
XLogReadBufferForRedoExtended() { ...... if (XLogRecHasBlockImage() && XLogRecHasBlockImageForRedo()) { RestoreBlockImage(); .... return BLK_RESTORED; } ...... } checkConsistency() { .... if (wal_consistency[rmid] && !XLogRecHasBlockImage()) throw error; ..... } *XLogRecHasBlockImageForRedo() checks whether bimg_info is set with BKPIMAGE_IS_REQUIRED_FOR_REDO. For a backup image any of the followings is possible: 1. consistency should be checked. 2. page should restored. 3. both 1 and 2. Consistency check can be controlled by a guc parameter. But, standby should be conveyed whether an image should be restored. For that, we have used the new flag. Suggestions? -- Thanks & Regards, Kuntal Ghosh EnterpriseDB: http://www.enterprisedb.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers