Re: AW: AW: AW: WAL-based allocation of XIDs is insecure

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: AW: AW: AW: WAL-based allocation of XIDs is insecure
Дата
Msg-id 6189.983897892@sss.pgh.pa.us
обсуждение исходный текст
Ответ на AW: AW: AW: WAL-based allocation of XIDs is insecure  (Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>)
Ответы Re: AW: AW: AW: WAL-based allocation of XIDs is insecure  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Zeugswetter Andreas SB  <ZeugswetterA@wien.spardat.at> writes:
> Is it so hard to swap ? First write page to log then modify in shmem. 
> Then those pages would have additional value, because
> then utilities could do all sorts of things with those pages.

After thinking about this a little, I believe I see why Vadim did it
the way he did.  Suppose we tried to make the code sequence be
obtain write lock on buffer;XLogOriginalPage(buffer);   // copy page to xlog if first since ckptmodify
buffer;XLogInsert(xlogentry for modification);mark buffer dirty and release write lock;
 

so that the saving of the original page is a separate xlog entry from
the modification data.  Looks easy, and it'd sure simplify XLogInsert
a lot.  The only problem is it's wrong.  What if a checkpoint occurs
between the two XLOG records?

The decision whether to log the whole buffer has to be atomic with the
actual entry of the xlog record.  Unless we want to hold the xlog insert
lock for the entire time that we're (eg) splitting a btree page, that
means we log the buffer after the modification work is done, not before.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Christof Petig
Дата:
Сообщение: Re: Query Planning time increased 3 times on 7.1 compared to 7.0.3
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: How to shoot yourself in the foot: kill -9 postmaster