veil_config.c
Go to the documentation of this file.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_load_config();
00055 return dbs_in_cluster;
00056 }
00057
00058
00059
00060
00061
00062
00063
00064 int
00065 veil_shared_hash_elems()
00066 {
00067 veil_load_config();
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_load_config();
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 DefineCustomIntVariable("veil.dbs_in_cluster",
00100 "The number of databases within the cluster "
00101 "that will be using veil (1)",
00102 NULL,
00103 &dbs_in_cluster,
00104 1, 1, 16,
00105 PGC_USERSET,
00106 0, NULL, NULL, NULL);
00107 DefineCustomIntVariable("veil.shared_hash_elems",
00108 "The number of entries for shared variables in "
00109 "each shared memory context (32)",
00110 NULL,
00111 &shared_hash_elems,
00112 32, 32, 8192,
00113 PGC_USERSET,
00114 0, NULL, NULL, NULL);
00115 DefineCustomIntVariable("veil.shmem_context_size",
00116 "Size of each shared memory context",
00117 "Size of each shared memory context in bytes. "
00118 "This cannot be increased without stopping "
00119 "and restarting the database cluster.",
00120 &shmem_context_size,
00121 4096, 4096, 104857600,
00122 PGC_USERSET,
00123 0, NULL, NULL, NULL);
00124
00125 first_time = false;
00126 }
00127
00128
00129
00130
00131
00132 void
00133 veil_load_config()
00134 {
00135 static bool first_time = true;
00136 if (!first_time) {
00137 return;
00138 }
00139
00140 dbs_in_cluster = atoi(GetConfigOption("veil.dbs_in_cluster", FALSE, FALSE));
00141 shared_hash_elems = atoi(GetConfigOption("veil.shared_hash_elems",
00142 FALSE, FALSE));
00143 shmem_context_size = atoi(GetConfigOption("veil.shmem_context_size",
00144 FALSE, FALSE));
00145 first_time = false;
00146 }
00147
00148