should use. Possible values are <literal>posix</literal> (for POSIX shared
memory allocated using <literal>shm_open</literal>), <literal>sysv</literal>
(for System V shared memory allocated via <literal>shmget</literal>),
- <literal>windows</literal> (for Windows shared memory), <literal>mmap</literal>
- (to simulate shared memory using memory-mapped files stored in the
- data directory), and <literal>none</literal> (to disable this feature).
+ <literal>windows</literal> (for Windows shared memory),
+ and <literal>mmap</literal> (to simulate shared memory using
+ memory-mapped files stored in the data directory).
Not all values are supported on all platforms; the first supported
option is the default for that platform. The use of the
<literal>mmap</literal> option, which is not the default on any platform,
configured via <varname>max_parallel_workers_per_gather</varname>.
</para>
</listitem>
-
- <listitem>
- <para>
- <xref linkend="guc-dynamic-shared-memory-type"/> must be set to a
- value other than <literal>none</literal>. Parallel query requires dynamic
- shared memory in order to pass data between cooperating processes.
- </para>
- </listitem>
</itemizedlist>
<para>
/* Number of workers should be non-negative. */
Assert(nworkers >= 0);
- /*
- * If dynamic shared memory is not available, we won't be able to use
- * background workers.
- */
- if (dynamic_shared_memory_type == DSM_IMPL_NONE)
- nworkers = 0;
-
/*
* If we are running under serializable isolation, we can't use parallel
* workers, at least not until somebody enhances that mechanism to be
*/
if ((cursorOptions & CURSOR_OPT_PARALLEL_OK) != 0 &&
IsUnderPostmaster &&
- dynamic_shared_memory_type != DSM_IMPL_NONE &&
parse->commandType == CMD_SELECT &&
!parse->hasModifyingCTE &&
max_parallel_workers_per_gather > 0 &&
double allvisfrac;
/* Return immediately when parallelism disabled */
- if (dynamic_shared_memory_type == DSM_IMPL_NONE ||
- max_parallel_maintenance_workers == 0)
+ if (max_parallel_maintenance_workers == 0)
return 0;
/* Set up largely-dummy planner state */
Assert(!IsUnderPostmaster);
- /* If dynamic shared memory is disabled, there's nothing to do. */
- if (dynamic_shared_memory_type == DSM_IMPL_NONE)
- return;
-
/*
* If we're using the mmap implementations, clean up any leftovers.
* Cleanup isn't needed on Windows, and happens earlier in startup for
uint32 i;
dsm_control_header *old_control;
- /* If dynamic shared memory is disabled, there's nothing to do. */
- if (dynamic_shared_memory_type == DSM_IMPL_NONE)
- return;
-
/*
* Try to attach the segment. If this fails, it probably just means that
* the operating system has been rebooted and the segment no longer
static void
dsm_backend_startup(void)
{
- /* If dynamic shared memory is disabled, reject this. */
- if (dynamic_shared_memory_type == DSM_IMPL_NONE)
- ereport(ERROR,
- (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
- errmsg("dynamic shared memory is disabled"),
- errhint("Set dynamic_shared_memory_type to a value other than \"none\".")));
-
#ifdef EXEC_BACKEND
{
void *control_address = NULL;
#ifdef USE_DSM_MMAP
{"mmap", DSM_IMPL_MMAP, false},
#endif
- {"none", DSM_IMPL_NONE, false},
{NULL, 0, false}
};
{
switch (dynamic_shared_memory_type)
{
- case DSM_IMPL_NONE:
- return false;
case DSM_IMPL_POSIX:
return true;
case DSM_IMPL_SYSV:
# sysv
# windows
# mmap
- # use none to disable dynamic shared memory
# (change requires restart)
# - Disk -
ok_buffers = 0;
+ /*
+ * Need to determine working DSM implementation first so that subsequent
+ * tests don't fail because DSM setting doesn't work.
+ */
+ printf(_("selecting dynamic shared memory implementation ... "));
+ fflush(stdout);
+ dynamic_shared_memory_type = choose_dsm_implementation();
+ printf("%s\n", dynamic_shared_memory_type);
+
printf(_("selecting default max_connections ... "));
fflush(stdout);
"\"%s\" --boot -x0 %s "
"-c max_connections=%d "
"-c shared_buffers=%d "
- "-c dynamic_shared_memory_type=none "
+ "-c dynamic_shared_memory_type=%s "
"< \"%s\" > \"%s\" 2>&1",
backend_exec, boot_options,
test_conns, test_buffs,
+ dynamic_shared_memory_type,
DEVNULL, DEVNULL);
status = system(cmd);
if (status == 0)
"\"%s\" --boot -x0 %s "
"-c max_connections=%d "
"-c shared_buffers=%d "
- "-c dynamic_shared_memory_type=none "
+ "-c dynamic_shared_memory_type=%s "
"< \"%s\" > \"%s\" 2>&1",
backend_exec, boot_options,
n_connections, test_buffs,
+ dynamic_shared_memory_type,
DEVNULL, DEVNULL);
status = system(cmd);
if (status == 0)
printf("%dMB\n", (n_buffers * (BLCKSZ / 1024)) / 1024);
else
printf("%dkB\n", n_buffers * (BLCKSZ / 1024));
-
- printf(_("selecting dynamic shared memory implementation ... "));
- fflush(stdout);
- dynamic_shared_memory_type = choose_dsm_implementation();
- printf("%s\n", dynamic_shared_memory_type);
}
/*
#define DSM_IMPL_H
/* Dynamic shared memory implementations. */
-#define DSM_IMPL_NONE 0
#define DSM_IMPL_POSIX 1
#define DSM_IMPL_SYSV 2
#define DSM_IMPL_WINDOWS 3