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
=== modified file 'drizzled/module/loader.cc'
--- drizzled/module/loader.cc 2010-06-23 20:11:47 +0000
+++ drizzled/module/loader.cc 2010-07-06 15:38:27 +0000
@@ -1686,33 +1686,33 @@
1686 long_options.add(module_options);1686 long_options.add(module_options);
16871687
1688 }1688 }
1689 else1689
1690 {1690 for (opt= test_module->getManifest().system_vars; opt && *opt; opt++)
16911691 {
1692 for (opt= test_module->getManifest().system_vars; opt && *opt; opt++)1692 count++;
1693 {1693 }
1694 count++;1694
1695 }1695 if (count > EXTRA_OPTIONS || (*argc > 1))
16961696 {
1697 if (count > EXTRA_OPTIONS || (*argc > 1))1697 if (!(opts= (option*) module_root->alloc_root(sizeof(option) * count)))
1698 {1698 {
1699 if (!(opts= (option*) module_root->alloc_root(sizeof(option) * count)))1699 errmsg_printf(ERRMSG_LVL_ERROR,
1700 {1700 _("Out of memory for plugin '%s'."),
1701 errmsg_printf(ERRMSG_LVL_ERROR,1701 test_module->getName().c_str());
1702 _("Out of memory for plugin '%s'."),1702 return(-1);
1703 test_module->getName().c_str());1703 }
1704 return(-1);1704 memset(opts, 0, sizeof(option) * count);
1705 }1705
1706 memset(opts, 0, sizeof(option) * count);1706 if (construct_options(module_root, test_module, opts))
17071707 {
1708 if (construct_options(module_root, test_module, opts))1708 errmsg_printf(ERRMSG_LVL_ERROR,
1709 {1709 _("Bad options for plugin '%s'."),
1710 errmsg_printf(ERRMSG_LVL_ERROR,1710 test_module->getName().c_str());
1711 _("Bad options for plugin '%s'."),1711 return(-1);
1712 test_module->getName().c_str());1712 }
1713 return(-1);1713
1714 }1714 if (test_module->getManifest().init_options == NULL)
17151715 {
1716 error= handle_options(argc, &argv, opts, get_one_plugin_option);1716 error= handle_options(argc, &argv, opts, get_one_plugin_option);
1717 (*argc)++; /* add back one for the program name */1717 (*argc)++; /* add back one for the program name */
17181718
17191719
=== modified file 'drizzled/module/option_context.cc'
--- drizzled/module/option_context.cc 2010-06-16 22:09:59 +0000
+++ drizzled/module/option_context.cc 2010-07-06 15:38:27 +0000
@@ -36,7 +36,7 @@
36option_context& option_context::operator()(const char* name,36option_context& option_context::operator()(const char* name,
37 const char* description)37 const char* description)
38{38{
39 const std::string new_name(prepend_name(name));39 const std::string new_name(prepend_name(module_name, name));
40 po_options(new_name.c_str(), description);40 po_options(new_name.c_str(), description);
41 return *this;41 return *this;
42}42}
@@ -45,7 +45,7 @@
45option_context& option_context::operator()(const char* name,45option_context& option_context::operator()(const char* name,
46 const po::value_semantic* s)46 const po::value_semantic* s)
47{47{
48 const std::string new_name(prepend_name(name));48 const std::string new_name(prepend_name(module_name, name));
49 po_options(new_name.c_str(), s);49 po_options(new_name.c_str(), s);
50 return *this;50 return *this;
51}51}
@@ -55,11 +55,40 @@
55 const po::value_semantic* s,55 const po::value_semantic* s,
56 const char* description)56 const char* description)
57{57{
58 const std::string new_name(prepend_name(name));58 const std::string new_name(prepend_name(module_name, name));
59 po_options(new_name.c_str(), s, description);59 po_options(new_name.c_str(), s, description);
60 return *this;60 return *this;
61}61}
6262
63namespace
64{
65
66class SwapUnderscores
67{
68public:
69 char operator()(char a) const
70 {
71 if (a == '_')
72 return '-';
73 return a;
74 }
75};
76
77} /* namespace */
78
79/*
80 * Private methods.
81 */
82std::string option_context::prepend_name(std::string module_name,
83 const char *name_in)
84{
85 module_name.push_back('.');
86 std::transform(module_name.begin(), module_name.end(),
87 module_name.begin(), SwapUnderscores());
88 module_name.append(name_in);
89 return module_name;
90}
91
6392
64} /* namespace module */93} /* namespace module */
65} /* namespace drizzled */94} /* namespace drizzled */
6695
=== modified file 'drizzled/module/option_context.h'
--- drizzled/module/option_context.h 2010-06-16 22:09:59 +0000
+++ drizzled/module/option_context.h 2010-07-06 15:38:27 +0000
@@ -47,8 +47,6 @@
47 const std::string &module_name;47 const std::string &module_name;
48 po::options_description_easy_init po_options;48 po::options_description_easy_init po_options;
4949
50 std::string prepend_name(const char *name) const;
51
52public:50public:
5351
54 option_context(const std::string &module_name_in,52 option_context(const std::string &module_name_in,
@@ -64,6 +62,9 @@
64 const po::value_semantic* s,62 const po::value_semantic* s,
65 const char* description);63 const char* description);
6664
65 static std::string prepend_name(std::string module_name_in,
66 const char *name);
67
67private:68private:
68 69
69 /**70 /**
@@ -82,17 +83,6 @@
82 option_context& operator=(const option_context &);83 option_context& operator=(const option_context &);
83};84};
8485
85/*
86 * Private methods.
87 */
88inline std::string option_context::prepend_name(const char *name_in) const
89{
90 std::string new_name(module_name);
91 new_name.push_back('.');
92 new_name.append(name_in);
93 return new_name;
94}
95
96} /* namespace module */86} /* namespace module */
97} /* namespace drizzled */87} /* namespace drizzled */
9888
9989
=== modified file 'drizzled/module/option_map.h'
--- drizzled/module/option_map.h 2010-06-20 19:05:15 +0000
+++ drizzled/module/option_map.h 2010-07-06 15:38:27 +0000
@@ -26,6 +26,7 @@
26#define DRIZZLED_MODULE_OPTION_MAP_H26#define DRIZZLED_MODULE_OPTION_MAP_H
2727
28#include "drizzled/visibility.h"28#include "drizzled/visibility.h"
29#include "drizzled/module/option_context.h"
2930
30#include <boost/program_options.hpp>31#include <boost/program_options.hpp>
3132
@@ -53,18 +54,12 @@
5354
54 const boost::program_options::variable_value& operator[](const std::string &name_in) const55 const boost::program_options::variable_value& operator[](const std::string &name_in) const
55 {56 {
56 std::string new_name(module_name);57 return vm[option_context::prepend_name(module_name, name_in.c_str())];
57 new_name.push_back('.');
58 new_name.append(name_in);
59 return vm[new_name];
60 }58 }
6159
62 size_t count(const std::string &name_in) const60 size_t count(const std::string &name_in) const
63 {61 {
64 std::string new_name(module_name);62 return vm.count(option_context::prepend_name(module_name, name_in.c_str()));
65 new_name.push_back('.');
66 new_name.append(name_in);
67 return vm.count(new_name);
68 }63 }
6964
70private:65private:
7166
=== modified file 'drizzled/option.cc'
--- drizzled/option.cc 2010-04-23 21:37:29 +0000
+++ drizzled/option.cc 2010-07-06 15:38:27 +0000
@@ -562,7 +562,7 @@
562 {562 {
563 char *ptr, *end;563 char *ptr, *end;
564564
565 ptr= strrchr(cur_arg + 1, '.'); /* Skip the first character */565 ptr= NULL; //Options with '.' are now supported.
566 end= strrchr(cur_arg, '=');566 end= strrchr(cur_arg, '=');
567567
568 /*568 /*
569569
=== modified file 'drizzled/plugin.h'
--- drizzled/plugin.h 2010-06-21 04:53:35 +0000
+++ drizzled/plugin.h 2010-07-06 15:38:27 +0000
@@ -68,7 +68,7 @@
6868
6969
70#define DRIZZLE_DECLARE_PLUGIN_END70#define DRIZZLE_DECLARE_PLUGIN_END
71#define DRIZZLE_PLUGIN(init,system) \71#define DRIZZLE_PLUGIN(init,system,options) \
72 DRIZZLE_DECLARE_PLUGIN \72 DRIZZLE_DECLARE_PLUGIN \
73 { \73 { \
74 DRIZZLE_VERSION_ID, \74 DRIZZLE_VERSION_ID, \
@@ -77,7 +77,7 @@
77 STRINGIFY_ARG(PANDORA_MODULE_AUTHOR), \77 STRINGIFY_ARG(PANDORA_MODULE_AUTHOR), \
78 STRINGIFY_ARG(PANDORA_MODULE_TITLE), \78 STRINGIFY_ARG(PANDORA_MODULE_TITLE), \
79 PANDORA_MODULE_LICENSE, \79 PANDORA_MODULE_LICENSE, \
80 init, system, NULL \80 init, system, options \
81 } 81 }
8282
8383
@@ -189,7 +189,7 @@
189 mysql_var_check_func check; \189 mysql_var_check_func check; \
190 mysql_var_update_func update190 mysql_var_update_func update
191191
192#define DRIZZLE_SYSVAR_NAME(name) mysql_sysvar_ ## name192#define DRIZZLE_SYSVAR_NAME(name) drizzle_sysvar_ ## name
193#define DRIZZLE_SYSVAR(name) \193#define DRIZZLE_SYSVAR(name) \
194 ((drizzle_sys_var *)(&(DRIZZLE_SYSVAR_NAME(name))))194 ((drizzle_sys_var *)(&(DRIZZLE_SYSVAR_NAME(name))))
195195
196196
=== modified file 'plugin/auth_file/auth_file.cc'
--- plugin/auth_file/auth_file.cc 2010-05-18 18:20:56 +0000
+++ plugin/auth_file/auth_file.cc 2010-07-06 15:38:27 +0000
@@ -237,4 +237,4 @@
237237
238} /* namespace auth_file */238} /* namespace auth_file */
239239
240DRIZZLE_PLUGIN(auth_file::init, auth_file::sys_variables);240DRIZZLE_PLUGIN(auth_file::init, auth_file::sys_variables, NULL);
241241
=== modified file 'plugin/auth_ldap/auth_ldap.cc'
--- plugin/auth_ldap/auth_ldap.cc 2010-05-18 18:20:56 +0000
+++ plugin/auth_ldap/auth_ldap.cc 2010-07-06 15:38:27 +0000
@@ -490,4 +490,4 @@
490490
491} /* namespace auth_ldap */491} /* namespace auth_ldap */
492492
493DRIZZLE_PLUGIN(auth_ldap::init, auth_ldap::sys_variables);493DRIZZLE_PLUGIN(auth_ldap::init, auth_ldap::sys_variables, NULL);
494494
=== modified file 'plugin/auth_ldap/test_ldap.sh'
--- plugin/auth_ldap/test_ldap.sh 2010-04-27 20:36:41 +0000
+++ plugin/auth_ldap/test_ldap.sh 2010-07-06 15:38:27 +0000
@@ -19,7 +19,7 @@
19 --auth-ldap-base-dn="dc=drizzle,dc=org" \19 --auth-ldap-base-dn="dc=drizzle,dc=org" \
20 --auth-ldap-cache-timeout=1 \20 --auth-ldap-cache-timeout=1 \
21 --mysql-protocol-port=12345 \21 --mysql-protocol-port=12345 \
22 --drizzle-protocol-port=12346 \22 --drizzle-protocol.port=12346 \
23 --pid-file=pid &23 --pid-file=pid &
2424
25sleep 325sleep 3
2626
=== modified file 'plugin/auth_test/auth_test.cc'
--- plugin/auth_test/auth_test.cc 2010-05-18 18:20:56 +0000
+++ plugin/auth_test/auth_test.cc 2010-07-06 15:38:27 +0000
@@ -106,4 +106,4 @@
106106
107} /* namespace auth_test */107} /* namespace auth_test */
108108
109DRIZZLE_PLUGIN(auth_test::init, NULL);109DRIZZLE_PLUGIN(auth_test::init, NULL, NULL);
110110
=== modified file 'plugin/blitzdb/ha_blitz.cc'
--- plugin/blitzdb/ha_blitz.cc 2010-06-29 21:22:35 +0000
+++ plugin/blitzdb/ha_blitz.cc 2010-07-06 15:38:27 +0000
@@ -1457,4 +1457,4 @@
1457 return pos + skip_len + sizeof(uint16_t);1457 return pos + skip_len + sizeof(uint16_t);
1458}1458}
14591459
1460DRIZZLE_PLUGIN(blitz_init, NULL);1460DRIZZLE_PLUGIN(blitz_init, NULL, NULL);
14611461
=== modified file 'plugin/crc32/crc32udf.cc'
--- plugin/crc32/crc32udf.cc 2010-05-18 18:20:56 +0000
+++ plugin/crc32/crc32udf.cc 2010-07-06 15:38:27 +0000
@@ -78,4 +78,4 @@
78 return 0;78 return 0;
79}79}
8080
81DRIZZLE_PLUGIN(initialize, NULL);81DRIZZLE_PLUGIN(initialize, NULL, NULL);
8282
=== modified file 'plugin/default_replicator/default_replicator.cc'
--- plugin/default_replicator/default_replicator.cc 2010-05-18 18:20:56 +0000
+++ plugin/default_replicator/default_replicator.cc 2010-07-06 15:38:27 +0000
@@ -66,4 +66,4 @@
66 return 0;66 return 0;
67}67}
6868
69DRIZZLE_PLUGIN(init, NULL);69DRIZZLE_PLUGIN(init, NULL, NULL);
7070
=== modified file 'plugin/drizzle_protocol/drizzle_protocol.cc'
--- plugin/drizzle_protocol/drizzle_protocol.cc 2010-05-18 18:20:56 +0000
+++ plugin/drizzle_protocol/drizzle_protocol.cc 2010-07-06 15:38:27 +0000
@@ -26,7 +26,9 @@
26#include "drizzled/internal/my_sys.h"26#include "drizzled/internal/my_sys.h"
27#include "drizzled/internal/m_string.h"27#include "drizzled/internal/m_string.h"
28#include <algorithm>28#include <algorithm>
2929#include <iostream>
30#include <boost/program_options.hpp>
31#include <drizzled/module/option_map.h>
30#include "pack.h"32#include "pack.h"
31#include "errmsg.h"33#include "errmsg.h"
32#include "drizzle_protocol.h"34#include "drizzle_protocol.h"
@@ -38,7 +40,7 @@
38{40{
39extern uint32_t global_thread_id;41extern uint32_t global_thread_id;
40}42}
4143namespace po= boost::program_options;
42using namespace drizzled;44using namespace drizzled;
43using namespace std;45using namespace std;
4446
@@ -812,12 +814,74 @@
812 drizzleclient_net_write(&net, buff, 5);814 drizzleclient_net_write(&net, buff, 5);
813}815}
814816
815static ListenDrizzleProtocol *listen_obj= NULL;
816
817static int init(module::Context &context)817static int init(module::Context &context)
818{818{
819 listen_obj= new ListenDrizzleProtocol("drizzle_protocol", false);819 const module::option_map &vm= context.getOptions();
820 context.add(listen_obj); 820 if (vm.count("port"))
821 {
822 if (port > 65535)
823 {
824 cout << "Invalid value of port";
825 exit(-1);
826 }
827 }
828
829 if (vm.count("connect-timeout"))
830 {
831 if (connect_timeout < 1 || connect_timeout > 300)
832 {
833 cout << "Invalid value for connect_timeout";
834 exit(-1);
835 }
836 }
837
838 if (vm.count("read-timeout"))
839 {
840 if (read_timeout < 1 || read_timeout > 300)
841 {
842 cout << "Invalid value for read_timeout";
843 exit(-1);
844 }
845 }
846
847 if (vm.count("write-timeout"))
848 {
849 if (write_timeout < 1 || write_timeout > 300)
850 {
851 cout << "Invalid value for write_timeout";
852 exit(-1);
853 }
854 }
855
856 if (vm.count("retry-count"))
857 {
858 if (retry_count < 1 || retry_count > 100)
859 {
860 cout << "Invalid value for retry_count";
861 exit(-1);
862 }
863 }
864
865 if (vm.count("buffer-length"))
866 {
867 if (buffer_length < 1024 || buffer_length > 1024*1024)
868 {
869 cout << "Invalid value for buffer_length";
870 exit(-1);
871 }
872 }
873
874 if (vm.count("bind-address"))
875 {
876 bind_address= strdup(vm["bind-address"].as<string>().c_str());
877 }
878
879 else
880 {
881 bind_address= NULL;
882 }
883
884 context.add(new ListenDrizzleProtocol("drizzle_protocol", false));
821 return 0;885 return 0;
822}886}
823887
@@ -842,6 +906,34 @@
842static DRIZZLE_SYSVAR_STR(bind_address, bind_address, PLUGIN_VAR_READONLY,906static DRIZZLE_SYSVAR_STR(bind_address, bind_address, PLUGIN_VAR_READONLY,
843 N_("Address to bind to."), NULL, NULL, NULL);907 N_("Address to bind to."), NULL, NULL, NULL);
844908
909static void init_options(drizzled::module::option_context &context)
910{
911 context("port",
912 po::value<uint32_t>(&port)->default_value(0),
913 N_("Port number to use for connection or 0 for "
914 "default to, in order of "
915 "preference, drizzle.cnf, $DRIZZLE_TCP_PORT, "
916 "built-in default (4427)."));
917 context("connect-timeout",
918 po::value<uint32_t>(&connect_timeout)->default_value(10),
919 N_("Connect Timeout."));
920 context("read-timeout",
921 po::value<uint32_t>(&read_timeout)->default_value(30),
922 N_("Read Timeout."));
923 context("write-timeout",
924 po::value<uint32_t>(&write_timeout)->default_value(60),
925 N_("Write Timeout."));
926 context("retry-count",
927 po::value<uint32_t>(&retry_count)->default_value(10),
928 N_("Retry Count."));
929 context("buffer-length",
930 po::value<uint32_t>(&buffer_length)->default_value(16384),
931 N_("Buffer length."));
932 context("bind-address",
933 po::value<string>(),
934 N_("Address to bind to."));
935}
936
845static drizzle_sys_var* sys_variables[]= {937static drizzle_sys_var* sys_variables[]= {
846 DRIZZLE_SYSVAR(port),938 DRIZZLE_SYSVAR(port),
847 DRIZZLE_SYSVAR(connect_timeout),939 DRIZZLE_SYSVAR(connect_timeout),
@@ -855,4 +947,4 @@
855947
856} /* namespace drizzle_protocol */948} /* namespace drizzle_protocol */
857949
858DRIZZLE_PLUGIN(drizzle_protocol::init, drizzle_protocol::sys_variables);950DRIZZLE_PLUGIN(drizzle_protocol::init, drizzle_protocol::sys_variables, drizzle_protocol::init_options);
859951
=== modified file 'plugin/errmsg_notify/errmsg_notify.cc'
--- plugin/errmsg_notify/errmsg_notify.cc 2010-05-18 18:20:56 +0000
+++ plugin/errmsg_notify/errmsg_notify.cc 2010-07-06 15:38:27 +0000
@@ -103,4 +103,4 @@
103 return 0;103 return 0;
104}104}
105105
106DRIZZLE_PLUGIN(plugin_init, NULL);106DRIZZLE_PLUGIN(plugin_init, NULL, NULL);
107107
=== modified file 'plugin/filtered_replicator/filtered_replicator.cc'
--- plugin/filtered_replicator/filtered_replicator.cc 2010-05-18 18:20:56 +0000
+++ plugin/filtered_replicator/filtered_replicator.cc 2010-07-06 15:38:27 +0000
@@ -611,4 +611,4 @@
611 NULL611 NULL
612};612};
613613
614DRIZZLE_PLUGIN(init, filtered_replicator_system_variables);614DRIZZLE_PLUGIN(init, filtered_replicator_system_variables, NULL);
615615
=== modified file 'plugin/logging_stats/tests/t/command-master.opt'
--- plugin/logging_stats/tests/t/command-master.opt 2010-04-09 01:58:28 +0000
+++ plugin/logging_stats/tests/t/command-master.opt 2010-07-06 15:38:27 +0000
@@ -1,1 +1,1 @@
1--plugin-add=logging_stats --logging_stats_enable --logging_stats_max_user_count=5031--plugin-add=logging_stats --logging-stats-enable --logging-stats-max-user-count=503
22
=== modified file 'plugin/logging_stats/tests/t/max_session-master.opt'
--- plugin/logging_stats/tests/t/max_session-master.opt 2010-04-09 01:58:28 +0000
+++ plugin/logging_stats/tests/t/max_session-master.opt 2010-07-06 15:38:27 +0000
@@ -1,1 +1,1 @@
1--plugin-add=logging_stats --logging_stats_enable --logging_stats_scoreboard_size=10 --logging_stats_bucket_count=5 --logging_stats_max_user_count=5021--plugin-add=logging_stats --logging-stats-enable --logging-stats-scoreboard-size=10 --logging-stats-bucket-count=5 --logging-stats-max-user-count=502
22
=== modified file 'plugin/logging_stats/tests/t/max_user-master.opt'
--- plugin/logging_stats/tests/t/max_user-master.opt 2010-04-09 01:58:28 +0000
+++ plugin/logging_stats/tests/t/max_user-master.opt 2010-07-06 15:38:27 +0000
@@ -1,1 +1,1 @@
1--plugin-add=logging_stats --logging_stats_enable --logging_stats_max_user_count=5051--plugin-add=logging_stats --logging-stats-enable --logging-stats-max-user-count=505
22
=== modified file 'plugin/logging_stats/tests/t/slap-master.opt'
--- plugin/logging_stats/tests/t/slap-master.opt 2010-04-09 01:58:28 +0000
+++ plugin/logging_stats/tests/t/slap-master.opt 2010-07-06 15:38:27 +0000
@@ -1,1 +1,1 @@
1--plugin-add=logging_stats --logging_stats_enable --logging_stats_max_user_count=5011--plugin-add=logging_stats --logging-stats-enable --logging-stats-max-user-count=501
22
=== modified file 'plugin/mysql_protocol/mysql_protocol.cc'
--- plugin/mysql_protocol/mysql_protocol.cc 2010-05-18 18:20:56 +0000
+++ plugin/mysql_protocol/mysql_protocol.cc 2010-07-06 15:38:27 +0000
@@ -25,12 +25,14 @@
25#include <drizzled/session.h>25#include <drizzled/session.h>
26#include "drizzled/internal/m_string.h"26#include "drizzled/internal/m_string.h"
27#include <algorithm>27#include <algorithm>
2828#include <boost/program_options.hpp>
29#include <drizzled/module/option_map.h>
29#include "errmsg.h"30#include "errmsg.h"
30#include "mysql_protocol.h"31#include "mysql_protocol.h"
31#include "mysql_password.h"32#include "mysql_password.h"
32#include "options.h"33#include "options.h"
3334
35namespace po= boost::program_options;
34using namespace std;36using namespace std;
35using namespace drizzled;37using namespace drizzled;
3638
@@ -882,12 +884,78 @@
882plugin::Create_function<MySQLPassword> *mysql_password= NULL;884plugin::Create_function<MySQLPassword> *mysql_password= NULL;
883885
884static int init(drizzled::module::Context &context)886static int init(drizzled::module::Context &context)
885{887{
888
886 /* Initialize random seeds for the MySQL algorithm with minimal changes. */889 /* Initialize random seeds for the MySQL algorithm with minimal changes. */
887 time_t seed_time= time(NULL);890 time_t seed_time= time(NULL);
888 random_seed1= seed_time % random_max;891 random_seed1= seed_time % random_max;
889 random_seed2= (seed_time / 2) % random_max;892 random_seed2= (seed_time / 2) % random_max;
890893
894 const module::option_map &vm= context.getOptions();
895 if (vm.count("port"))
896 {
897 if (port > 65535)
898 {
899 errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value of port\n"));
900 exit(-1);
901 }
902 }
903
904 if (vm.count("connect-timeout"))
905 {
906 if (connect_timeout < 1 || connect_timeout > 300)
907 {
908 errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for connect_timeout\n"));
909 exit(-1);
910 }
911 }
912
913 if (vm.count("read-timeout"))
914 {
915 if (read_timeout < 1 || read_timeout > 300)
916 {
917 errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for read_timeout\n"));
918 exit(-1);
919 }
920 }
921
922 if (vm.count("write-timeout"))
923 {
924 if (write_timeout < 1 || write_timeout > 300)
925 {
926 errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for write_timeout\n"));
927 exit(-1);
928 }
929 }
930
931 if (vm.count("retry-count"))
932 {
933 if (retry_count < 1 || retry_count > 100)
934 {
935 errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for retry_count"));
936 exit(-1);
937 }
938 }
939
940 if (vm.count("buffer-length"))
941 {
942 if (buffer_length < 1024 || buffer_length > 1024*1024)
943 {
944 errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for buffer_length\n"));
945 exit(-1);
946 }
947 }
948
949 if (vm.count("bind-address"))
950 {
951 bind_address= strdup(vm["bind-address"].as<string>().c_str());
952 }
953
954 else
955 {
956 bind_address= NULL;
957 }
958
891 mysql_password= new plugin::Create_function<MySQLPassword>(MySQLPasswordName);959 mysql_password= new plugin::Create_function<MySQLPassword>(MySQLPasswordName);
892 context.add(mysql_password);960 context.add(mysql_password);
893961
@@ -916,6 +984,32 @@
916static DRIZZLE_SYSVAR_STR(bind_address, bind_address, PLUGIN_VAR_READONLY,984static DRIZZLE_SYSVAR_STR(bind_address, bind_address, PLUGIN_VAR_READONLY,
917 N_("Address to bind to."), NULL, NULL, NULL);985 N_("Address to bind to."), NULL, NULL, NULL);
918986
987static void init_options(drizzled::module::option_context &context)
988{
989 context("port",
990 po::value<uint32_t>(&port)->default_value(3306),
991 N_("Port number to use for connection or 0 for default to with MySQL "
992 "protocol."));
993 context("connect-timeout",
994 po::value<uint32_t>(&connect_timeout)->default_value(10),
995 N_("Connect Timeout."));
996 context("read-timeout",
997 po::value<uint32_t>(&read_timeout)->default_value(30),
998 N_("Read Timeout."));
999 context("write-timeout",
1000 po::value<uint32_t>(&write_timeout)->default_value(60),
1001 N_("Write Timeout."));
1002 context("retry-count",
1003 po::value<uint32_t>(&retry_count)->default_value(10),
1004 N_("Retry Count."));
1005 context("buffer-length",
1006 po::value<uint32_t>(&buffer_length)->default_value(16384),
1007 N_("Buffer length."));
1008 context("bind-address",
1009 po::value<string>(),
1010 N_("Address to bind to."));
1011}
1012
919static drizzle_sys_var* sys_variables[]= {1013static drizzle_sys_var* sys_variables[]= {
920 DRIZZLE_SYSVAR(port),1014 DRIZZLE_SYSVAR(port),
921 DRIZZLE_SYSVAR(connect_timeout),1015 DRIZZLE_SYSVAR(connect_timeout),
@@ -930,13 +1024,13 @@
930DRIZZLE_DECLARE_PLUGIN1024DRIZZLE_DECLARE_PLUGIN
931{1025{
932 DRIZZLE_VERSION_ID,1026 DRIZZLE_VERSION_ID,
933 "mysql_protocol",1027 "mysql-protocol",
934 "0.1",1028 "0.1",
935 "Eric Day",1029 "Eric Day",
936 "MySQL Protocol Module",1030 "MySQL Protocol Module",
937 PLUGIN_LICENSE_GPL,1031 PLUGIN_LICENSE_GPL,
938 init, /* Plugin Init */1032 init, /* Plugin Init */
939 sys_variables, /* system variables */1033 sys_variables, /* system variables */
940 NULL /* config options */1034 init_options /* config options */
941}1035}
942DRIZZLE_DECLARE_PLUGIN_END;1036DRIZZLE_DECLARE_PLUGIN_END;
9431037
=== modified file 'plugin/rabbitmq/rabbitmq_log.cc'
--- plugin/rabbitmq/rabbitmq_log.cc 2010-05-21 16:24:37 +0000
+++ plugin/rabbitmq/rabbitmq_log.cc 2010-07-06 15:38:27 +0000
@@ -263,5 +263,5 @@
263 NULL263 NULL
264};264};
265265
266DRIZZLE_PLUGIN(init, system_variables);266DRIZZLE_PLUGIN(init, system_variables, NULL);
267267
268268
=== modified file 'plugin/rand_function/rand_function.cc'
--- plugin/rand_function/rand_function.cc 2010-06-04 09:05:44 +0000
+++ plugin/rand_function/rand_function.cc 2010-07-06 15:38:27 +0000
@@ -126,4 +126,4 @@
126 return 0;126 return 0;
127}127}
128128
129DRIZZLE_PLUGIN(initialize, NULL);129DRIZZLE_PLUGIN(initialize, NULL, NULL);
130130
=== modified file 'plugin/replication_dictionary/module.cc'
--- plugin/replication_dictionary/module.cc 2010-05-18 18:20:56 +0000
+++ plugin/replication_dictionary/module.cc 2010-07-06 15:38:27 +0000
@@ -53,4 +53,4 @@
53 }53 }
54}54}
5555
56DRIZZLE_PLUGIN(init, NULL);56DRIZZLE_PLUGIN(init, NULL, NULL);
5757
=== modified file 'plugin/rot13/rot13.cc'
--- plugin/rot13/rot13.cc 2010-05-18 18:20:56 +0000
+++ plugin/rot13/rot13.cc 2010-07-06 15:38:27 +0000
@@ -93,4 +93,4 @@
9393
94} /* namespace rot13 */94} /* namespace rot13 */
9595
96DRIZZLE_PLUGIN(rot13::init, NULL);96DRIZZLE_PLUGIN(rot13::init, NULL, NULL);
9797
=== modified file 'plugin/simple_user_policy/module.cc'
--- plugin/simple_user_policy/module.cc 2010-05-18 18:20:56 +0000
+++ plugin/simple_user_policy/module.cc 2010-07-06 15:38:27 +0000
@@ -36,4 +36,4 @@
3636
37} /* namespace simple_user_policy */37} /* namespace simple_user_policy */
3838
39DRIZZLE_PLUGIN(simple_user_policy::init, NULL);39DRIZZLE_PLUGIN(simple_user_policy::init, NULL, NULL);
4040
=== modified file 'plugin/sleep/sleep.cc'
--- plugin/sleep/sleep.cc 2010-05-18 18:20:56 +0000
+++ plugin/sleep/sleep.cc 2010-07-06 15:38:27 +0000
@@ -136,4 +136,4 @@
136 return 0;136 return 0;
137}137}
138138
139DRIZZLE_PLUGIN(sleep_plugin_init, NULL);139DRIZZLE_PLUGIN(sleep_plugin_init, NULL, NULL);
140140
=== modified file 'plugin/syslog/module.cc'
--- plugin/syslog/module.cc 2010-06-24 03:15:21 +0000
+++ plugin/syslog/module.cc 2010-07-06 15:38:27 +0000
@@ -157,4 +157,4 @@
157157
158} // namespace syslog_module158} // namespace syslog_module
159159
160DRIZZLE_PLUGIN(syslog_module::init, syslog_module::system_variables);160DRIZZLE_PLUGIN(syslog_module::init, syslog_module::system_variables, NULL);
161161
=== modified file 'plugin/transaction_log/module.cc'
--- plugin/transaction_log/module.cc 2010-05-18 18:20:56 +0000
+++ plugin/transaction_log/module.cc 2010-07-06 15:38:27 +0000
@@ -292,4 +292,4 @@
292 NULL292 NULL
293};293};
294294
295DRIZZLE_PLUGIN(init, sys_variables);295DRIZZLE_PLUGIN(init, sys_variables, NULL);
296296
=== modified file 'plugin/version/versionudf.cc'
--- plugin/version/versionudf.cc 2010-05-18 18:20:56 +0000
+++ plugin/version/versionudf.cc 2010-07-06 15:38:27 +0000
@@ -60,4 +60,4 @@
60 return 0;60 return 0;
61}61}
6262
63DRIZZLE_PLUGIN(initialize, NULL);63DRIZZLE_PLUGIN(initialize, NULL, NULL);
6464
=== modified file 'tests/test-run.pl'
--- tests/test-run.pl 2010-06-19 19:28:47 +0000
+++ tests/test-run.pl 2010-07-06 15:38:27 +0000
@@ -1497,7 +1497,7 @@
1497 $ENV{'SLAVE_MYPORT1'}= $slave->[1]->{'port'};1497 $ENV{'SLAVE_MYPORT1'}= $slave->[1]->{'port'};
1498 $ENV{'SLAVE_MYPORT2'}= $slave->[2]->{'port'};1498 $ENV{'SLAVE_MYPORT2'}= $slave->[2]->{'port'};
1499 $ENV{'MC_PORT'}= $opt_memc_myport;1499 $ENV{'MC_PORT'}= $opt_memc_myport;
1500 $ENV{'DRIZZLE_TCP_PORT'}= $mysqld_variables{'drizzle-protocol-port'};1500 $ENV{'DRIZZLE_TCP_PORT'}= $mysqld_variables{'drizzle-protocol.port'};
15011501
1502 $ENV{'MTR_BUILD_THREAD'}= $opt_mtr_build_thread;1502 $ENV{'MTR_BUILD_THREAD'}= $opt_mtr_build_thread;
15031503
@@ -2558,7 +2558,7 @@
2558 # Increase default connect_timeout to avoid intermittent2558 # Increase default connect_timeout to avoid intermittent
2559 # disconnects when test servers are put under load2559 # disconnects when test servers are put under load
2560 # see BUG#283592560 # see BUG#28359
2561 mtr_add_arg($args, "%s--mysql-protocol-connect-timeout=60", $prefix);2561 mtr_add_arg($args, "%s--mysql-protocol.connect-timeout=60", $prefix);
25622562
25632563
2564 # When mysqld is run by a root user(euid is 0), it will fail2564 # When mysqld is run by a root user(euid is 0), it will fail
@@ -2571,10 +2571,10 @@
2571 mtr_add_arg($args, "%s--pid-file=%s", $prefix,2571 mtr_add_arg($args, "%s--pid-file=%s", $prefix,
2572 $mysqld->{'path_pid'});2572 $mysqld->{'path_pid'});
25732573
2574 mtr_add_arg($args, "%s--mysql-protocol-port=%d", $prefix,2574 mtr_add_arg($args, "%s--mysql-protocol.port=%d", $prefix,
2575 $mysqld->{'port'});2575 $mysqld->{'port'});
25762576
2577 mtr_add_arg($args, "%s--drizzle-protocol-port=%d", $prefix,2577 mtr_add_arg($args, "%s--drizzle-protocol.port=%d", $prefix,
2578 $mysqld->{'secondary_port'});2578 $mysqld->{'secondary_port'});
25792579
2580 mtr_add_arg($args, "%s--datadir=%s", $prefix,2580 mtr_add_arg($args, "%s--datadir=%s", $prefix,
@@ -2739,6 +2739,7 @@
27392739
2740 if ( defined $exe )2740 if ( defined $exe )
2741 {2741 {
2742 mtr_verbose("running Drizzle with: $exe @$args");
2742 $pid= mtr_spawn($exe, $args, "",2743 $pid= mtr_spawn($exe, $args, "",
2743 $mysqld->{'path_myerr'},2744 $mysqld->{'path_myerr'},
2744 $mysqld->{'path_myerr'},2745 $mysqld->{'path_myerr'},