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
055c352a
Commit
055c352a
authored
Jun 01, 2012
by
Simon Riggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
After any checkpoint, close all smgr files handles in bgwriter
parent
a297d64d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
0 deletions
+36
-0
src/backend/postmaster/bgwriter.c
src/backend/postmaster/bgwriter.c
+9
-0
src/backend/postmaster/checkpointer.c
src/backend/postmaster/checkpointer.c
+25
-0
src/include/postmaster/bgwriter.h
src/include/postmaster/bgwriter.h
+2
-0
No files found.
src/backend/postmaster/bgwriter.c
View file @
055c352a
...
...
@@ -276,6 +276,15 @@ BackgroundWriterMain(void)
*/
pgstat_send_bgwriter
();
if
(
FirstCallSinceLastCheckpoint
())
{
/*
* After any checkpoint, close all smgr files. This is so we
* won't hang onto smgr references to deleted files indefinitely.
*/
smgrcloseall
();
}
/*
* Sleep until we are signaled or BgWriterDelay has elapsed.
*
...
...
src/backend/postmaster/checkpointer.c
View file @
055c352a
...
...
@@ -1346,3 +1346,28 @@ UpdateSharedMemoryConfig(void)
elog
(
DEBUG2
,
"checkpointer updated shared memory configuration values"
);
}
/*
* FirstCallSinceLastCheckpoint allows a process to take an action once
* per checkpoint cycle by asynchronously checking for checkpoint completion.
*/
bool
FirstCallSinceLastCheckpoint
(
void
)
{
/* use volatile pointer to prevent code rearrangement */
volatile
CheckpointerShmemStruct
*
cps
=
CheckpointerShmem
;
static
int
ckpt_done
=
0
;
int
new_done
;
bool
FirstCall
=
false
;
SpinLockAcquire
(
&
cps
->
ckpt_lck
);
new_done
=
cps
->
ckpt_done
;
SpinLockRelease
(
&
cps
->
ckpt_lck
);
if
(
new_done
!=
ckpt_done
)
FirstCall
=
true
;
ckpt_done
=
new_done
;
return
FirstCall
;
}
src/include/postmaster/bgwriter.h
View file @
055c352a
...
...
@@ -38,4 +38,6 @@ extern void AbsorbFsyncRequests(void);
extern
Size
CheckpointerShmemSize
(
void
);
extern
void
CheckpointerShmemInit
(
void
);
extern
bool
FirstCallSinceLastCheckpoint
(
void
);
#endif
/* _BGWRITER_H */
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