Veil
veil_config.c File Reference

Code for setting and reading configuration data. More...

#include "postgres.h"
#include "storage/fd.h"
#include "utils/guc.h"
#include "veil_version.h"
#include "veil_funcs.h"

Go to the source code of this file.

Functions

int veil_dbs_in_cluster ()
 Return the number of databases, within the database cluster, that will use Veil. More...
 
int veil_shared_hash_elems ()
 Return the number of entries that should be allocated for shared variables in our shared hashes. More...
 
int veil_shmem_context_size ()
 Return the amount of shared memory to be requested for each of the two shared memory contexts. More...
 
void veil_config_init ()
 Initialise Veil's use of GUC variables.
 
void veil_load_config ()
 Retrieve Veil's GUC variables for this session.
 

Variables

static int shared_hash_elems = 32
 The number of buckets to create in the hash for shared variables. More...
 
static int dbs_in_cluster = 2
 The number of databases within the db cluster that will use veil. More...
 
static int shmem_context_size = 16384
 The size in KBytes, of each of Veil's shared memory contexts. More...
 

Detailed Description

Code for setting and reading configuration data.

Author: Marc Munro
Copyright (c) 2006-2011 Marc Munro
License: BSD

Definition in file veil_config.c.

Function Documentation

◆ veil_dbs_in_cluster()

int veil_dbs_in_cluster ( void  )

Return the number of databases, within the database cluster, that will use Veil.

Each such database will be allocated 2 chunks of shared memory (of shmem_context_size), and a single LWLock. It defaults to 1 and may be defined in postgresql.conf using eg: "veil.dbs_in_cluster = 2"

Definition at line 52 of file veil_config.c.

References dbs_in_cluster, and veil_load_config().

Referenced by _PG_init(), and get_shmem_context().

◆ veil_shared_hash_elems()

int veil_shared_hash_elems ( void  )

Return the number of entries that should be allocated for shared variables in our shared hashes.

This defaults to 32 and may be defined in postgresql.conf using eg: "veil.shared_hash_elems = 64"

Definition at line 65 of file veil_config.c.

References shared_hash_elems, and veil_load_config().

Referenced by create_shared_hash().

◆ veil_shmem_context_size()

int veil_shmem_context_size ( void  )

Return the amount of shared memory to be requested for each of the two shared memory contexts.

This variable has no effect unless shared_preload_libraries has been defined in postgresql.conf to load the Veil shared library Note that this must be large enough to allocate at least one chunk of memory for each veil-using database in the Postgres cluster. It defaults to 16K and may be defined in postgresql.conf using eg: "veil.shmem_context_size = 16384"

Definition at line 82 of file veil_config.c.

References shmem_context_size, and veil_load_config().

Referenced by _PG_init(), and shmalloc_init().

Variable Documentation

◆ shared_hash_elems

int shared_hash_elems = 32
static

The number of buckets to create in the hash for shared variables.

This defaults to 32 and may be defined in postgresql.conf using eg: "veil.shared_hash_elems = 64"

Definition at line 26 of file veil_config.c.

Referenced by veil_config_init(), veil_load_config(), and veil_shared_hash_elems().

◆ dbs_in_cluster

int dbs_in_cluster = 2
static

The number of databases within the db cluster that will use veil.

Every veil-using database within the cluster will get the same allocation of shared memory.

Definition at line 33 of file veil_config.c.

Referenced by veil_config_init(), veil_dbs_in_cluster(), and veil_load_config().

◆ shmem_context_size

int shmem_context_size = 16384
static

The size in KBytes, of each of Veil's shared memory contexts.

Veil will pre-allocate (from Postgres 8.2 onwards) twice this amount of shared memory, one for each context area. The default is 16384 Bytes and may be defined in postgresql.conf using eg: "veil.shmem_context_size = 8192"

Definition at line 42 of file veil_config.c.

Referenced by veil_config_init(), veil_load_config(), and veil_shmem_context_size().