Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
fa98e9c7
Commit
fa98e9c7
authored
Sep 06, 2006
by
serg@janus.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
converting plugin states to bitmask to simplify testing.
state_mask argument to plugin_foreach()
parent
29acac81
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
19 deletions
+27
-19
sql/sql_plugin.cc
sql/sql_plugin.cc
+9
-7
sql/sql_plugin.h
sql/sql_plugin.h
+15
-10
sql/sql_show.cc
sql/sql_show.cc
+3
-2
No files found.
sql/sql_plugin.cc
View file @
fa98e9c7
...
@@ -372,7 +372,7 @@ struct st_plugin_int *plugin_lock(const LEX_STRING *name, int type)
...
@@ -372,7 +372,7 @@ struct st_plugin_int *plugin_lock(const LEX_STRING *name, int type)
rw_wrlock
(
&
THR_LOCK_plugin
);
rw_wrlock
(
&
THR_LOCK_plugin
);
if
((
rc
=
plugin_find_internal
(
name
,
type
)))
if
((
rc
=
plugin_find_internal
(
name
,
type
)))
{
{
if
(
rc
->
state
==
PLUGIN_IS_READY
||
rc
->
state
==
PLUGIN_IS_UNINITIALIZED
)
if
(
rc
->
state
&
(
PLUGIN_IS_READY
|
PLUGIN_IS_UNINITIALIZED
)
)
rc
->
ref_count
++
;
rc
->
ref_count
++
;
else
else
rc
=
0
;
rc
=
0
;
...
@@ -943,13 +943,15 @@ my_bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name)
...
@@ -943,13 +943,15 @@ my_bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name)
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
}
}
my_bool
plugin_foreach
(
THD
*
thd
,
plugin_foreach_func
*
func
,
my_bool
plugin_foreach
_with_mask
(
THD
*
thd
,
plugin_foreach_func
*
func
,
int
type
,
void
*
arg
)
int
type
,
uint
state_mask
,
void
*
arg
)
{
{
uint
idx
,
total
;
uint
idx
,
total
;
struct
st_plugin_int
*
plugin
,
**
plugins
;
struct
st_plugin_int
*
plugin
,
**
plugins
;
int
version
=
plugin_array_version
;
int
version
=
plugin_array_version
;
DBUG_ENTER
(
"plugin_foreach"
);
DBUG_ENTER
(
"plugin_foreach_with_mask"
);
state_mask
=
~
state_mask
;
// do it only once
rw_rdlock
(
&
THR_LOCK_plugin
);
rw_rdlock
(
&
THR_LOCK_plugin
);
if
(
type
==
MYSQL_ANY_PLUGIN
)
if
(
type
==
MYSQL_ANY_PLUGIN
)
...
@@ -959,7 +961,7 @@ my_bool plugin_foreach(THD *thd, plugin_foreach_func *func,
...
@@ -959,7 +961,7 @@ my_bool plugin_foreach(THD *thd, plugin_foreach_func *func,
for
(
idx
=
0
;
idx
<
total
;
idx
++
)
for
(
idx
=
0
;
idx
<
total
;
idx
++
)
{
{
plugin
=
dynamic_element
(
&
plugin_array
,
idx
,
struct
st_plugin_int
*
);
plugin
=
dynamic_element
(
&
plugin_array
,
idx
,
struct
st_plugin_int
*
);
if
(
plugin
->
state
==
PLUGIN_IS_FREED
)
if
(
plugin
->
state
&
state_mask
)
continue
;
continue
;
plugins
[
idx
]
=
plugin
;
plugins
[
idx
]
=
plugin
;
}
}
...
@@ -972,7 +974,7 @@ my_bool plugin_foreach(THD *thd, plugin_foreach_func *func,
...
@@ -972,7 +974,7 @@ my_bool plugin_foreach(THD *thd, plugin_foreach_func *func,
for
(
idx
=
0
;
idx
<
total
;
idx
++
)
for
(
idx
=
0
;
idx
<
total
;
idx
++
)
{
{
plugin
=
(
struct
st_plugin_int
*
)
hash_element
(
hash
,
idx
);
plugin
=
(
struct
st_plugin_int
*
)
hash_element
(
hash
,
idx
);
if
(
plugin
->
state
==
PLUGIN_IS_FREED
)
if
(
plugin
->
state
&
state_mask
)
continue
;
continue
;
plugins
[
idx
]
=
plugin
;
plugins
[
idx
]
=
plugin
;
}
}
...
@@ -986,7 +988,7 @@ my_bool plugin_foreach(THD *thd, plugin_foreach_func *func,
...
@@ -986,7 +988,7 @@ my_bool plugin_foreach(THD *thd, plugin_foreach_func *func,
{
{
rw_rdlock
(
&
THR_LOCK_plugin
);
rw_rdlock
(
&
THR_LOCK_plugin
);
for
(
uint
i
=
idx
;
i
<
total
;
i
++
)
for
(
uint
i
=
idx
;
i
<
total
;
i
++
)
if
(
plugins
[
i
]
->
state
==
PLUGIN_IS_FREED
)
if
(
plugins
[
i
]
->
state
&
state_mask
)
plugins
[
i
]
=
0
;
plugins
[
i
]
=
0
;
rw_unlock
(
&
THR_LOCK_plugin
);
rw_unlock
(
&
THR_LOCK_plugin
);
}
}
...
...
sql/sql_plugin.h
View file @
fa98e9c7
...
@@ -31,13 +31,17 @@ typedef struct st_mysql_show_var SHOW_VAR;
...
@@ -31,13 +31,17 @@ typedef struct st_mysql_show_var SHOW_VAR;
#define MYSQL_ANY_PLUGIN -1
#define MYSQL_ANY_PLUGIN -1
enum
enum_plugin_state
/*
{
different values of st_plugin_int::state
PLUGIN_IS_FREED
=
0
,
though they look like a bitmap, plugin may only
PLUGIN_IS_DELETED
,
be in one of those eigenstates, not in a superposition of them :)
PLUGIN_IS_UNINITIALIZED
,
It's a bitmap, because it makes it easier to test
PLUGIN_IS_READY
"whether the state is one of those..."
};
*/
#define PLUGIN_IS_FREED 1
#define PLUGIN_IS_DELETED 2
#define PLUGIN_IS_UNINITIALIZED 4
#define PLUGIN_IS_READY 8
/* A handle for the dynamic library containing a plugin or plugins. */
/* A handle for the dynamic library containing a plugin or plugins. */
...
@@ -57,7 +61,7 @@ struct st_plugin_int
...
@@ -57,7 +61,7 @@ struct st_plugin_int
LEX_STRING
name
;
LEX_STRING
name
;
struct
st_mysql_plugin
*
plugin
;
struct
st_mysql_plugin
*
plugin
;
struct
st_plugin_dl
*
plugin_dl
;
struct
st_plugin_dl
*
plugin_dl
;
enum
enum_plugin_state
state
;
uint
state
;
uint
ref_count
;
/* number of threads using the plugin */
uint
ref_count
;
/* number of threads using the plugin */
void
*
data
;
/* plugin type specific, e.g. handlerton */
void
*
data
;
/* plugin type specific, e.g. handlerton */
};
};
...
@@ -78,6 +82,7 @@ extern my_bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name);
...
@@ -78,6 +82,7 @@ extern my_bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name);
typedef
my_bool
(
plugin_foreach_func
)(
THD
*
thd
,
typedef
my_bool
(
plugin_foreach_func
)(
THD
*
thd
,
st_plugin_int
*
plugin
,
st_plugin_int
*
plugin
,
void
*
arg
);
void
*
arg
);
extern
my_bool
plugin_foreach
(
THD
*
thd
,
plugin_foreach_func
*
func
,
#define plugin_foreach(A,B,C,D) plugin_foreach_with_mask(A,B,C,PLUGIN_IS_READY,D)
int
type
,
void
*
arg
);
extern
my_bool
plugin_foreach_with_mask
(
THD
*
thd
,
plugin_foreach_func
*
func
,
int
type
,
uint
state_mask
,
void
*
arg
);
#endif
#endif
sql/sql_show.cc
View file @
fa98e9c7
...
@@ -220,9 +220,10 @@ int fill_plugins(THD *thd, TABLE_LIST *tables, COND *cond)
...
@@ -220,9 +220,10 @@ int fill_plugins(THD *thd, TABLE_LIST *tables, COND *cond)
DBUG_ENTER
(
"fill_plugins"
);
DBUG_ENTER
(
"fill_plugins"
);
TABLE
*
table
=
tables
->
table
;
TABLE
*
table
=
tables
->
table
;
if
(
plugin_foreach
(
thd
,
show_plugins
,
MYSQL_ANY_PLUGIN
,
table
))
if
(
plugin_foreach_with_mask
(
thd
,
show_plugins
,
MYSQL_ANY_PLUGIN
,
~
PLUGIN_IS_FREED
,
table
))
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment