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

Names with dot are incorrectly restored by myloader #56

Closed
akrus opened this issue Aug 25, 2017 · 4 comments · Fixed by #399
Closed

Names with dot are incorrectly restored by myloader #56

akrus opened this issue Aug 25, 2017 · 4 comments · Fixed by #399

Comments

@akrus
Copy link

akrus commented Aug 25, 2017

Hi!

Just found a problem when trying to dump/restore a DB host with databases containing dot in their names.

Let's say I have a database called 'db1.project1', inside I have a table 'table'. mydumper will properly dump everything resulting in a file name 'db1.project1.table-schema.sql'.

But when myloader tries to restore such file, it just creates database with name 'db1', not 'db1.project1'.

I think problem is here:
https://github.com/maxbube/mydumper/blob/master/myloader.c#L355

@maxbube maxbube added the bug label Aug 30, 2017
@maxbube
Copy link
Collaborator

maxbube commented Aug 30, 2017

Hi @akrus thanks for the report, this is also related to issue #41 I will review both

@maxbube
Copy link
Collaborator

maxbube commented Oct 4, 2017

Hi @akrus, I tested your code and looks good. But if could add chunks to it would be great.

i.e.

** Message: Thread 2 restoring `mysql`.`user` part 0
** Message: Table mysql.user (Thread 2) took 0.001561 seconds

should be

** Message: Table mysql.user part 0 (Thread 2) took 0.001561 seconds

@babaorum
Copy link

babaorum commented Jul 3, 2018

Just encounter the same issue. Can I be of any help ?

My use case

I have two databases. One without dot let's say db1 and one with db1.test
If i dump db1 and load it inside db1.test it works fine.
But when i dump db1.test and try to load it in db1.test I get a bunch of errors like duplicate entries for example.

After renaming db1.test into db1test everything works fine.
A dump of db1.test into db1test also works. So the problem seems to be the same as the one described above (during the loading part).

@ssgoburdhun
Copy link

Hello @akrus,

Got the same issue.

What you can do:

  1. Import the necessary users separately (pt-show-grants)
  2. Edit the "dbname-schema-create.sql" to add backticks surrounding the database name (`) and create all the schema
    Edit example:
CREATE DATABASE `db1.project1` /*!40100 DEFAULT CHARACTER SET utf8 */;

Create example:

cat db1.project1-schema-create.sql | mysql
  1. Launch the import
myloader -s "db1.project1" -B "db1.project1" -d . -v 3

You can then industrialize these commands if needed.

Hope it helps.

@davidducos davidducos added this to the Release 0.10.9 milestone Jul 16, 2021
@davidducos davidducos linked a pull request Aug 24, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

5 participants