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

Function tuplesort_initialize_shared

src/backend/utils/sort/tuplesort.c:4674–4690  ·  view source on GitHub ↗

* tuplesort_initialize_shared - initialize shared tuplesort state * * Must be called from leader process before workers are launched, to * establish state needed up-front for worker tuplesortstates. nWorkers * should match the argument passed to tuplesort_estimate_shared(). */

Source from the content-addressed store, hash-verified

4672 * should match the argument passed to tuplesort_estimate_shared().
4673 */
4674void
4675tuplesort_initialize_shared(Sharedsort *shared, int nWorkers, dsm_segment *seg)
4676{
4677 int i;
4678
4679 Assert(nWorkers > 0);
4680
4681 SpinLockInit(&shared->mutex);
4682 shared->currentWorker = 0;
4683 shared->workersFinished = 0;
4684 SharedFileSetInit(&shared->fileset, seg);
4685 shared->nTapes = nWorkers;
4686 for (i = 0; i < nWorkers; i++)
4687 {
4688 shared->tapes[i].firstblocknumber = 0L;
4689 }
4690}
4691
4692/*
4693 * tuplesort_attach_shared - attach to shared tuplesort state

Callers 1

_bt_begin_parallelFunction · 0.85

Calls 1

SharedFileSetInitFunction · 0.85

Tested by

no test coverage detected