Re: Online base backup from the hot-standby
От | Fujii Masao |
---|---|
Тема | Re: Online base backup from the hot-standby |
Дата | |
Msg-id | CAHGQGwHuEMqKviTxuyS1FEouDN3qyS+dseoMAuxFTnEz-Wgb6g@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Online base backup from the hot-standby (Magnus Hagander <magnus@hagander.net>) |
Ответы |
Re: Online base backup from the hot-standby
|
Список | pgsql-hackers |
On Wed, Sep 21, 2011 at 5:34 PM, Magnus Hagander <magnus@hagander.net> wrote: > On Wed, Sep 21, 2011 at 08:23, Fujii Masao <masao.fujii@gmail.com> wrote: >> On Wed, Sep 21, 2011 at 2:13 PM, Magnus Hagander <magnus@hagander.net> wrote: >>> Presumably pg_start_backup() will check this. And we'll somehow track >>> this before pg_stop_backup() as well? (for such evil things such as >>> the user changing FPW from on to off and then back to on again during >>> a backup, will will make it look correct both during start and stop, >>> but incorrect in the middle - pg_stop_backup needs to fail in that >>> case as well) >> >> Right. As I suggested upthread, to address that problem, we need to log >> the change of FPW on the master, and then we need to check whether >> such a WAL is replayed on the standby during the backup. If it's done, >> pg_stop_backup() should emit an error. > > I somehow missed this thread completely, so I didn't catch your > previous comments - oops, sorry. The important point being that we > need to track if when this happens even if it has been reset to a > valid value. So we can't just check the state of the variable at the > beginning and at the end. Right. Let me explain again what I'm thinking. When FPW is changed, the master always writes the WAL record which contains the current value of FPW. This means that the standby can track all changes of FPW by reading WAL records. The standby has two flags: One indicates whether FPW has always been TRUE since last restartpoint. Another indicates whether FPW has always been TRUE since last pg_start_backup(). The standby can maintain those flags by reading WAL records streamed from the master. If the former flag indicates FALSE (i.e., the WAL records which the standby has replayed since last restartpoint might not contain required FPW), pg_start_backup() fails. If the latter flag indicates FALSE (i.e., the WAL records which the standby has replayed during the backup might not contain required FPW), pg_stop_backup() fails. If I'm not missing something, this approach can address the problem which you're concerned about. Regards, -- Fujii Masao NIPPON TELEGRAPH AND TELEPHONE CORPORATION NTT Open Source Software Center
В списке pgsql-hackers по дате отправления: