Re: WAL consistency check facility
От | Kuntal Ghosh |
---|---|
Тема | Re: WAL consistency check facility |
Дата | |
Msg-id | CAGz5QCKuyr98du3Nnbu97xpQNuXmQpAGawg3YWNb+PV0xz5Ltw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: WAL consistency check facility (Michael Paquier <michael.paquier@gmail.com>) |
Ответы |
Re: WAL consistency check facility
|
Список | pgsql-hackers |
On Wed, Sep 14, 2016 at 11:31 AM, Michael Paquier <michael.paquier@gmail.com> wrote: > On Wed, Sep 14, 2016 at 2:56 PM, Kuntal Ghosh > <kuntalghosh.2007@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 withBKPIMAGE_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
В списке pgsql-hackers по дате отправления: