From 4580391963153e525834efb84136f93e363d2a14 Mon Sep 17 00:00:00 2001 From: Konstantin Knizhnik Date: Tue, 22 Jul 2025 18:51:38 +0300 Subject: [PATCH] Update pgxn/neon/pagestore_smgr.c Co-authored-by: Heikki Linnakangas --- pgxn/neon/pagestore_smgr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pgxn/neon/pagestore_smgr.c b/pgxn/neon/pagestore_smgr.c index 2d86dda36b..9c28cf1ef5 100644 --- a/pgxn/neon/pagestore_smgr.c +++ b/pgxn/neon/pagestore_smgr.c @@ -1617,8 +1617,9 @@ neon_write(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, const vo relperst = mdexists(reln, debug_compare_local ? INIT_FORKNUM : forknum) ? NEON_RELPERSISTENCE_UNLOGGED : NEON_RELPERSISTENCE_PERMANENT; /* * There is no lock hold between get_cached_relperst and set_cached_relperst. - * We assume that multiple backends can repeat this check and get the same result (there is assert in set_cached_relperst). - * And concurrent setting UNLOGGED_BUILD is not possible because only one backend can perform unlogged build. + * We assume that if multiple backends perform this check, they all get the same result (there is assert in set_cached_relperst). + * Furthermore we assume that when a relation changes from PERMANENT to UNLOGGED_BUILD, we assume that it has no buffers in + * the shared buffer cache and therefore no other backend will try to concurrently write its pages. (In fact we require that the relation is completely empty.) */ set_cached_relperst(rinfo, relperst); }