From cc5f81366c36b3dd8f02bd9be1cf75b2cc8482bd Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Thu, 14 Sep 2017 19:59:21 -0700 Subject: 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 --- src/backend/utils/init/postinit.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/backend/utils/init/postinit.c') diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index eb6960d93fa..20f1d279e9c 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -21,6 +21,7 @@ #include "access/heapam.h" #include "access/htup_details.h" +#include "access/session.h" #include "access/sysattr.h" #include "access/xact.h" #include "access/xlog.h" @@ -1027,6 +1028,9 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username, /* initialize client encoding */ InitializeClientEncoding(); + /* Initialize this backend's session state. */ + InitializeSession(); + /* report this backend in the PgBackendStatus array */ if (!bootstrap) pgstat_bestart(); -- cgit v1.2.3