This is an automated email from the ASF dual-hosted git repository.

reshke pushed a commit to branch unlink_temp_first_seg
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit c05fc149b6e05ca9b6d37c1cb7674d42e9ab8c6f
Author: reshke <[email protected]>
AuthorDate: Wed Apr 1 08:21:41 2026 +0000

    Always unlink first segment for AO/AOCO temp relation.
---
 src/backend/access/appendonly/aomd.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/backend/access/appendonly/aomd.c 
b/src/backend/access/appendonly/aomd.c
index 342e7771b7b..1c47339c514 100644
--- a/src/backend/access/appendonly/aomd.c
+++ b/src/backend/access/appendonly/aomd.c
@@ -256,6 +256,7 @@ struct truncate_ao_callback_ctx
 void
 mdunlink_ao(RelFileNodeBackend rnode, ForkNumber forkNumber, bool isRedo)
 {
+       int ret;
        const char *path = relpath(rnode, forkNumber);
 
        /*
@@ -294,6 +295,19 @@ mdunlink_ao(RelFileNodeBackend rnode, ForkNumber 
forkNumber, bool isRedo)
                pfree(segPath);
        }
 
+       /*
+        * Delete or truncate the first segment. See mdunlinkfork also.
+        */
+       if (RelFileNodeBackendIsTemp(rnode))
+       {
+               /* Next unlink the file, unless it was already found to be 
missing */
+               ret = unlink(path);
+               if (ret < 0 && errno != ENOENT)
+                       ereport(WARNING,
+                                       (errcode_for_file_access(),
+                                               errmsg("could not remove file 
\"%s\": %m", path)));
+       }
+
        pfree((void *) path);
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to