You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by av...@apache.org on 2025/01/23 09:04:58 UTC
(cloudberry) 06/26: Fix AO table fsync memory leak.
This is an automated email from the ASF dual-hosted git repository.
avamingli pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 9e40ae0d354877f034c15d881023a4b7396abbd1
Author: dreamedcheng <dr...@gmail.com>
AuthorDate: Tue Dec 26 21:06:42 2023 +0800
Fix AO table fsync memory leak.
AO table has its own fsync function `aosyncfiletag`, but it didn't call
`FileClose` at the end, which will cause mirror segment's checkpointer
process memory leak.
---
src/backend/storage/smgr/md.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index c523bdde99..7b8dc1a345 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -1479,6 +1479,8 @@ aosyncfiletag(const FileTag *ftag, char *path)
{
SMgrRelation reln = smgropen(ftag->rnode, InvalidBackendId, 1, NULL);
char *p;
+ int result,
+ save_errno;
/* Provide the path for informational messages. */
p = _mdfd_segpath(reln, ftag->forknum, ftag->segno);
@@ -1490,7 +1492,13 @@ aosyncfiletag(const FileTag *ftag, char *path)
elog(ERROR, "could not open file %s: %m", path);
/* Try to fsync the file. */
- return FileSync(fd, WAIT_EVENT_DATA_FILE_SYNC);
+ result = FileSync(fd, WAIT_EVENT_DATA_FILE_SYNC);
+ save_errno = errno;
+
+ FileClose(fd);
+
+ errno = save_errno;
+ return result;
}
/*
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org