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
15ec36a6
Commit
15ec36a6
authored
Feb 21, 2023
by
Yuchen Pei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check for import tablespace option
parent
54fcb541
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
10 deletions
+14
-10
sql/handler.h
sql/handler.h
+0
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+1
-0
sql/structs.h
sql/structs.h
+3
-1
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+10
-8
No files found.
sql/handler.h
View file @
15ec36a6
...
...
@@ -2232,7 +2232,6 @@ struct Table_scope_and_contents_source_pod_st // For trivial members
MDL_ticket
*
mdl_ticket
;
bool
table_was_deleted
;
sequence_definition
*
seq_create_info
;
bool
importing_tablespace
;
// Whether we are attempting to import tablespace
void
init
()
{
...
...
sql/sql_yacc.yy
View file @
15ec36a6
...
...
@@ -7210,6 +7210,7 @@ alter_commands:
Lex->m_sql_cmd= new (thd->mem_root)
Sql_cmd_discard_import_tablespace(
Sql_cmd_discard_import_tablespace::IMPORT_TABLESPACE);
Lex->create_info.add(DDL_options_st::OPT_IMPORT_TABLESPACE);
if (unlikely(Lex->m_sql_cmd == NULL))
MYSQL_YYABORT;
}
...
...
sql/structs.h
View file @
15ec36a6
...
...
@@ -537,7 +537,8 @@ struct DDL_options_st
OPT_OR_REPLACE_SLAVE_GENERATED
=
32
,
// REPLACE was added on slave, it was
// not in the original query on master.
OPT_IF_EXISTS
=
64
,
OPT_CREATE_SELECT
=
128
// CREATE ... SELECT
OPT_CREATE_SELECT
=
128
,
// CREATE ... SELECT
OPT_IMPORT_TABLESPACE
=
256
// ALTER ... IMPORT TABLESPACE
};
private:
...
...
@@ -566,6 +567,7 @@ struct DDL_options_st
bool
like
()
const
{
return
m_options
&
OPT_LIKE
;
}
bool
if_exists
()
const
{
return
m_options
&
OPT_IF_EXISTS
;
}
bool
is_create_select
()
const
{
return
m_options
&
OPT_CREATE_SELECT
;
}
bool
import_tablespace
()
const
{
return
m_options
&
OPT_IMPORT_TABLESPACE
;
}
void
add
(
const
DDL_options_st
::
Options
other
)
{
...
...
storage/innobase/handler/ha_innodb.cc
View file @
15ec36a6
...
...
@@ -5844,13 +5844,13 @@ ha_innobase::open(const char* name, int, uint)
DEBUG_SYNC
(
thd
,
"ib_open_after_dict_open"
);
// TODO: thd_sql_command() is a weak check. We should also check it
// is an importing.
if
(
!
ib_table
&&
thd_sql_command
(
thd
)
==
SQLCOM_ALTER_TABLE
)
/* If the table does not exist and we are trying to import, create a
"bare" table similar to the effects of CREATE TABLE followed by ALTER
TABLE ... DISCARD TABLESPACE. */
if
(
!
ib_table
&&
thd_ddl_options
(
thd
)
->
import_tablespace
())
{
HA_CREATE_INFO
create_info
;
create_info
.
init
();
create_info
.
importing_tablespace
=
true
;
trx_t
*
trx
=
innobase_trx_allocate
(
thd
);
trx_start_for_ddl
(
trx
);
lock_sys_tables
(
trx
);
...
...
@@ -5861,7 +5861,7 @@ ha_innobase::open(const char* name, int, uint)
trx
->
free
();
ib_table
=
open_dict_table
(
name
,
norm_name
,
is_part
,
DICT_ERR_IGNORE_TABLESPACE
);
DEBUG_SYNC
(
thd
,
"ib_open_after_
import_tablespace
"
);
DEBUG_SYNC
(
thd
,
"ib_open_after_
create_and_open_for_import
"
);
}
if
(
NULL
==
ib_table
)
{
...
...
@@ -10591,7 +10591,7 @@ create_table_info_t::create_table_def()
/* Set file_unreadable to avoid is_readable() assertion
errors. Semantically we assume the tablespace is not available
until we are able to import it.*/
if
(
m_create_info
->
importing_tablespace
)
if
(
thd_ddl_options
(
m_thd
)
->
import_tablespace
()
)
table
->
file_unreadable
=
true
;
if
(
DICT_TF_HAS_DATA_DIR
(
m_flags
))
{
...
...
@@ -11607,8 +11607,10 @@ bool create_table_info_t::innobase_table_flags()
}
}
// If we are trying to import a tablespace, mark tablespace as discarded
if
(
m_create_info
->
importing_tablespace
)
/* If we are trying to import a tablespace, mark tablespace as
discarded. Without this dict_create_index_space() will attempt to
create a tablespace. */
if
(
thd_ddl_options
(
m_thd
)
->
import_tablespace
())
m_flags2
|=
DICT_TF2_DISCARDED
;
row_type
=
m_create_info
->
row_type
;
...
...
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