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:
@ -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.
|
||||
|
Reference in New Issue
Block a user