1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-23 14:01:44 +03:00

Get rid of GenericXLogUnregister().

This routine is unsafe as implemented, because it invalidates the page
image pointers returned by previous GenericXLogRegister() calls.

Rather than complicate the API or the implementation to avoid that,
let's just get rid of it; the use-case for having it seems much
too thin to justify a lot of work here.

While at it, do some wordsmithing on the SGML docs for generic WAL.
This commit is contained in:
Tom Lane
2016-04-09 16:39:30 -04:00
parent 80cf18910c
commit 08e785436f
3 changed files with 71 additions and 86 deletions

View File

@ -257,35 +257,6 @@ GenericXLogRegister(GenericXLogState *state, Buffer buffer, bool isNew)
return NULL;
}
/*
* Unregister particular buffer for generic xlog record.
*
* XXX this is dangerous and should go away.
*/
void
GenericXLogUnregister(GenericXLogState *state, Buffer buffer)
{
int block_id;
/* Find block in array to unregister */
for (block_id = 0; block_id < MAX_GENERIC_XLOG_PAGES; block_id++)
{
if (state->pages[block_id].buffer == buffer)
{
/*
* Preserve order of pages in array because it could matter for
* concurrency.
*/
memmove(&state->pages[block_id], &state->pages[block_id + 1],
(MAX_GENERIC_XLOG_PAGES - block_id - 1) * sizeof(PageData));
state->pages[MAX_GENERIC_XLOG_PAGES - 1].buffer = InvalidBuffer;
return;
}
}
elog(ERROR, "registered generic xlog buffer not found");
}
/*
* Apply changes represented by GenericXLogState to the actual buffers,
* and emit a generic xlog record.