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
6c529316
Commit
6c529316
authored
Jun 22, 2020
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace HTON_AUTOMATIC_DELETE_TABLE with return -1 from drop_table()
parent
4876651e
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
31 additions
and
51 deletions
+31
-51
sql/handler.cc
sql/handler.cc
+10
-20
sql/handler.h
sql/handler.h
+5
-7
sql/log.cc
sql/log.cc
+2
-5
sql/temporary_tables.cc
sql/temporary_tables.cc
+1
-1
storage/blackhole/ha_blackhole.cc
storage/blackhole/ha_blackhole.cc
+2
-2
storage/federated/ha_federated.cc
storage/federated/ha_federated.cc
+2
-3
storage/federatedx/ha_federatedx.cc
storage/federatedx/ha_federatedx.cc
+2
-3
storage/heap/ha_heap.cc
storage/heap/ha_heap.cc
+1
-1
storage/perfschema/ha_perfschema.cc
storage/perfschema/ha_perfschema.cc
+3
-6
storage/sphinx/ha_sphinx.cc
storage/sphinx/ha_sphinx.cc
+2
-2
storage/spider/spd_table.cc
storage/spider/spd_table.cc
+1
-1
No files found.
sql/handler.cc
View file @
6c529316
...
...
@@ -2758,14 +2758,14 @@ int ha_delete_table(THD *thd, handlerton *hton, const char *path,
if
(
hton
==
NULL
||
hton
==
view_pseudo_hton
)
DBUG_RETURN
(
0
);
if
(
unlikely
((
error
=
hton
->
drop_table
(
hton
,
path
))))
error
=
hton
->
drop_table
(
hton
,
path
);
if
(
error
>
0
)
{
/*
It's not an error if the table doesn't exist in the engine.
warn the user, but still report DROP being a success
*/
bool
intercept
=
non_existing_table_error
(
error
);
DBUG_ASSERT
(
error
>
0
);
if
((
!
intercept
||
generate_warning
)
&&
!
thd
->
is_error
())
{
...
...
@@ -5001,24 +5001,14 @@ static my_bool delete_table_force(THD *thd, plugin_ref plugin, void *arg)
handlerton
*
hton
=
plugin_hton
(
plugin
);
st_force_drop_table_params
*
param
=
(
st_force_drop_table_params
*
)
arg
;
/*
We have to ignore HEAP tables as these may not have been created yet
We also remove engines marked with
HTON_AUTOMATIC_DELETE_TABLE as for these we can't check if the table
ever existed.
*/
if
(
hton
->
db_type
!=
DB_TYPE_HEAP
&&
!
(
hton
->
flags
&
HTON_AUTOMATIC_DELETE_TABLE
))
{
int
error
;
error
=
ha_delete_table
(
thd
,
hton
,
param
->
path
,
param
->
db
,
param
->
alias
,
0
);
if
(
error
>
0
&&
!
non_existing_table_error
(
error
))
param
->
error
=
error
;
if
(
error
==
0
)
{
param
->
error
=
0
;
return
TRUE
;
// Table was deleted
}
int
error
;
error
=
ha_delete_table
(
thd
,
hton
,
param
->
path
,
param
->
db
,
param
->
alias
,
0
);
if
(
error
>
0
&&
!
non_existing_table_error
(
error
))
param
->
error
=
error
;
if
(
error
==
0
)
{
param
->
error
=
0
;
return
TRUE
;
// Table was deleted
}
return
FALSE
;
}
...
...
sql/handler.h
View file @
6c529316
...
...
@@ -1484,6 +1484,11 @@ struct handlerton
void
(
*
close_cursor_read_view
)(
handlerton
*
hton
,
THD
*
thd
,
void
*
read_view
);
handler
*
(
*
create
)(
handlerton
*
hton
,
TABLE_SHARE
*
table
,
MEM_ROOT
*
mem_root
);
void
(
*
drop_database
)(
handlerton
*
hton
,
char
*
path
);
/*
return 0 if dropped successfully,
-1 if nothing was done by design (as in e.g. blackhole)
an error code (e.g. HA_ERR_NO_SUCH_TABLE) otherwise
*/
int
(
*
drop_table
)(
handlerton
*
hton
,
const
char
*
path
);
int
(
*
panic
)(
handlerton
*
hton
,
enum
ha_panic_function
flag
);
int
(
*
start_consistent_snapshot
)(
handlerton
*
hton
,
THD
*
thd
);
...
...
@@ -1791,13 +1796,6 @@ handlerton *ha_default_tmp_handlerton(THD *thd);
*/
#define HTON_TRANSACTIONAL_AND_NON_TRANSACTIONAL (1 << 17)
/*
The engine doesn't keep track of tables, delete_table() is not
needed and delete_table() always returns 0 (table deleted). This flag
mainly used to skip storage engines in case of ha_delete_table_force()
*/
#define HTON_AUTOMATIC_DELETE_TABLE (1 << 18)
class
Ha_trx_info
;
struct
THD_TRANS
...
...
sql/log.cc
View file @
6c529316
...
...
@@ -1692,7 +1692,7 @@ int binlog_init(void *p)
binlog_savepoint_rollback_can_release_mdl
;
binlog_hton
->
commit
=
binlog_commit
;
binlog_hton
->
rollback
=
binlog_rollback
;
binlog_hton
->
drop_table
=
[](
handlerton
*
,
const
char
*
)
{
return
0
;
};
binlog_hton
->
drop_table
=
[](
handlerton
*
,
const
char
*
)
{
return
-
1
;
};
if
(
WSREP_ON
||
opt_bin_log
)
{
binlog_hton
->
prepare
=
binlog_prepare
;
...
...
@@ -1702,10 +1702,7 @@ int binlog_init(void *p)
// recover needs to be set to make xa{commit,rollback}_handlerton effective
binlog_hton
->
recover
=
binlog_xa_recover_dummy
;
}
binlog_hton
->
flags
=
(
HTON_NOT_USER_SELECTABLE
|
HTON_HIDDEN
|
HTON_NO_ROLLBACK
|
HTON_AUTOMATIC_DELETE_TABLE
);
binlog_hton
->
flags
=
HTON_NOT_USER_SELECTABLE
|
HTON_HIDDEN
|
HTON_NO_ROLLBACK
;
return
0
;
}
...
...
sql/temporary_tables.cc
View file @
6c529316
...
...
@@ -700,7 +700,7 @@ bool THD::rm_temporary_table(handlerton *base, const char *path)
if
(
mysql_file_delete
(
key_file_frm
,
frm_path
,
MYF
(
MY_WME
|
MY_IGNORE_ENOENT
)))
error
=
true
;
if
(
base
->
drop_table
(
base
,
path
))
if
(
base
->
drop_table
(
base
,
path
)
>
0
)
{
error
=
true
;
sql_print_warning
(
"Could not remove temporary table: '%s', error: %d"
,
...
...
storage/blackhole/ha_blackhole.cc
View file @
6c529316
...
...
@@ -399,8 +399,8 @@ static int blackhole_init(void *p)
blackhole_hton
=
(
handlerton
*
)
p
;
blackhole_hton
->
db_type
=
DB_TYPE_BLACKHOLE_DB
;
blackhole_hton
->
create
=
blackhole_create_handler
;
blackhole_hton
->
drop_table
=
[](
handlerton
*
,
const
char
*
)
{
return
0
;
};
blackhole_hton
->
flags
=
HTON_CAN_RECREATE
|
HTON_AUTOMATIC_DELETE_TABLE
;
blackhole_hton
->
drop_table
=
[](
handlerton
*
,
const
char
*
)
{
return
-
1
;
};
blackhole_hton
->
flags
=
HTON_CAN_RECREATE
;
mysql_mutex_init
(
bh_key_mutex_blackhole
,
&
blackhole_mutex
,
MY_MUTEX_INIT_FAST
);
...
...
storage/federated/ha_federated.cc
View file @
6c529316
...
...
@@ -484,9 +484,8 @@ int federated_db_init(void *p)
federated_hton
->
commit
=
federated_commit
;
federated_hton
->
rollback
=
federated_rollback
;
federated_hton
->
create
=
federated_create_handler
;
federated_hton
->
drop_table
=
[](
handlerton
*
,
const
char
*
)
{
return
0
;
};
federated_hton
->
flags
=
(
HTON_ALTER_NOT_SUPPORTED
|
HTON_NO_PARTITION
|
HTON_AUTOMATIC_DELETE_TABLE
);
federated_hton
->
drop_table
=
[](
handlerton
*
,
const
char
*
)
{
return
-
1
;
};
federated_hton
->
flags
=
HTON_ALTER_NOT_SUPPORTED
|
HTON_NO_PARTITION
;
/*
Support for transactions disabled until WL#2952 fixes it.
...
...
storage/federatedx/ha_federatedx.cc
View file @
6c529316
...
...
@@ -438,9 +438,8 @@ int federatedx_db_init(void *p)
federatedx_hton
->
rollback
=
ha_federatedx
::
rollback
;
federatedx_hton
->
discover_table_structure
=
ha_federatedx
::
discover_assisted
;
federatedx_hton
->
create
=
federatedx_create_handler
;
federatedx_hton
->
drop_table
=
[](
handlerton
*
,
const
char
*
)
{
return
0
;
};
federatedx_hton
->
flags
=
(
HTON_ALTER_NOT_SUPPORTED
|
HTON_AUTOMATIC_DELETE_TABLE
);
federatedx_hton
->
drop_table
=
[](
handlerton
*
,
const
char
*
)
{
return
-
1
;
};
federatedx_hton
->
flags
=
HTON_ALTER_NOT_SUPPORTED
;
federatedx_hton
->
create_derived
=
create_federatedx_derived_handler
;
federatedx_hton
->
create_select
=
create_federatedx_select_handler
;
...
...
storage/heap/ha_heap.cc
View file @
6c529316
...
...
@@ -43,7 +43,7 @@ static int heap_panic(handlerton *hton, ha_panic_function flag)
static
int
heap_drop_table
(
handlerton
*
hton
,
const
char
*
path
)
{
int
error
=
heap_delete_table
(
path
);
return
error
==
ENOENT
?
0
:
error
;
return
error
==
ENOENT
?
-
1
:
error
;
}
int
heap_init
(
void
*
p
)
...
...
storage/perfschema/ha_perfschema.cc
View file @
6c529316
...
...
@@ -94,13 +94,10 @@ static int pfs_init_func(void *p)
pfs_hton
=
reinterpret_cast
<
handlerton
*>
(
p
);
pfs_hton
->
create
=
pfs_create_handler
;
pfs_hton
->
drop_table
=
[](
handlerton
*
,
const
char
*
)
{
return
0
;
};
pfs_hton
->
drop_table
=
[](
handlerton
*
,
const
char
*
)
{
return
-
1
;
};
pfs_hton
->
show_status
=
pfs_show_status
;
pfs_hton
->
flags
=
(
HTON_ALTER_NOT_SUPPORTED
|
HTON_TEMPORARY_NOT_SUPPORTED
|
HTON_NO_PARTITION
|
HTON_NO_BINLOG_ROW_OPT
|
HTON_AUTOMATIC_DELETE_TABLE
);
pfs_hton
->
flags
=
HTON_ALTER_NOT_SUPPORTED
|
HTON_TEMPORARY_NOT_SUPPORTED
|
HTON_NO_PARTITION
|
HTON_NO_BINLOG_ROW_OPT
;
/*
As long as the server implementation keeps using legacy_db_type,
...
...
storage/sphinx/ha_sphinx.cc
View file @
6c529316
...
...
@@ -749,8 +749,8 @@ static int sphinx_init_func ( void * p )
hton
->
close_connection
=
sphinx_close_connection
;
hton
->
show_status
=
sphinx_show_status
;
hton
->
panic
=
sphinx_panic
;
hton
->
drop_table
=
[](
handlerton
*
,
const
char
*
)
{
return
0
;
};
hton
->
flags
=
HTON_CAN_RECREATE
|
HTON_AUTOMATIC_DELETE_TABLE
;
hton
->
drop_table
=
[](
handlerton
*
,
const
char
*
)
{
return
-
1
;
};
hton
->
flags
=
HTON_CAN_RECREATE
;
#endif
}
SPH_RET
(
0
);
...
...
storage/spider/spd_table.cc
View file @
6c529316
...
...
@@ -7249,7 +7249,7 @@ int spider_db_init(
DBUG_ENTER
(
"spider_db_init"
);
spider_hton_ptr
=
spider_hton
;
spider_hton
->
flags
=
HTON_NO_FLAGS
|
HTON_AUTOMATIC_DELETE_TABLE
;
spider_hton
->
flags
=
HTON_NO_FLAGS
;
#ifdef HTON_CAN_READ_CONNECT_STRING_IN_PARTITION
spider_hton
->
flags
|=
HTON_CAN_READ_CONNECT_STRING_IN_PARTITION
;
#endif
...
...
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