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
93e91928
Commit
93e91928
authored
Apr 13, 2006
by
osku
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use bound literals in row_discard_tablespace_for_mysql.
parent
fd19fb9c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
61 deletions
+25
-61
row/row0mysql.c
row/row0mysql.c
+25
-61
No files found.
row/row0mysql.c
View file @
93e91928
...
...
@@ -2384,11 +2384,9 @@ row_discard_tablespace_for_mysql(
dict_foreign_t
*
foreign
;
dulint
new_id
;
dict_table_t
*
table
;
que_thr_t
*
thr
;
que_t
*
graph
=
NULL
;
ibool
success
;
ulint
err
;
char
*
buf
;
pars_info_t
*
info
=
NULL
;
/* How do we prevent crashes caused by ongoing operations on the table? Old
operations could try to access non-existent pages.
...
...
@@ -2410,36 +2408,6 @@ discard ongoing operations.
5) FOREIGN KEY operations: if table->n_foreign_key_checks_running > 0, we
do not allow the discard. We also reserve the data dictionary latch. */
static
const
char
discard_tablespace_proc1
[]
=
"PROCEDURE DISCARD_TABLESPACE_PROC () IS
\n
"
"old_id CHAR;
\n
"
"new_id CHAR;
\n
"
"new_id_low INT;
\n
"
"new_id_high INT;
\n
"
"table_name CHAR;
\n
"
"BEGIN
\n
"
"table_name := '"
;
static
const
char
discard_tablespace_proc2
[]
=
"';
\n
"
"new_id_high := %lu;
\n
"
"new_id_low := %lu;
\n
"
"new_id := CONCAT(TO_BINARY(new_id_high, 4), TO_BINARY(new_id_low, 4));
\n
"
"SELECT ID INTO old_id
\n
"
"FROM SYS_TABLES
\n
"
"WHERE NAME = table_name;
\n
"
"IF (SQL %% NOTFOUND) THEN
\n
"
" COMMIT WORK;
\n
"
" RETURN;
\n
"
"END IF;
\n
"
"UPDATE SYS_TABLES SET ID = new_id
\n
"
"WHERE ID = old_id;
\n
"
"UPDATE SYS_COLUMNS SET TABLE_ID = new_id
\n
"
"WHERE TABLE_ID = old_id;
\n
"
"UPDATE SYS_INDEXES SET TABLE_ID = new_id
\n
"
"WHERE TABLE_ID = old_id;
\n
"
"COMMIT WORK;
\n
"
"END;
\n
"
;
ut_ad
(
trx
->
mysql_thread_id
==
os_thread_get_curr_id
());
trx
->
op_info
=
"discarding tablespace"
;
...
...
@@ -2519,35 +2487,34 @@ do not allow the discard. We also reserve the data dictionary latch. */
new_id
=
dict_hdr_get_new_id
(
DICT_HDR_TABLE_ID
);
buf
=
mem_alloc
((
sizeof
discard_tablespace_proc1
)
+
(
sizeof
discard_tablespace_proc2
)
+
20
+
ut_strlenq
(
name
,
'\''
));
memcpy
(
buf
,
discard_tablespace_proc1
,
sizeof
discard_tablespace_proc1
);
sprintf
(
ut_strcpyq
(
buf
+
(
sizeof
discard_tablespace_proc1
-
1
),
'\''
,
name
),
discard_tablespace_proc2
,
(
ulong
)
ut_dulint_get_high
(
new_id
),
(
ulong
)
ut_dulint_get_low
(
new_id
));
graph
=
pars_sql
(
NULL
,
buf
);
ut_a
(
graph
);
/* Remove any locks there are on the table or its records */
lock_reset_all_on_table
(
table
);
graph
->
trx
=
trx
;
trx
->
graph
=
NULL
;
graph
->
fork_type
=
QUE_FORK_MYSQL_INTERFACE
;
ut_a
(
thr
=
que_fork_start_command
(
graph
));
info
=
pars_info_create
();
que_run_threads
(
thr
);
pars_info_add_str_literal
(
info
,
"table_name"
,
name
);
pars_info_add_dulint_literal
(
info
,
"new_id"
,
new_id
);
err
=
trx
->
error_state
;
err
=
que_eval_sql
(
info
,
"PROCEDURE DISCARD_TABLESPACE_PROC () IS
\n
"
"old_id CHAR;
\n
"
"BEGIN
\n
"
"SELECT ID INTO old_id
\n
"
"FROM SYS_TABLES
\n
"
"WHERE NAME = :table_name;
\n
"
"IF (SQL % NOTFOUND) THEN
\n
"
" COMMIT WORK;
\n
"
" RETURN;
\n
"
"END IF;
\n
"
"UPDATE SYS_TABLES SET ID = :new_id
\n
"
" WHERE ID = old_id;
\n
"
"UPDATE SYS_COLUMNS SET TABLE_ID = :new_id
\n
"
" WHERE TABLE_ID = old_id;
\n
"
"UPDATE SYS_INDEXES SET TABLE_ID = :new_id
\n
"
" WHERE TABLE_ID = old_id;
\n
"
"COMMIT WORK;
\n
"
"END;
\n
"
,
trx
);
if
(
err
!=
DB_SUCCESS
)
{
trx
->
error_state
=
DB_SUCCESS
;
...
...
@@ -2571,13 +2538,10 @@ do not allow the discard. We also reserve the data dictionary latch. */
table
->
ibd_file_missing
=
TRUE
;
}
}
funct_exit:
row_mysql_unlock_data_dictionary
(
trx
);
if
(
graph
)
{
que_graph_free
(
graph
);
}
trx_commit_for_mysql
(
trx
);
trx
->
op_info
=
""
;
...
...
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