Merge lp:~skinny.moey/drizzle/show_variables_582975 into lp:~drizzle-trunk/drizzle/development

Proposed by Joe Daly
Status: Merged
Merged at revision: 1562
Proposed branch: lp:~skinny.moey/drizzle/show_variables_582975
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 54 lines (+8/-1)
3 files modified
drizzled/drizzled.cc (+3/-1)
drizzled/set_var.cc (+4/-0)
drizzled/set_var.h (+1/-0)
To merge this branch: bzr merge lp:~skinny.moey/drizzle/show_variables_582975
Reviewer Review Type Date Requested Status
Monty Taylor Approve
Brian Aker Pending
Review via email: mp+25827@code.launchpad.net

Description of the change

fix for "show variables" not displaying the scheduler bug #582975

To post a comment you must log in.
Revision history for this message
Monty Taylor (mordred) wrote :

Looks mostly good. However ...

opt_scheduler_default= (char*) "multi_thread";

Casting a static const char * to a char * is something I've been trying to get rid of in the tree in general. Is there a reason you needed to go away from from the const string here?

review: Needs Information
Revision history for this message
Joe Daly (skinny.moey) wrote :

> Looks mostly good. However ...
>
> opt_scheduler_default= (char*) "multi_thread";
>
> Casting a static const char * to a char * is something I've been trying to get
> rid of in the tree in general. Is there a reason you needed to go away from
> from the const string here?

The constructor for sys_var_const_str_ptr() expects a char** so to leave the const string here I would need to do a cast of (char*) opt_scheduler_default.c_str() or strcpy() to set the value of opt_scheduler which gets passed into sys_var_const_str_ptr(). What I did above seemed like the best choice. I looked into changing the constructor for sys_var_const_str_ptr() to accept const char** but that sent me down problems with other variables that were not const. Maybe Im missing something?

Revision history for this message
Monty Taylor (mordred) wrote :

Ok. Fair enough. I can't wait until this is systemically fixed. I really hate all the casting nonsense.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'drizzled/drizzled.cc'
2--- drizzled/drizzled.cc 2010-05-21 18:25:00 +0000
3+++ drizzled/drizzled.cc 2010-05-23 00:13:27 +0000
4@@ -218,7 +218,7 @@
5 bool volatile select_thread_in_use;
6 bool volatile abort_loop;
7 bool volatile shutdown_in_progress;
8-const string opt_scheduler_default("multi_thread");
9+char *opt_scheduler_default;
10 char *opt_scheduler= NULL;
11
12 size_t my_thread_stack_size= 65536;
13@@ -996,6 +996,7 @@
14 else
15 {
16 scheduler_name= opt_scheduler_default;
17+ opt_scheduler= opt_scheduler_default;
18 }
19
20 if (plugin::Scheduler::setPlugin(scheduler_name))
21@@ -1555,6 +1556,7 @@
22 max_system_variables.select_limit= (uint64_t) HA_POS_ERROR;
23 global_system_variables.max_join_size= (uint64_t) HA_POS_ERROR;
24 max_system_variables.max_join_size= (uint64_t) HA_POS_ERROR;
25+ opt_scheduler_default= (char*) "multi_thread";
26
27 /* Variables that depends on compile options */
28 #ifdef HAVE_BROKEN_REALPATH
29
30=== modified file 'drizzled/set_var.cc'
31--- drizzled/set_var.cc 2010-04-23 01:02:40 +0000
32+++ drizzled/set_var.cc 2010-05-23 00:13:27 +0000
33@@ -200,6 +200,10 @@
34
35 static sys_var_const_str_ptr sys_secure_file_priv(&vars, "secure_file_priv",
36 &opt_secure_file_priv);
37+
38+static sys_var_const_str_ptr sys_scheduler(&vars, "scheduler",
39+ &opt_scheduler);
40+
41 static sys_var_uint32_t_ptr sys_server_id(&vars, "server_id", &server_id,
42 fix_server_id);
43
44
45=== modified file 'drizzled/set_var.h'
46--- drizzled/set_var.h 2010-05-21 02:16:56 +0000
47+++ drizzled/set_var.h 2010-05-23 00:13:27 +0000
48@@ -81,6 +81,7 @@
49 extern bool opt_readonly;
50 extern char* opt_secure_file_priv;
51 extern char *default_tz_name;
52+extern char *opt_scheduler;
53
54 uint64_t fix_unsigned(Session *, uint64_t, const struct option *);
55