mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Refactor some repetitive SLRU code
Functions to bootstrap and zero pages in various SLRU callers were fairly duplicative. We can slash almost two hundred lines with a couple of simple helpers: - SimpleLruZeroAndWritePage: Does the equivalent of SimpleLruZeroPage followed by flushing the page to disk - XLogSimpleInsertInt64: Does a XLogBeginInsert followed by XLogInsert of a trivial record whose data is just an int64. Author: Evgeny Voropaev <evgeny.voropaev@tantorlabs.com> Reviewed by: Álvaro Herrera <alvherre@kurilemu.de> Reviewed by: Andrey Borodin <x4mmm@yandex-team.ru> Reviewed by: Aleksander Alekseev <aleksander@timescale.com> Discussion: https://www.postgresql.org/message-id/flat/97820ce8-a1cd-407f-a02b-47368fadb14b%40tantorlabs.com
This commit is contained in:
@@ -187,6 +187,7 @@ extern void SimpleLruInit(SlruCtl ctl, const char *name, int nslots, int nlsns,
|
||||
int bank_tranche_id, SyncRequestHandler sync_handler,
|
||||
bool long_segment_names);
|
||||
extern int SimpleLruZeroPage(SlruCtl ctl, int64 pageno);
|
||||
extern void SimpleLruZeroAndWritePage(SlruCtl ctl, int64 pageno);
|
||||
extern int SimpleLruReadPage(SlruCtl ctl, int64 pageno, bool write_ok,
|
||||
TransactionId xid);
|
||||
extern int SimpleLruReadPage_ReadOnly(SlruCtl ctl, int64 pageno,
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
extern void XLogBeginInsert(void);
|
||||
extern void XLogSetRecordFlags(uint8 flags);
|
||||
extern XLogRecPtr XLogInsert(RmgrId rmid, uint8 info);
|
||||
extern XLogRecPtr XLogSimpleInsertInt64(RmgrId rmid, uint8 info, int64 value);
|
||||
extern void XLogEnsureRecordSpace(int max_block_id, int ndatas);
|
||||
extern void XLogRegisterData(const void *data, uint32 len);
|
||||
extern void XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags);
|
||||
|
||||
Reference in New Issue
Block a user