mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Further work on connecting the free space map (which is still just a
stub) into the rest of the system. Adopt a cleaner approach to preventing deadlock in concurrent heap_updates: allow RelationGetBufferForTuple to select any page of the rel, and put the onus on it to lock both buffers in a consistent order. Remove no-longer-needed isExtend hack from API of ReleaseAndReadBuffer.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.50 2001/06/27 23:31:39 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.51 2001/06/29 21:08:24 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -437,7 +437,20 @@ smgrblindmarkdirty(int16 which,
|
||||
BlockNumber
|
||||
smgrnblocks(int16 which, Relation reln)
|
||||
{
|
||||
return (*(smgrsw[which].smgr_nblocks)) (reln);
|
||||
BlockNumber nblocks;
|
||||
|
||||
nblocks = (*(smgrsw[which].smgr_nblocks)) (reln);
|
||||
/*
|
||||
* NOTE: if a relation ever did grow to 2^32-1 blocks, this code would
|
||||
* fail --- but that's a good thing, because it would stop us from
|
||||
* extending the rel another block and having a block whose number
|
||||
* actually is InvalidBlockNumber.
|
||||
*/
|
||||
if (nblocks == InvalidBlockNumber)
|
||||
elog(ERROR, "cannot count blocks for %s: %m",
|
||||
RelationGetRelationName(reln));
|
||||
|
||||
return nblocks;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user