From 5713f03973e26ad6df6df5ac8b9efa0123d68062 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 12 Apr 2016 11:42:06 -0400 Subject: Improve API of GenericXLogRegister(). Rename this function to GenericXLogRegisterBuffer() to make it clearer what it does, and leave room for other sorts of "register" actions in future. Also, replace its "bool isNew" argument with an integer flags argument, so as to allow adding more flags in future without an API break. Alexander Korotkov, adjusted slightly by me --- doc/src/sgml/generic-wal.sgml | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/generic-wal.sgml b/doc/src/sgml/generic-wal.sgml index 2398d860037..147d456d34c 100644 --- a/doc/src/sgml/generic-wal.sgml +++ b/doc/src/sgml/generic-wal.sgml @@ -31,15 +31,18 @@ - page = GenericXLogRegister(state, buffer, isNew) — - register a buffer to be modified within the current generic WAL + page = GenericXLogRegisterBuffer(state, buffer, flags) + — register a buffer to be modified within the current generic WAL record. This function returns a pointer to a temporary copy of the buffer's page, where modifications should be made. (Do not modify the - buffer's contents directly.) The third argument indicates if the page - is new; if true, this will result in a full-page image rather than a - delta update being included in the WAL record. - GenericXLogRegister can be repeated if the WAL-logged - action needs to modify multiple pages. + buffer's contents directly.) The third argument is a bitmask of flags + applicable to the operation. Currently the only such flag is + GENERIC_XLOG_FULL_IMAGE, which indicates that a full-page + image rather than a delta update should be included in the WAL record. + Typically this flag would be set if the page is new or has been + rewritten completely. + GenericXLogRegisterBuffer can be repeated if the + WAL-logged action needs to modify multiple pages. @@ -71,13 +74,13 @@ - No direct modifications of buffers are allowed! All modifications - must be done in copies acquired from GenericXLogRegister(). + No direct modifications of buffers are allowed! All modifications must + be done in copies acquired from GenericXLogRegisterBuffer(). In other words, code that makes generic WAL records should never call BufferGetPage() for itself. However, it remains the caller's responsibility to pin/unpin and lock/unlock the buffers at appropriate times. Exclusive lock must be held on each target buffer - from before GenericXLogRegister() until after + from before GenericXLogRegisterBuffer() until after GenericXLogFinish(). @@ -145,10 +148,11 @@ - If a registered buffer is not new, the generic WAL record contains - a delta between the old and the new page images. This delta is based - on byte-by-byte comparison. This is not very compact for the case of - moving data within a page, and might be improved in the future. + If GENERIC_XLOG_FULL_IMAGE is not specified for a + registered buffer, the generic WAL record contains a delta between + the old and the new page images. This delta is based on byte-by-byte + comparison. This is not very compact for the case of moving data + within a page, and might be improved in the future. -- cgit v1.2.3