Re: WIP: Access method extendability - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: WIP: Access method extendability
Date
Msg-id CAPpHfdu=EYSo=jzzN+dOWHhekhJbbyMKLETYby_RFwBe9q6dTQ@mail.gmail.com
Whole thread Raw
In response to Re: WIP: Access method extendability  (Alexander Korotkov <aekorotkov@gmail.com>)
Responses Re: WIP: Access method extendability
List pgsql-hackers
Hackers,

there is next revision of patches providing access method extendability.
Now it's based on another patch which reworks access method interface.
http://www.postgresql.org/message-id/CAPpHfdsXwZmojm6Dx+TJnpYk27kT4o7Ri6X_4OSWcByu1Rm+VA@mail.gmail.com

Besides access method interface, major change is generic xlog interface. Now, generic xlog interface is more user friendly. Generic xlog compares initial and changed versions of page by itself. The only thing it can't do is to find data moves inside page, because it would be too high overhead. So in order to get compact WAL records one should use GenericXLogMemmove(dst, src, size) in order to move data inside page. If this function wasn't used then WAL records would just not so compact.

In general pattern of generic WAL usage is following.

1) Start using generic WAL: specify relation

GenericXLogStart(index);

2) Register buffers

GenericXLogRegister(0, buffer1, false);
GenericXLogRegister(1, buffer2, true);

first argument is a slot number, second is the buffer, third is flag indicating new buffer

3) Do changes in the pages. Use GenericXLogMemmove() if needed.

4) Finish using GenericXLogFinish(), or abort using GenericXLogAbort(). In the case of abort initial state of pages will be reverted.

Generic xlog takes care about critical section, unlogged relation, setting lsn, making buffer dirty. User code is just simple and clear.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: pg_upgrade + Extensions
Next
From: Alvaro Herrera
Date:
Subject: On columnar storage (2)