* Create a BufFile that can be discovered and opened read-only by other * backends that are attached to the same SharedFileSet using the same name. * * The naming scheme for shared BufFiles is left up to the calling code. The * name will appear as part of one or more filenames on disk, and might * provide clues to administrators about which subsystem is generating * temporary file data. Si
| 358 | * unrelated SharedFileSet objects. |
| 359 | */ |
| 360 | BufFile * |
| 361 | BufFileCreateShared(SharedFileSet *fileset, const char *name, workfile_set *work_set) |
| 362 | { |
| 363 | BufFile *file; |
| 364 | |
| 365 | file = makeBufFileCommon(1); |
| 366 | file->fileset = fileset; |
| 367 | file->name = pstrdup(name); |
| 368 | file->files = (File *) palloc(sizeof(File)); |
| 369 | file->files[0] = MakeNewSharedSegment(file, 0); |
| 370 | file->readOnly = false; |
| 371 | /* |
| 372 | * Register the file as a "work file", so that the Cloudberry workfile |
| 373 | * limits apply to it. |
| 374 | */ |
| 375 | file->work_set = work_set; |
| 376 | |
| 377 | FileSetIsWorkfile(file->files[0]); |
| 378 | RegisterFileWithSet(file->files[0], work_set); |
| 379 | |
| 380 | return file; |
| 381 | } |
| 382 | |
| 383 | /* |
| 384 | * Open a file that was previously created in another backend (or this one) |
no test coverage detected