1
/* Copyright (c) 2008 PrimeBase Technologies GmbH, Germany
3
* PrimeBase Media Stream for MySQL
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
* Original author: Paul McCullagh
20
* Continued development: Barry Leslie
30
#ifdef USE_PRAGMA_IMPLEMENTATION
31
#pragma implementation // gcc: Class implementation
35
#include <drizzled/server_includes.h>
36
#include <drizzled/handler.h>
37
#include <drizzled/table.h>
38
#include <drizzled/current_session.h>
39
#include <drizzled/plugin/storage_engine.h>
40
#include <drizzled/plugin.h>
42
#define my_strdup(a,b) strdup(a)
46
#include <drizzled/common_server.h>
47
#include <drizzled/data_home.h>
48
#include <drizzled/error.h>
49
#include <drizzled/handler.h>
50
#include <drizzled/plugin/storage_engine.h>
55
#include "mysql_priv.h"
56
#include <mysql/plugin.h>
70
#include "CSStrUtil.h"
74
#include "Engine_ms.h"
76
#include "Network_ms.h"
77
#include "ConnectionHandler_ms.h"
78
#include "OpenTable_ms.h"
79
#include "Database_ms.h"
80
#include "TempLog_ms.h"
82
#include "SystemTable_ms.h"
84
#include "Discover_ms.h"
85
#include "metadata_ms.h"
86
#include "Transaction_ms.h"
87
#include "SysTab_httpheader.h"
89
/* Note: 'new' used here is NOT CSObject::new which is a DEBUG define*/
95
#define PBMS_PORT 8080
98
static int pbms_port = PBMS_PORT;
99
static char *pbms_repository_threshold;
100
static char *pbms_temp_log_threshold;
101
static char *pbms_http_metadata_headers;
104
class PBMSTableNameIterator: public TableNameIteratorImplementation
107
uint32_t current_name;
110
PBMSTableNameIterator(const std::string &database)
111
: TableNameIteratorImplementation(database), current_name(0)
114
int next(std::string *name);
118
int PBMSTableNameIterator::next(string *name)
120
const char *tab_name = pbms_getSysTableName(current_name++);
126
name->assign(tab_name);
132
int pbms_discover_system_tables(const char *name, drizzled::message::Table *table);
134
class PBMSStorageEngine : public StorageEngine {
136
PBMSStorageEngine(std::string name_arg)
137
: StorageEngine(name_arg, HTON_NO_FLAGS | HTON_HIDDEN, 4 /*savepoint_offset*/, false /*support_2pc*/) {}
139
int close_connection(Session *);
140
int commit(Session *, bool);
141
int rollback(Session *, bool);
142
handler *create(TABLE_SHARE *, MEM_ROOT *);
143
void drop_database(char *);
144
int savepoint_set(Session *thd, void *sv);
145
int savepoint_rollback(Session *thd, void *sv);
146
int savepoint_release(Session *thd, void *sv);
147
const char **bas_ext() const;
149
int createTableImplementation(Session*, const char *path, Table *,HA_CREATE_INFO *, drizzled::message::Table*)
151
if (pbms_is_Systable(cs_last_name_of_path(path)))
154
/* Create only works for system tables. */
155
return( HA_ERR_WRONG_COMMAND );
158
int deleteTableImplementation(Session*, const string table_name) { return 0;}
160
int getTableProtoImplementation(const char* path, drizzled::message::Table *table_proto)
162
int err = pbms_discover_system_tables(path, table_proto);
169
TableNameIteratorImplementation* tableNameIterator(const std::string &database)
171
return new PBMSTableNameIterator(database);
174
int renameTableImplementation(Session*,
175
const char *from, const char *to)
181
PBMSStorageEngine *pbms_hton;
183
handlerton *pbms_hton;
186
static const char *ha_pbms_exts[] = {
191
* ---------------------------------------------------------------
195
void pbms_take_part_in_transaction(void *thread)
198
if ((thd = (THD *) thread)) {
199
trans_register_ha(thd, true, pbms_hton);
204
const char **PBMSStorageEngine::bas_ext() const
206
const char **ha_pbms::bas_ext() const
213
int PBMSStorageEngine::close_connection(Session *thd)
215
PBMSStorageEngine * const hton = this;
217
static int pbms_close_connection(handlerton *hton, THD* thd)
222
self = CSThread::getSelf();
223
if (self && self->pbms_api_owner)
227
if ((self = (CSThread *) *thd_ha_data(thd, pbms_hton))) {
228
*thd_ha_data(thd, pbms_hton) = NULL;
229
CSThread::setSelf(self);
230
CSThread::detach(self);
234
self = CSThread::getSelf();
235
CSThread::detach(self);
240
static int pbms_enter_conn(void *thread, CSThread **r_self, PBMSResultPtr result)
245
self = CSThread::getSelf();
247
if ((thd = (THD *) thread)) {
248
if (!(self = (CSThread *) *thd_ha_data(((THD *) thd), pbms_hton))) {
249
if (!(self = CSThread::newCSThread()))
250
return pbms_os_error_result(CS_CONTEXT, ENOMEM, result);
251
if (!CSThread::attach(self))
252
return pbms_exception_to_result(&self->myException, result);
253
*thd_ha_data(thd, pbms_hton) = self;
256
if (!CSThread::setSelf(self))
257
return pbms_exception_to_result(&self->myException, result);
261
if (!(self = CSThread::newCSThread()))
262
return pbms_os_error_result(CS_CONTEXT, ENOMEM, result);
263
if (!CSThread::attach(self))
264
return pbms_exception_to_result(&self->myException, result);
271
int pbms_enter_conn_no_thd(CSThread **r_self, PBMSResultPtr result)
273
return pbms_enter_conn(current_thd, r_self, result);
276
void pbms_exit_conn()
278
THD *thd = (THD *) current_thd;
281
self = CSThread::getSelf();
282
if (self && self->pbms_api_owner)
287
CSThread::setSelf(NULL);
289
self = CSThread::getSelf();
290
CSThread::detach(self);
294
int pbms_exception_to_result(CSException *e, PBMSResultPtr result)
296
const char *context, *trace;
298
result->mr_code = e->getErrorCode();
299
cs_strcpy(MS_RESULT_MESSAGE_SIZE, result->mr_message, e->getMessage());
300
context = e->getContext();
301
trace = e->getStackTrace();
302
if (context && *context) {
303
cs_strcpy(MS_RESULT_STACK_SIZE, result->mr_stack, context);
305
cs_strcat(MS_RESULT_STACK_SIZE, result->mr_stack, "\n");
308
*result->mr_stack = 0;
310
cs_strcat(MS_RESULT_STACK_SIZE, result->mr_stack, trace);
311
return MS_ERR_ENGINE;
314
int pbms_os_error_result(const char *func, const char *file, int line, int err, PBMSResultPtr result)
318
e.initOSError(func, file, line, err);
319
return pbms_exception_to_result(&e, result);
322
int pbms_error_result(const char *func, const char *file, int line, int err, const char *message, PBMSResultPtr result)
326
e.initException(func, file, line, err, message);
327
return pbms_exception_to_result(&e, result);
331
* ---------------------------------------------------------------
337
handler *PBMSStorageEngine::create(TABLE_SHARE *table, MEM_ROOT *mem_root)
339
PBMSStorageEngine * const hton = this;
341
static handler *pbms_create_handler(handlerton *hton, TABLE_SHARE *table, MEM_ROOT *mem_root)
344
return new (mem_root) ha_pbms(hton, table);
348
int PBMSStorageEngine::commit(Session *thd, bool all)
350
PBMSStorageEngine * const hton = this;
352
static int pbms_commit(handlerton *hton, THD *thd, bool all)
357
PBMSResultRec result;
359
if (pbms_enter_conn_no_thd(&self, &result))
363
MSTransactionManager::commit();
366
err = pbms_exception_to_result(&self->myException, &result);
373
int PBMSStorageEngine::rollback(Session *thd, bool all)
375
PBMSStorageEngine * const hton = this;
377
static int pbms_rollback(handlerton *hton, THD *thd, bool all)
382
PBMSResultRec result;
384
if (pbms_enter_conn_no_thd(&self, &result))
388
MSTransactionManager::rollback();
391
err = pbms_exception_to_result(&self->myException, &result);
398
int PBMSStorageEngine::savepoint_set(Session *thd, void *sv)
400
PBMSStorageEngine * const hton = this;
402
static int pbms_savepoint_set(handlerton *hton, THD *thd, void *sv)
407
PBMSResultRec result;
409
if (pbms_enter_conn_no_thd(&self, &result))
412
*((uint32_t*)sv) = self->myStmtCount;
417
int PBMSStorageEngine::savepoint_rollback(Session *thd, void *sv)
419
PBMSStorageEngine * const hton = this;
421
static int pbms_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
426
PBMSResultRec result;
428
if (pbms_enter_conn_no_thd(&self, &result))
432
MSTransactionManager::rollbackTo(*((uint32_t*)sv));
435
err = pbms_exception_to_result(&self->myException, &result);
442
int PBMSStorageEngine::savepoint_release(Session *thd, void *sv)
444
PBMSStorageEngine * const hton = this;
446
static int pbms_savepoint_release(handlerton *hton, THD *thd, void *sv)
454
void PBMSStorageEngine::drop_database(char *path)
456
PBMSStorageEngine * const hton = this;
458
static void pbms_drop_database(handlerton *hton, char *path)
462
char db_name[PATH_MAX];
463
PBMSResultRec result;
465
if (pbms_enter_conn_no_thd(&self, &result))
469
cs_strcpy(PATH_MAX, db_name, cs_last_directory_of_path(path));
470
cs_remove_dir_char(db_name);
472
MSDatabase::dropDatabase(db_name);
475
self->logException();
480
static bool pbms_started = false;
484
static int pbms_init_func(drizzled::plugin::Registry ®istry)
486
int pbms_discover_system_tables(handlerton *hton, THD* thd, const char *db, const char *name, uchar **frmblob, size_t *frmlen);
487
static int pbms_init_func(void *p)
490
PBMSResultRec result;
495
ASSERT(!pbms_started);
496
pbms_started = false;
498
MSDatabase::gRepoThreshold = (uint64_t) cs_byte_size_to_int8(pbms_repository_threshold);
499
MSDatabase::gTempLogThreshold = (uint64_t) cs_byte_size_to_int8(pbms_temp_log_threshold);
503
snprintf(info, 120, "PrimeBase Media Stream (PBMS) Daemon %s loaded...", ms_version());
504
CSL.logLine(NULL, CSLog::Protocol, info);
506
CSL.logLine(NULL, CSLog::Protocol, "Barry Leslie, PrimeBase Technologies GmbH, http://www.primebase.org");
508
if ((err = MSEngine::startUp(&result))) {
509
CSL.logLine(NULL, CSLog::Error, result.mr_message);
514
pbms_hton= new PBMSStorageEngine(std::string("PBMS"));
515
registry.add(pbms_hton);
517
pbms_hton = (handlerton *) p;
518
pbms_hton->state = SHOW_OPTION_YES;
519
pbms_hton->close_connection = pbms_close_connection; /* close_connection, cleanup thread related data. */
520
pbms_hton->create = pbms_create_handler;
521
pbms_hton->flags = HTON_CAN_RECREATE | HTON_HIDDEN;
522
pbms_hton->drop_database = pbms_drop_database; /* Drop a database */
523
pbms_hton->discover = pbms_discover_system_tables;
525
pbms_hton->commit = pbms_commit; /* commit */
526
pbms_hton->rollback = pbms_rollback; /* rollback */
528
pbms_hton->savepoint_offset = 4;
529
pbms_hton->savepoint_set = pbms_savepoint_set;
530
pbms_hton->savepoint_rollback = pbms_savepoint_rollback;
531
pbms_hton->savepoint_release = pbms_savepoint_release;
534
/* Startup the Media Stream network: */
537
if (!(thread = CSThread::newCSThread())) {
538
CSException::logOSError(CS_CONTEXT, ENOMEM);
541
if (!CSThread::attach(thread)) {
542
thread->myException.log(NULL);
543
CSThread::shutDown();
545
MSEngine::shutDown();
550
thread->threadName = CSString::newString("startup");
552
MSDatabase::startUp(pbms_http_metadata_headers);
553
MSTableList::startUp();
554
MSSystemTableShare::startUp();
555
MSNetwork::startUp(pbms_port);
556
MSTransactionManager::startUp();
557
MSNetwork::startNetwork();
560
self->logException();
566
MSNetwork::shutDown();
567
MSTransactionManager::shutDown();
568
MSSystemTableShare::shutDown();
569
MSDatabase::stopThreads();
570
MSTableList::shutDown();
571
MSDatabase::shutDown();
572
CSThread::shutDown();
575
self->logException();
580
CSThread::detach(thread);
584
MSEngine::shutDown();
596
static int pbms_done_func(drizzled::plugin::Registry ®istry)
598
static int pbms_done_func(void *)
606
CSL.logLine(NULL, CSLog::Protocol, "PrimeBase Media Stream (PBMS) Daemon shutdown...");
608
/* Shutdown the Media Stream network. */
609
if (!(thread = CSThread::newCSThread()))
610
CSException::logOSError(CS_CONTEXT, ENOMEM);
611
else if (!CSThread::attach(thread))
612
thread->myException.log(NULL);
616
thread->threadName = CSString::newString("shutdown");
617
MSNetwork::shutDown();
618
MSSystemTableShare::shutDown();
619
/* Ensure that the database threads are stopped before
620
* freeing the tables.
622
MSDatabase::stopThreads();
623
MSTableList::shutDown();
624
/* Databases must be shutdown after table because tables
625
* have references to repositories.
627
MSDatabase::shutDown();
629
/* Shutdown the transaction manager after the databases
630
* incase they want to commit or rollback a transaction.
632
MSTransactionManager::shutDown();
635
self->logException();
639
CSThread::shutDown();
640
CSThread::detach(thread);
643
MSEngine::shutDown();
646
CSL.logLine(NULL, CSLog::Protocol, "PrimeBase Media Stream (PBMS) Daemon shutdown completed");
647
pbms_started = false;
649
registry.remove(pbms_hton);
654
ha_pbms::ha_pbms(handlerton *hton, TABLE_SHARE *table_arg):
655
handler(hton, table_arg),
659
memset(&ha_result, 0, sizeof(PBMSResultRec));
662
MX_TABLE_TYPES_T ha_pbms::table_flags() const
665
/* We need this flag because records are not packed
666
* into a table which means #ROWID != offset
670
#if MYSQL_VERSION_ID > 50119
671
/* We can do row logging, but not statement, because
672
* MVCC is not serializable!
674
HA_BINLOG_ROW_CAPABLE |
677
* Auto-increment is allowed on a partial key.
682
int ha_pbms::open(const char *table_path, int mode, uint test_if_locked)
686
if ((ha_error = pbms_enter_conn(current_thd, &self, &ha_result)))
691
ha_open_tab = MSSystemTableShare::openSystemTable(table_path, table);
692
thr_lock_data_init(&ha_open_tab->myShare->myThrLock, &ha_lock, NULL);
693
ref_length = ha_open_tab->getRefLen();
696
ha_error = pbms_exception_to_result(&self->myException, &ha_result);
699
return_(ha_error != MS_OK);
702
int ha_pbms::close(void)
706
if ((ha_error = pbms_enter_conn(current_thd, &self, &ha_result)))
711
ha_open_tab->release();
720
/* Index access functions: */
721
int ha_pbms::index_init(uint idx, bool sorted __attribute__((unused)))
726
ha_open_tab->index_init(idx);
729
ha_error = pbms_exception_to_result(&self->myException, &ha_result);
737
int ha_pbms::index_end()
742
ha_open_tab->index_end();
745
ha_error = pbms_exception_to_result(&self->myException, &ha_result);
753
int ha_pbms::index_read(byte * buf, const byte * key,
754
uint key_len, enum ha_rkey_function find_flag)
759
if (!ha_open_tab->index_read(buf, key, key_len, find_flag))
760
err = HA_ERR_KEY_NOT_FOUND;
764
ha_error = pbms_exception_to_result(&self->myException, &ha_result);
772
int ha_pbms::index_read_idx(byte * buf, uint idx, const byte * key,
773
uint key_len, enum ha_rkey_function find_flag)
778
if (!ha_open_tab->index_read_idx(buf, idx, key, key_len, find_flag))
779
err = HA_ERR_KEY_NOT_FOUND;
782
ha_error = pbms_exception_to_result(&self->myException, &ha_result);
790
int ha_pbms::index_next(byte * buf)
795
if (!ha_open_tab->index_next(buf))
796
err = HA_ERR_END_OF_FILE;
799
ha_error = pbms_exception_to_result(&self->myException, &ha_result);
807
int ha_pbms::index_prev(byte * buf)
812
if (!ha_open_tab->index_prev(buf))
813
err = HA_ERR_END_OF_FILE;
816
ha_error = pbms_exception_to_result(&self->myException, &ha_result);
824
int ha_pbms::index_first(byte * buf)
829
if (!ha_open_tab->index_first(buf))
830
err = HA_ERR_END_OF_FILE;
833
ha_error = pbms_exception_to_result(&self->myException, &ha_result);
841
int ha_pbms::index_last(byte * buf)
846
if (!ha_open_tab->index_last(buf))
847
err = HA_ERR_END_OF_FILE;
850
ha_error = pbms_exception_to_result(&self->myException, &ha_result);
858
int ha_pbms::index_read_last(byte * buf, const byte * key, uint key_len)
863
if (!ha_open_tab->index_read_last(buf, key, key_len))
864
err = HA_ERR_KEY_NOT_FOUND;
867
ha_error = pbms_exception_to_result(&self->myException, &ha_result);
876
#endif // PBMS_HAS_KEYS
878
/* Sequential scan functions: */
879
int ha_pbms::rnd_init(bool scan)
884
ha_open_tab->seqScanInit();
887
ha_error = pbms_exception_to_result(&self->myException, &ha_result);
895
int ha_pbms::rnd_next(unsigned char *buf)
900
if (!ha_open_tab->seqScanNext((char *) buf))
901
err = HA_ERR_END_OF_FILE;
904
ha_error = pbms_exception_to_result(&self->myException, &ha_result);
912
void ha_pbms::position(const unsigned char *record)
914
ha_open_tab->seqScanPos((uint8_t *) ref);
918
int ha_pbms::rnd_pos(unsigned char * buf, unsigned char *pos)
923
ha_open_tab->seqScanRead((uint8_t *) pos, (char *) buf);
926
ha_error = pbms_exception_to_result(&self->myException, &ha_result);
933
//////////////////////////////
934
int ha_pbms::write_row(unsigned char * buf)
939
ha_open_tab->insertRow((char *) buf);
942
ha_error = pbms_exception_to_result(&self->myException, &ha_result);
949
int ha_pbms::delete_row(const unsigned char * buf)
954
ha_open_tab->deleteRow((char *) buf);
957
ha_error = pbms_exception_to_result(&self->myException, &ha_result);
964
int ha_pbms::update_row(const unsigned char * old_data, unsigned char * new_data)
969
ha_open_tab->updateRow((char *) old_data, (char *) new_data);
972
ha_error = pbms_exception_to_result(&self->myException, &ha_result);
979
int ha_pbms::info(uint flag)
984
int ha_pbms::external_lock(THD *thd, int lock_type)
989
if ((ha_error = pbms_enter_conn(thd, &self, &ha_result)))
994
if (lock_type == F_UNLCK)
995
ha_open_tab->unuse();
1000
ha_error = pbms_exception_to_result(&self->myException, &ha_result);
1007
THR_LOCK_DATA **ha_pbms::store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type)
1009
if (lock_type != TL_IGNORE && ha_lock.type == TL_UNLOCK)
1010
ha_lock.type = lock_type;
1016
int ha_pbms::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_info)
1018
if (pbms_is_Systable(cs_last_name_of_path(name)))
1021
/* Create only works for system tables. */
1022
return( HA_ERR_WRONG_COMMAND );
1026
bool ha_pbms::get_error_message(int error, String *buf)
1028
if (!ha_result.mr_code)
1031
buf->copy(ha_result.mr_message, strlen(ha_result.mr_message), system_charset_info);
1037
struct st_mysql_storage_engine pbms_engine_handler = {
1038
MYSQL_HANDLERTON_INTERFACE_VERSION
1042
struct st_mysql_sys_var
1044
MYSQL_PLUGIN_VAR_HEADER;
1047
#if MYSQL_VERSION_ID < 60000
1048
#if MYSQL_VERSION_ID >= 50124
1049
#define USE_CONST_SAVE
1052
#if MYSQL_VERSION_ID >= 60005
1053
#define USE_CONST_SAVE
1057
#ifdef USE_CONST_SAVE
1058
static void pbms_repository_threshold_func(THD *thd, struct st_mysql_sys_var *var, void *tgt, const void *save)
1060
static void pbms_repository_threshold_func(THD *thd, struct st_mysql_sys_var *var, void *tgt, void *save)
1063
char *old= *(char **) tgt;
1064
*(char **)tgt= *(char **) save;
1065
if (var->flags & PLUGIN_VAR_MEMALLOC)
1067
*(char **)tgt= my_strdup(*(char **) save, MYF(0));
1068
my_free(old, MYF(0));
1070
MSDatabase::gRepoThreshold = (uint64_t) cs_byte_size_to_int8(pbms_repository_threshold);
1074
snprintf(buffer, 200, "pbms_repository_threshold=%"PRIu64"\n", MSDatabase::gRepoThreshold);
1075
CSL.log(NULL, CSLog::Protocol, buffer);
1079
#ifdef USE_CONST_SAVE
1080
static void pbms_temp_log_threshold_func(THD *thd, struct st_mysql_sys_var *var, void *tgt, const void *save)
1082
static void pbms_temp_log_threshold_func(THD *thd, struct st_mysql_sys_var *var, void *tgt, void *save)
1085
char *old= *(char **) tgt;
1086
*(char **)tgt= *(char **) save;
1087
if (var->flags & PLUGIN_VAR_MEMALLOC)
1089
*(char **)tgt= my_strdup(*(char **) save, MYF(0));
1090
my_free(old, MYF(0));
1092
MSDatabase::gTempLogThreshold = (uint64_t) cs_byte_size_to_int8(pbms_temp_log_threshold);
1096
snprintf(buffer, 200, "pbms_temp_log_threshold=%"PRIu64"\n",MSDatabase::gTempLogThreshold);
1097
CSL.log(NULL, CSLog::Protocol, buffer);
1101
#ifdef USE_CONST_SAVE
1102
static void pbms_http_metadata_headers_func(THD *thd, struct st_mysql_sys_var *var, void *tgt, const void *save)
1104
static void pbms_http_metadata_headers_func(THD *thd, struct st_mysql_sys_var *var, void *tgt, void *save)
1107
char *old= *(char **) tgt;
1108
*(char **)tgt= *(char **) save;
1109
if (var->flags & PLUGIN_VAR_MEMALLOC)
1111
*(char **)tgt= my_strdup(*(char **) save, MYF(0));
1112
my_free(old, MYF(0));
1115
MSHTTPHeaderTable::setDefaultMetaDataHeaders(pbms_http_metadata_headers);
1120
snprintf(buffer, 200, "pbms_http_metadata_headers=%"PRIu64"\n", pbms_http_metadata_headers);
1121
CSL.log(NULL, CSLog::Protocol, buffer);
1125
#ifdef USE_CONST_SAVE
1126
static void pbms_temp_blob_timeout_func(THD *thd, struct st_mysql_sys_var *var, void *tgt, const void *save)
1128
static void pbms_temp_blob_timeout_func(THD *thd, struct st_mysql_sys_var *var, void *tgt, void *save)
1132
PBMSResultRec result;
1134
*(long *)tgt= *(long *) save;
1136
if (pbms_enter_conn(thd, &self, &result))
1138
MSDatabase::wakeTempLogThreads();
1141
#if MYSQL_VERSION_ID >= 50118
1142
static MYSQL_SYSVAR_INT(port, pbms_port,
1143
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
1144
"The port for the server stream-based communications.",
1145
NULL, NULL, pbms_port, 0, 64*1024, 1);
1147
static MYSQL_SYSVAR_STR(repository_threshold, pbms_repository_threshold,
1148
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_MEMALLOC,
1149
"The maximum size of a BLOB repository file.",
1150
NULL, /*NULL*/ /**/pbms_repository_threshold_func/**/, MS_REPO_THRESHOLD_DEF);
1152
static MYSQL_SYSVAR_STR(temp_log_threshold, pbms_temp_log_threshold,
1153
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_MEMALLOC,
1154
"The maximum size of a temorary BLOB log file.",
1155
NULL, /*NULL*/ /**/pbms_temp_log_threshold_func/**/, MS_TEMP_LOG_THRESHOLD_DEF);
1157
static MYSQL_SYSVAR_STR(http_metadata_headers, pbms_http_metadata_headers,
1158
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_MEMALLOC,
1159
"A ':' delimited list of metadata header names to be used to initialize the pbms_metadata_header table when a database is created.",
1160
NULL, /*NULL*/ /**/pbms_http_metadata_headers_func/**/, MS_HTTP_METADATA_HEADERS_DEF);
1162
static MYSQL_SYSVAR_ULONG(temp_blob_timeout, MSTempLog::gTempBlobTimeout,
1163
PLUGIN_VAR_OPCMDARG,
1164
"The timeout, in seconds, for temporary BLOBs. Uploaded blob data is removed after this time, unless committed to the database.",
1165
NULL, pbms_temp_blob_timeout_func, MS_DEFAULT_TEMP_LOG_WAIT, 1, ~0L, 1);
1167
static MYSQL_SYSVAR_INT(garbage_threshold, MSRepository::gGarbageThreshold,
1168
PLUGIN_VAR_OPCMDARG,
1169
"The percentage of garbage in a repository file before it is compacted.",
1170
NULL, NULL, MS_DEFAULT_GARBAGE_LEVEL, 0, 100, 1);
1173
static MYSQL_SYSVAR_INT(max_keep_alive, MSConnectionHandler::gMaxKeepAlive,
1174
PLUGIN_VAR_OPCMDARG,
1175
"The timeout, in milli-seconds, before the HTTP server will close an inactive HTTP connection.",
1176
NULL, NULL, MS_DEFAULT_KEEP_ALIVE, 1, INT32_MAX, 1);
1178
static struct st_mysql_sys_var* pbms_system_variables[] = {
1180
MYSQL_SYSVAR(repository_threshold),
1181
MYSQL_SYSVAR(temp_log_threshold),
1182
MYSQL_SYSVAR(temp_blob_timeout),
1183
MYSQL_SYSVAR(garbage_threshold),
1184
MYSQL_SYSVAR(http_metadata_headers),
1185
MYSQL_SYSVAR(max_keep_alive),
1191
drizzle_declare_plugin(pbms)
1193
mysql_declare_plugin(pbms)
1197
MYSQL_STORAGE_ENGINE_PLUGIN,
1198
&pbms_engine_handler,
1204
"Barry Leslie, PrimeBase Technologies GmbH",
1205
"The Media Stream daemon for MySQL",
1207
pbms_init_func, /* Plugin Init */
1208
pbms_done_func, /* Plugin Deinit */
1212
NULL, /* status variables */
1213
#if MYSQL_VERSION_ID >= 50118
1214
pbms_system_variables, /* system variables */
1218
NULL /* config options */
1221
drizzle_declare_plugin_end;
1223
mysql_declare_plugin_end;