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

Function SharedFileSetAttach

src/backend/storage/file/sharedfileset.c:126–148  ·  view source on GitHub ↗

* Attach to a set of directories that was created with SharedFileSetInit. */

Source from the content-addressed store, hash-verified

124 * Attach to a set of directories that was created with SharedFileSetInit.
125 */
126void
127SharedFileSetAttach(SharedFileSet *fileset, dsm_segment *seg)
128{
129 bool success;
130
131 SpinLockAcquire(&fileset->mutex);
132 if (fileset->refcnt == 0)
133 success = false;
134 else
135 {
136 ++fileset->refcnt;
137 success = true;
138 }
139 SpinLockRelease(&fileset->mutex);
140
141 if (!success)
142 ereport(ERROR,
143 (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
144 errmsg("could not attach to a SharedFileSet that is already destroyed")));
145
146 /* Register our cleanup callback. */
147 on_dsm_detach(seg, SharedFileSetOnDetach, PointerGetDatum(fileset));
148}
149
150/*
151 * Create a new file in the given set.

Callers 3

tuplesort_attach_sharedFunction · 0.85
get_shareinput_filesetFunction · 0.85

Calls 3

on_dsm_detachFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected