Restore (Galera Cluster) does not delete Databases after restore

Hello All

We’re using XtraBackup to backup our Galera Cluster. We had some testings. We also tested the restore. We’re doing at 00:30 every day a full backup and then incremental ones. It was working perfectly with prepare and then the restore. But after the restore we see a lot (amount of incremental backups) databases on the restored cluster/server (#mysql50#Incremental-09022018_xxxxx [xxxx = time]). All of those does not have any tables and are 0.0 bytes big. when I want to delete them it says me ‘Error Code: 1010. Error dropping database (can’t rmdir ‘./Incremental-09022018_011001/’, errno: 17)’

What are does databases and how i can delete them? and why are they there?
When i do a ‘dir -l’ on ‘/var/lib/mysql’ i see those databases too, and all belongs to mysql:mysql like the other (normal) databases

Thank you.

No one? bump

Hi there, sorry for the delay, I just asked the team to take a look at your question…
Are you putting the incremental backups into a subdirectory of the full backup directory?
The problem with that is that MySQL treats every subdirectory as a separate database.
If you see here you will see the full backup is in /base and the incrementals at the same directory level /inc1 /inc2 etc

/data/backups/base /data/backups/inc1 /data/backups/inc2

If that’s not the case, let us know and we can take another view? We would probably need a bit more information from you though in that case about what your set up looks like.

Hello Lorraine

Sorry for my delay now :wink: No Problem.

Yes, i but every incremental backup into a sub of the full backup.
How can i remove those “ghost” Databases?

Thank you.

Hello Che

OK I have checked this for you.

You should be able to just remove these directories with rm - they are not recognised by the data dictionary as databases, but they are being shown as databases because they are in the file system structure. Once the sub-directories are gone, they will no longer be listed by show databases command

If you want to make sure that this is the case - and it would be good practice to do this anyway I think, to verify the suggestion - you could mv one initially and make sure that you are happy that the database is not longer displayed and there is no adverse effect.

Thank you. It was working - just removed them with rm. To be safe for a week or so (because some times, issues are coming later ;)) i’ve just moved them away to a temporary folder inside a folder at the homedrive.

But, yes, just delete/move them is working.
Thank you!

Thank you, Che,for letting me know, I will pass that back to the team that helped me with the answer.
It is always best to check out rather than experiment and I totally agree with you - ‘safe’ is ALWAYS better than ‘sorry’ - especially in DBA work in my opinion! :smiley: