Re: [HACKERS] Small code improvement for btree
От | Alvaro Herrera |
---|---|
Тема | Re: [HACKERS] Small code improvement for btree |
Дата | |
Msg-id | 20170804181233.lohknf2tqsdlz5fg@alvherre.pgsql обсуждение исходный текст |
Ответ на | [HACKERS] Small code improvement for btree (Masahiko Sawada <sawada.mshk@gmail.com>) |
Ответы |
Re: [HACKERS] Small code improvement for btree
|
Список | pgsql-hackers |
Masahiko Sawada wrote: > While hacking the btree code I found two points we can improve in nbtxlog.c. > > @@ -135,7 +135,7 @@ _bt_clear_incomplete_split(XLogReaderState > *record, uint8 block_id) > Page page = (Page) BufferGetPage(buf); > BTPageOpaque pageop = (BTPageOpaque) > PageGetSpecialPointer(page); > > - Assert((pageop->btpo_flags & BTP_INCOMPLETE_SPLIT) != 0); > + Assert(P_INCOMPLETE_SPLIT(pageop) != 0); > pageop->btpo_flags &= ~BTP_INCOMPLETE_SPLIT; Interesting. We learned elsewhere that it's better to integrate the "!= 0" test as part of the macro definition; so a better formulation of this patch would be to change the P_INCOMPLETE_SPLIT macro and omit the comparison in the Assert. (See commit 594e61a1de03 for an example). > - LockBuffer(hbuffer, BUFFER_LOCK_SHARE); > + LockBuffer(hbuffer, BT_READ); I think BT_READ and BT_WRITE are useless, and I'd rather get rid of them ... -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
В списке pgsql-hackers по дате отправления: