Crash running script
| User, date | Message |
|---|---|
|
Written by kalvaro
7 months ago Category: Running SQL scripts 440 posts since Thu, 29 Nov 07 |
Just got this when running a 14.6MB SQL file directly: date/time : 2012-10-29, 09:40:13, 742ms Tried again (after carefully clicking on the only database showing up on the left tree) and got this: date/time : 2012-10-29, 09:43:33, 576ms That's what I call a Monday. I finally ran the script from the command line client. No idea why that worked because select @@max_allowed_packet; returns the same value in both clients :-? |
|
Written by kalvaro
7 months ago 440 posts since Thu, 29 Nov 07 |
I can already answer my question: it didn't work in the command line client. It simply didn't crash so I hadn't noticed part of the data was missing. |
|
Written by kalvaro
7 months ago 440 posts since Thu, 29 Nov 07 |
I can run my script from the command line if I start the client with a specific option: mysql --max_allowed_packet=50MB ... Apparently, it isn't something you can change after establishing a connection. Can something similar be done with HeidiSQL? If not, would that make a sensible feature request? |
|
Written by ansgar
7 months ago 3951 posts since Fri, 07 Apr 06 |
Not sure. When you say you cannot change the max_allowed_packet variable effectively after establishing a connection, then how does the MySQL client do that? |
|
Written by kalvaro
7 months ago 440 posts since Thu, 29 Nov 07 |
No idea about the internals but it's probably a parameter that's used to establish the connection, such as the username or password. |
|
Written by ansgar
7 months ago 3951 posts since Fri, 07 Apr 06 |
Hm that looks a bit confusing when reading the docs. I cannot set max_allowed_packet in a session scope, only the global scope seems to be allowed. See when you try to fire: SET @@SESSION.max_allowed_packet:=1024; Now, as you said, it's not possible to set this global value effectively in one session. A reconnect is required. The documentation on mysql_real_connect states that you can run mysql_options(FHandle, MYSQL_READ_DEFAULT_FILE, nil); where you can have a max_allowed_packet value in the default ini file. Read here. |
|
Written by ansgar
7 months ago 3951 posts since Fri, 07 Apr 06 |
Ah ok, that just does not work. Not sure if that's a bug. My test: - create a test.ini file with this contents: [client] max_allowed_packet=3000 - add a mysql_options(FHandle, "path\test.ini", nil) in the HeidiSQL connection code max_allowed_packet is still on the old value (1024). |
|
Written by ansgar
7 months ago 3951 posts since Fri, 07 Apr 06 |
Oh, that *does* work, I only had a file permissions problem, obviously, as after saving the file with admin privs I suddenly got some " SQL Error (2020): Got packet bigger than 'max_allowed_packet' bytes . Hurray.Hm, but it's still a bit mysterious, as I'm not able to look up the new variable value. Firing SHOW VARIABLES always shows the default 1M, anyway what I pass in my config file. |
|
Written by ansgar
7 months ago 3951 posts since Fri, 07 Apr 06 |
Ah, found the right docs for it here: mysql-docs wrote: On the client side, max_allowed_packet has a default of 1GB. Some programs such as mysql and mysqldump enable you to change the client-side value by setting max_allowed_packet on the command line or in an option file. That means, HeidiSQL could * offer a new numeric session setting for that variable * apply a reasonable default for it (let's say 1M as the server does) * auto-create a my.ini file somewhere (in a temp folder) and place the parameter value in it. * add the mysql_options command as mentioned above, so the ini file is read by libmysql.dll But what if your dump file contains a bigger query than this value allows? Let it crash? I could even, as an alternative to the above hassle, warn you before sending too big queries, and offer to auto-fire a "SET @@GLOBAL.max_allowed_packet:=10M" or whatever. Mostly that variable should not be a problem, as HeidiSQL for example ensures a multi-query batch is smaller than the server side max_allowed_packet variable. |
|
Written by kalvaro
7 months ago 440 posts since Thu, 29 Nov 07 |
Again, I'm sorry I can't help with the internals. If I understood correctly, the MySQL library does not allow to set max_allowed_packet explicitly but provides an indirect way to do so (a external *.ini file). Then I guess there're two possibilities: 1. Provide a "Path to custom *.ini file" setting 2. Provide a direct "max_allowed_packet" setting ... both of which should be added to Session Manager. #1 is more powerful but #2 is more user friendly. I'm not sure I have a favourite... But I'd definitively love to have any because I'm been having problems running custom scripts for a while. |
|
Written by ansgar
7 months ago 3951 posts since Fri, 07 Apr 06 |
More and more options tend to decrease usability, so I would like to shed more light on my alternative idea: Warn the user if a query is larger than the current server-side max_allowed_packet, including the possibility to fire "SET @@GLOBAL.max_allowed_packet:=10M" or whatever". But it seems I forgot that this does not have an effect for the current session, so forget it. For the first option you pointed out (path to .ini file), HeidiSQL would be unable to know the client side max_allowed_packet value, as there is no way in MySQL to query it, only the server-sided can be queries with SHOW VARIABLES. HeidiSQL needs to know the value, e.g. when you export SQL directly to another server or database, or when you fire a multi-statement batch. The second idea looks better to me, although this would even be one more setting on top of the myriad of session settings. But I'm getting space problems in the first tab of the session manager, so that will be thought about carefully. |
|
Written by kalvaro
7 months ago 440 posts since Thu, 29 Nov 07 |
You can always add an "Advanced" tab and move there some of the most esoteric settings such as "Set client time zone" or "Startup script". BTW, would you like to have a proper bug report so you don't have to look into it right now? |
|
Written by ansgar
7 months ago 3951 posts since Fri, 07 Apr 06 |
Yes, please file a report. There are too many things to look at currently. |
|
Written by kalvaro
7 months ago 440 posts since Thu, 29 Nov 07 |
Done: http://code.google.com/p/heidisql/issues/detail?id=3002 |
|
Written by ansgar
5 months ago 3951 posts since Fri, 07 Apr 06 |
My 8 year old daughter just looked over my shoulder into the HeidiSQL code, and read aloud "Papa, what is 'max packet size'?". And I tried to explain her that this "packet" is not something you normally send by shipping. But I guess my explanation failed. :) |
|
Written by kalvaro
5 months ago 440 posts since Thu, 29 Nov 07 |
xD |
|
Please login to leave a reply, or register at first. |