This is an automated email from the ASF dual-hosted git repository.
reshke pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
The following commit(s) were added to refs/heads/main by this push:
new 1a5641bbb86 Fix extnesible SMGR API violation in
register_dirty_segment_ao (#1918)
1a5641bbb86 is described below
commit 1a5641bbb86a99ccecc44ca921bab81d3cf39f1d
Author: reshke <[email protected]>
AuthorDate: Mon Aug 24 14:37:09 2026 +0500
Fix extnesible SMGR API violation in register_dirty_segment_ao (#1918)
$subj, in CBDB we allow extension to hijack all SMGR calls via
interface, but register_dirty_segment_ao didn't follow the memo.
Exntension that need this is Yezzey
---
src/backend/cdb/cdbappendonlyxlog.c | 2 +-
src/backend/storage/smgr/md.c | 4 ++--
src/include/access/aomd.h | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/backend/cdb/cdbappendonlyxlog.c
b/src/backend/cdb/cdbappendonlyxlog.c
index 6f13de288f9..bb19dcb436f 100644
--- a/src/backend/cdb/cdbappendonlyxlog.c
+++ b/src/backend/cdb/cdbappendonlyxlog.c
@@ -109,7 +109,7 @@ ao_insert_replay(XLogReaderState *record)
register_dirty_segment_ao(xlrec->target.node,
xlrec->target.segment_filenum,
- file);
+ file, smgr->smgr_ao);
smgr->smgr_ao->smgr_FileClose(file);
}
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index e00e3c5172d..9b133d91372 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -1256,7 +1256,7 @@ register_dirty_segment(SMgrRelation reln, ForkNumber
forknum, MdfdVec *seg)
* for AO segment files.
*/
void
-register_dirty_segment_ao(RelFileLocator rnode, int segno, File vfd)
+register_dirty_segment_ao(RelFileLocator rnode, int segno, File vfd, const
struct f_smgr_ao *smgrao)
{
FileTag tag;
@@ -1267,7 +1267,7 @@ register_dirty_segment_ao(RelFileLocator rnode, int
segno, File vfd)
ereport(DEBUG1,
(errmsg("could not forward AO fsync request
because request queue is full")));
- if (FileSync(vfd, WAIT_EVENT_DATA_FILE_SYNC) < 0)
+ if (smgrao->smgr_FileSync(vfd, WAIT_EVENT_DATA_FILE_SYNC) < 0)
ereport(data_sync_elevel(ERROR),
(errcode_for_file_access(),
errmsg("could not fsync AO file
\"%s\": %m",
diff --git a/src/include/access/aomd.h b/src/include/access/aomd.h
index 7fa83fe8a51..14a11b10c36 100644
--- a/src/include/access/aomd.h
+++ b/src/include/access/aomd.h
@@ -69,7 +69,7 @@ typedef bool (*ao_extent_callback)(int segno, void *ctx);
extern void ao_foreach_extent_file(ao_extent_callback callback, void *ctx);
-extern void register_dirty_segment_ao(RelFileLocator rnode, int segno, File
vfd);
+extern void register_dirty_segment_ao(RelFileLocator rnode, int segno, File
vfd, const struct f_smgr_ao *smgrao);
extern void register_forget_request_ao(RelFileLocator rnode, int segno);
extern uint64 ao_rel_get_physical_size(Relation aorel);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]