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
3f17f511
Commit
3f17f511
authored
Sep 14, 2017
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Follow-up to MDEV-13563 mariabackup --lock-ddl-per-table
Fix memory leaks, and add a missing newline to a message.
parent
cfd51c01
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
25 deletions
+15
-25
extra/mariabackup/backup_mysql.cc
extra/mariabackup/backup_mysql.cc
+15
-25
No files found.
extra/mariabackup/backup_mysql.cc
View file @
3f17f511
...
...
@@ -1662,6 +1662,7 @@ static void check_mdl_lock_works(const char *table_name)
int
err_no
=
mysql_errno
(
test_con
);
DBUG_ASSERT
(
err_no
==
ER_STATEMENT_TIMEOUT
);
mysql_close
(
test_con
);
free
(
query
);
}
#endif
...
...
@@ -1671,53 +1672,42 @@ dict_fs2utf8(const char*, char*, size_t, char*, size_t);
void
mdl_lock_table
(
ulint
space_id
)
{
char
*
query
;
static
const
char
q
[]
=
"SELECT NAME "
"FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES "
"WHERE SPACE = "
ULINTPF
" AND NAME LIKE '%%/%%'"
;
char
query
[
22
+
sizeof
q
];
snprintf
(
query
,
sizeof
query
,
q
,
space_id
);
pthread_mutex_lock
(
&
mdl_lock_con_mutex
);
xb_a
(
asprintf
(
&
query
,
"SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES "
"WHERE SPACE = %llu AND NAME LIKE '%%/%%'"
,
(
ulonglong
)
space_id
));
xb_mysql_query
(
mdl_con
,
query
,
true
,
true
);
MYSQL_RES
*
mysql_result
=
xb_mysql_query
(
mdl_con
,
query
,
true
);
MYSQL_ROW
row
;
while
((
row
=
mysql_fetch_row
(
mysql_result
)))
{
MYSQL_RES
*
mysql_result
=
xb_mysql_query
(
mdl_con
,
query
,
true
,
true
);
while
(
MYSQL_ROW
row
=
mysql_fetch_row
(
mysql_result
))
{
char
full_table_name
[
2
*
FN_REFLEN
+
2
];
char
db_utf8
[
FN_REFLEN
];
char
table_utf8
[
FN_REFLEN
];
static
const
char
lq
[]
=
"SELECT * FROM %s LIMIT 0"
;
char
lock_query
[
sizeof
full_table_name
+
sizeof
lq
];
dict_fs2utf8
(
row
[
0
],
db_utf8
,
sizeof
(
db_utf8
),
table_utf8
,
sizeof
(
table_utf8
)
);
dict_fs2utf8
(
row
[
0
],
db_utf8
,
sizeof
db_utf8
,
table_utf8
,
sizeof
table_utf8
);
snprintf
(
full_table_name
,
sizeof
(
full_table_name
),
"`%s`.`%s`"
,
db_utf8
,
table_utf8
);
char
*
lock_query
;
msg_ts
(
"Locking MDL for %s
\n
"
,
full_table_name
);
xb_a
(
asprintf
(
&
lock_query
,
"SELECT * FROM %s LIMIT 0"
,
full_table_name
));
snprintf
(
lock_query
,
sizeof
lock_query
,
lq
,
full_table_name
);
xb_mysql_query
(
mdl_con
,
lock_query
,
false
,
false
);
free
(
lock_query
);
DBUG_EXECUTE_IF
(
"check_mdl_lock_works"
,
check_mdl_lock_works
(
full_table_name
););
}
mysql_free_result
(
mysql_result
);
free
(
query
);
pthread_mutex_unlock
(
&
mdl_lock_con_mutex
);
pthread_mutex_unlock
(
&
mdl_lock_con_mutex
);
mysql_free_result
(
mysql_result
);
}
void
mdl_unlock_all
()
{
msg_ts
(
"Unlocking MDL for all tables"
);
msg_ts
(
"Unlocking MDL for all tables
\n
"
);
xb_mysql_query
(
mdl_con
,
"COMMIT"
,
false
,
true
);
mysql_close
(
mdl_con
);
pthread_mutex_destroy
(
&
mdl_lock_con_mutex
);
...
...
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