[MDEV-24557] Logical dump of MySQL users via MariaDB's mariadb-dump generates invalid commands Created: 2021-01-10 Updated: 2023-04-27 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Authentication and Privilege System, Backup, Scripts & Clients |
| Affects Version/s: | 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.4, 10.5 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Vicențiu Ciorbaru | Assignee: | Daniel Black |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | foundation | ||
| Description |
|
Steps to reproduce: 1. Run MySQL Server 8.0.22 (in my case, but probably anything 8.0 that supports roles causes the same problem)
3. With mariadb-dump, attempt a logical dump from MySQL:
The generated output has privileges that are not supported by MariaDB, which makes importing into MariaDB impossible.
Importing the file with MariaDB (among other errors) one can see:
|
| Comments |
| Comment by Daniel Black [ 2021-01-10 ] | ||
|
Thanks for looking/testing. https://github.com/MariaDB/server/blob/10.3/man/mysqldump.1#L2289 "Mappings of implementation specific grants/plugins isn't always one-to-one however" I haven't tried to map the grants across as there isn't a specific mapping. Any recommendations? | ||
| Comment by Vicențiu Ciorbaru [ 2021-01-11 ] | ||
|
The first step should be to make the full list of MySQL and MariaDB grants. Then we need to decide which ones are redundant and which need to be covered by a more general level privilege. This guarantees we understand the problem completely. Perhaps for some privileges, it makes sense to implement our own version of it. danblack, can you do this? For example: CREATE ROLE privilege could be replaced by CREATE USER, but is there a use case when one needs to be able to create roles only? MySQL believes so. Should we follow suit? There is however a problem with the whole logical dump of USERS from MySQL. Whenever MySQL chooses to support an extra privilege, we need to do the same. This will probably become unmaintainable in the long run and we'll probably have to stop doing it at some point. On the other hand, if we want to support migrating from MySQL to MariaDB and make it as painless as possible, we need to have this. | ||
| Comment by Sergei Golubchik [ 2021-01-11 ] | ||
|
I'd suggest "Won't fix". | ||
| Comment by Vicențiu Ciorbaru [ 2021-01-11 ] | ||
|
serg If we don't support this properly, I see little value in claiming: Experimentally this option is designed to be able to dump system information from MySQL-5.7 and 8.0 servers. SQL generated is also This just opens up a can of worms on expectations set. On one hand we are designing a feature for MySQL dumps but we don't cover problematic cases. This way we guarantee the feature always remains "experimental". Either we claim it only works for MariaDB, or we adjust the logic (either in mariadb-dump or in the server) to get this in a usable state.
On second thought, there isn't a simple way to make this future proof
| ||
| Comment by Daniel Black [ 2021-01-13 ] | ||
|
Documenting per last comment in the man as suggested sounds pretty good. A kb page on comparison of grants might also have value if it's not there already and would help evaluating if particular grants are useful. An alternative to keeping track of MySQL grants added is to whitelist the ones MariaDB supports (and in which version) and version comment the others to the source mysql version. Its still a bit of can of worms but hopefully less so. I'm less inclined to implement grant classes because its there in MySQL. We could consider them one by one however. Adding a kb/blog on using the feature as an example is something I could do. | ||
| Comment by Daniel Black [ 2021-01-22 ] | ||
|
cvicentiu I've committed the wording change on the man page. Do any other described remedies contain value? | ||
| Comment by Daniel Black [ 2021-02-06 ] | ||
|
cvicentiuserg implementation POC bb-10.2-danielblack-MDEV-24557-mysqldump-understand-all-grants . Doesn't cover CREATE ROLE -> CREATE USER however appropriately uses executable comments on each grant. | ||
| Comment by Sergei Golubchik [ 2021-02-17 ] | ||
|
This feature definitely wasn't designed to dump MySQL 8.0 tables in a way that can be loaded into MariaDB. So, my suggestion is either keep the design and clarify the use case. Or keep the use case and redesign. Because currently they don't seem to match. |