TablePlus / DBngin

DB Engine
https://dbngin.com
1.01k stars 19 forks source link

trying to import ~300MB sql file #14

Closed Gavrisimo closed 5 years ago

Gavrisimo commented 5 years ago
  1. Driver (Ex: PostgreSQL 10.0):

MySQL 5.7.23

  1. DBngin build number:

1.0 (14)

  1. macOS version:

10.14.1 (18B75)

  1. The steps to reproduce this issue:

I am submitting this here because when I tried to run the "restore backup" or just simply copy/past entire content of the file to the sql editor and running it like that, in both those cases I see message like "MySQL has gone away" or something like that.

This makes me think that the MySQL server dies during the import which makes the tableplus crash.

tableplus-crash-report.txt

huyphams commented 5 years ago

@Gavrisimo which TablePlus build are you using? 300 MB shouldn’t be a problem, I have tested with a GB file dump.

Gavrisimo commented 5 years ago

@huyphams 1.0 (150).

Did you run that import on mysql 5.7 service through DBngin?

huyphams commented 5 years ago

Yup, I’m using DBngin and TablePlus, looks like it was an other issue. Lets me see the crash log.

Gavrisimo commented 5 years ago

If you want I can email you link to download database?

huyphams commented 5 years ago

Sure, that’s awesome, thank you so much. My email is huy@tableplusapp.com 👍

huyphams commented 5 years ago

Update: I got the bug:

(2018-11-13 20:42:22.902330+0700 TablePlus[855:20195] [General] An uncaught exception was raised
4910, 2233, 2018-11-13 20:42:22.902375+0700 TablePlus[855:20195] [General] NSWindow drag regions should only be invalidated on the Main Thread!

Looks like it was a UI issue when TablePlus tries to show a popup (probably an error popup). I'm fixing it now. it's so easy to reproduce the bug with your dump 👍

Gavrisimo commented 5 years ago

Yeah, my dumps are the best... ¯\_(ツ)_/¯

huyphams commented 5 years ago

Yup, this is the issue, I have a stupid mistake that shows this popup from the background thread 🤦‍♂️

screen shot 2018-11-13 at 9 26 55 pm
Gavrisimo commented 5 years ago

Just FYI I can import that DB dump without any issues when importing to MySQL running on my virtual machine.

huyphams commented 5 years ago

Yeah maybe it has a bigger @max_allowed_packet, I'm reading the MySQL document about this threshold and see if we can change it safely.

huyphams commented 5 years ago

It's fixed https://www.dropbox.com/s/0i0ofnhi88vlxz8/TablePlus.dmg?dl=0 In the meantime, you can always use backup/restore function to perform restore a dump file in MySQL.

huyphams commented 5 years ago

I released the build 154 which includes this fixes.

Gavrisimo commented 5 years ago

It's fixed https://www.dropbox.com/s/0i0ofnhi88vlxz8/TablePlus.dmg?dl=0 In the meantime, you can always use backup/restore function to perform restore a dump file in MySQL.

Yeah, I know... The thing is I need to export the database from WordPress admin panel using migrate db pro plugin, so I have a functional DB in my local environment... :-/

huyphams commented 5 years ago

I mean, the backup/restore function is supported by TablePlus

screen shot 2018-11-14 at 4 00 15 pm
Gavrisimo commented 5 years ago

I know! :) The thing with these WordPress DBs is that it's the worst...

You can't just make a backup or SQL dump from production DB and restore/import it to local environment using a tool like tableplus or terminal or whatever...

The issue is that they've got the URL of the production website inside the database all over the place. In bunch of places the data is saved as serialized data using php's serialize() function and updating serialized data has its set of issues and challenges...

That's why plugins like WP Migrate DB Pro help a lot, where you just enter production URL and local dev URL and it exports the database all ready to go, you just need to import it...

Basically for all other projects I use backup/restore through tableplus, but the WordPress ones are weird... :-/

huyphams commented 5 years ago

I got it, I have tried to restore the file you sent me with the restore function, it works. So you don't need to use the backup but you can use the restore function.

Gavrisimo commented 5 years ago

If I try to use "restore" with this dump I have sent you I get this:

image

And if I try to use "import" function I get this:

image

I tried running that SQL and importing it again, but it failed with the same error.

I then reconnected to the MySQL instance started importing it again and it seems like it is working!!

So I stopped it just to test restarting the MySQL instance and trying the import again, but that just brought me back to begging with that max_allowed_packet error.

It seems that running SET GLOBAL max_allowed_packet=1073741824; is not being preserved after MySQL restart.

huyphams commented 5 years ago

Yeah, I think it has the same error, but the backup/restore was implemented by Oracle (the maintainer of MySQL), they didn't add the structure warning about the max allowed package.

The restore from dump was implemented by me and I have added the instructions to tell the user what they can do to resolve the issue.

After increasing the max allowed package, I believe that both the backup/restore and restore from dump functions will work fine. Thanks for testing 👍