diff options
author | Andres Freund <andres@anarazel.de> | 2017-09-14 19:59:21 -0700 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2017-09-14 19:59:21 -0700 |
commit | cc5f81366c36b3dd8f02bd9be1cf75b2cc8482bd (patch) | |
tree | 8670bbca7404426515b5556ab2c6477b316e3edc /src/backend/access/common/tupdesc.c | |
parent | 9b6cb4650bc6a56114000678c1944afdb95f8333 (diff) |
Add support for coordinating record typmods among parallel workers.
Tuples can have type RECORDOID and a typmod number that identifies a blessed
TupleDesc in a backend-private cache. To support the sharing of such tuples
through shared memory and temporary files, provide a typmod registry in
shared memory.
To achieve that, introduce per-session DSM segments, created on demand when a
backend first runs a parallel query. The per-session DSM segment has a
table-of-contents just like the per-query DSM segment, and initially the
contents are a shared record typmod registry and a DSA area to provide the
space it needs to grow.
State relating to the current session is accessed via a Session object
reached through global variable CurrentSession that may require significant
redesign further down the road as we figure out what else needs to be shared
or remodelled.
Author: Thomas Munro
Reviewed-By: Andres Freund
Discussion: https://postgr.es/m/CAEepm=0ZtQ-SpsgCyzzYpsXS6e=kZWqk3g5Ygn3MDV7A8dabUA@mail.gmail.com
Diffstat (limited to 'src/backend/access/common/tupdesc.c')
-rw-r--r-- | src/backend/access/common/tupdesc.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c index 4436c863617..9e37ca73a86 100644 --- a/src/backend/access/common/tupdesc.c +++ b/src/backend/access/common/tupdesc.c @@ -185,6 +185,22 @@ CreateTupleDescCopyConstr(TupleDesc tupdesc) } /* + * TupleDescCopy + * Copy a tuple descriptor into caller-supplied memory. + * The memory may be shared memory mapped at any address, and must + * be sufficient to hold TupleDescSize(src) bytes. + * + * !!! Constraints and defaults are not copied !!! + */ +void +TupleDescCopy(TupleDesc dst, TupleDesc src) +{ + memcpy(dst, src, TupleDescSize(src)); + dst->constr = NULL; + dst->tdrefcount = -1; +} + +/* * TupleDescCopyEntry * This function copies a single attribute structure from one tuple * descriptor to another. |