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
050d7d6d
Commit
050d7d6d
authored
Apr 09, 2013
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimize discovery for cases when the storage engine is known in advance
parent
3a8e1a22
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
30 additions
and
17 deletions
+30
-17
sql/handler.cc
sql/handler.cc
+10
-3
sql/sql_base.cc
sql/sql_base.cc
+5
-1
sql/sql_base.h
sql/sql_base.h
+2
-2
sql/sql_partition.cc
sql/sql_partition.cc
+1
-1
sql/sql_table.cc
sql/sql_table.cc
+7
-4
sql/sql_truncate.cc
sql/sql_truncate.cc
+1
-1
sql/table.cc
sql/table.cc
+4
-5
No files found.
sql/handler.cc
View file @
050d7d6d
...
...
@@ -4162,6 +4162,8 @@ int ha_create_table(THD *thd, const char *path,
else
{
// open an frm file
share
.
db_plugin
=
ha_lock_engine
(
thd
,
create_info
->
db_type
);
if
(
open_table_def
(
thd
,
&
share
))
goto
err
;
}
...
...
@@ -4343,12 +4345,17 @@ static my_bool discover_handlerton(THD *thd, plugin_ref plugin,
int
ha_discover_table
(
THD
*
thd
,
TABLE_SHARE
*
share
)
{
DBUG_ENTER
(
"ha_discover_table"
);
int
found
;
DBUG_ASSERT
(
share
->
error
==
OPEN_FRM_OPEN_ERROR
);
// share is not OK yet
DBUG_ASSERT
(
!
share
->
db_plugin
);
if
(
!
plugin_foreach
(
thd
,
discover_handlerton
,
MYSQL_STORAGE_ENGINE_PLUGIN
,
share
))
if
(
share
->
db_plugin
)
found
=
discover_handlerton
(
thd
,
share
->
db_plugin
,
share
);
else
found
=
plugin_foreach
(
thd
,
discover_handlerton
,
MYSQL_STORAGE_ENGINE_PLUGIN
,
share
);
if
(
!
found
)
open_table_error
(
share
,
OPEN_FRM_OPEN_ERROR
,
ENOENT
);
// not found
DBUG_RETURN
(
share
->
error
!=
OPEN_FRM_OK
);
...
...
sql/sql_base.cc
View file @
050d7d6d
...
...
@@ -5908,6 +5908,8 @@ void close_tables_for_reopen(THD *thd, TABLE_LIST **tables,
the opened TABLE instance will be addded to THD::temporary_tables list.
@param thd Thread context.
@param hton Storage engine of the table, if known,
or NULL otherwise.
@param path Path (without .frm)
@param db Database name.
@param table_name Table name.
...
...
@@ -5923,7 +5925,8 @@ void close_tables_for_reopen(THD *thd, TABLE_LIST **tables,
@retval NULL on error.
*/
TABLE
*
open_table_uncached
(
THD
*
thd
,
const
char
*
path
,
const
char
*
db
,
TABLE
*
open_table_uncached
(
THD
*
thd
,
handlerton
*
hton
,
const
char
*
path
,
const
char
*
db
,
const
char
*
table_name
,
bool
add_to_temporary_tables_list
)
{
...
...
@@ -5953,6 +5956,7 @@ TABLE *open_table_uncached(THD *thd, const char *path, const char *db,
init_tmp_table_share
(
thd
,
share
,
saved_cache_key
,
key_length
,
strend
(
saved_cache_key
)
+
1
,
tmp_path
);
share
->
db_plugin
=
ha_lock_engine
(
thd
,
hton
);
if
(
open_table_def
(
thd
,
share
,
GTS_TABLE
|
GTS_FORCE_DISCOVERY
)
||
open_table_from_share
(
thd
,
share
,
table_name
,
...
...
sql/sql_base.h
View file @
050d7d6d
...
...
@@ -195,8 +195,8 @@ bool open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias,
bool
get_key_map_from_key_list
(
key_map
*
map
,
TABLE
*
table
,
List
<
String
>
*
index_list
);
TABLE
*
open_table_uncached
(
THD
*
thd
,
const
char
*
path
,
const
char
*
db
,
const
char
*
table_name
,
TABLE
*
open_table_uncached
(
THD
*
thd
,
handlerton
*
hton
,
const
char
*
path
,
const
char
*
db
,
const
char
*
table_name
,
bool
add_to_temporary_tables_list
);
TABLE
*
find_locked_table
(
TABLE
*
list
,
const
char
*
db
,
const
char
*
table_name
);
TABLE
*
find_write_locked_table
(
TABLE
*
list
,
const
char
*
db
,
...
...
sql/sql_partition.cc
View file @
050d7d6d
...
...
@@ -4536,7 +4536,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
*/
DBUG_ASSERT
(
thd
->
mdl_context
.
is_lock_owner
(
MDL_key
::
TABLE
,
db
,
table_name
,
MDL_INTENTION_EXCLUSIVE
));
new_table
=
open_table_uncached
(
thd
,
path
,
db
,
table_name
,
0
);
new_table
=
open_table_uncached
(
thd
,
old_db_type
,
path
,
db
,
table_name
,
0
);
if
(
!
new_table
)
DBUG_RETURN
(
TRUE
);
...
...
sql/sql_table.cc
View file @
050d7d6d
...
...
@@ -2303,7 +2303,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
Let's lock the plugin till the end of the statement.
*/
if
(
table_type
&&
table_type
!=
view_pseudo_hton
)
plugin_lock
(
thd
,
plugin_int_to_ref
(
hton2plugin
[
table_type
->
slot
])
);
ha_lock_engine
(
thd
,
table_type
);
if
(
thd
->
locked_tables_mode
)
{
...
...
@@ -4052,6 +4052,7 @@ static bool check_if_created_table_can_be_opened(THD *thd,
return
TRUE
;
init_tmp_table_share
(
thd
,
&
share
,
db
,
0
,
table_name
,
path
);
share
.
db_plugin
=
ha_lock_engine
(
thd
,
file
->
ht
);
result
=
(
open_table_def
(
thd
,
&
share
)
||
open_table_from_share
(
thd
,
&
share
,
""
,
0
,
(
uint
)
READ_ALL
,
...
...
@@ -4401,7 +4402,7 @@ bool mysql_create_table_no_lock(THD *thd,
/* prepare everything for discovery */
share
.
field
=
&
no_fields
;
share
.
db_plugin
=
plugin_int_to_ref
(
hton2plugin
[
hton
->
slot
]
);
share
.
db_plugin
=
ha_lock_engine
(
thd
,
hton
);
share
.
option_list
=
create_info
->
option_list
;
share
.
connect_string
=
create_info
->
connect_string
;
...
...
@@ -4435,7 +4436,8 @@ bool mysql_create_table_no_lock(THD *thd,
THD::temporary_tables list.
*/
TABLE
*
table
=
open_table_uncached
(
thd
,
path
,
db
,
table_name
,
TRUE
);
TABLE
*
table
=
open_table_uncached
(
thd
,
create_info
->
db_type
,
path
,
db
,
table_name
,
TRUE
);
if
(
!
table
)
{
...
...
@@ -6779,7 +6781,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
build_table_filename
(
path
,
sizeof
(
path
)
-
1
,
new_db
,
tmp_name
,
""
,
FN_IS_TMP
);
/* Open our intermediate table. */
new_table
=
open_table_uncached
(
thd
,
path
,
new_db
,
tmp_name
,
TRUE
);
new_table
=
open_table_uncached
(
thd
,
new_db_type
,
path
,
new_db
,
tmp_name
,
TRUE
);
}
if
(
!
new_table
)
goto
err_new_table_cleanup
;
...
...
sql/sql_truncate.cc
View file @
050d7d6d
...
...
@@ -269,7 +269,7 @@ static bool recreate_temporary_table(THD *thd, TABLE *table)
dd_recreate_table
(
thd
,
share
->
db
.
str
,
share
->
table_name
.
str
,
share
->
normalized_path
.
str
);
if
(
open_table_uncached
(
thd
,
share
->
path
.
str
,
share
->
db
.
str
,
if
(
open_table_uncached
(
thd
,
table_type
,
share
->
path
.
str
,
share
->
db
.
str
,
share
->
table_name
.
str
,
TRUE
))
{
error
=
FALSE
;
...
...
sql/table.cc
View file @
050d7d6d
...
...
@@ -1101,10 +1101,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
plugin_ref
tmp_plugin
=
ha_resolve_by_name
(
thd
,
&
name
);
if
(
tmp_plugin
!=
NULL
&&
!
plugin_equals
(
tmp_plugin
,
se_plugin
))
{
if
(
legacy_db_type
>
DB_TYPE_UNKNOWN
&&
legacy_db_type
<
DB_TYPE_FIRST_DYNAMIC
&&
legacy_db_type
!=
ha_legacy_type
(
plugin_data
(
tmp_plugin
,
handlerton
*
)))
if
(
se_plugin
)
{
/* bad file, legacy_db_type did not match the name */
goto
err
;
...
...
@@ -1236,6 +1233,9 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
}
share
->
key_block_size
=
uint2korr
(
frm_image
+
62
);
if
(
share
->
db_plugin
&&
!
plugin_equals
(
share
->
db_plugin
,
se_plugin
))
goto
err
;
// wrong engine (someone changed the frm under our feet?)
extra_rec_buf_length
=
uint2korr
(
frm_image
+
59
);
rec_buff_length
=
ALIGN_SIZE
(
share
->
reclength
+
1
+
extra_rec_buf_length
);
share
->
rec_buff_length
=
rec_buff_length
;
...
...
@@ -1955,7 +1955,6 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
(
void
)
my_hash_check
(
&
share
->
name_hash
);
#endif
DBUG_ASSERT
(
!
share
->
db_plugin
||
plugin_equals
(
share
->
db_plugin
,
se_plugin
));
share
->
db_plugin
=
se_plugin
;
share
->
error
=
OPEN_FRM_OK
;
thd
->
status_var
.
opened_shares
++
;
...
...
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