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
634b38aa
Commit
634b38aa
authored
Dec 27, 1996
by
Bryan Henderson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add asserts to check for file descriptor ring corruption.
parent
4a5135c3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
293 additions
and
285 deletions
+293
-285
src/backend/storage/file/fd.c
src/backend/storage/file/fd.c
+293
-285
No files found.
src/backend/storage/file/fd.c
View file @
634b38aa
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Id: fd.c,v 1.1
0 1996/12/04 03:05:58
bryanh Exp $
* $Id: fd.c,v 1.1
1 1996/12/27 22:57:51
bryanh Exp $
*
*
* NOTES:
* NOTES:
*
*
...
@@ -169,7 +169,9 @@ static char Sep_char = '\\';
...
@@ -169,7 +169,9 @@ static char Sep_char = '\\';
* AssertLruRoom - make sure that there is a free fd.
* AssertLruRoom - make sure that there is a free fd.
*
*
* the Last Recently Used ring is a doubly linked list that begins and
* the Last Recently Used ring is a doubly linked list that begins and
* ends on element zero.
* ends on element zero. Element zero is special -- it doesn't represent
* a file and its "fd" field always == VFD_CLOSED. Element zero is just an
* anchor that shows us the beginning/end of the ring.
*
*
* example:
* example:
*
*
...
@@ -373,6 +375,10 @@ AssertLruRoom()
...
@@ -373,6 +375,10 @@ AssertLruRoom()
FreeFd
));
FreeFd
));
if
(
FreeFd
<=
0
||
nfile
>=
MAXFILES
)
{
if
(
FreeFd
<=
0
||
nfile
>=
MAXFILES
)
{
/* We supposedly are using more vfds than we want to be. First
assert that there is at least one used vfd in the ring.
*/
Assert
(
VfdCache
[
0
].
lruMoreRecently
!
0
);
LruDelete
(
VfdCache
[
0
].
lruMoreRecently
);
LruDelete
(
VfdCache
[
0
].
lruMoreRecently
);
}
}
}
}
...
@@ -521,6 +527,7 @@ FileAccess(File file)
...
@@ -521,6 +527,7 @@ FileAccess(File file)
void
void
FileInvalidate
(
File
file
)
FileInvalidate
(
File
file
)
{
{
Assert
(
file
>
0
);
if
(
!
FileIsNotOpen
(
file
))
{
if
(
!
FileIsNotOpen
(
file
))
{
LruDelete
(
file
);
LruDelete
(
file
);
}
}
...
@@ -879,7 +886,8 @@ void
...
@@ -879,7 +886,8 @@ void
closeAllVfds
()
closeAllVfds
()
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
SizeVfdCache
;
i
++
)
{
Assert
(
FileIsNotOpen
(
0
));
/* Make sure ring not corrupted */
for
(
i
=
1
;
i
<
SizeVfdCache
;
i
++
)
{
if
(
!
FileIsNotOpen
(
i
))
if
(
!
FileIsNotOpen
(
i
))
LruDelete
(
i
);
LruDelete
(
i
);
}
}
...
...
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