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
bb73e589
Commit
bb73e589
authored
Apr 12, 2006
by
osku
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use bound literals in row_truncate_table_for_mysql.
parent
9bfa19a5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
53 deletions
+19
-53
row/row0mysql.c
row/row0mysql.c
+19
-53
No files found.
row/row0mysql.c
View file @
bb73e589
...
...
@@ -2738,9 +2738,7 @@ row_truncate_table_for_mysql(
btr_pcur_t
pcur
;
mtr_t
mtr
;
dulint
new_id
;
char
*
sql
;
que_thr_t
*
thr
;
que_t
*
graph
=
NULL
;
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.
...
...
@@ -2768,30 +2766,6 @@ by DISCARD TABLESPACE.)
5) FOREIGN KEY operations: if table->n_foreign_key_checks_running > 0, we
do not allow the TRUNCATE. We also reserve the data dictionary latch. */
static
const
char
renumber_tablespace_proc
[]
=
"PROCEDURE RENUMBER_TABLESPACE_PROC () IS
\n
"
"old_id CHAR;
\n
"
"new_id CHAR;
\n
"
"old_id_low INT;
\n
"
"old_id_high INT;
\n
"
"new_id_low INT;
\n
"
"new_id_high INT;
\n
"
"BEGIN
\n
"
"old_id_high := %lu;
\n
"
"old_id_low := %lu;
\n
"
"new_id_high := %lu;
\n
"
"new_id_low := %lu;
\n
"
"old_id := CONCAT(TO_BINARY(old_id_high, 4), TO_BINARY(old_id_low, 4));
\n
"
"new_id := CONCAT(TO_BINARY(new_id_high, 4), TO_BINARY(new_id_low, 4));
\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
());
ut_ad
(
table
);
...
...
@@ -2952,35 +2926,27 @@ do not allow the TRUNCATE. We also reserve the data dictionary latch. */
btr_pcur_close
(
&
pcur
);
mtr_commit
(
&
mtr
);
new_id
=
dict_hdr_get_new_id
(
DICT_HDR_TABLE_ID
);
mem_heap_empty
(
heap
);
sql
=
mem_heap_alloc
(
heap
,
(
sizeof
renumber_tablespace_proc
)
+
40
);
sprintf
(
sql
,
renumber_tablespace_proc
,
(
ulong
)
ut_dulint_get_high
(
table
->
id
),
(
ulong
)
ut_dulint_get_low
(
table
->
id
),
(
ulong
)
ut_dulint_get_high
(
new_id
),
(
ulong
)
ut_dulint_get_low
(
new_id
));
graph
=
pars_sql
(
NULL
,
sql
);
ut_a
(
graph
);
mem_heap_free
(
heap
);
graph
->
trx
=
trx
;
trx
->
graph
=
NULL
;
graph
->
fork_type
=
QUE_FORK_MYSQL_INTERFACE
;
thr
=
que_fork_start_command
(
graph
);
ut_a
(
thr
);
new_id
=
dict_hdr_get_new_id
(
DICT_HDR_TABLE_ID
);
que_run_threads
(
thr
);
info
=
pars_info_create
(
);
que_graph_free
(
graph
);
pars_info_add_dulint_literal
(
info
,
"old_id"
,
table
->
id
);
pars_info_add_dulint_literal
(
info
,
"new_id"
,
new_id
);
err
=
trx
->
error_state
;
err
=
que_eval_sql
(
info
,
"PROCEDURE RENUMBER_TABLESPACE_PROC () IS
\n
"
"BEGIN
\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
;
...
...
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