aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/generic_xlog.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-04-12 11:42:06 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2016-04-12 11:42:06 -0400
commit5713f03973e26ad6df6df5ac8b9efa0123d68062 (patch)
treec526803a22b48a7f42cd383ec69a88f9a67e5bed /src/backend/access/transam/generic_xlog.c
parentbdf7db81921deb99fd9d489cbcc635906c89e215 (diff)
downloadpostgresql-5713f03973e26ad6df6df5ac8b9efa0123d68062.tar.gz
postgresql-5713f03973e26ad6df6df5ac8b9efa0123d68062.zip
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
Diffstat (limited to 'src/backend/access/transam/generic_xlog.c')
-rw-r--r--src/backend/access/transam/generic_xlog.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/backend/access/transam/generic_xlog.c b/src/backend/access/transam/generic_xlog.c
index e07bd836d2e..87a4861cddb 100644
--- a/src/backend/access/transam/generic_xlog.c
+++ b/src/backend/access/transam/generic_xlog.c
@@ -50,7 +50,7 @@
typedef struct
{
Buffer buffer; /* registered buffer */
- bool fullImage; /* are we taking a full image of this page? */
+ int flags; /* flags for this buffer */
int deltaLen; /* space consumed in delta field */
char image[BLCKSZ]; /* copy of page image for modification */
char delta[MAX_DELTA_SIZE]; /* delta between page images */
@@ -280,9 +280,11 @@ GenericXLogStart(Relation relation)
* is what the caller should modify.
*
* If the buffer is already registered, just return its existing entry.
+ * (It's not very clear what to do with the flags in such a case, but
+ * for now we stay with the original flags.)
*/
Page
-GenericXLogRegister(GenericXLogState *state, Buffer buffer, bool isNew)
+GenericXLogRegisterBuffer(GenericXLogState *state, Buffer buffer, int flags)
{
int block_id;
@@ -295,7 +297,7 @@ GenericXLogRegister(GenericXLogState *state, Buffer buffer, bool isNew)
{
/* Empty slot, so use it (there cannot be a match later) */
page->buffer = buffer;
- page->fullImage = isNew;
+ page->flags = flags;
memcpy(page->image,
BufferGetPage(buffer, NULL, NULL, BGP_NO_SNAPSHOT_TEST),
BLCKSZ);
@@ -347,7 +349,7 @@ GenericXLogFinish(GenericXLogState *state)
BGP_NO_SNAPSHOT_TEST);
pageHeader = (PageHeader) pageData->image;
- if (pageData->fullImage)
+ if (pageData->flags & GENERIC_XLOG_FULL_IMAGE)
{
/*
* A full-page image does not require us to supply any xlog