distal-attribute
distal-attribute
distal-attribute
distal-attribute

Stop query loop on reconnect.

User, date Message
Written by imre
4 years ago
Category: Running SQL scripts
12 posts since Thu, 30 Dec 10
Hello,

If i run a script with many queries and connection is lost then heidy automatically reconnects and continues the query loop from next(?) item.

This is a problem for me.
For example if i use transactions then after reconnect the script does not run in transaction anymore and yields inconsistent result.
Same case when using variables / temporary tables.


What do you think of making query loop to not continue in case of reconnects or at least make it optional?

Thank you.
Written by ansgar
4 years ago
4940 posts since Fri, 07 Apr 06
Reconnecting is done *before* executing a query. Queries are never skipped. The only situation when that can happen is if the query itself produces a huge query or takes longer to finish as idle_timeout allows. What was the cause of your reconnect?
Written by imre
4 years ago
12 posts since Thu, 30 Dec 10
For example, when thread is killed.

runnign the script:


set @a:=null;
select @a:=concat_ws(',',@a,sleep(5)+1);
select @a:=concat_ws(',',@a,sleep(5)+2);
select @a:=concat_ws(',',@a,sleep(5)+3);
select @a:=concat_ws(',',@a,sleep(5)+4);



Log:


set @a:=null;
select @a:=concat_ws(',',@a,sleep(2)+1);
select @a:=concat_ws(',',@a,sleep(2)+2);
/* Connection to 192.168.0.4 closed at 2010-12-30 15:16:17 */
/* Connecting to 192.168.0.4 via TCP/IP, username imre, using password: Yes ... */
/* Connected. Thread-ID: 78 */
/* Characterset: utf8 */
SHOW STATUS LIKE 'Uptime';
SHOW VARIABLES LIKE 'version_compile_os';
SHOW VARIABLES LIKE 'hostname';
USE `insurance`;
select @a:=concat_ws(',',@a,sleep(2)+3);
select @a:=concat_ws(',',@a,sleep(2)+4);
/* 0 rows affected, 4 rows found. Duration for 5 queries: 6,438 sec. */



Result tabs:


Result #1: 1
Result #2: 1,3 // i dont know why 3 here, there should be no result.
Result #3: 3
Result #4: 3,4

Written by ansgar
4 years ago
4940 posts since Fri, 07 Apr 06
Ok - the query was somehow causing a disconnect. But a query should not get executed again if when that happens. That would mean you are stuck in some endless loop, would it?
Written by imre
4 years ago
12 posts since Thu, 30 Dec 10
I agree.

Just to clarify again:
In that example I opened the second Heidi instance and killed the server thread manually while it was running the 2nd query.


If i just plug the network cable then it gets timeout in around 5 seconds and works as expexted.
So its not that critical than i thought, but still i must take into account i cannot kill the server thread to stop execution

which means killing the heidisql.exe is the only option.
 

Please login to leave a reply, or register at first.