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

Function table_parallelscan_initialize

src/backend/access/table/tableam.c:157–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157void
158table_parallelscan_initialize(Relation rel, ParallelTableScanDesc pscan,
159 Snapshot snapshot)
160{
161 Size snapshot_off = rel->rd_tableam->parallelscan_initialize(rel, pscan);
162
163 pscan->phs_snapshot_off = snapshot_off;
164
165 if (IsMVCCSnapshot(snapshot))
166 {
167 SerializeSnapshot(snapshot, (char *) pscan + pscan->phs_snapshot_off);
168 pscan->phs_snapshot_any = false;
169 }
170 else
171 {
172 Assert(snapshot == SnapshotAny);
173 pscan->phs_snapshot_any = true;
174 }
175
176 /*
177 * GPDB: for AO/AOCO tables,
178 * we need to fill parallel info which need a snapshot to scan systables.
179 * We couldn't do it in parallelscan_initialize AM which doesn't have a
180 * snapshot param. And we should keep same with Upstream.
181 * But parallelscan_initialize tells us the snapshot offset and we have set
182 * it in ParallelTableScanDesc, so we could use it directly.
183 */
184 if (RelationIsAoRows(rel))
185 {
186 Snapshot appendOnlyMetaDataSnapshot = snapshot;
187 ParallelBlockTableScanDesc bpscan = (ParallelBlockTableScanDesc) pscan;
188 int segfile_count;
189 FileSegInfo **seginfo;
190 if (snapshot == SnapshotAny)
191 {
192 /*
193 * the append-only meta data should never be fetched with
194 * SnapshotAny as bogus results are returned.
195 */
196 appendOnlyMetaDataSnapshot = GetTransactionSnapshot();
197 }
198 seginfo = GetAllFileSegInfo(rel, appendOnlyMetaDataSnapshot, &segfile_count, NULL);
199 bpscan->phs_nblocks = segfile_count;
200 if (seginfo)
201 {
202 FreeAllSegFileInfo(seginfo, segfile_count);
203 pfree(seginfo);
204 }
205 }
206 else if (RelationIsAoCols(rel))
207 {
208 Snapshot appendOnlyMetaDataSnapshot = snapshot;
209 ParallelBlockTableScanDesc bpscan = (ParallelBlockTableScanDesc) pscan;
210 int segfile_count;
211 AOCSFileSegInfo **seginfo;
212 if (snapshot == SnapshotAny)
213 {
214 /*

Callers 2

_bt_begin_parallelFunction · 0.85
ExecSeqScanInitializeDSMFunction · 0.85

Calls 7

SerializeSnapshotFunction · 0.85
GetTransactionSnapshotFunction · 0.85
GetAllFileSegInfoFunction · 0.85
FreeAllSegFileInfoFunction · 0.85
GetAllAOCSFileSegInfoFunction · 0.85
FreeAllAOCSSegFileInfoFunction · 0.85
pfreeFunction · 0.50

Tested by

no test coverage detected