Merge lp:~vjsamuel/drizzle/rplugin-mysql-protocol into lp:~drizzle-trunk/drizzle/development

Proposed by Vijay Samuel
Status: Merged
Merged at revision: 1645
Proposed branch: lp:~vjsamuel/drizzle/rplugin-mysql-protocol
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 794 lines (+293/-92)
31 files modified
drizzled/module/loader.cc (+27/-27)
drizzled/module/option_context.cc (+32/-3)
drizzled/module/option_context.h (+3/-13)
drizzled/module/option_map.h (+3/-8)
drizzled/option.cc (+1/-1)
drizzled/plugin.h (+3/-3)
plugin/auth_file/auth_file.cc (+1/-1)
plugin/auth_ldap/auth_ldap.cc (+1/-1)
plugin/auth_ldap/test_ldap.sh (+1/-1)
plugin/auth_test/auth_test.cc (+1/-1)
plugin/blitzdb/ha_blitz.cc (+1/-1)
plugin/crc32/crc32udf.cc (+1/-1)
plugin/default_replicator/default_replicator.cc (+1/-1)
plugin/drizzle_protocol/drizzle_protocol.cc (+99/-7)
plugin/errmsg_notify/errmsg_notify.cc (+1/-1)
plugin/filtered_replicator/filtered_replicator.cc (+1/-1)
plugin/logging_stats/tests/t/command-master.opt (+1/-1)
plugin/logging_stats/tests/t/max_session-master.opt (+1/-1)
plugin/logging_stats/tests/t/max_user-master.opt (+1/-1)
plugin/logging_stats/tests/t/slap-master.opt (+1/-1)
plugin/mysql_protocol/mysql_protocol.cc (+98/-4)
plugin/rabbitmq/rabbitmq_log.cc (+1/-1)
plugin/rand_function/rand_function.cc (+1/-1)
plugin/replication_dictionary/module.cc (+1/-1)
plugin/rot13/rot13.cc (+1/-1)
plugin/simple_user_policy/module.cc (+1/-1)
plugin/sleep/sleep.cc (+1/-1)
plugin/syslog/module.cc (+1/-1)
plugin/transaction_log/module.cc (+1/-1)
plugin/version/versionudf.cc (+1/-1)
tests/test-run.pl (+5/-4)
To merge this branch: bzr merge lp:~vjsamuel/drizzle/rplugin-mysql-protocol
Reviewer Review Type Date Requested Status
Monty Taylor Approve
Brian Aker Pending
Vijay Samuel Pending
Review via email: mp+29308@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Monty Taylor (mordred) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'drizzled/module/loader.cc'
2--- drizzled/module/loader.cc 2010-06-23 20:11:47 +0000
3+++ drizzled/module/loader.cc 2010-07-06 15:38:27 +0000
4@@ -1686,33 +1686,33 @@
5 long_options.add(module_options);
6
7 }
8- else
9- {
10-
11- for (opt= test_module->getManifest().system_vars; opt && *opt; opt++)
12- {
13- count++;
14- }
15-
16- if (count > EXTRA_OPTIONS || (*argc > 1))
17- {
18- if (!(opts= (option*) module_root->alloc_root(sizeof(option) * count)))
19- {
20- errmsg_printf(ERRMSG_LVL_ERROR,
21- _("Out of memory for plugin '%s'."),
22- test_module->getName().c_str());
23- return(-1);
24- }
25- memset(opts, 0, sizeof(option) * count);
26-
27- if (construct_options(module_root, test_module, opts))
28- {
29- errmsg_printf(ERRMSG_LVL_ERROR,
30- _("Bad options for plugin '%s'."),
31- test_module->getName().c_str());
32- return(-1);
33- }
34-
35+
36+ for (opt= test_module->getManifest().system_vars; opt && *opt; opt++)
37+ {
38+ count++;
39+ }
40+
41+ if (count > EXTRA_OPTIONS || (*argc > 1))
42+ {
43+ if (!(opts= (option*) module_root->alloc_root(sizeof(option) * count)))
44+ {
45+ errmsg_printf(ERRMSG_LVL_ERROR,
46+ _("Out of memory for plugin '%s'."),
47+ test_module->getName().c_str());
48+ return(-1);
49+ }
50+ memset(opts, 0, sizeof(option) * count);
51+
52+ if (construct_options(module_root, test_module, opts))
53+ {
54+ errmsg_printf(ERRMSG_LVL_ERROR,
55+ _("Bad options for plugin '%s'."),
56+ test_module->getName().c_str());
57+ return(-1);
58+ }
59+
60+ if (test_module->getManifest().init_options == NULL)
61+ {
62 error= handle_options(argc, &argv, opts, get_one_plugin_option);
63 (*argc)++; /* add back one for the program name */
64
65
66=== modified file 'drizzled/module/option_context.cc'
67--- drizzled/module/option_context.cc 2010-06-16 22:09:59 +0000
68+++ drizzled/module/option_context.cc 2010-07-06 15:38:27 +0000
69@@ -36,7 +36,7 @@
70 option_context& option_context::operator()(const char* name,
71 const char* description)
72 {
73- const std::string new_name(prepend_name(name));
74+ const std::string new_name(prepend_name(module_name, name));
75 po_options(new_name.c_str(), description);
76 return *this;
77 }
78@@ -45,7 +45,7 @@
79 option_context& option_context::operator()(const char* name,
80 const po::value_semantic* s)
81 {
82- const std::string new_name(prepend_name(name));
83+ const std::string new_name(prepend_name(module_name, name));
84 po_options(new_name.c_str(), s);
85 return *this;
86 }
87@@ -55,11 +55,40 @@
88 const po::value_semantic* s,
89 const char* description)
90 {
91- const std::string new_name(prepend_name(name));
92+ const std::string new_name(prepend_name(module_name, name));
93 po_options(new_name.c_str(), s, description);
94 return *this;
95 }
96
97+namespace
98+{
99+
100+class SwapUnderscores
101+{
102+public:
103+ char operator()(char a) const
104+ {
105+ if (a == '_')
106+ return '-';
107+ return a;
108+ }
109+};
110+
111+} /* namespace */
112+
113+/*
114+ * Private methods.
115+ */
116+std::string option_context::prepend_name(std::string module_name,
117+ const char *name_in)
118+{
119+ module_name.push_back('.');
120+ std::transform(module_name.begin(), module_name.end(),
121+ module_name.begin(), SwapUnderscores());
122+ module_name.append(name_in);
123+ return module_name;
124+}
125+
126
127 } /* namespace module */
128 } /* namespace drizzled */
129
130=== modified file 'drizzled/module/option_context.h'
131--- drizzled/module/option_context.h 2010-06-16 22:09:59 +0000
132+++ drizzled/module/option_context.h 2010-07-06 15:38:27 +0000
133@@ -47,8 +47,6 @@
134 const std::string &module_name;
135 po::options_description_easy_init po_options;
136
137- std::string prepend_name(const char *name) const;
138-
139 public:
140
141 option_context(const std::string &module_name_in,
142@@ -64,6 +62,9 @@
143 const po::value_semantic* s,
144 const char* description);
145
146+ static std::string prepend_name(std::string module_name_in,
147+ const char *name);
148+
149 private:
150
151 /**
152@@ -82,17 +83,6 @@
153 option_context& operator=(const option_context &);
154 };
155
156-/*
157- * Private methods.
158- */
159-inline std::string option_context::prepend_name(const char *name_in) const
160-{
161- std::string new_name(module_name);
162- new_name.push_back('.');
163- new_name.append(name_in);
164- return new_name;
165-}
166-
167 } /* namespace module */
168 } /* namespace drizzled */
169
170
171=== modified file 'drizzled/module/option_map.h'
172--- drizzled/module/option_map.h 2010-06-20 19:05:15 +0000
173+++ drizzled/module/option_map.h 2010-07-06 15:38:27 +0000
174@@ -26,6 +26,7 @@
175 #define DRIZZLED_MODULE_OPTION_MAP_H
176
177 #include "drizzled/visibility.h"
178+#include "drizzled/module/option_context.h"
179
180 #include <boost/program_options.hpp>
181
182@@ -53,18 +54,12 @@
183
184 const boost::program_options::variable_value& operator[](const std::string &name_in) const
185 {
186- std::string new_name(module_name);
187- new_name.push_back('.');
188- new_name.append(name_in);
189- return vm[new_name];
190+ return vm[option_context::prepend_name(module_name, name_in.c_str())];
191 }
192
193 size_t count(const std::string &name_in) const
194 {
195- std::string new_name(module_name);
196- new_name.push_back('.');
197- new_name.append(name_in);
198- return vm.count(new_name);
199+ return vm.count(option_context::prepend_name(module_name, name_in.c_str()));
200 }
201
202 private:
203
204=== modified file 'drizzled/option.cc'
205--- drizzled/option.cc 2010-04-23 21:37:29 +0000
206+++ drizzled/option.cc 2010-07-06 15:38:27 +0000
207@@ -562,7 +562,7 @@
208 {
209 char *ptr, *end;
210
211- ptr= strrchr(cur_arg + 1, '.'); /* Skip the first character */
212+ ptr= NULL; //Options with '.' are now supported.
213 end= strrchr(cur_arg, '=');
214
215 /*
216
217=== modified file 'drizzled/plugin.h'
218--- drizzled/plugin.h 2010-06-21 04:53:35 +0000
219+++ drizzled/plugin.h 2010-07-06 15:38:27 +0000
220@@ -68,7 +68,7 @@
221
222
223 #define DRIZZLE_DECLARE_PLUGIN_END
224-#define DRIZZLE_PLUGIN(init,system) \
225+#define DRIZZLE_PLUGIN(init,system,options) \
226 DRIZZLE_DECLARE_PLUGIN \
227 { \
228 DRIZZLE_VERSION_ID, \
229@@ -77,7 +77,7 @@
230 STRINGIFY_ARG(PANDORA_MODULE_AUTHOR), \
231 STRINGIFY_ARG(PANDORA_MODULE_TITLE), \
232 PANDORA_MODULE_LICENSE, \
233- init, system, NULL \
234+ init, system, options \
235 }
236
237
238@@ -189,7 +189,7 @@
239 mysql_var_check_func check; \
240 mysql_var_update_func update
241
242-#define DRIZZLE_SYSVAR_NAME(name) mysql_sysvar_ ## name
243+#define DRIZZLE_SYSVAR_NAME(name) drizzle_sysvar_ ## name
244 #define DRIZZLE_SYSVAR(name) \
245 ((drizzle_sys_var *)(&(DRIZZLE_SYSVAR_NAME(name))))
246
247
248=== modified file 'plugin/auth_file/auth_file.cc'
249--- plugin/auth_file/auth_file.cc 2010-05-18 18:20:56 +0000
250+++ plugin/auth_file/auth_file.cc 2010-07-06 15:38:27 +0000
251@@ -237,4 +237,4 @@
252
253 } /* namespace auth_file */
254
255-DRIZZLE_PLUGIN(auth_file::init, auth_file::sys_variables);
256+DRIZZLE_PLUGIN(auth_file::init, auth_file::sys_variables, NULL);
257
258=== modified file 'plugin/auth_ldap/auth_ldap.cc'
259--- plugin/auth_ldap/auth_ldap.cc 2010-05-18 18:20:56 +0000
260+++ plugin/auth_ldap/auth_ldap.cc 2010-07-06 15:38:27 +0000
261@@ -490,4 +490,4 @@
262
263 } /* namespace auth_ldap */
264
265-DRIZZLE_PLUGIN(auth_ldap::init, auth_ldap::sys_variables);
266+DRIZZLE_PLUGIN(auth_ldap::init, auth_ldap::sys_variables, NULL);
267
268=== modified file 'plugin/auth_ldap/test_ldap.sh'
269--- plugin/auth_ldap/test_ldap.sh 2010-04-27 20:36:41 +0000
270+++ plugin/auth_ldap/test_ldap.sh 2010-07-06 15:38:27 +0000
271@@ -19,7 +19,7 @@
272 --auth-ldap-base-dn="dc=drizzle,dc=org" \
273 --auth-ldap-cache-timeout=1 \
274 --mysql-protocol-port=12345 \
275- --drizzle-protocol-port=12346 \
276+ --drizzle-protocol.port=12346 \
277 --pid-file=pid &
278
279 sleep 3
280
281=== modified file 'plugin/auth_test/auth_test.cc'
282--- plugin/auth_test/auth_test.cc 2010-05-18 18:20:56 +0000
283+++ plugin/auth_test/auth_test.cc 2010-07-06 15:38:27 +0000
284@@ -106,4 +106,4 @@
285
286 } /* namespace auth_test */
287
288-DRIZZLE_PLUGIN(auth_test::init, NULL);
289+DRIZZLE_PLUGIN(auth_test::init, NULL, NULL);
290
291=== modified file 'plugin/blitzdb/ha_blitz.cc'
292--- plugin/blitzdb/ha_blitz.cc 2010-06-29 21:22:35 +0000
293+++ plugin/blitzdb/ha_blitz.cc 2010-07-06 15:38:27 +0000
294@@ -1457,4 +1457,4 @@
295 return pos + skip_len + sizeof(uint16_t);
296 }
297
298-DRIZZLE_PLUGIN(blitz_init, NULL);
299+DRIZZLE_PLUGIN(blitz_init, NULL, NULL);
300
301=== modified file 'plugin/crc32/crc32udf.cc'
302--- plugin/crc32/crc32udf.cc 2010-05-18 18:20:56 +0000
303+++ plugin/crc32/crc32udf.cc 2010-07-06 15:38:27 +0000
304@@ -78,4 +78,4 @@
305 return 0;
306 }
307
308-DRIZZLE_PLUGIN(initialize, NULL);
309+DRIZZLE_PLUGIN(initialize, NULL, NULL);
310
311=== modified file 'plugin/default_replicator/default_replicator.cc'
312--- plugin/default_replicator/default_replicator.cc 2010-05-18 18:20:56 +0000
313+++ plugin/default_replicator/default_replicator.cc 2010-07-06 15:38:27 +0000
314@@ -66,4 +66,4 @@
315 return 0;
316 }
317
318-DRIZZLE_PLUGIN(init, NULL);
319+DRIZZLE_PLUGIN(init, NULL, NULL);
320
321=== modified file 'plugin/drizzle_protocol/drizzle_protocol.cc'
322--- plugin/drizzle_protocol/drizzle_protocol.cc 2010-05-18 18:20:56 +0000
323+++ plugin/drizzle_protocol/drizzle_protocol.cc 2010-07-06 15:38:27 +0000
324@@ -26,7 +26,9 @@
325 #include "drizzled/internal/my_sys.h"
326 #include "drizzled/internal/m_string.h"
327 #include <algorithm>
328-
329+#include <iostream>
330+#include <boost/program_options.hpp>
331+#include <drizzled/module/option_map.h>
332 #include "pack.h"
333 #include "errmsg.h"
334 #include "drizzle_protocol.h"
335@@ -38,7 +40,7 @@
336 {
337 extern uint32_t global_thread_id;
338 }
339-
340+namespace po= boost::program_options;
341 using namespace drizzled;
342 using namespace std;
343
344@@ -812,12 +814,74 @@
345 drizzleclient_net_write(&net, buff, 5);
346 }
347
348-static ListenDrizzleProtocol *listen_obj= NULL;
349-
350 static int init(module::Context &context)
351 {
352- listen_obj= new ListenDrizzleProtocol("drizzle_protocol", false);
353- context.add(listen_obj);
354+ const module::option_map &vm= context.getOptions();
355+ if (vm.count("port"))
356+ {
357+ if (port > 65535)
358+ {
359+ cout << "Invalid value of port";
360+ exit(-1);
361+ }
362+ }
363+
364+ if (vm.count("connect-timeout"))
365+ {
366+ if (connect_timeout < 1 || connect_timeout > 300)
367+ {
368+ cout << "Invalid value for connect_timeout";
369+ exit(-1);
370+ }
371+ }
372+
373+ if (vm.count("read-timeout"))
374+ {
375+ if (read_timeout < 1 || read_timeout > 300)
376+ {
377+ cout << "Invalid value for read_timeout";
378+ exit(-1);
379+ }
380+ }
381+
382+ if (vm.count("write-timeout"))
383+ {
384+ if (write_timeout < 1 || write_timeout > 300)
385+ {
386+ cout << "Invalid value for write_timeout";
387+ exit(-1);
388+ }
389+ }
390+
391+ if (vm.count("retry-count"))
392+ {
393+ if (retry_count < 1 || retry_count > 100)
394+ {
395+ cout << "Invalid value for retry_count";
396+ exit(-1);
397+ }
398+ }
399+
400+ if (vm.count("buffer-length"))
401+ {
402+ if (buffer_length < 1024 || buffer_length > 1024*1024)
403+ {
404+ cout << "Invalid value for buffer_length";
405+ exit(-1);
406+ }
407+ }
408+
409+ if (vm.count("bind-address"))
410+ {
411+ bind_address= strdup(vm["bind-address"].as<string>().c_str());
412+ }
413+
414+ else
415+ {
416+ bind_address= NULL;
417+ }
418+
419+ context.add(new ListenDrizzleProtocol("drizzle_protocol", false));
420 return 0;
421 }
422
423@@ -842,6 +906,34 @@
424 static DRIZZLE_SYSVAR_STR(bind_address, bind_address, PLUGIN_VAR_READONLY,
425 N_("Address to bind to."), NULL, NULL, NULL);
426
427+static void init_options(drizzled::module::option_context &context)
428+{
429+ context("port",
430+ po::value<uint32_t>(&port)->default_value(0),
431+ N_("Port number to use for connection or 0 for "
432+ "default to, in order of "
433+ "preference, drizzle.cnf, $DRIZZLE_TCP_PORT, "
434+ "built-in default (4427)."));
435+ context("connect-timeout",
436+ po::value<uint32_t>(&connect_timeout)->default_value(10),
437+ N_("Connect Timeout."));
438+ context("read-timeout",
439+ po::value<uint32_t>(&read_timeout)->default_value(30),
440+ N_("Read Timeout."));
441+ context("write-timeout",
442+ po::value<uint32_t>(&write_timeout)->default_value(60),
443+ N_("Write Timeout."));
444+ context("retry-count",
445+ po::value<uint32_t>(&retry_count)->default_value(10),
446+ N_("Retry Count."));
447+ context("buffer-length",
448+ po::value<uint32_t>(&buffer_length)->default_value(16384),
449+ N_("Buffer length."));
450+ context("bind-address",
451+ po::value<string>(),
452+ N_("Address to bind to."));
453+}
454+
455 static drizzle_sys_var* sys_variables[]= {
456 DRIZZLE_SYSVAR(port),
457 DRIZZLE_SYSVAR(connect_timeout),
458@@ -855,4 +947,4 @@
459
460 } /* namespace drizzle_protocol */
461
462-DRIZZLE_PLUGIN(drizzle_protocol::init, drizzle_protocol::sys_variables);
463+DRIZZLE_PLUGIN(drizzle_protocol::init, drizzle_protocol::sys_variables, drizzle_protocol::init_options);
464
465=== modified file 'plugin/errmsg_notify/errmsg_notify.cc'
466--- plugin/errmsg_notify/errmsg_notify.cc 2010-05-18 18:20:56 +0000
467+++ plugin/errmsg_notify/errmsg_notify.cc 2010-07-06 15:38:27 +0000
468@@ -103,4 +103,4 @@
469 return 0;
470 }
471
472-DRIZZLE_PLUGIN(plugin_init, NULL);
473+DRIZZLE_PLUGIN(plugin_init, NULL, NULL);
474
475=== modified file 'plugin/filtered_replicator/filtered_replicator.cc'
476--- plugin/filtered_replicator/filtered_replicator.cc 2010-05-18 18:20:56 +0000
477+++ plugin/filtered_replicator/filtered_replicator.cc 2010-07-06 15:38:27 +0000
478@@ -611,4 +611,4 @@
479 NULL
480 };
481
482-DRIZZLE_PLUGIN(init, filtered_replicator_system_variables);
483+DRIZZLE_PLUGIN(init, filtered_replicator_system_variables, NULL);
484
485=== modified file 'plugin/logging_stats/tests/t/command-master.opt'
486--- plugin/logging_stats/tests/t/command-master.opt 2010-04-09 01:58:28 +0000
487+++ plugin/logging_stats/tests/t/command-master.opt 2010-07-06 15:38:27 +0000
488@@ -1,1 +1,1 @@
489---plugin-add=logging_stats --logging_stats_enable --logging_stats_max_user_count=503
490+--plugin-add=logging_stats --logging-stats-enable --logging-stats-max-user-count=503
491
492=== modified file 'plugin/logging_stats/tests/t/max_session-master.opt'
493--- plugin/logging_stats/tests/t/max_session-master.opt 2010-04-09 01:58:28 +0000
494+++ plugin/logging_stats/tests/t/max_session-master.opt 2010-07-06 15:38:27 +0000
495@@ -1,1 +1,1 @@
496---plugin-add=logging_stats --logging_stats_enable --logging_stats_scoreboard_size=10 --logging_stats_bucket_count=5 --logging_stats_max_user_count=502
497+--plugin-add=logging_stats --logging-stats-enable --logging-stats-scoreboard-size=10 --logging-stats-bucket-count=5 --logging-stats-max-user-count=502
498
499=== modified file 'plugin/logging_stats/tests/t/max_user-master.opt'
500--- plugin/logging_stats/tests/t/max_user-master.opt 2010-04-09 01:58:28 +0000
501+++ plugin/logging_stats/tests/t/max_user-master.opt 2010-07-06 15:38:27 +0000
502@@ -1,1 +1,1 @@
503---plugin-add=logging_stats --logging_stats_enable --logging_stats_max_user_count=505
504+--plugin-add=logging_stats --logging-stats-enable --logging-stats-max-user-count=505
505
506=== modified file 'plugin/logging_stats/tests/t/slap-master.opt'
507--- plugin/logging_stats/tests/t/slap-master.opt 2010-04-09 01:58:28 +0000
508+++ plugin/logging_stats/tests/t/slap-master.opt 2010-07-06 15:38:27 +0000
509@@ -1,1 +1,1 @@
510---plugin-add=logging_stats --logging_stats_enable --logging_stats_max_user_count=501
511+--plugin-add=logging_stats --logging-stats-enable --logging-stats-max-user-count=501
512
513=== modified file 'plugin/mysql_protocol/mysql_protocol.cc'
514--- plugin/mysql_protocol/mysql_protocol.cc 2010-05-18 18:20:56 +0000
515+++ plugin/mysql_protocol/mysql_protocol.cc 2010-07-06 15:38:27 +0000
516@@ -25,12 +25,14 @@
517 #include <drizzled/session.h>
518 #include "drizzled/internal/m_string.h"
519 #include <algorithm>
520-
521+#include <boost/program_options.hpp>
522+#include <drizzled/module/option_map.h>
523 #include "errmsg.h"
524 #include "mysql_protocol.h"
525 #include "mysql_password.h"
526 #include "options.h"
527
528+namespace po= boost::program_options;
529 using namespace std;
530 using namespace drizzled;
531
532@@ -882,12 +884,78 @@
533 plugin::Create_function<MySQLPassword> *mysql_password= NULL;
534
535 static int init(drizzled::module::Context &context)
536-{
537+{
538+
539 /* Initialize random seeds for the MySQL algorithm with minimal changes. */
540 time_t seed_time= time(NULL);
541 random_seed1= seed_time % random_max;
542 random_seed2= (seed_time / 2) % random_max;
543
544+ const module::option_map &vm= context.getOptions();
545+ if (vm.count("port"))
546+ {
547+ if (port > 65535)
548+ {
549+ errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value of port\n"));
550+ exit(-1);
551+ }
552+ }
553+
554+ if (vm.count("connect-timeout"))
555+ {
556+ if (connect_timeout < 1 || connect_timeout > 300)
557+ {
558+ errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for connect_timeout\n"));
559+ exit(-1);
560+ }
561+ }
562+
563+ if (vm.count("read-timeout"))
564+ {
565+ if (read_timeout < 1 || read_timeout > 300)
566+ {
567+ errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for read_timeout\n"));
568+ exit(-1);
569+ }
570+ }
571+
572+ if (vm.count("write-timeout"))
573+ {
574+ if (write_timeout < 1 || write_timeout > 300)
575+ {
576+ errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for write_timeout\n"));
577+ exit(-1);
578+ }
579+ }
580+
581+ if (vm.count("retry-count"))
582+ {
583+ if (retry_count < 1 || retry_count > 100)
584+ {
585+ errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for retry_count"));
586+ exit(-1);
587+ }
588+ }
589+
590+ if (vm.count("buffer-length"))
591+ {
592+ if (buffer_length < 1024 || buffer_length > 1024*1024)
593+ {
594+ errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for buffer_length\n"));
595+ exit(-1);
596+ }
597+ }
598+
599+ if (vm.count("bind-address"))
600+ {
601+ bind_address= strdup(vm["bind-address"].as<string>().c_str());
602+ }
603+
604+ else
605+ {
606+ bind_address= NULL;
607+ }
608+
609 mysql_password= new plugin::Create_function<MySQLPassword>(MySQLPasswordName);
610 context.add(mysql_password);
611
612@@ -916,6 +984,32 @@
613 static DRIZZLE_SYSVAR_STR(bind_address, bind_address, PLUGIN_VAR_READONLY,
614 N_("Address to bind to."), NULL, NULL, NULL);
615
616+static void init_options(drizzled::module::option_context &context)
617+{
618+ context("port",
619+ po::value<uint32_t>(&port)->default_value(3306),
620+ N_("Port number to use for connection or 0 for default to with MySQL "
621+ "protocol."));
622+ context("connect-timeout",
623+ po::value<uint32_t>(&connect_timeout)->default_value(10),
624+ N_("Connect Timeout."));
625+ context("read-timeout",
626+ po::value<uint32_t>(&read_timeout)->default_value(30),
627+ N_("Read Timeout."));
628+ context("write-timeout",
629+ po::value<uint32_t>(&write_timeout)->default_value(60),
630+ N_("Write Timeout."));
631+ context("retry-count",
632+ po::value<uint32_t>(&retry_count)->default_value(10),
633+ N_("Retry Count."));
634+ context("buffer-length",
635+ po::value<uint32_t>(&buffer_length)->default_value(16384),
636+ N_("Buffer length."));
637+ context("bind-address",
638+ po::value<string>(),
639+ N_("Address to bind to."));
640+}
641+
642 static drizzle_sys_var* sys_variables[]= {
643 DRIZZLE_SYSVAR(port),
644 DRIZZLE_SYSVAR(connect_timeout),
645@@ -930,13 +1024,13 @@
646 DRIZZLE_DECLARE_PLUGIN
647 {
648 DRIZZLE_VERSION_ID,
649- "mysql_protocol",
650+ "mysql-protocol",
651 "0.1",
652 "Eric Day",
653 "MySQL Protocol Module",
654 PLUGIN_LICENSE_GPL,
655 init, /* Plugin Init */
656 sys_variables, /* system variables */
657- NULL /* config options */
658+ init_options /* config options */
659 }
660 DRIZZLE_DECLARE_PLUGIN_END;
661
662=== modified file 'plugin/rabbitmq/rabbitmq_log.cc'
663--- plugin/rabbitmq/rabbitmq_log.cc 2010-05-21 16:24:37 +0000
664+++ plugin/rabbitmq/rabbitmq_log.cc 2010-07-06 15:38:27 +0000
665@@ -263,5 +263,5 @@
666 NULL
667 };
668
669-DRIZZLE_PLUGIN(init, system_variables);
670+DRIZZLE_PLUGIN(init, system_variables, NULL);
671
672
673=== modified file 'plugin/rand_function/rand_function.cc'
674--- plugin/rand_function/rand_function.cc 2010-06-04 09:05:44 +0000
675+++ plugin/rand_function/rand_function.cc 2010-07-06 15:38:27 +0000
676@@ -126,4 +126,4 @@
677 return 0;
678 }
679
680-DRIZZLE_PLUGIN(initialize, NULL);
681+DRIZZLE_PLUGIN(initialize, NULL, NULL);
682
683=== modified file 'plugin/replication_dictionary/module.cc'
684--- plugin/replication_dictionary/module.cc 2010-05-18 18:20:56 +0000
685+++ plugin/replication_dictionary/module.cc 2010-07-06 15:38:27 +0000
686@@ -53,4 +53,4 @@
687 }
688 }
689
690-DRIZZLE_PLUGIN(init, NULL);
691+DRIZZLE_PLUGIN(init, NULL, NULL);
692
693=== modified file 'plugin/rot13/rot13.cc'
694--- plugin/rot13/rot13.cc 2010-05-18 18:20:56 +0000
695+++ plugin/rot13/rot13.cc 2010-07-06 15:38:27 +0000
696@@ -93,4 +93,4 @@
697
698 } /* namespace rot13 */
699
700-DRIZZLE_PLUGIN(rot13::init, NULL);
701+DRIZZLE_PLUGIN(rot13::init, NULL, NULL);
702
703=== modified file 'plugin/simple_user_policy/module.cc'
704--- plugin/simple_user_policy/module.cc 2010-05-18 18:20:56 +0000
705+++ plugin/simple_user_policy/module.cc 2010-07-06 15:38:27 +0000
706@@ -36,4 +36,4 @@
707
708 } /* namespace simple_user_policy */
709
710-DRIZZLE_PLUGIN(simple_user_policy::init, NULL);
711+DRIZZLE_PLUGIN(simple_user_policy::init, NULL, NULL);
712
713=== modified file 'plugin/sleep/sleep.cc'
714--- plugin/sleep/sleep.cc 2010-05-18 18:20:56 +0000
715+++ plugin/sleep/sleep.cc 2010-07-06 15:38:27 +0000
716@@ -136,4 +136,4 @@
717 return 0;
718 }
719
720-DRIZZLE_PLUGIN(sleep_plugin_init, NULL);
721+DRIZZLE_PLUGIN(sleep_plugin_init, NULL, NULL);
722
723=== modified file 'plugin/syslog/module.cc'
724--- plugin/syslog/module.cc 2010-06-24 03:15:21 +0000
725+++ plugin/syslog/module.cc 2010-07-06 15:38:27 +0000
726@@ -157,4 +157,4 @@
727
728 } // namespace syslog_module
729
730-DRIZZLE_PLUGIN(syslog_module::init, syslog_module::system_variables);
731+DRIZZLE_PLUGIN(syslog_module::init, syslog_module::system_variables, NULL);
732
733=== modified file 'plugin/transaction_log/module.cc'
734--- plugin/transaction_log/module.cc 2010-05-18 18:20:56 +0000
735+++ plugin/transaction_log/module.cc 2010-07-06 15:38:27 +0000
736@@ -292,4 +292,4 @@
737 NULL
738 };
739
740-DRIZZLE_PLUGIN(init, sys_variables);
741+DRIZZLE_PLUGIN(init, sys_variables, NULL);
742
743=== modified file 'plugin/version/versionudf.cc'
744--- plugin/version/versionudf.cc 2010-05-18 18:20:56 +0000
745+++ plugin/version/versionudf.cc 2010-07-06 15:38:27 +0000
746@@ -60,4 +60,4 @@
747 return 0;
748 }
749
750-DRIZZLE_PLUGIN(initialize, NULL);
751+DRIZZLE_PLUGIN(initialize, NULL, NULL);
752
753=== modified file 'tests/test-run.pl'
754--- tests/test-run.pl 2010-06-19 19:28:47 +0000
755+++ tests/test-run.pl 2010-07-06 15:38:27 +0000
756@@ -1497,7 +1497,7 @@
757 $ENV{'SLAVE_MYPORT1'}= $slave->[1]->{'port'};
758 $ENV{'SLAVE_MYPORT2'}= $slave->[2]->{'port'};
759 $ENV{'MC_PORT'}= $opt_memc_myport;
760- $ENV{'DRIZZLE_TCP_PORT'}= $mysqld_variables{'drizzle-protocol-port'};
761+ $ENV{'DRIZZLE_TCP_PORT'}= $mysqld_variables{'drizzle-protocol.port'};
762
763 $ENV{'MTR_BUILD_THREAD'}= $opt_mtr_build_thread;
764
765@@ -2558,7 +2558,7 @@
766 # Increase default connect_timeout to avoid intermittent
767 # disconnects when test servers are put under load
768 # see BUG#28359
769- mtr_add_arg($args, "%s--mysql-protocol-connect-timeout=60", $prefix);
770+ mtr_add_arg($args, "%s--mysql-protocol.connect-timeout=60", $prefix);
771
772
773 # When mysqld is run by a root user(euid is 0), it will fail
774@@ -2571,10 +2571,10 @@
775 mtr_add_arg($args, "%s--pid-file=%s", $prefix,
776 $mysqld->{'path_pid'});
777
778- mtr_add_arg($args, "%s--mysql-protocol-port=%d", $prefix,
779+ mtr_add_arg($args, "%s--mysql-protocol.port=%d", $prefix,
780 $mysqld->{'port'});
781
782- mtr_add_arg($args, "%s--drizzle-protocol-port=%d", $prefix,
783+ mtr_add_arg($args, "%s--drizzle-protocol.port=%d", $prefix,
784 $mysqld->{'secondary_port'});
785
786 mtr_add_arg($args, "%s--datadir=%s", $prefix,
787@@ -2739,6 +2739,7 @@
788
789 if ( defined $exe )
790 {
791+ mtr_verbose("running Drizzle with: $exe @$args");
792 $pid= mtr_spawn($exe, $args, "",
793 $mysqld->{'path_myerr'},
794 $mysqld->{'path_myerr'},