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

Fixes issue where MariaDBs with VIEWs couldn't be backupped on iAPC #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

asittampalam
Copy link

@asittampalam asittampalam commented Oct 28, 2019

When a MariaDB with a VIEW was backupped, it couldn't be restored in the iAPC environment because the dump contained DEFINER=XXXXXXXX statements which needed SUPER PRIVILEGES during the restore process.

ERROR 1227 (42000) at line 941: Access denied; you need (at least one of) the SUPER privilege(s) for this operation```
sed -n 942p XXXX_mariadb_main_20191028030000 
/*!50013 DEFINER=`XXXXXXXXX`@`%` SQL SECURITY INVOKER */

This pull request removes those statements from the dump and thus fixes the restoring process.

@asittampalam
Copy link
Author

Any updates on this @JamesClonk ? :)

@JamesClonk
Copy link
Member

@asittampalam Sorry, I seem to have completely missed PR notifications for this repo. Didn't realize until now there was something waiting. Oops! 😅

Unfortunately this will not work by simply adding | sed, as it will produce incomplete dump files since the stream will get closed too early / not recognized when it actually closes. Dumps created via this PR would be broken. I just tested it on a small 2MB test database and the resulting dump was always incomplete unfortunately.

I'd also rather go for modifying the backup during restore while piping it into mysql rather than during dumping. You'd have to hook ontop the gzip reader and look for lines which contain DEFINER to be able to remove them before they're passed along to cmd.Stdin.

JamesClonk added a commit that referenced this pull request Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants