Commit 2549f982 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-17532 Performance_schema reports wrong directory for the temporary files...

MDEV-17532 Performance_schema reports wrong directory for the temporary files of ALTER TABLE…ALGORITHM=INPLACE

row_merge_file_create_low(): Pass the directory of the temporary file
to the PSI_FILE_CALL.
parent 5dd3b52f
update performance_schema.setup_instruments set enabled='yes';
update performance_schema.setup_consumers set enabled='yes';
CREATE TABLE t1 (a serial, b varchar(255)) ENGINE=InnoDB;
BEGIN;
COMMIT;
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL go WAIT_FOR gone';
ALTER TABLE t1 ADD INDEX(b), ALGORITHM=INPLACE;
SET DEBUG_SYNC = 'now WAIT_FOR go';
SELECT DISTINCT object_name FROM performance_schema.events_waits_history_long
WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';
object_name
tmp/Innodb Merge Temp File
SET DEBUG_SYNC = 'now SIGNAL gone';
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
--innodb-sort-buffer-size=64k
--tmpdir=$MYSQLTEST_VARDIR/tmp
--source include/have_innodb.inc
--source include/have_perfschema.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/not_embedded.inc
connect (ddl, localhost, root,,);
update performance_schema.setup_instruments set enabled='yes';
update performance_schema.setup_consumers set enabled='yes';
CREATE TABLE t1 (a serial, b varchar(255)) ENGINE=InnoDB;
BEGIN;
let $n=10;
--disable_query_log
while ($n) {
dec $n;
INSERT INTO t1 SELECT NULL, REPEAT('b',255);
}
--enable_query_log
COMMIT;
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL go WAIT_FOR gone';
send ALTER TABLE t1 ADD INDEX(b), ALGORITHM=INPLACE;
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR go';
--replace_regex /.*[\\\/]tmp/tmp/
SELECT DISTINCT object_name FROM performance_schema.events_waits_history_long
WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';
#--exec lsof -p `pidof mysqld`
SET DEBUG_SYNC = 'now SIGNAL gone';
connection ddl;
reap;
disconnect ddl;
connection default;
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
......@@ -3139,9 +3139,17 @@ row_merge_file_create_low(
performance schema */
struct PSI_file_locker* locker = NULL;
PSI_file_locker_state state;
if (!path) {
path = mysql_tmpdir;
}
static const char label[] = "/Innodb Merge Temp File";
char* name = static_cast<char*>(
ut_malloc(strlen(path) + sizeof label));
strcpy(name, path);
strcat(name, label);
locker = PSI_FILE_CALL(get_thread_file_name_locker)(
&state, innodb_file_temp_key, PSI_FILE_OPEN,
"Innodb Merge Temp File", &locker);
path ? name : label, &locker);
if (locker != NULL) {
PSI_FILE_CALL(start_file_open_wait)(locker,
__FILE__,
......@@ -3154,6 +3162,7 @@ row_merge_file_create_low(
PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(
locker, fd);
}
ut_free(name);
#endif
if (fd < 0) {
......
......@@ -3143,9 +3143,17 @@ row_merge_file_create_low(
performance schema */
struct PSI_file_locker* locker = NULL;
PSI_file_locker_state state;
if (!path) {
path = mysql_tmpdir;
}
static const char label[] = "/Innodb Merge Temp File";
char* name = static_cast<char*>(
ut_malloc(strlen(path) + sizeof label));
strcpy(name, path);
strcat(name, label);
locker = PSI_FILE_CALL(get_thread_file_name_locker)(
&state, innodb_file_temp_key, PSI_FILE_OPEN,
"Innodb Merge Temp File", &locker);
path ? name : label, &locker);
if (locker != NULL) {
PSI_FILE_CALL(start_file_open_wait)(locker,
__FILE__,
......@@ -3158,6 +3166,7 @@ row_merge_file_create_low(
PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(
locker, fd);
}
ut_free(name);
#endif
if (fd < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment