Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDEV-30259 & MDEV-33187: mariadb-hotcopy fails for performance_schema/sys #2995

Merged
merged 3 commits into from
Jan 13, 2024

Conversation

an3l
Copy link
Collaborator

@an3l an3l commented Jan 11, 2024

This PR consists of 3 PR:

1. Make mariadb-hotcopy compatible with DBI:MariaDB

  • I tried to allow DBI for mariadb-hotcopy the same as for other scripts.
Check driver compatibility
Install DB and run server locally ✔️
$ ./scripts/mysql_install_db --srcdir=../../src/10.11 --defaults-file=~/.my1011-hs.cnf
Installing MariaDB/MySQL system tables in '/tmp/10.11' ...
OK
$ ./sql/mysqld --defaults-file=~/.my1011-hs.cnf
  1. User not allowed to connect through socket ✔️
$ ./scripts/mysqlhotcopy  "--regex=.*" ./tmp 
DBI connect(';host=;port=;mariadb_read_default_group=mysqlhotcopy','',...) failed: Access denied for user 'anel'@'localhost' (using password: NO) at ./scripts/mysqlhotcopy line 222.
  1. User cannot connect through socket ✔️
$ ./scripts/mysqlhotcopy  "--regex=.*" ./tmp 
DBI connect(';host=;port=;mariadb_read_default_group=mysqlhotcopy','',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at ./scripts/mysqlhotcopy line 22
  1. Create new user test@localhost and connect through host and port ✔️
# There is no table
$ ./scripts/mysqlhotcopy  "--regex=.*" -h 127.0.0.1 -P 3306 -u test -p mypassword ./tmp 
No tables to hot-copy at ./scripts/mysqlhotcopy line 60.

# Create table for that user in test table
$ ./scripts/mysqlhotcopy  "--regex=.*" -h 127.0.0.1 -P 3306 -u test -p mypassword ./tmp 
No tables to hot-copy at ./scripts/mysqlhotcopy line 60.

# Give user test@localhost privilege
MariaDB [(none)]> grant RELOAD on test.* to test@localhost;
ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
MariaDB [(none)]> grant RELOAD on *.* to test@localhost;
Query OK, 0 rows affected (0.015 sec)
MariaDB [(none)]> show grants for test@localhost;
+--------------------------------------------------------------------------------------------------------------+
| Grants for test@localhost                                                                                    |
+--------------------------------------------------------------------------------------------------------------+
| GRANT RELOAD ON *.* TO `test`@`localhost` IDENTIFIED BY PASSWORD '*FABE5482D5AADF36D028AC443D117BE1180B9725' |
+--------------------------------------------------------------------------------------------------------------+
1 row in set (0.000 sec)

# Apply patches 2. and 3. and it will work
$ ./scripts/mysqlhotcopy  "--regex=.*" -h 127.0.0.1 -P 3306 -u test -p mypassword --allowold ./tmp 
Deleting previous 'old' hotcopy directory ('./tmp/test_old')
...
mysqlhotcopy copied 1 tables (3 files) in 0 seconds (0 seconds overall).
- Still there is the problem ❌
performance schema missing
$ ./scripts/mysqlhotcopy  "--regex=.*" -S /tmp/mysql.sock  --allowold ./tmp
DBD::mysql::db do failed:  command denied to user 'anel'@'localhost' for table `performance_schema`.`accounts` at ./scripts/mysqlhotcopy line 540.

2. MDEV-30259: mariadb-hotcopy fails for performance_schema

  • Contributed by Paul Szabo psz@maths.usyd.edu.au
  • Solves the problem from 1. ( ✔️ ) but there is another problem ❌
sys schema missing
$ ./scripts/mysqlhotcopy  "--regex=.*" -S /tmp/mysql.sock  --allowold ./tmp
Deleting previous 'old' hotcopy directory ('./tmp/mysql_old')
...
DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' `sys`.`host_summary` READ, `sys`.`host_summary_by_file_io` READ, `sys`.`host...' at line 1 at ./scripts/mysqlhotcopy line 547.
....

3. MDEV-33187: mariadb-hotcopy fails for sys

$ ./scripts/mysqlhotcopy  "--regex=.*" -S /tmp/mysql.sock  --allowold ./tmp
Deleting previous 'old' hotcopy directory ('./tmp/mysql_old')
Existing hotcopy directory renamed to './tmp/mysql_old'
Deleting previous 'old' hotcopy directory ('./tmp/test_old')
Existing hotcopy directory renamed to './tmp/test_old'
2024-01-11 13:01:47 9 [Note] InnoDB: Sync to disk of `mysql`.`gtid_slave_pos` started.
2024-01-11 13:01:47 9 [Note] InnoDB: Stopping purge
2024-01-11 13:01:47 9 [Note] InnoDB: Writing table metadata to './mysql/gtid_slave_pos.cfg'
2024-01-11 13:01:47 9 [Note] InnoDB: Table `mysql`.`gtid_slave_pos` flushed to disk
2024-01-11 13:01:47 9 [Note] InnoDB: Sync to disk of `mysql`.`innodb_index_stats` started.
2024-01-11 13:01:47 9 [Note] InnoDB: Writing table metadata to './mysql/innodb_index_stats.cfg'
2024-01-11 13:01:47 9 [Note] InnoDB: Table `mysql`.`innodb_index_stats` flushed to disk
2024-01-11 13:01:47 9 [Note] InnoDB: Sync to disk of `mysql`.`innodb_table_stats` started.
2024-01-11 13:01:47 9 [Note] InnoDB: Writing table metadata to './mysql/innodb_table_stats.cfg'
2024-01-11 13:01:47 9 [Note] InnoDB: Table `mysql`.`innodb_table_stats` flushed to disk
Flushed 27 tables with read lock (`mysql`.`column_stats`, `mysql`.`columns_priv`, `mysql`.`db`, `mysql`.`event`, `mysql`.`func`, `mysql`.`global_priv`, `mysql`.`gtid_slave_pos`, `mysql`.`help_category`, `mysql`.`help_keyword`, `mysql`.`help_relation`, `mysql`.`help_topic`, `mysql`.`index_stats`, `mysql`.`innodb_index_stats`, `mysql`.`innodb_table_stats`, `mysql`.`plugin`, `mysql`.`proc`, `mysql`.`procs_priv`, `mysql`.`proxies_priv`, `mysql`.`roles_mapping`, `mysql`.`servers`, `mysql`.`table_stats`, `mysql`.`tables_priv`, `mysql`.`time_zone`, `mysql`.`time_zone_leap_second`, `mysql`.`time_zone_name`, `mysql`.`time_zone_transition`, `mysql`.`time_zone_transition_type`) in 0 seconds.
2024-01-11 13:01:47 9 [Note] InnoDB: Deleting the meta-data file './mysql/gtid_slave_pos.cfg'
2024-01-11 13:01:47 9 [Note] InnoDB: Deleting the meta-data file './mysql/innodb_index_stats.cfg'
2024-01-11 13:01:47 9 [Note] InnoDB: Deleting the meta-data file './mysql/innodb_table_stats.cfg'
2024-01-11 13:01:47 9 [Note] InnoDB: Resuming purge
Locked 1 views (`mysql`.`user`) in 0 seconds.
Copying 88 files...
Copying indices for 0 files...
Copying 1 files...
Copying indices for 0 files...
Unlocked tables.
mysqlhotcopy copied 56 tables (89 files) in 0 seconds (0 seconds overall).

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

@CLAassistant
Copy link

CLAassistant commented Jan 11, 2024

CLA assistant check
All committers have signed the CLA.

@an3l an3l added the MariaDB Foundation Pull requests created by MariaDB Foundation label Jan 11, 2024
@an3l an3l added this to the 10.11 milestone Jan 11, 2024
@an3l an3l self-assigned this Jan 11, 2024
@an3l an3l requested a review from grooverdan January 11, 2024 12:43
@an3l an3l changed the title Bb 10.11 anel mdev 33187 hotcopy MDEV-30259 & MDEV-33187: mariadb-hotcopy fails for performance_schema/sys Jan 11, 2024
Copy link
Member

@grooverdan grooverdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks Anel/Peter

an3l and others added 3 commits January 12, 2024 16:07
Signed-off-by: Paul Szabo psz@maths.usyd.edu.au www.maths.usyd.edu.au/u/psz
School of Mathematics and Statistics University of Sydney Australia
Signed-off-by: Paul Szabo psz@maths.usyd.edu.au www.maths.usyd.edu.au/u/psz
School of Mathematics and Statistics University of Sydney Australia
@an3l an3l force-pushed the bb-10.11-anel-MDEV-33187-hotcopy branch from adc8115 to f627c86 Compare January 12, 2024 15:07
@grooverdan grooverdan merged commit 78ea9ee into MariaDB:10.11 Jan 13, 2024
12 of 15 checks passed
@ottok
Copy link
Contributor

ottok commented Jan 18, 2024

this fixed downstream https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1060056

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MariaDB Foundation Pull requests created by MariaDB Foundation
5 participants