~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/parameters_ms.cc

Merge to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2010 PrimeBase Technologies GmbH, Germany
 
1
/* Copyright (c) 2010 PrimeBase Technologies GmbH, Germany
2
2
 *
3
3
 * PrimeBase Media Stream for MySQL
4
4
 *
14
14
 *
15
15
 * You should have received a copy of the GNU General Public License
16
16
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
18
 *
19
19
 * Barry Leslie
20
20
 *
30
30
#include <drizzled/common.h>
31
31
#include <drizzled/plugin.h>
32
32
#include <drizzled/session.h>
33
 
 
 
33
using namespace drizzled;
 
34
using namespace drizzled::plugin;
34
35
 
35
36
#define my_strdup(a,b) strdup(a)
36
37
 
43
44
#endif 
44
45
 
45
46
#include <inttypes.h>
46
 
#include <string.h>
47
47
 
48
48
#include "cslib/CSDefs.h"
49
49
#include "cslib/CSObject.h"
57
57
#include "database_ms.h"
58
58
#include "parameters_ms.h"
59
59
 
60
 
using namespace std;
61
 
using namespace drizzled;
62
 
using namespace drizzled::plugin;
63
 
 
64
 
#include <drizzled/module/option_map.h>
65
 
#include <boost/program_options.hpp>
66
 
namespace po= boost::program_options;
67
60
#ifndef PBMS_PORT
68
61
#define PBMS_PORT 8080
69
62
#endif
70
63
 
71
 
/* Note: 'new' used here is NOT CSObject::new which is a DEBUG define*/
72
 
#ifdef new
73
 
#undef new
74
 
#endif
75
 
 
76
 
 
77
 
#ifdef DRIZZLED
78
 
static port_constraint pbms_port_number;
79
 
 
80
 
static std::string my_repository_threshold;
81
 
static std::string my_temp_log_threshold;
82
 
static std::string my_http_metadata_headers;
83
 
 
84
 
typedef drizzled::constrained_check<uint32_t, 100, 0> percent_constraint;
85
 
static percent_constraint my_garbage_threshold;
86
 
static uint32_nonzero_constraint my_temp_blob_timeout;
87
 
static uint32_nonzero_constraint my_max_keep_alive;
88
 
static uint32_nonzero_constraint my_backup_db_id;
89
 
 
90
 
static uint32_t my_server_id = 1;
91
 
#else
92
 
uint32_t pbms_port_number;
 
64
 
 
65
static int my_port_number = PBMS_PORT;
93
66
 
94
67
static char             *my_repository_threshold = NULL;
95
68
static char             *my_temp_log_threshold = NULL;
101
74
 
102
75
static u_long   my_backup_db_id = 1;
103
76
static uint32_t my_server_id = 1;
104
 
#endif
105
77
 
106
78
#ifdef DRIZZLED
107
79
static set<string> my_black_list;
109
81
static CSMutex my_table_list_lock;
110
82
 
111
83
typedef enum {MATCH_ALL, MATCH_DBS, MATCH_SOME, MATCH_NONE, MATCH_UNKNOWN, MATCH_ERROR} TableMatchState;
112
 
static std::string my_table_list;
 
84
static char *my_table_list = NULL;
 
85
static const char *dflt_my_table_list = "*";
113
86
 
114
87
static TableMatchState my_table_match = MATCH_UNKNOWN;
115
88
 
116
 
typedef constrained_check<int32_t, INT32_MAX-1, 1> before_position_constraint;
117
 
static before_position_constraint my_before_insert_position;      // Call this event observer first.
118
 
static before_position_constraint my_before_update_position;
 
89
static int32_t my_before_insert_position= 1;      // Call this event observer first.
 
90
static int32_t my_before_update_position= 1;
119
91
 
120
92
using namespace drizzled;
121
93
using namespace drizzled::plugin;
149
121
#endif
150
122
 
151
123
//--------------
152
 
uint32_t PBMSParameters::getPortNumber(){ return pbms_port_number;}
 
124
uint32_t PBMSParameters::getPortNumber(){ return my_port_number;}
153
125
 
154
126
//--------------
155
127
uint32_t PBMSParameters::getServerID(){ return my_server_id;}
157
129
//--------------
158
130
uint64_t PBMSParameters::getRepoThreshold()
159
131
{
160
 
#ifdef DRIZZLED
161
 
  return (uint64_t) cs_byte_size_to_int8(my_repository_threshold.c_str());
162
 
#else
163
132
        if (my_repository_threshold)
164
133
                return((uint64_t) cs_byte_size_to_int8(my_repository_threshold));
165
134
 
166
135
        return((uint64_t) cs_byte_size_to_int8(MS_REPO_THRESHOLD_DEF));
167
 
#endif
168
136
}
169
137
 
170
138
//--------------
171
139
uint64_t PBMSParameters::getTempLogThreshold()
172
140
{
173
 
#ifdef DRIZZLED
174
 
  return (uint64_t) cs_byte_size_to_int8(my_temp_log_threshold.c_str());
175
 
#else
176
141
        if (my_temp_log_threshold)
177
142
                return((uint64_t) cs_byte_size_to_int8(my_temp_log_threshold));
178
143
 
179
144
        return((uint64_t) cs_byte_size_to_int8(MS_TEMP_LOG_THRESHOLD_DEF));
180
 
#endif
181
145
}
182
146
 
183
147
//--------------
184
 
uint32_t PBMSParameters::getTempBlobTimeout(){ return static_cast<uint32_t>(my_temp_blob_timeout);}
185
 
 
186
 
//--------------
187
 
uint32_t PBMSParameters::getGarbageThreshold(){ return static_cast<uint32_t>(my_garbage_threshold);}
188
 
 
189
 
//--------------
190
 
uint32_t PBMSParameters::getMaxKeepAlive(){ return static_cast<uint32_t>(my_max_keep_alive);}
 
148
uint32_t PBMSParameters::getTempBlobTimeout(){ return my_temp_blob_timeout;}
 
149
 
 
150
//--------------
 
151
uint32_t PBMSParameters::getGarbageThreshold(){ return my_garbage_threshold;}
 
152
 
 
153
//--------------
 
154
uint32_t PBMSParameters::getMaxKeepAlive(){ return my_max_keep_alive;}
191
155
 
192
156
//--------------
193
157
const char * PBMSParameters::getDefaultMetaDataHeaders()
194
158
{
195
 
#ifdef DRIZZLED
196
 
        return my_http_metadata_headers.c_str();
197
 
#else
198
159
        if (my_http_metadata_headers)
199
160
                return my_http_metadata_headers; 
200
161
                
201
162
        return MS_HTTP_METADATA_HEADERS_DEF; 
202
 
#endif
203
163
}
204
164
 
205
165
//-----------------
206
 
uint32_t PBMSParameters::getBackupDatabaseID() { return static_cast<uint32_t>(my_backup_db_id);}
 
166
uint32_t PBMSParameters::getBackupDatabaseID() { return my_backup_db_id;}
207
167
 
208
168
//-----------------
209
169
void PBMSParameters::setBackupDatabaseID(uint32_t id) { my_backup_db_id = id;}
332
292
        return NULL;
333
293
}
334
294
 
335
 
#ifdef DRIZZLED
336
 
static void temp_blob_timeout_update(Session*, sql_var_t)
337
 
{
338
 
        CSThread                *self;
339
 
        PBMSResultRec   result;
340
 
        
341
 
        if (MSEngine::enterConnectionNoThd(&self, &result))
342
 
                return;
343
 
        try_(a) {
344
 
                MSDatabase::wakeTempLogThreads();
345
 
        }
346
 
        
347
 
        catch_(a);
348
 
        cont_(a);
349
 
}
350
 
//----------
351
 
static int table_list_validate(Session*, set_var *var)
352
 
{
353
 
        const char *list= var->value->str_value.ptr();
354
 
        if (list == NULL)
355
 
                return 1;
356
 
 
357
 
        TableMatchState state = set_match_type(list);
358
 
        if (state == MATCH_ERROR)
359
 
                return 1;
360
 
                
361
 
        std::string new_list(list);
362
 
 
363
 
        my_table_list_lock.lock();
364
 
        my_table_list.swap(new_list);
365
 
        my_table_match = state;
366
 
        my_table_list_lock.unlock();
367
 
 
368
 
        return 0;
369
 
}
370
 
 
371
 
//----------
372
 
#endif
373
 
 
374
295
//--------------
375
296
// Parameter update functions are not called for parameters that are set on
376
297
// the command line. PBMSParameters::startUp() will perform any initialization required.
377
 
#ifdef DRIZZLED
378
 
void PBMSParameters::startUp(drizzled::module::Context &context)
379
 
#else
380
 
void PBMSParameters::startup()
381
 
#endif
 
298
void PBMSParameters::startUp()
382
299
383
 
 
384
 
#ifdef DRIZZLED
385
 
        my_table_match = set_match_type(my_table_list.c_str());
386
 
        const module::option_map &vm= context.getOptions();
387
 
        my_events_enabled= (vm.count("watch-disable")) ? false : true;
388
 
 
389
 
        context.registerVariable(new sys_var_constrained_value_readonly<in_port_t>("port",
390
 
                                                                         pbms_port_number));
391
 
        context.registerVariable(new sys_var_std_string("repository_threshold",
392
 
                                                        my_repository_threshold));
393
 
        context.registerVariable(new sys_var_std_string("temp_log_threshold",
394
 
                                                        my_temp_log_threshold));
395
 
        context.registerVariable(new sys_var_const_string("http_metadata_headers",
396
 
                                                          my_http_metadata_headers));
397
 
        context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("garbage_threshold", my_garbage_threshold));
398
 
        context.registerVariable(new sys_var_constrained_value<uint32_t>("temp_blob_timeout",
399
 
                                                                         my_temp_blob_timeout,
400
 
                                                                         temp_blob_timeout_update));
401
 
        context.registerVariable(new sys_var_constrained_value<uint32_t>("max_keep_alive",
402
 
                                                                         my_max_keep_alive));
403
 
        context.registerVariable(new sys_var_constrained_value<uint32_t>("next_backup_db_id",
404
 
                                                                         my_backup_db_id));
405
 
        context.registerVariable(new sys_var_std_string("watch_tables",
406
 
                                                        my_table_list,
407
 
                                                        table_list_validate));
408
 
        context.registerVariable(new sys_var_bool_ptr("watch_enable",
409
 
                                                      &my_events_enabled));
410
 
        context.registerVariable(new sys_var_constrained_value<int32_t>("before_insert_position",
411
 
                                                                        my_before_insert_position));
412
 
        context.registerVariable(new sys_var_constrained_value<int32_t>("before_update_position",
413
 
                                                                        my_before_update_position));
414
 
 
415
 
#else
416
300
        my_table_match = set_match_type(my_table_list);
417
 
#endif
418
 
}
419
 
 
420
 
 
421
 
#ifdef DRIZZLED
422
 
void PBMSParameters::initOptions(drizzled::module::option_context &context)
423
 
{
424
 
        context("port",
425
 
                po::value<port_constraint>(&pbms_port_number)->default_value(DEFAULT_PBMS_PORT),
426
 
                _("Port number to use for connection or 0 for default PBMS port "));
427
 
        context("repository-threshold",
428
 
                po::value<std::string>(&my_repository_threshold)->default_value(MS_REPO_THRESHOLD_DEF),
429
 
                _("The maximum size of a BLOB repository file."));
430
 
        context("temp-log-threshold",
431
 
                po::value<std::string>(&my_temp_log_threshold)->default_value(MS_TEMP_LOG_THRESHOLD_DEF),
432
 
                _("The maximum size of a temorary BLOB log file."));
433
 
        context("http-metadata-headers",
434
 
                po::value<std::string>(&my_http_metadata_headers)->default_value(MS_HTTP_METADATA_HEADERS_DEF),
435
 
                _("A ':' delimited list of metadata header names to be used to initialize "
436
 
                   "the pbms_metadata_header table when a database is created."));
437
 
        context("garbage-threshold",
438
 
                po::value<percent_constraint>(&my_garbage_threshold)->default_value(MS_DEFAULT_GARBAGE_LEVEL),
439
 
                _("The percentage of garbage in a repository file before it is compacted."));
440
 
        context("temp-blob-timeout",
441
 
                po::value<uint32_nonzero_constraint>(&my_temp_blob_timeout)->default_value(MS_DEFAULT_TEMP_LOG_WAIT),
442
 
                _("The timeout, in seconds, for temporary BLOBs. Uploaded blob data is removed after this time, unless committed to the database."));
443
 
        context("max-keep-alive",
444
 
                po::value<uint32_nonzero_constraint>(&my_temp_blob_timeout)->default_value(MS_DEFAULT_KEEP_ALIVE),
445
 
                _("The timeout, in milli-seconds, before the HTTP server will close an inactive HTTP connection."));
446
 
        context("next-backup-db-id",
447
 
                po::value<uint32_nonzero_constraint>(&my_backup_db_id)->default_value(1),
448
 
                _("The next backup ID to use when backing up a PBMS database."));
449
 
        context("watch-tables",
450
 
                po::value<std::string>(&my_table_list)->default_value("*"),
451
 
                _("A comma delimited list of tables to watch of the format: <database>.<table>, ..."));
452
 
        context("watch-disable",
453
 
                _("Enable PBMS daemon Insert/Update/Delete event scanning"));
454
 
 
455
 
        context("before-insert-position",
456
 
                po::value<before_position_constraint>(&my_before_insert_position)->default_value(1),
457
 
                _("Before insert row event observer call position"));
458
 
 
459
 
        context("before-update-position",
460
 
                po::value<before_position_constraint>(&my_before_update_position)->default_value(1),
461
 
                _("Before update row event observer call position"));
462
 
 
463
 
}
464
 
#endif
 
301
}
465
302
 
466
303
//-----------------
467
304
bool PBMSParameters::isBlackListedDB(const char *db)
479
316
}               
480
317
 
481
318
//-----------------
482
 
bool PBMSParameters::try_LocateDB(CSThread *self, const char *db, bool *found)
483
 
{
484
 
        volatile bool rtc = true;
485
 
        try_(a) {
486
 
                lock_(&my_table_list_lock);     
487
 
                
488
 
                        
489
 
                *found = (locate_db(my_table_list.c_str(), db, strlen(db)) != NULL);
490
 
                        
491
 
                unlock_(&my_table_list_lock);
492
 
                rtc = false;
493
 
        }
494
 
        
495
 
        catch_(a)
496
 
        cont_(a);
497
 
        return rtc;
498
 
}
499
 
 
500
 
//-----------------
501
319
bool PBMSParameters::isBLOBDatabase(const char *db)
502
320
{
503
 
        CSThread *self= NULL;
 
321
        CSThread *self;
504
322
        int             err;
505
323
        PBMSResultRec result;
506
324
        bool found = false;
509
327
                return false;
510
328
                
511
329
        if (my_table_match == MATCH_UNKNOWN)
512
 
        {
513
 
                try_(a) {
514
 
                        lock_(&my_table_list_lock);     
515
 
                        my_table_match = set_match_type(my_table_list.c_str());
516
 
                        unlock_(&my_table_list_lock);
517
 
                }
518
 
 
519
 
                catch_(a)
520
 
                cont_(a);
521
 
        }
 
330
                my_table_match = set_match_type(my_table_list);
522
331
 
523
332
        if (my_table_match == MATCH_NONE)
524
333
                return false;
529
338
        if ((err = MSEngine::enterConnectionNoThd(&self, &result)) == 0) {
530
339
 
531
340
                inner_();
532
 
                if (try_LocateDB(self, db, &found)) {
 
341
                try_(a) {
 
342
                        lock_(&my_table_list_lock);     
 
343
                        
 
344
                                
 
345
                        found = (locate_db(my_table_list, db, strlen(db)) != NULL);
 
346
                                
 
347
                        unlock_(&my_table_list_lock);
 
348
                }
 
349
                
 
350
                catch_(a) {
533
351
                        err = MSEngine::exceptionToResult(&self->myException, &result);
534
 
                }               
 
352
                }
 
353
                cont_(a);
535
354
                outer_();
536
355
        
537
356
        }
545
364
}
546
365
        
547
366
//-----------------
548
 
bool PBMSParameters::try_LocateTable(CSThread *self, const char *db, const char *table, bool *found)
 
367
bool PBMSParameters::isBLOBTable(const char *db, const char *table)
549
368
{
550
 
        volatile bool rtc = true;
551
 
        try_(a) {
552
 
                int db_len, table_len, match_len;
553
 
                
554
 
                lock_(&my_table_list_lock);     
555
 
                                
556
 
                db_len = strlen(db);
557
 
                table_len = strlen(table);
558
 
                
559
 
                const char *ptr = my_table_list.c_str();
560
 
                while (ptr) {
561
 
                        ptr = locate_db(ptr, db, db_len);
562
 
                        if (ptr) {
563
 
                                match_len = 0;
564
 
                                if (*ptr == '*')
565
 
                                        match_len = 1;
566
 
                                else if (strncmp(ptr, table, table_len) == 0)
567
 
                                        match_len = table_len;
 
369
        CSThread *self;
 
370
        int             err;
 
371
        PBMSResultRec result;
 
372
        bool found = false;
 
373
        const char *ptr;
 
374
        int db_len, table_len, match_len;
 
375
        
 
376
        if (isBlackListedDB(db))
 
377
                return false;
 
378
                
 
379
        if (my_table_match == MATCH_UNKNOWN)
 
380
                my_table_match = set_match_type(my_table_list);
 
381
 
 
382
        if (my_table_match == MATCH_NONE)
 
383
                return false;
 
384
 
 
385
        if (my_table_match <= MATCH_ALL)
 
386
                return true;
 
387
 
 
388
        if ((err = MSEngine::enterConnectionNoThd(&self, &result)) == 0) {
 
389
 
 
390
                inner_();
 
391
                try_(a) {
 
392
                        lock_(&my_table_list_lock);     
568
393
                                        
569
 
                                if (match_len) {
570
 
                                        ptr += match_len;
571
 
                                        if ((!*ptr) || (*ptr == ',') || isspace(*ptr)) {
572
 
                                                *found = true;
573
 
                                                break;
 
394
                        db_len = strlen(db);
 
395
                        table_len = strlen(table);
 
396
                        
 
397
                        ptr = my_table_list;
 
398
                        while (ptr) {
 
399
                                ptr = locate_db(ptr, db, db_len);
 
400
                                if (ptr) {
 
401
                                        match_len = 0;
 
402
                                        if (*ptr == '*')
 
403
                                                match_len = 1;
 
404
                                        else if (strncmp(ptr, table, table_len) == 0)
 
405
                                                match_len = table_len;
 
406
                                                
 
407
                                        if (match_len) {
 
408
                                                ptr += match_len;
 
409
                                                if ((!*ptr) || (*ptr == ',') || isspace(*ptr)) {
 
410
                                                        found = true;
 
411
                                                        break;
 
412
                                                }
574
413
                                        }
 
414
                                        
 
415
                                        NEXT_IN_TABLE_LIST(ptr);
575
416
                                }
 
417
                        }
576
418
                                
577
 
                                NEXT_IN_TABLE_LIST(ptr);
578
 
                        }
579
 
                }
580
 
                        
581
 
                unlock_(&my_table_list_lock);
582
 
                rtc = false;
583
 
        }
584
 
        
585
 
        catch_(a)
586
 
        cont_(a);
587
 
        return rtc;
588
 
}
589
 
 
590
 
//-----------------
591
 
bool PBMSParameters::isBLOBTable(const char *db, const char *table)
592
 
{
593
 
        CSThread *self= NULL;
594
 
        int             err;
595
 
        PBMSResultRec result;
596
 
        bool found = false;
597
 
        
598
 
        if (isBlackListedDB(db))
599
 
                return false;
600
 
                
601
 
        if (my_table_match == MATCH_UNKNOWN)
602
 
        {
603
 
                try_(a) {
604
 
                        lock_(&my_table_list_lock);     
605
 
                        my_table_match = set_match_type(my_table_list.c_str());
606
419
                        unlock_(&my_table_list_lock);
607
420
                }
608
 
 
609
 
                catch_(a)
 
421
                catch_(a) {
 
422
                        err = MSEngine::exceptionToResult(&self->myException, &result);
 
423
                }
610
424
                cont_(a);
611
 
        }
612
 
 
613
 
        if (my_table_match == MATCH_NONE)
614
 
                return false;
615
 
 
616
 
        if (my_table_match <= MATCH_ALL)
617
 
                return true;
618
 
 
619
 
        if ((err = MSEngine::enterConnectionNoThd(&self, &result)) == 0) {
620
 
 
621
 
                inner_();
622
 
                if (try_LocateTable(self, db, table, &found)) {
623
 
                        err = MSEngine::exceptionToResult(&self->myException, &result);
624
 
                }               
625
425
                outer_();
626
426
        
627
427
        }
636
436
 
637
437
 
638
438
//-----------------
639
 
int32_t PBMSParameters::getBeforeUptateEventPosition() { return static_cast<int32_t>(my_before_update_position);}
 
439
int32_t PBMSParameters::getBeforeUptateEventPosition() { return my_before_update_position;}
640
440
 
641
441
//-----------------
642
 
int32_t PBMSParameters::getBeforeInsertEventPosition() { return static_cast<int32_t>(my_before_insert_position);}
 
442
int32_t PBMSParameters::getBeforeInsertEventPosition() { return my_before_insert_position;}
643
443
#endif // DRIZZLED
644
444
 
645
445
//-----------------
646
 
#ifndef DRIZZLED
647
446
static void pbms_temp_blob_timeout_func(THD *thd, struct st_mysql_sys_var *var, void *trg, CONST_SAVE void *save)
648
447
{
649
448
        CSThread                *self;
663
462
        catch_(a);
664
463
        cont_(a);
665
464
}
666
 
#endif
667
 
//-----------------
668
 
//-----------------
669
 
 
670
 
#ifndef DRIZZLED
671
 
 
672
 
static MYSQL_SYSVAR_UINT(port, pbms_port_number,
673
 
        PLUGIN_VAR_READONLY,
 
465
 
 
466
//-----------------
 
467
//-----------------
 
468
static MYSQL_SYSVAR_INT(port, my_port_number,
 
469
        PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
674
470
        "The port for the server stream-based communications.",
675
471
        NULL, NULL, PBMS_PORT, 0, 64*1024, 1);
676
472
 
710
506
        "The next backup ID to use when backing up a PBMS database.",
711
507
        NULL, NULL, 1, 1, UINT32_MAX, 1);
712
508
 
 
509
 
 
510
#ifdef DRIZZLED
 
511
 
 
512
//----------
 
513
static int check_table_list(THD *, struct st_mysql_sys_var *, void *save, drizzle_value *value)
 
514
{
 
515
        char buffer[100];
 
516
        int len = 100;
 
517
        const char *list = value->val_str(value, buffer, &len);
 
518
        TableMatchState state;
 
519
        
 
520
        state = set_match_type(list);
 
521
        if (state == MATCH_ERROR)
 
522
                return 1;
 
523
                
 
524
        char *new_list = strdup(list);
 
525
        if (!new_list)
 
526
                return 1;
 
527
        
 
528
        my_table_list_lock.lock();
 
529
        if (my_table_list && (my_table_list != dflt_my_table_list)) free(my_table_list);
 
530
        my_table_list = new_list;
 
531
        
 
532
        my_table_match = state;
 
533
        my_table_list_lock.unlock();
 
534
 
 
535
   *static_cast<const char**>(save)= my_table_list;
 
536
 
 
537
        return 0;
 
538
}
 
539
 
 
540
//----------
 
541
static void set_table_list(THD *, struct st_mysql_sys_var *, void *var_ptr, CONST_SAVE void *)
 
542
{
 
543
        // Everything was done in check_table_list()
 
544
  *static_cast<const char**>(var_ptr)= my_table_list;
 
545
}
 
546
 
 
547
//----------
 
548
 
 
549
static MYSQL_SYSVAR_STR(watch_tables,
 
550
                           my_table_list,
 
551
                           PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_MEMALLOC,
 
552
                           N_("A comma delimited list of tables to watch of the format: <database>.<table>, ..."),
 
553
                           check_table_list, /* check func */
 
554
                           set_table_list, /* update func */
 
555
                           dflt_my_table_list /* default */);
 
556
 
 
557
static MYSQL_SYSVAR_BOOL(watch_enable,
 
558
                           my_events_enabled,
 
559
                           PLUGIN_VAR_OPCMDARG,
 
560
                           N_("Enable PBMS daemon Insert/Update/Delete event scanning"),
 
561
                           NULL, /* check func */
 
562
                           NULL, /* update func */
 
563
                           true /* default */);
 
564
 
 
565
static MYSQL_SYSVAR_INT(before_insert_position,
 
566
                           my_before_insert_position,
 
567
                           PLUGIN_VAR_OPCMDARG,
 
568
                           N_("Before insert row event observer call position"),
 
569
                           NULL, /* check func */
 
570
                           NULL, /* update func */
 
571
                           1, /* default */
 
572
                           1, /* min */
 
573
                           INT32_MAX -1, /* max */
 
574
                           0 /* blk */);
 
575
 
 
576
static MYSQL_SYSVAR_INT(before_update_position,
 
577
                           my_before_update_position,
 
578
                           PLUGIN_VAR_OPCMDARG,
 
579
                           N_("Before update row event observer call position"),
 
580
                           NULL, /* check func */
 
581
                           NULL, /* update func */
 
582
                           1, /* default */
 
583
                           1, /* min */
 
584
                           INT32_MAX -1, /* max */
 
585
                           0 /* blk */);
 
586
 
 
587
#endif // DRIZZLED
 
588
 
713
589
struct st_mysql_sys_var* pbms_system_variables[] = {
714
590
        MYSQL_SYSVAR(port),
715
591
        MYSQL_SYSVAR(repository_threshold),
719
595
        MYSQL_SYSVAR(http_metadata_headers),
720
596
        MYSQL_SYSVAR(max_keep_alive),
721
597
        MYSQL_SYSVAR(next_backup_db_id),
 
598
        
 
599
#ifdef DRIZZLED
 
600
        MYSQL_SYSVAR(watch_tables),
 
601
        MYSQL_SYSVAR(watch_enable),
 
602
        
 
603
        MYSQL_SYSVAR(before_insert_position),
 
604
        MYSQL_SYSVAR(before_update_position),
 
605
#endif
 
606
  
722
607
        NULL
723
608
};
724
609
 
725
 
#endif // !DRIZZLED
726
 
 
727
 
 
728
 
// vim:noexpandtab:sts=8:sw=8:tabstop=8:smarttab:
 
610
 
 
611
 
 
612
 
 
613