00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "postgres.h"
00015 #include "storage/fd.h"
00016 #include "utils/guc.h"
00017 #include "veil_version.h"
00018 #include "veil_funcs.h"
00019
00020
00021
00022
00023
00024
00025
00026 static int shared_hash_elems = 32;
00027
00028
00029
00030
00031
00032
00033 static int dbs_in_cluster = 2;
00034
00035
00036
00037
00038
00039
00040
00041
00042 static int shmem_context_size = 16384;
00043
00044
00045
00046
00047
00048
00049
00050
00051 int
00052 veil_dbs_in_cluster()
00053 {
00054 veil_config_init();
00055 return dbs_in_cluster;
00056 }
00057
00058
00059
00060
00061
00062
00063
00064 int
00065 veil_shared_hash_elems()
00066 {
00067 veil_config_init();
00068 return shared_hash_elems;
00069 }
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 int
00082 veil_shmem_context_size()
00083 {
00084 veil_config_init();
00085 return shmem_context_size;
00086 }
00087
00088
00089
00090
00091 void
00092 veil_config_init()
00093 {
00094 static bool first_time = true;
00095 if (!first_time) {
00096 return;
00097 }
00098
00099 #if PG_VERSION_GE(8, 2)
00100 DefineCustomIntVariable("veil.dbs_in_cluster",
00101 "The number of databases within the cluster "
00102 "that will be using veil (1)",
00103 NULL,
00104 &dbs_in_cluster,
00105 1, 16,
00106 PGC_USERSET,
00107 NULL, NULL);
00108 DefineCustomIntVariable("veil.shared_hash_elems",
00109 "The number of entries for shared variables in "
00110 "each shared memory context (32)",
00111 NULL,
00112 &shared_hash_elems,
00113 32, 8192,
00114 PGC_USERSET,
00115 NULL, NULL);
00116 DefineCustomIntVariable("veil.shmem_context_size",
00117 "Size of each shared memory context",
00118 "Size of each shared memory context in bytes. "
00119 "This cannot be increased without stopping "
00120 "and restarting the database cluster.",
00121 &shmem_context_size,
00122 4096, 104857600,
00123 PGC_USERSET,
00124 NULL, NULL);
00125 #endif
00126
00127 first_time = false;
00128 }
00129
00130
00131
00132