Merge lp:~atcurtis/maria/10.0-opaque-thdvar into lp:maria

Proposed by Antony T Curtis
Status: Needs review
Proposed branch: lp:~atcurtis/maria/10.0-opaque-thdvar
Merge into: lp:maria
Diff against target: 77 lines (+21/-0)
2 files modified
include/mysql/plugin.h (+6/-0)
sql/sql_plugin.cc (+15/-0)
To merge this branch: bzr merge lp:~atcurtis/maria/10.0-opaque-thdvar
Reviewer Review Type Date Requested Status
Sergei Golubchik Pending
Review via email: mp+214139@code.launchpad.net

Description of the change

OPAQUE thdvar is useful for plugins.
Plugin is responsible for freeing data on connection close (plugin dependent behaviour).

To post a comment you must log in.
Revision history for this message
Sergei Golubchik (sergii) wrote :

Hi, Antony!

> OPAQUE thdvar is useful for plugins.
> Plugin is responsible for freeing data on connection close (plugin dependent behaviour).

What's the point of this? To create THD-local storage for plugins, not
visible or accessible from SQL?

Regards,
Sergei

Revision history for this message
Antony T Curtis (atcurtis) wrote :

Yes, exactly.
On Apr 9, 2014 5:45 AM, "Sergei" <email address hidden> wrote:

> Hi, Antony!
>
> > OPAQUE thdvar is useful for plugins.
> > Plugin is responsible for freeing data on connection close (plugin
> dependent behaviour).
>
> What's the point of this? To create THD-local storage for plugins, not
> visible or accessible from SQL?
>
> Regards,
> Sergei
>
> --
> https://code.launchpad.net/~atcurtis/maria/10.0-opaque-thdvar/+merge/214139
> You are the owner of lp:~atcurtis/maria/10.0-opaque-thdvar.
>

Unmerged revisions

4144. By Antony T Curtis

Implement missing OPAQUE plugin thdvar.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'include/mysql/plugin.h'
--- include/mysql/plugin.h 2014-03-21 12:30:55 +0000
+++ include/mysql/plugin.h 2014-04-04 00:33:54 +0000
@@ -211,6 +211,7 @@
211#define PLUGIN_VAR_ENUM 0x0006211#define PLUGIN_VAR_ENUM 0x0006
212#define PLUGIN_VAR_SET 0x0007212#define PLUGIN_VAR_SET 0x0007
213#define PLUGIN_VAR_DOUBLE 0x0008213#define PLUGIN_VAR_DOUBLE 0x0008
214#define PLUGIN_VAR_OPAQUE 0x000f
214#define PLUGIN_VAR_UNSIGNED 0x0080215#define PLUGIN_VAR_UNSIGNED 0x0080
215#define PLUGIN_VAR_THDLOCAL 0x0100 /* Variable is per-connection */216#define PLUGIN_VAR_THDLOCAL 0x0100 /* Variable is per-connection */
216#define PLUGIN_VAR_READONLY 0x0200 /* Server variable is read only */217#define PLUGIN_VAR_READONLY 0x0200 /* Server variable is read only */
@@ -453,6 +454,11 @@
453 PLUGIN_VAR_DOUBLE | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \454 PLUGIN_VAR_DOUBLE | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
454 #name, comment, check, update, -1, def, min, max, blk, NULL }455 #name, comment, check, update, -1, def, min, max, blk, NULL }
455456
457#define MYSQL_THDVAR_OPAQUE(name, type) \
458DECLARE_MYSQL_THDVAR_BASIC(name, __typeof__ (type *)) = { \
459 PLUGIN_VAR_OPAQUE | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_NOCMDOPT, \
460 #name, NULL, NULL, NULL, -1, NULL, NULL }
461
456/* accessor macros */462/* accessor macros */
457463
458#define SYSVAR(name) \464#define SYSVAR(name) \
459465
=== modified file 'sql/sql_plugin.cc'
--- sql/sql_plugin.cc 2014-03-26 21:25:38 +0000
+++ sql/sql_plugin.cc 2014-04-04 00:33:54 +0000
@@ -2444,6 +2444,7 @@
2444typedef DECLARE_MYSQL_THDVAR_BASIC(thdvar_bool_t, my_bool);2444typedef DECLARE_MYSQL_THDVAR_BASIC(thdvar_bool_t, my_bool);
2445typedef DECLARE_MYSQL_SYSVAR_BASIC(sysvar_str_t, char *);2445typedef DECLARE_MYSQL_SYSVAR_BASIC(sysvar_str_t, char *);
2446typedef DECLARE_MYSQL_THDVAR_BASIC(thdvar_str_t, char *);2446typedef DECLARE_MYSQL_THDVAR_BASIC(thdvar_str_t, char *);
2447typedef DECLARE_MYSQL_THDVAR_BASIC(thdvar_opaque_t, void *);
24472448
2448typedef DECLARE_MYSQL_SYSVAR_TYPELIB(sysvar_enum_t, unsigned long);2449typedef DECLARE_MYSQL_SYSVAR_TYPELIB(sysvar_enum_t, unsigned long);
2449typedef DECLARE_MYSQL_THDVAR_TYPELIB(thdvar_enum_t, unsigned long);2450typedef DECLARE_MYSQL_THDVAR_TYPELIB(thdvar_enum_t, unsigned long);
@@ -2862,6 +2863,9 @@
2862 case PLUGIN_VAR_DOUBLE:2863 case PLUGIN_VAR_DOUBLE:
2863 size= sizeof(double);2864 size= sizeof(double);
2864 break;2865 break;
2866 case PLUGIN_VAR_OPAQUE:
2867 size= sizeof(void*);
2868 break;
2865 default:2869 default:
2866 DBUG_ASSERT(0);2870 DBUG_ASSERT(0);
2867 return NULL;2871 return NULL;
@@ -3069,6 +3073,11 @@
3069 return (double *) intern_sys_var_ptr(thd, offset, true);3073 return (double *) intern_sys_var_ptr(thd, offset, true);
3070}3074}
30713075
3076static void **mysql_sys_var_ptr(THD* thd, int offset)
3077{
3078 return (void **) intern_sys_var_ptr(thd, offset, true);
3079}
3080
3072void plugin_thdvar_init(THD *thd)3081void plugin_thdvar_init(THD *thd)
3073{3082{
3074 plugin_ref old_table_plugin= thd->variables.table_plugin;3083 plugin_ref old_table_plugin= thd->variables.table_plugin;
@@ -3643,6 +3652,9 @@
3643 case PLUGIN_VAR_DOUBLE:3652 case PLUGIN_VAR_DOUBLE:
3644 ((thdvar_double_t *) opt)->resolve= mysql_sys_var_double;3653 ((thdvar_double_t *) opt)->resolve= mysql_sys_var_double;
3645 break;3654 break;
3655 case PLUGIN_VAR_OPAQUE:
3656 ((thdvar_opaque_t *) opt)->resolve= mysql_sys_var_ptr;
3657 break;
3646 default:3658 default:
3647 sql_print_error("Unknown variable type code 0x%x in plugin '%s'.",3659 sql_print_error("Unknown variable type code 0x%x in plugin '%s'.",
3648 opt->flags, plugin_name);3660 opt->flags, plugin_name);
@@ -3712,6 +3724,9 @@
3712 if (!opt->update)3724 if (!opt->update)
3713 opt->update= update_func_double;3725 opt->update= update_func_double;
3714 break;3726 break;
3727 case PLUGIN_VAR_OPAQUE:
3728 /* this type is opaque */
3729 break;
3715 default:3730 default:
3716 sql_print_error("Unknown variable type code 0x%x in plugin '%s'.",3731 sql_print_error("Unknown variable type code 0x%x in plugin '%s'.",
3717 opt->flags, plugin_name);3732 opt->flags, plugin_name);

Subscribers

People subscribed via source and target branches