MCPcopy Create free account
hub / github.com/apache/cloudberry / CloseTransientFile

Function CloseTransientFile

src/backend/storage/file/fd.c:2731–2751  ·  view source on GitHub ↗

* Close a file returned by OpenTransientFile. * * Note we do not check close's return value --- it is up to the caller * to handle close errors. */

Source from the content-addressed store, hash-verified

2729 * to handle close errors.
2730 */
2731int
2732CloseTransientFile(int fd)
2733{
2734 int i;
2735
2736 DO_DB(elog(LOG, "CloseTransientFile: Allocated %d", numAllocatedDescs));
2737
2738 /* Remove fd from list of allocated files, if it's present */
2739 for (i = numAllocatedDescs; --i >= 0;)
2740 {
2741 AllocateDesc *desc = &allocatedDescs[i];
2742
2743 if (desc->kind == AllocateDescRawFD && desc->desc.fd == fd)
2744 return FreeDesc(desc);
2745 }
2746
2747 /* Only get here if someone passes us a file not in allocatedDescs */
2748 elog(WARNING, "fd passed to CloseTransientFile was not obtained from OpenTransientFile");
2749
2750 return close(fd);
2751}
2752
2753/*
2754 * Routines that want to use <dirent.h> (ie, DIR*) should use AllocateDir

Callers 15

qtext_storeFunction · 0.85
qtext_load_fileFunction · 0.85
load_relmap_fileFunction · 0.85
write_relmap_fileFunction · 0.85
close_filefdFunction · 0.85
perform_base_backupFunction · 0.85
sendFileFunction · 0.85
SendTimeLineHistoryFunction · 0.85
SaveSlotToPathFunction · 0.85
RestoreSlotFromDiskFunction · 0.85

Calls 1

FreeDescFunction · 0.85

Tested by

no test coverage detected