Drizzled Public API Documentation

parameters_ms.cc

00001 /* Copyright (C) 2010 PrimeBase Technologies GmbH, Germany
00002  *
00003  * PrimeBase Media Stream for MySQL
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00018  *
00019  * Barry Leslie
00020  *
00021  * 2010-05-25
00022  *
00023  * PBMS daemon global parameters.
00024  *
00025  */
00026 
00027 #ifdef DRIZZLED
00028 #include <config.h>
00029 #include <set>
00030 #include <drizzled/common.h>
00031 #include <drizzled/plugin.h>
00032 #include <drizzled/session.h>
00033 #include <drizzled/sql_lex.h>
00034 
00035 
00036 #define my_strdup(a,b) strdup(a)
00037 
00038 #include "cslib/CSConfig.h"
00039 #else
00040 #include "cslib/CSConfig.h"
00041 #include "mysql_priv.h"
00042 #include <mysql/plugin.h>
00043 #include <my_dir.h>
00044 #endif 
00045 
00046 #include <inttypes.h>
00047 #include <string.h>
00048 
00049 #include "cslib/CSDefs.h"
00050 #include "cslib/CSObject.h"
00051 #include "cslib/CSGlobal.h"
00052 #include "cslib/CSThread.h"
00053 #include "cslib/CSStrUtil.h"
00054 #include "cslib/CSPath.h"
00055 #include "cslib/CSLog.h"
00056 
00057 #include "defs_ms.h"
00058 #include "database_ms.h"
00059 #include "parameters_ms.h"
00060 
00061 using namespace std;
00062 using namespace drizzled;
00063 using namespace drizzled::plugin;
00064 
00065 #include <drizzled/module/option_map.h>
00066 #include <boost/program_options.hpp>
00067 namespace po= boost::program_options;
00068 #ifndef PBMS_PORT
00069 #define PBMS_PORT 8080
00070 #endif
00071 
00072 /* Note: 'new' used here is NOT CSObject::new which is a DEBUG define*/
00073 #ifdef new
00074 #undef new
00075 #endif
00076 
00077 
00078 #ifdef DRIZZLED
00079 static port_constraint pbms_port_number;
00080 
00081 static std::string my_repository_threshold;
00082 static std::string my_temp_log_threshold;
00083 static std::string my_http_metadata_headers;
00084 
00085 typedef drizzled::constrained_check<uint32_t, 100, 0> percent_constraint;
00086 static percent_constraint my_garbage_threshold;
00087 static uint32_nonzero_constraint my_temp_blob_timeout;
00088 static uint32_nonzero_constraint my_max_keep_alive;
00089 static uint32_nonzero_constraint my_backup_db_id;
00090 
00091 static uint32_t my_server_id = 1;
00092 #else
00093 uint32_t pbms_port_number;
00094 
00095 static char   *my_repository_threshold = NULL;
00096 static char   *my_temp_log_threshold = NULL;
00097 static char   *my_http_metadata_headers = NULL;
00098 
00099 static u_long my_temp_blob_timeout = MS_DEFAULT_TEMP_LOG_WAIT;
00100 static u_long my_garbage_threshold = MS_DEFAULT_GARBAGE_LEVEL;
00101 static u_long my_max_keep_alive = MS_DEFAULT_KEEP_ALIVE;
00102 
00103 static u_long my_backup_db_id = 1;
00104 static uint32_t my_server_id = 1;
00105 #endif
00106 
00107 #ifdef DRIZZLED
00108 static set<string> my_black_list;
00109 static bool my_events_enabled = true;
00110 static CSMutex my_table_list_lock;
00111 
00112 typedef enum {MATCH_ALL, MATCH_DBS, MATCH_SOME, MATCH_NONE, MATCH_UNKNOWN, MATCH_ERROR} TableMatchState;
00113 static std::string my_table_list;
00114 
00115 static TableMatchState my_table_match = MATCH_UNKNOWN;
00116 
00117 typedef constrained_check<int32_t, INT32_MAX-1, 1> before_position_constraint;
00118 static before_position_constraint my_before_insert_position;      // Call this event observer first.
00119 static before_position_constraint my_before_update_position;
00120 
00121 using namespace drizzled;
00122 using namespace drizzled::plugin;
00123 
00124 #define st_mysql_sys_var drizzled::drizzle_sys_var
00125 #else
00126 
00127 struct st_mysql_sys_var
00128 {
00129   MYSQL_PLUGIN_VAR_HEADER;
00130 };
00131 
00132 #endif
00133 
00134 #if MYSQL_VERSION_ID < 60000
00135 
00136 #if MYSQL_VERSION_ID >= 50124
00137 #define CONST_SAVE const
00138 #endif
00139 
00140 #else
00141 
00142 #if MYSQL_VERSION_ID >= 60005
00143 #define CONST_SAVE const
00144 #endif
00145 
00146 #endif
00147 
00148 #ifndef CONST_SAVE
00149 #define CONST_SAVE 
00150 #endif
00151 
00152 //--------------
00153 uint32_t PBMSParameters::getPortNumber(){ return pbms_port_number;}
00154 
00155 //--------------
00156 uint32_t PBMSParameters::getServerID(){ return my_server_id;}
00157 
00158 //--------------
00159 uint64_t PBMSParameters::getRepoThreshold()
00160 {
00161 #ifdef DRIZZLED
00162   return (uint64_t) cs_byte_size_to_int8(my_repository_threshold.c_str());
00163 #else
00164   if (my_repository_threshold)
00165     return((uint64_t) cs_byte_size_to_int8(my_repository_threshold));
00166 
00167   return((uint64_t) cs_byte_size_to_int8(MS_REPO_THRESHOLD_DEF));
00168 #endif
00169 }
00170 
00171 //--------------
00172 uint64_t PBMSParameters::getTempLogThreshold()
00173 {
00174 #ifdef DRIZZLED
00175   return (uint64_t) cs_byte_size_to_int8(my_temp_log_threshold.c_str());
00176 #else
00177   if (my_temp_log_threshold)
00178     return((uint64_t) cs_byte_size_to_int8(my_temp_log_threshold));
00179 
00180   return((uint64_t) cs_byte_size_to_int8(MS_TEMP_LOG_THRESHOLD_DEF));
00181 #endif
00182 }
00183 
00184 //--------------
00185 uint32_t PBMSParameters::getTempBlobTimeout(){ return static_cast<uint32_t>(my_temp_blob_timeout);}
00186 
00187 //--------------
00188 uint32_t PBMSParameters::getGarbageThreshold(){ return static_cast<uint32_t>(my_garbage_threshold);}
00189 
00190 //--------------
00191 uint32_t PBMSParameters::getMaxKeepAlive(){ return static_cast<uint32_t>(my_max_keep_alive);}
00192 
00193 //--------------
00194 const char * PBMSParameters::getDefaultMetaDataHeaders()
00195 {
00196 #ifdef DRIZZLED
00197         return my_http_metadata_headers.c_str();
00198 #else
00199   if (my_http_metadata_headers)
00200     return my_http_metadata_headers; 
00201     
00202   return MS_HTTP_METADATA_HEADERS_DEF; 
00203 #endif
00204 }
00205 
00206 //-----------------
00207 uint32_t PBMSParameters::getBackupDatabaseID() { return static_cast<uint32_t>(my_backup_db_id);}
00208 
00209 //-----------------
00210 void PBMSParameters::setBackupDatabaseID(uint32_t id) { my_backup_db_id = id;}
00211 
00212 #ifdef DRIZZLED
00213 //-----------------
00214 bool PBMSParameters::isPBMSEventsEnabled() { return my_events_enabled;}
00215 
00216 
00217 #define NEXT_IN_TABLE_LIST(list) {\
00218   while ((*list) && (*list != ',')) list++;\
00219   if (*list) list++;\
00220 }
00221   
00222 static TableMatchState set_match_type(const char *list)
00223 {
00224   const char *ptr = list;
00225   const char *name;
00226   int name_len;
00227   TableMatchState match_state;
00228 
00229   if (!list)
00230     return MATCH_ALL;
00231     
00232   if (!ptr) {
00233     return MATCH_NONE;
00234   }
00235   
00236   while ((*ptr) && isspace(*ptr)) ptr++;
00237   if (!*ptr) {
00238     return MATCH_NONE;
00239   }
00240   
00241   match_state = MATCH_UNKNOWN;
00242 
00243   while (*ptr) {
00244   
00245     // Check database name
00246     name = ptr;
00247     name_len = 0;
00248     while ((*ptr) && (!isspace(*ptr)) && (*ptr != ',') && (*ptr != '.')) {ptr++;name_len++;}
00249     while ((*ptr) && isspace(*ptr)) ptr++;
00250     
00251     if (*ptr != '.') {
00252       if ((name_len == 1) && (*name == '*'))
00253         match_state = MATCH_ALL;
00254       else
00255         goto bad_list; // Missing table
00256     } else {
00257     
00258       if ((match_state > MATCH_DBS) && (name_len == 1) && (*name == '*'))
00259         match_state = MATCH_DBS;
00260         
00261       ptr++; // Skip the '.'
00262       
00263       // Find the start of the table name.
00264       while ((*ptr) && isspace(*ptr)) ptr++;
00265       if ((!*ptr) || (*ptr == ',') || (*ptr == '.'))
00266         goto bad_list; // Missing table
00267         
00268       // Find the end of the table name.
00269       while ((*ptr) && (!isspace(*ptr)) && (*ptr != ',') && (*ptr != '.')) ptr++;
00270     }
00271     
00272     // Locate the end of the element.
00273     while ((*ptr) && isspace(*ptr)) ptr++;
00274         
00275     if ((*ptr) && (*ptr != ','))
00276       goto bad_list; // Bad table name
00277       
00278     if (match_state > MATCH_SOME)
00279       match_state = MATCH_SOME;
00280       
00281     if (*ptr) ptr++;
00282     while ((*ptr) && isspace(*ptr)) ptr++;
00283   }
00284   
00285   return match_state;
00286 bad_list:
00287 
00288   char info[120];
00289   snprintf(info, 120, "pbms_watch_tables format error near character position %d", (int) (ptr - list));
00290   CSL.logLine(NULL, CSLog::Error, info);
00291   CSL.logLine(NULL, CSLog::Error, list);
00292   
00293   return MATCH_ERROR;
00294 }
00295 
00296 //-----------------
00297 static const char* locate_db(const char *list, const char *db, int len)
00298 {
00299   int match_len;
00300   
00301   while (*list) {
00302     while ((*list) && isspace(*list)) list++;
00303     if ((*list == 0) || (*(list+1) == 0) || (*(list+2) == 0)) // We need at least 3 characters
00304       return NULL;
00305     
00306     match_len = 0;
00307     if (*list == '*') 
00308       match_len = 1;
00309     else if (strncmp(list, db, len) == 0) 
00310       match_len = len;
00311     
00312     if (match_len) {
00313       list += match_len;
00314       
00315       // Find the '.'
00316       while ((*list) && isspace(*list)) list++;
00317       if ((*list == 0) || (*(list+1) == 0) ) // We need at least 2 characters
00318         return NULL;
00319             
00320       if (*list == '.') { 
00321         list++;
00322         while ((*list) && isspace(*list)) list++;
00323         if (*list == 0)
00324            return NULL;
00325            
00326         return list; // We have gound a table that could belong to this database;
00327       }
00328     }
00329     
00330     NEXT_IN_TABLE_LIST(list);
00331   }
00332   
00333   return NULL;
00334 }
00335 
00336 #ifdef DRIZZLED
00337 static void temp_blob_timeout_update(Session*, sql_var_t)
00338 {
00339   CSThread    *self;
00340   PBMSResultRec result;
00341   
00342   if (MSEngine::enterConnectionNoThd(&self, &result))
00343     return;
00344   try_(a) {
00345     MSDatabase::wakeTempLogThreads();
00346   }
00347   
00348   catch_(a);
00349   cont_(a);
00350 }
00351 //----------
00352 static int table_list_validate(Session*, set_var *var)
00353 {
00354   const char *list= var->value->str_value.ptr();
00355   if (list == NULL)
00356     return 1;
00357 
00358   TableMatchState state = set_match_type(list);
00359   if (state == MATCH_ERROR)
00360     return 1;
00361     
00362   std::string new_list(list);
00363 
00364   my_table_list_lock.lock();
00365   my_table_list.swap(new_list);
00366   my_table_match = state;
00367   my_table_list_lock.unlock();
00368 
00369   return 0;
00370 }
00371 
00372 //----------
00373 #endif
00374 
00375 //--------------
00376 // Parameter update functions are not called for parameters that are set on
00377 // the command line. PBMSParameters::startUp() will perform any initialization required.
00378 #ifdef DRIZZLED
00379 void PBMSParameters::startUp(drizzled::module::Context &context)
00380 #else
00381 void PBMSParameters::startup()
00382 #endif
00383 { 
00384 
00385 #ifdef DRIZZLED
00386   my_table_match = set_match_type(my_table_list.c_str());
00387         const module::option_map &vm= context.getOptions();
00388   my_events_enabled= (vm.count("watch-disable")) ? false : true;
00389 
00390         context.registerVariable(new sys_var_constrained_value_readonly<in_port_t>("port",
00391                                                                          pbms_port_number));
00392         context.registerVariable(new sys_var_std_string("repository_threshold",
00393                                                         my_repository_threshold));
00394         context.registerVariable(new sys_var_std_string("temp_log_threshold",
00395                                                         my_temp_log_threshold));
00396         context.registerVariable(new sys_var_const_string("http_metadata_headers",
00397                                                           my_http_metadata_headers));
00398         context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("garbage_threshold", my_garbage_threshold));
00399   context.registerVariable(new sys_var_constrained_value<uint32_t>("temp_blob_timeout",
00400                    my_temp_blob_timeout,
00401                    temp_blob_timeout_update));
00402   context.registerVariable(new sys_var_constrained_value<uint32_t>("max_keep_alive",
00403                    my_max_keep_alive));
00404   context.registerVariable(new sys_var_constrained_value<uint32_t>("next_backup_db_id",
00405                    my_backup_db_id));
00406   context.registerVariable(new sys_var_std_string("watch_tables",
00407               my_table_list,
00408               table_list_validate));
00409   context.registerVariable(new sys_var_bool_ptr("watch_enable",
00410                   &my_events_enabled));
00411   context.registerVariable(new sys_var_constrained_value<int32_t>("before_insert_position",
00412                   my_before_insert_position));
00413   context.registerVariable(new sys_var_constrained_value<int32_t>("before_update_position",
00414                   my_before_update_position));
00415 
00416 #else
00417   my_table_match = set_match_type(my_table_list);
00418 #endif
00419 }
00420 
00421 
00422 #ifdef DRIZZLED
00423 void PBMSParameters::initOptions(drizzled::module::option_context &context)
00424 {
00425   context("port",
00426                 po::value<port_constraint>(&pbms_port_number)->default_value(DEFAULT_PBMS_PORT),
00427                 _("Port number to use for connection or 0 for default PBMS port "));
00428         context("repository-threshold",
00429                 po::value<std::string>(&my_repository_threshold)->default_value(MS_REPO_THRESHOLD_DEF),
00430                 _("The maximum size of a BLOB repository file."));
00431         context("temp-log-threshold",
00432                 po::value<std::string>(&my_temp_log_threshold)->default_value(MS_TEMP_LOG_THRESHOLD_DEF),
00433                 _("The maximum size of a temorary BLOB log file."));
00434         context("http-metadata-headers",
00435                 po::value<std::string>(&my_http_metadata_headers)->default_value(MS_HTTP_METADATA_HEADERS_DEF),
00436                 _("A ':' delimited list of metadata header names to be used to initialize "
00437                    "the pbms_metadata_header table when a database is created."));
00438         context("garbage-threshold",
00439                 po::value<percent_constraint>(&my_garbage_threshold)->default_value(MS_DEFAULT_GARBAGE_LEVEL),
00440                 _("The percentage of garbage in a repository file before it is compacted."));
00441   context("temp-blob-timeout",
00442     po::value<uint32_nonzero_constraint>(&my_temp_blob_timeout)->default_value(MS_DEFAULT_TEMP_LOG_WAIT),
00443     _("The timeout, in seconds, for temporary BLOBs. Uploaded blob data is removed after this time, unless committed to the database."));
00444   context("max-keep-alive",
00445     po::value<uint32_nonzero_constraint>(&my_temp_blob_timeout)->default_value(MS_DEFAULT_KEEP_ALIVE),
00446     _("The timeout, in milli-seconds, before the HTTP server will close an inactive HTTP connection."));
00447   context("next-backup-db-id",
00448     po::value<uint32_nonzero_constraint>(&my_backup_db_id)->default_value(1),
00449     _("The next backup ID to use when backing up a PBMS database."));
00450   context("watch-tables",
00451     po::value<std::string>(&my_table_list)->default_value("*"),
00452     _("A comma delimited list of tables to watch of the format: <database>.<table>, ..."));
00453   context("watch-disable",
00454     _("Enable PBMS daemon Insert/Update/Delete event scanning"));
00455 
00456   context("before-insert-position",
00457     po::value<before_position_constraint>(&my_before_insert_position)->default_value(1),
00458     _("Before insert row event observer call position"));
00459 
00460   context("before-update-position",
00461     po::value<before_position_constraint>(&my_before_update_position)->default_value(1),
00462     _("Before update row event observer call position"));
00463 
00464 }
00465 #endif
00466 
00467 //-----------------
00468 bool PBMSParameters::isBlackListedDB(const char *db)
00469 {
00470   if (my_black_list.find(string(db)) == my_black_list.end())
00471     return false;
00472     
00473   return true;
00474 }   
00475 
00476 //-----------------
00477 void PBMSParameters::blackListedDB(const char *db)
00478 {
00479   my_black_list.insert(string(db));
00480 }   
00481 
00482 //-----------------
00483 bool PBMSParameters::try_LocateDB(CSThread *self, const char *db, bool *found)
00484 {
00485   volatile bool rtc = true;
00486   try_(a) {
00487     lock_(&my_table_list_lock); 
00488     
00489       
00490     *found = (locate_db(my_table_list.c_str(), db, strlen(db)) != NULL);
00491       
00492     unlock_(&my_table_list_lock);
00493     rtc = false;
00494   }
00495   
00496   catch_(a)
00497   cont_(a);
00498   return rtc;
00499 }
00500 
00501 //-----------------
00502 bool PBMSParameters::isBLOBDatabase(const char *db)
00503 {
00504   CSThread *self= NULL;
00505   int   err;
00506   PBMSResultRec result;
00507   bool found = false;
00508   
00509   if (isBlackListedDB(db))
00510     return false;
00511     
00512   if (my_table_match == MATCH_UNKNOWN)
00513   {
00514     try_(a) {
00515       lock_(&my_table_list_lock); 
00516       my_table_match = set_match_type(my_table_list.c_str());
00517       unlock_(&my_table_list_lock);
00518     }
00519 
00520     catch_(a)
00521     cont_(a);
00522   }
00523 
00524   if (my_table_match == MATCH_NONE)
00525     return false;
00526 
00527   if (my_table_match <= MATCH_DBS)
00528     return true;
00529   
00530   if ((err = MSEngine::enterConnectionNoThd(&self, &result)) == 0) {
00531 
00532     inner_();
00533     if (try_LocateDB(self, db, &found)) {
00534       err = MSEngine::exceptionToResult(&self->myException, &result);
00535     }   
00536     outer_();
00537   
00538   }
00539   
00540   if (err) {
00541     fprintf(stderr, "PBMSParameters::isBLOBDatabase(\"%s\") error (%d):'%s'\n", 
00542       db, result.mr_code,  result.mr_message);
00543   }
00544   
00545   return found;
00546 }
00547   
00548 //-----------------
00549 bool PBMSParameters::try_LocateTable(CSThread *self, const char *db, const char *table, bool *found)
00550 {
00551   volatile bool rtc = true;
00552   try_(a) {
00553     int db_len, table_len, match_len;
00554     
00555     lock_(&my_table_list_lock); 
00556         
00557     db_len = strlen(db);
00558     table_len = strlen(table);
00559     
00560     const char *ptr = my_table_list.c_str();
00561     while (ptr) {
00562       ptr = locate_db(ptr, db, db_len);
00563       if (ptr) {
00564         match_len = 0;
00565         if (*ptr == '*')
00566           match_len = 1;
00567         else if (strncmp(ptr, table, table_len) == 0)
00568           match_len = table_len;
00569           
00570         if (match_len) {
00571           ptr += match_len;
00572           if ((!*ptr) || (*ptr == ',') || isspace(*ptr)) {
00573             *found = true;
00574             break;
00575           }
00576         }
00577         
00578         NEXT_IN_TABLE_LIST(ptr);
00579       }
00580     }
00581       
00582     unlock_(&my_table_list_lock);
00583     rtc = false;
00584   }
00585   
00586   catch_(a)
00587   cont_(a);
00588   return rtc;
00589 }
00590 
00591 //-----------------
00592 bool PBMSParameters::isBLOBTable(const char *db, const char *table)
00593 {
00594   CSThread *self= NULL;
00595   int   err;
00596   PBMSResultRec result;
00597   bool found = false;
00598   
00599   if (isBlackListedDB(db))
00600     return false;
00601     
00602   if (my_table_match == MATCH_UNKNOWN)
00603   {
00604     try_(a) {
00605       lock_(&my_table_list_lock); 
00606       my_table_match = set_match_type(my_table_list.c_str());
00607       unlock_(&my_table_list_lock);
00608     }
00609 
00610     catch_(a)
00611     cont_(a);
00612   }
00613 
00614   if (my_table_match == MATCH_NONE)
00615     return false;
00616 
00617   if (my_table_match <= MATCH_ALL)
00618     return true;
00619 
00620   if ((err = MSEngine::enterConnectionNoThd(&self, &result)) == 0) {
00621 
00622     inner_();
00623     if (try_LocateTable(self, db, table, &found)) {
00624       err = MSEngine::exceptionToResult(&self->myException, &result);
00625     }   
00626     outer_();
00627   
00628   }
00629   
00630   if (err) {
00631     fprintf(stderr, "PBMSParameters::isBLOBTable(\"%s\", \"%s\") error (%d):'%s'\n", 
00632       db, table, result.mr_code,  result.mr_message);
00633   }
00634   
00635   return found;
00636 }
00637 
00638 
00639 //-----------------
00640 int32_t PBMSParameters::getBeforeUptateEventPosition() { return static_cast<int32_t>(my_before_update_position);}
00641 
00642 //-----------------
00643 int32_t PBMSParameters::getBeforeInsertEventPosition() { return static_cast<int32_t>(my_before_insert_position);}
00644 #endif // DRIZZLED
00645 
00646 //-----------------
00647 #ifndef DRIZZLED
00648 static void pbms_temp_blob_timeout_func(THD *thd, struct st_mysql_sys_var *var, void *trg, CONST_SAVE void *save)
00649 {
00650   CSThread    *self;
00651   PBMSResultRec result;
00652 
00653   (void)thd;
00654   (void)var;
00655   
00656   *(u_long *)trg= *(u_long *) save;
00657   
00658   if (MSEngine::enterConnectionNoThd(&self, &result))
00659     return;
00660   try_(a) {
00661     MSDatabase::wakeTempLogThreads();
00662   }
00663   
00664   catch_(a);
00665   cont_(a);
00666 }
00667 #endif
00668 //-----------------
00669 //-----------------
00670 
00671 #ifndef DRIZZLED
00672 
00673 static MYSQL_SYSVAR_UINT(port, pbms_port_number,
00674   PLUGIN_VAR_READONLY,
00675   "The port for the server stream-based communications.",
00676   NULL, NULL, PBMS_PORT, 0, 64*1024, 1);
00677 
00678 static MYSQL_SYSVAR_STR(repository_threshold, my_repository_threshold,
00679   PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_MEMALLOC,
00680   "The maximum size of a BLOB repository file.",
00681   NULL, NULL, MS_REPO_THRESHOLD_DEF);
00682 
00683 static MYSQL_SYSVAR_STR(temp_log_threshold, my_temp_log_threshold,
00684   PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_MEMALLOC,
00685   "The maximum size of a temorary BLOB log file.",
00686   NULL, NULL, MS_TEMP_LOG_THRESHOLD_DEF);
00687 
00688 static MYSQL_SYSVAR_STR(http_metadata_headers, my_http_metadata_headers,
00689   PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
00690   "A ':' delimited list of metadata header names to be used to initialize the pbms_metadata_header table when a database is created.",
00691   NULL, NULL , MS_HTTP_METADATA_HEADERS_DEF);
00692 
00693 static MYSQL_SYSVAR_ULONG(temp_blob_timeout, my_temp_blob_timeout,
00694   PLUGIN_VAR_OPCMDARG,
00695   "The timeout, in seconds, for temporary BLOBs. Uploaded blob data is removed after this time, unless committed to the database.",
00696   NULL, pbms_temp_blob_timeout_func, MS_DEFAULT_TEMP_LOG_WAIT, 1, ~0L, 1);
00697 
00698 static MYSQL_SYSVAR_ULONG(garbage_threshold, my_garbage_threshold,
00699   PLUGIN_VAR_OPCMDARG,
00700   "The percentage of garbage in a repository file before it is compacted.",
00701   NULL, NULL, MS_DEFAULT_GARBAGE_LEVEL, 0, 100, 1);
00702 
00703 
00704 static MYSQL_SYSVAR_ULONG(max_keep_alive, my_max_keep_alive,
00705   PLUGIN_VAR_OPCMDARG,
00706   "The timeout, in milli-seconds, before the HTTP server will close an inactive HTTP connection.",
00707   NULL, NULL, MS_DEFAULT_KEEP_ALIVE, 1, UINT32_MAX, 1);
00708 
00709 static MYSQL_SYSVAR_ULONG(next_backup_db_id, my_backup_db_id,
00710   PLUGIN_VAR_OPCMDARG,
00711   "The next backup ID to use when backing up a PBMS database.",
00712   NULL, NULL, 1, 1, UINT32_MAX, 1);
00713 
00714 struct st_mysql_sys_var* pbms_system_variables[] = {
00715   MYSQL_SYSVAR(port),
00716   MYSQL_SYSVAR(repository_threshold),
00717   MYSQL_SYSVAR(temp_log_threshold),
00718   MYSQL_SYSVAR(temp_blob_timeout),
00719   MYSQL_SYSVAR(garbage_threshold),
00720   MYSQL_SYSVAR(http_metadata_headers),
00721   MYSQL_SYSVAR(max_keep_alive),
00722   MYSQL_SYSVAR(next_backup_db_id),
00723   NULL
00724 };
00725 
00726 #endif // !DRIZZLED
00727 
00728 
00729 // vim:noexpandtab:sts=8:sw=8:tabstop=8:smarttab: