Re: XLog size reductions: Reduced XLog record header size for PG17
От | Michael Paquier |
---|---|
Тема | Re: XLog size reductions: Reduced XLog record header size for PG17 |
Дата | |
Msg-id | ZQp90RaJDOcSqlSn@paquier.xyz обсуждение исходный текст |
Ответ на | Re: XLog size reductions: Reduced XLog record header size for PG17 (Matthias van de Meent <boekewurm+postgres@gmail.com>) |
Ответы |
Re: XLog size reductions: Reduced XLog record header size for PG17
|
Список | pgsql-hackers |
On Tue, Sep 19, 2023 at 12:07:07PM +0200, Matthias van de Meent wrote: > V5 is a rebased version of v4, and includes the latest patch from > "smaller XLRec block header" [0] as 0001. 0001 and 0007 are the meat of the changes. -#define XLR_CHECK_CONSISTENCY 0x02 +#define XLR_CHECK_CONSISTENCY (0x20) I can't help but notice that there are a few stylistic choices like this one that are part of the patch. Using parenthesis in the case of hexa values is inconsistent with the usual practices I've seen in the tree. #define COPY_HEADER_FIELD(_dst, _size) \ do { \ - if (remaining < _size) \ + if (remaining < (_size)) \ goto shortdata_err; \ There are a couple of stylistic changes like this one, that I guess could just use their own patch to make these macros easier to use. -#define XLogRecGetInfo(decoder) ((decoder)->record->header.xl_info) +#define XLogRecGetInfo(decoder) ((decoder)->record->header.xl_info & XLR_INFO_MASK) +#define XLogRecGetRmgrInfo(decoder) (((decoder)->record->header.xl_info) & XLR_RMGR_INFO_MASK) This stuff in 0002 is independent of 0001, am I right? Doing this split with an extra macro is okay by me, reducing the presence of XLR_INFO_MASK and bitwise operations based on it. 0003 is also mechanical, but if you begin to enforce the use of XLR_RMGR_INFO_MASK as the bits allowed to be passed down to the RMGR identity callback, we should have at least a validity check to make sure that nothing, even custom RMGRs, pass down unexpected bits? I am not convinced that XLOG_INCLUDE_XID is a good interface, TBH, and I fear that people are going to forget to set it. Wouldn't it be better to use an option where the XID is excluded instead, making the inclusing the an XID the default? > The resource manager has ID = 0, thus requiring some special > handling in other code. Apart from being generally useful, it is > used in future patches to detect the end of wal in lieu of a zero-ed > fixed-size xl_tot_len field. Err, no, that may not be true. See for example this thread where the topic of improving the checks of xl_tot_len and rely on this value on when a record header has been validated, even across page borders: https://www.postgresql.org/message-id/17928-aa92416a70ff44a2@postgresql.org Except that, in which cases could an invalid RMGR be useful? -- Michael
Вложения
В списке pgsql-hackers по дате отправления: