mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
Clean up the messy semantics (not to mention inefficiency) of PageGetTempPage
by splitting it into three functions with better-defined behaviors. Zdenek Kotala
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.152 2008/09/30 10:52:10 heikki Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.153 2008/11/03 20:47:48 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -343,7 +343,7 @@ gistplacetopage(GISTInsertState *state, GISTSTATE *giststate)
|
||||
* we must create temporary page to operate
|
||||
*/
|
||||
dist->buffer = state->stack->buffer;
|
||||
dist->page = PageGetTempPage(BufferGetPage(dist->buffer), sizeof(GISTPageOpaqueData));
|
||||
dist->page = PageGetTempPageCopySpecial(BufferGetPage(dist->buffer));
|
||||
|
||||
/* clean all flags except F_LEAF */
|
||||
GistPageGetOpaque(dist->page)->flags = (is_leaf) ? F_LEAF : 0;
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistvacuum.c,v 1.39 2008/10/31 15:04:59 heikki Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistvacuum.c,v 1.40 2008/11/03 20:47:48 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -144,18 +144,6 @@ gistDeleteSubtree(GistVacuum *gv, BlockNumber blkno)
|
||||
UnlockReleaseBuffer(buffer);
|
||||
}
|
||||
|
||||
static Page
|
||||
GistPageGetCopyPage(Page page)
|
||||
{
|
||||
Size pageSize = PageGetPageSize(page);
|
||||
Page tmppage;
|
||||
|
||||
tmppage = (Page) palloc(pageSize);
|
||||
memcpy(tmppage, page, pageSize);
|
||||
|
||||
return tmppage;
|
||||
}
|
||||
|
||||
static ArrayTuple
|
||||
vacuumSplitPage(GistVacuum *gv, Page tempPage, Buffer buffer, IndexTuple *addon, int curlenaddon)
|
||||
{
|
||||
@ -325,7 +313,7 @@ gistVacuumUpdate(GistVacuum *gv, BlockNumber blkno, bool needunion)
|
||||
addon = (IndexTuple *) palloc(sizeof(IndexTuple) * lenaddon);
|
||||
|
||||
/* get copy of page to work */
|
||||
tempPage = GistPageGetCopyPage(page);
|
||||
tempPage = PageGetTempPageCopy(page);
|
||||
|
||||
for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
|
||||
{
|
||||
|
Reference in New Issue
Block a user