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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
821db380
Commit
821db380
authored
Apr 15, 2013
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove numerous #ifdef HAVE_PSI_TABLE_INTERFACE
simplify ha_table_share_psi()
parent
a9035be5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
52 deletions
+38
-52
include/mysql/psi/mysql_table.h
include/mysql/psi/mysql_table.h
+16
-0
sql/handler.cc
sql/handler.cc
+12
-28
sql/handler.h
sql/handler.h
+5
-9
sql/sql_base.cc
sql/sql_base.cc
+2
-10
sql/sql_table.cc
sql/sql_table.cc
+3
-5
No files found.
include/mysql/psi/mysql_table.h
View file @
821db380
...
@@ -29,6 +29,22 @@
...
@@ -29,6 +29,22 @@
@{
@{
*/
*/
#ifdef HAVE_PSI_TABLE_INTERFACE
#define PSI_CALL_unbind_table PSI_CALL(unbind_table)
#define PSI_CALL_rebind_table PSI_CALL(rebind_table)
#define PSI_CALL_open_table PSI_CALL(open_table)
#define PSI_CALL_close_table PSI_CALL(close_table)
#define PSI_CALL_get_table_share PSI_CALL(get_table_share)
#define PSI_CALL_drop_table_share PSI_CALL(drop_table_share)
#else
#define PSI_CALL_unbind_table(A1)
/* no-op */
#define PSI_CALL_rebind_table(A1,A2,A3) NULL
#define PSI_CALL_close_table(A1)
/* no-op */
#define PSI_CALL_open_table(A1,A2) NULL
#define PSI_CALL_get_table_share(A1,A2) NULL
#define PSI_CALL_drop_table_share(A1,A2,A3,A4,A5)
/* no-op */
#endif
/**
/**
@def MYSQL_TABLE_WAIT_VARIABLES
@def MYSQL_TABLE_WAIT_VARIABLES
Instrumentation helper for table waits.
Instrumentation helper for table waits.
...
...
sql/handler.cc
View file @
821db380
...
@@ -2265,14 +2265,11 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
...
@@ -2265,14 +2265,11 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
}
}
delete
file
;
delete
file
;
#ifdef HAVE_PSI_TABLE_INTERFACE
if
(
likely
(
error
==
0
))
if
(
likely
(
error
==
0
))
{
{
my_bool
temp_table
=
(
my_bool
)
is_prefix
(
alias
,
tmp_file_prefix
);
PSI_CALL_drop_table_share
(
is_prefix
(
alias
,
tmp_file_prefix
),
PSI_CALL
(
drop_table_share
)(
temp_table
,
db
,
strlen
(
db
),
db
,
strlen
(
db
),
alias
,
strlen
(
alias
));
alias
,
strlen
(
alias
));
}
}
#endif
DBUG_RETURN
(
error
);
DBUG_RETURN
(
error
);
}
}
...
@@ -2343,31 +2340,27 @@ THD *handler::ha_thd(void) const
...
@@ -2343,31 +2340,27 @@ THD *handler::ha_thd(void) const
void
handler
::
unbind_psi
()
void
handler
::
unbind_psi
()
{
{
#ifdef HAVE_PSI_TABLE_INTERFACE
/*
/*
Notify the instrumentation that this table is not owned
Notify the instrumentation that this table is not owned
by this thread any more.
by this thread any more.
*/
*/
PSI_CALL
(
unbind_table
)(
m_psi
);
PSI_CALL_unbind_table
(
m_psi
);
#endif
}
}
void
handler
::
rebind_psi
()
void
handler
::
rebind_psi
()
{
{
#ifdef HAVE_PSI_TABLE_INTERFACE
/*
/*
Notify the instrumentation that this table is now owned
Notify the instrumentation that this table is now owned
by this thread.
by this thread.
*/
*/
PSI_table_share
*
share_psi
=
ha_table_share_psi
(
table_share
);
PSI_table_share
*
share_psi
=
ha_table_share_psi
();
m_psi
=
PSI_CALL
(
rebind_table
)(
share_psi
,
this
,
m_psi
);
m_psi
=
PSI_CALL_rebind_table
(
share_psi
,
this
,
m_psi
);
#endif
}
}
PSI_table_share
*
handler
::
ha_table_share_psi
(
const
TABLE_SHARE
*
share
)
const
PSI_table_share
*
handler
::
ha_table_share_psi
()
const
{
{
return
share
->
m_psi
;
return
table_
share
->
m_psi
;
}
}
/** @brief
/** @brief
...
@@ -2409,10 +2402,7 @@ int handler::ha_open(TABLE *table_arg, const char *name, int mode,
...
@@ -2409,10 +2402,7 @@ int handler::ha_open(TABLE *table_arg, const char *name, int mode,
{
{
DBUG_ASSERT
(
m_psi
==
NULL
);
DBUG_ASSERT
(
m_psi
==
NULL
);
DBUG_ASSERT
(
table_share
!=
NULL
);
DBUG_ASSERT
(
table_share
!=
NULL
);
#ifdef HAVE_PSI_TABLE_INTERFACE
m_psi
=
PSI_CALL_open_table
(
ha_table_share_psi
(),
this
);
PSI_table_share
*
share_psi
=
ha_table_share_psi
(
table_share
);
m_psi
=
PSI_CALL
(
open_table
)(
share_psi
,
this
);
#endif
if
(
table
->
s
->
db_options_in_use
&
HA_OPTION_READ_ONLY_DATA
)
if
(
table
->
s
->
db_options_in_use
&
HA_OPTION_READ_ONLY_DATA
)
table
->
db_stat
|=
HA_READ_ONLY
;
table
->
db_stat
|=
HA_READ_ONLY
;
...
@@ -2443,10 +2433,8 @@ int handler::ha_close(void)
...
@@ -2443,10 +2433,8 @@ int handler::ha_close(void)
*/
*/
if
(
table
->
in_use
)
if
(
table
->
in_use
)
status_var_add
(
table
->
in_use
->
status_var
.
rows_tmp_read
,
rows_tmp_read
);
status_var_add
(
table
->
in_use
->
status_var
.
rows_tmp_read
,
rows_tmp_read
);
#ifdef HAVE_PSI_TABLE_INTERFACE
PSI_CALL_close_table
(
m_psi
);
PSI_CALL
(
close_table
)(
m_psi
);
m_psi
=
NULL
;
/* instrumentation handle, invalid after close_table() */
m_psi
=
NULL
;
/* instrumentation handle, invalid after close_table() */
#endif
DBUG_RETURN
(
close
());
DBUG_RETURN
(
close
());
}
}
...
@@ -4355,9 +4343,7 @@ int ha_create_table(THD *thd, const char *path,
...
@@ -4355,9 +4343,7 @@ int ha_create_table(THD *thd, const char *path,
goto
err
;
goto
err
;
}
}
#ifdef HAVE_PSI_TABLE_INTERFACE
share
.
m_psi
=
PSI_CALL_get_table_share
(
temp_table
,
&
share
);
share
.
m_psi
=
PSI_CALL
(
get_table_share
)(
temp_table
,
&
share
);
#endif
if
(
open_table_from_share
(
thd
,
&
share
,
""
,
0
,
READ_ALL
,
0
,
&
table
,
true
))
if
(
open_table_from_share
(
thd
,
&
share
,
""
,
0
,
READ_ALL
,
0
,
&
table
,
true
))
goto
err
;
goto
err
;
...
@@ -4373,10 +4359,8 @@ int ha_create_table(THD *thd, const char *path,
...
@@ -4373,10 +4359,8 @@ int ha_create_table(THD *thd, const char *path,
if
(
error
)
if
(
error
)
{
{
my_error
(
ER_CANT_CREATE_TABLE
,
MYF
(
0
),
db
,
table_name
,
error
);
my_error
(
ER_CANT_CREATE_TABLE
,
MYF
(
0
),
db
,
table_name
,
error
);
#ifdef HAVE_PSI_TABLE_INTERFACE
PSI_CALL_drop_table_share
(
temp_table
,
share
.
db
.
str
,
share
.
db
.
length
,
PSI_CALL
(
drop_table_share
)(
temp_table
,
share
.
db
.
str
,
share
.
db
.
length
,
share
.
table_name
.
str
,
share
.
table_name
.
length
);
share
.
table_name
.
str
,
share
.
table_name
.
length
);
#endif
}
}
err:
err:
...
...
sql/handler.h
View file @
821db380
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#include <my_compare.h>
#include <my_compare.h>
#include <ft_global.h>
#include <ft_global.h>
#include <keycache.h>
#include <keycache.h>
#include <mysql/psi/mysql_table.h>
#if MAX_KEY > 128
#if MAX_KEY > 128
#error MAX_KEY is too large. Values up to 128 are supported.
#error MAX_KEY is too large. Values up to 128 are supported.
...
@@ -2907,34 +2908,29 @@ protected:
...
@@ -2907,34 +2908,29 @@ protected:
/**
/**
Acquire the instrumented table information from a table share.
Acquire the instrumented table information from a table share.
@param share a table share
@return an instrumented table share, or NULL.
@return an instrumented table share, or NULL.
*/
*/
PSI_table_share
*
ha_table_share_psi
(
const
TABLE_SHARE
*
share
)
const
;
PSI_table_share
*
ha_table_share_psi
()
const
;
inline
void
psi_open
()
inline
void
psi_open
()
{
{
DBUG_ASSERT
(
m_psi
==
NULL
);
DBUG_ASSERT
(
m_psi
==
NULL
);
DBUG_ASSERT
(
table_share
!=
NULL
);
DBUG_ASSERT
(
table_share
!=
NULL
);
#ifdef HAVE_PSI_INTERFACE
if
(
PSI_server
)
if
(
PSI_server
)
{
{
PSI_table_share
*
share_psi
=
ha_table_share_psi
(
table_share
);
PSI_table_share
*
share_psi
=
ha_table_share_psi
();
if
(
share_psi
)
if
(
share_psi
)
m_psi
=
PSI_
server
->
open_table
(
share_psi
,
this
);
m_psi
=
PSI_
CALL_
open_table
(
share_psi
,
this
);
}
}
#endif
}
}
inline
void
psi_close
()
inline
void
psi_close
()
{
{
#ifdef HAVE_PSI_INTERFACE
if
(
PSI_server
&&
m_psi
)
if
(
PSI_server
&&
m_psi
)
{
{
PSI_
server
->
close_table
(
m_psi
);
PSI_
CALL_
close_table
(
m_psi
);
m_psi
=
NULL
;
/* instrumentation handle, invalid after close_table() */
m_psi
=
NULL
;
/* instrumentation handle, invalid after close_table() */
}
}
#endif
DBUG_ASSERT
(
m_psi
==
NULL
);
DBUG_ASSERT
(
m_psi
==
NULL
);
}
}
...
...
sql/sql_base.cc
View file @
821db380
...
@@ -640,11 +640,7 @@ TABLE_SHARE *get_table_share(THD *thd, const char *db, const char *table_name,
...
@@ -640,11 +640,7 @@ TABLE_SHARE *get_table_share(THD *thd, const char *db, const char *table_name,
goto
err
;
goto
err
;
}
}
#ifdef HAVE_PSI_TABLE_INTERFACE
share
->
m_psi
=
PSI_CALL_get_table_share
(
false
,
share
);
share
->
m_psi
=
PSI_CALL
(
get_table_share
)(
false
,
share
);
#else
share
->
m_psi
=
NULL
;
#endif
DBUG_PRINT
(
"exit"
,
(
"share: 0x%lx ref_count: %u"
,
DBUG_PRINT
(
"exit"
,
(
"share: 0x%lx ref_count: %u"
,
(
ulong
)
share
,
share
->
ref_count
));
(
ulong
)
share
,
share
->
ref_count
));
...
@@ -6007,11 +6003,7 @@ TABLE *open_table_uncached(THD *thd, handlerton *hton,
...
@@ -6007,11 +6003,7 @@ TABLE *open_table_uncached(THD *thd, handlerton *hton,
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
#ifdef HAVE_PSI_TABLE_INTERFACE
share
->
m_psi
=
PSI_CALL_get_table_share
(
true
,
share
);
share
->
m_psi
=
PSI_CALL
(
get_table_share
)(
true
,
share
);
#else
share
->
m_psi
=
NULL
;
#endif
if
(
open_table_from_share
(
thd
,
share
,
table_name
,
if
(
open_table_from_share
(
thd
,
share
,
table_name
,
(
uint
)
(
HA_OPEN_KEYFILE
|
HA_OPEN_RNDFILE
|
(
uint
)
(
HA_OPEN_KEYFILE
|
HA_OPEN_RNDFILE
|
...
...
sql/sql_table.cc
View file @
821db380
...
@@ -4668,18 +4668,16 @@ mysql_rename_table(handlerton *base, const char *old_db,
...
@@ -4668,18 +4668,16 @@ mysql_rename_table(handlerton *base, const char *old_db,
else
if
(
error
)
else
if
(
error
)
my_error
(
ER_ERROR_ON_RENAME
,
MYF
(
0
),
from
,
to
,
error
);
my_error
(
ER_ERROR_ON_RENAME
,
MYF
(
0
),
from
,
to
,
error
);
#ifdef HAVE_PSI_TABLE_INTERFACE
/*
/*
Remove the old table share from the pfs table share array. The new table
Remove the old table share from the pfs table share array. The new table
share will be created when the renamed table is first accessed.
share will be created when the renamed table is first accessed.
*/
*/
if
(
likely
(
error
==
0
))
if
(
likely
(
error
==
0
))
{
{
my_bool
temp_table
=
(
my_bool
)
is_prefix
(
old_name
,
tmp_file_prefix
);
PSI_CALL_drop_table_share
(
is_prefix
(
old_name
,
tmp_file_prefix
),
PSI_CALL
(
drop_table_share
)(
temp_table
,
old_db
,
strlen
(
old_db
),
old_db
,
strlen
(
old_db
),
old_name
,
strlen
(
old_name
));
old_name
,
strlen
(
old_name
));
}
}
#endif
DBUG_RETURN
(
error
!=
0
);
DBUG_RETURN
(
error
!=
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