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

Function get_shareinput_fileset

src/backend/executor/nodeShareInputScan.c:748–789  ·  view source on GitHub ↗

* Get reference to the SharedFileSet used to hold all the tuplestore files. * * This is exported so that it can also be used by the INITPLAN function * tuplestores. */

Source from the content-addressed store, hash-verified

746 * tuplestores.
747 */
748SharedFileSet *
749get_shareinput_fileset(void)
750{
751 dsm_handle handle;
752
753 if (shareinput_Xslice_fileset == NULL)
754 {
755 dsm_segment *seg;
756
757 LWLockAcquire(ShareInputScanLock, LW_EXCLUSIVE);
758
759 handle = *shareinput_Xslice_dsm_handle_ptr;
760
761 if (handle)
762 {
763 seg = dsm_attach(handle);
764 if (seg == NULL)
765 elog(ERROR, "could not attach to ShareInputScan DSM segment");
766 dsm_pin_mapping(seg);
767
768 shareinput_Xslice_fileset = dsm_segment_address(seg);
769 }
770 else
771 {
772 seg = dsm_create(sizeof(SharedFileSet), 0);
773 dsm_pin_segment(seg);
774 *shareinput_Xslice_dsm_handle_ptr = dsm_segment_handle(seg);
775 dsm_pin_mapping(seg);
776
777 shareinput_Xslice_fileset = dsm_segment_address(seg);
778 }
779
780 if (shareinput_Xslice_fileset->refcnt == 0)
781 SharedFileSetInit(shareinput_Xslice_fileset, seg);
782 else
783 SharedFileSetAttach(shareinput_Xslice_fileset, seg);
784
785 LWLockRelease(ShareInputScanLock);
786 }
787
788 return shareinput_Xslice_fileset;
789}
790
791/*
792 * Get a reference to slot in shared memory for this shared scan.

Callers 7

register_delta_ENRsFunction · 0.85
init_tuplestore_stateFunction · 0.85
FunctionNext_gutsFunction · 0.85
ExecSetParamPlanFunction · 0.85

Calls 10

LWLockAcquireFunction · 0.85
dsm_attachFunction · 0.85
dsm_pin_mappingFunction · 0.85
dsm_segment_addressFunction · 0.85
dsm_createFunction · 0.85
dsm_pin_segmentFunction · 0.85
dsm_segment_handleFunction · 0.85
SharedFileSetInitFunction · 0.85
SharedFileSetAttachFunction · 0.85
LWLockReleaseFunction · 0.85

Tested by

no test coverage detected