Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
5fb82eb4
Commit
5fb82eb4
authored
Sep 22, 1997
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Blowaway relation buffers from buffer pool before truncation:
+ BlowawayRelationBuffers(relation, blocknumber)
parent
708f67c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
1 deletion
+65
-1
src/backend/storage/buffer/bufmgr.c
src/backend/storage/buffer/bufmgr.c
+65
-1
No files found.
src/backend/storage/buffer/bufmgr.c
View file @
5fb82eb4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.2
5 1997/09/18 20:21:21 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.2
6 1997/09/22 07:13:56 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -99,6 +99,9 @@ static int FlushBuffer(Buffer buffer, bool release);
static
void
BufferSync
(
void
);
static
int
BufferReplace
(
BufferDesc
*
bufHdr
,
bool
bufferLockHeld
);
/* not static but used by vacuum only ... */
int
BlowawayRelationBuffers
(
Relation
rdesc
,
BlockNumber
block
);
/* ---------------------------------------------------
* RelationGetBufferWithBuffer
* see if the given buffer is what we want
...
...
@@ -1603,6 +1606,67 @@ BufferPoolBlowaway()
#endif
/* ---------------------------------------------------------------------
* BlowawayRelationBuffers
*
* This function blowaway all the pages with blocknumber >= passed
* of a relation in the buffer pool. Used by vacuum before truncation...
*
* Returns: 0 - Ok, -1 - DIRTY, -2 - PINNED
*
* XXX currently it sequentially searches the buffer pool, should be
* changed to more clever ways of searching.
* --------------------------------------------------------------------
*/
int
BlowawayRelationBuffers
(
Relation
rdesc
,
BlockNumber
block
)
{
register
int
i
;
BufferDesc
*
buf
;
if
(
rdesc
->
rd_islocal
)
{
for
(
i
=
0
;
i
<
NLocBuffer
;
i
++
)
{
buf
=
&
LocalBufferDescriptors
[
i
];
if
(
buf
->
tag
.
relId
.
relId
==
rdesc
->
rd_id
&&
buf
->
tag
.
blockNum
>=
block
)
{
if
(
buf
->
flags
&
BM_DIRTY
)
return
(
-
1
);
if
(
LocalRefCount
[
i
]
>
0
)
return
(
-
2
);
buf
->
tag
.
relId
.
relId
=
InvalidOid
;
}
}
return
(
0
);
}
SpinAcquire
(
BufMgrLock
);
for
(
i
=
0
;
i
<
NBuffers
;
i
++
)
{
buf
=
&
BufferDescriptors
[
i
];
if
(
buf
->
tag
.
relId
.
dbId
==
MyDatabaseId
&&
buf
->
tag
.
relId
.
relId
==
rdesc
->
rd_id
&&
buf
->
tag
.
blockNum
>=
block
)
{
if
(
buf
->
flags
&
BM_DIRTY
)
{
SpinRelease
(
BufMgrLock
);
return
(
-
1
);
}
if
(
!
(
buf
->
flags
&
BM_FREE
))
{
SpinRelease
(
BufMgrLock
);
return
(
-
2
);
}
BufTableDelete
(
buf
);
}
}
SpinRelease
(
BufMgrLock
);
return
(
0
);
}
#undef IncrBufferRefCount
#undef ReleaseBuffer
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment