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

Function ExecHashTableDetach

src/backend/executor/nodeHash.c:3895–3927  ·  view source on GitHub ↗

* Detach from all shared resources. If we are last to detach, clean up. */

Source from the content-addressed store, hash-verified

3893 * Detach from all shared resources. If we are last to detach, clean up.
3894 */
3895void
3896ExecHashTableDetach(HashJoinTable hashtable)
3897{
3898 if (hashtable->parallel_state)
3899 {
3900 ParallelHashJoinState *pstate = hashtable->parallel_state;
3901 int i;
3902
3903 /* Make sure any temporary files are closed. */
3904 if (hashtable->batches)
3905 {
3906 for (i = 0; i < hashtable->nbatch; ++i)
3907 {
3908 sts_end_write(hashtable->batches[i].inner_tuples);
3909 sts_end_write(hashtable->batches[i].outer_tuples);
3910 sts_end_parallel_scan(hashtable->batches[i].inner_tuples);
3911 sts_end_parallel_scan(hashtable->batches[i].outer_tuples);
3912 }
3913 }
3914
3915 /* If we're last to detach, clean up shared memory. */
3916 if (BarrierDetach(&pstate->build_barrier))
3917 {
3918 if (DsaPointerIsValid(pstate->batches))
3919 {
3920 dsa_free(hashtable->area, pstate->batches);
3921 pstate->batches = InvalidDsaPointer;
3922 }
3923 }
3924
3925 hashtable->parallel_state = NULL;
3926 }
3927}
3928
3929/*
3930 * Get the first tuple in a given bucket identified by number.

Callers 2

ExecShutdownHashJoinFunction · 0.85

Calls 4

sts_end_writeFunction · 0.85
sts_end_parallel_scanFunction · 0.85
BarrierDetachFunction · 0.85
dsa_freeFunction · 0.85

Tested by

no test coverage detected