FetchAll=False & Lost connection again
-
GuzunNicolae
- Posts: 78
- Joined: Wed 17 Jan 2007 14:16
FetchAll=False & Lost connection again
Hello
I am experiencing a problem that I thought was solved a long time ago. And to be honest till now everything was perfect.
The situation is as follows:
- I have to parse a lot of records (about 1 mln) and based on some conditions to change the data in the DB. This is a very lengthy process. It may take 10h to finish.
- So I have created a query with:
FetchAll=False;
FetchedRows=2000;
Unidirectional=True;
- Everything goes perfect until the parsed record reach 2000 and the new records have to be fetched. Then I get "Lost connection to MySQL server"
It cannot be the wait_timeout cause the connection does not stay iddle for more than 30 secs.
It cannot be the link quality: I am using LAN and even on local host I get the same problem.
I have decreased the FetchedRows to 200, and on 400th record (on localhost on 200th) I get the connection loss.
I have changed UniDirectional to False but this did not help either.
I have run MySQLAdmin to look at the queries. I have found out the following:
- When I run the program one connection is created
- When I run the parsing process a new connection is created that runs for about 1 min saying "Writing to net" and the query that opens all my records.
- While the second query is running my application is parsing records already. (I guess this is how it should be)
- After the second connection finishes it closes.
- All the data updates is done in the main connection which never gets iddle for more than 30 s
- Before the new records have to be fetched I get connection loss and even the main connection is closed
I am using Deplhi 7, MyDAC 5.20.0.11 and
MySQL server version: 5.0.18-Debian_3.dotdeb.1-log
MySQL client version: Direct
Can you please point me out what the problem might be. I will try to decrease the Fetched Rows to a smaller ammount. Yet I guess if I set it higher this will increase performance as less queries will be sent to the server.
Thanks
I am experiencing a problem that I thought was solved a long time ago. And to be honest till now everything was perfect.
The situation is as follows:
- I have to parse a lot of records (about 1 mln) and based on some conditions to change the data in the DB. This is a very lengthy process. It may take 10h to finish.
- So I have created a query with:
FetchAll=False;
FetchedRows=2000;
Unidirectional=True;
- Everything goes perfect until the parsed record reach 2000 and the new records have to be fetched. Then I get "Lost connection to MySQL server"
It cannot be the wait_timeout cause the connection does not stay iddle for more than 30 secs.
It cannot be the link quality: I am using LAN and even on local host I get the same problem.
I have decreased the FetchedRows to 200, and on 400th record (on localhost on 200th) I get the connection loss.
I have changed UniDirectional to False but this did not help either.
I have run MySQLAdmin to look at the queries. I have found out the following:
- When I run the program one connection is created
- When I run the parsing process a new connection is created that runs for about 1 min saying "Writing to net" and the query that opens all my records.
- While the second query is running my application is parsing records already. (I guess this is how it should be)
- After the second connection finishes it closes.
- All the data updates is done in the main connection which never gets iddle for more than 30 s
- Before the new records have to be fetched I get connection loss and even the main connection is closed
I am using Deplhi 7, MyDAC 5.20.0.11 and
MySQL server version: 5.0.18-Debian_3.dotdeb.1-log
MySQL client version: Direct
Can you please point me out what the problem might be. I will try to decrease the Fetched Rows to a smaller ammount. Yet I guess if I set it higher this will increase performance as less queries will be sent to the server.
Thanks
-
GuzunNicolae
- Posts: 78
- Joined: Wed 17 Jan 2007 14:16
-
eduardosic
- Posts: 387
- Joined: Fri 18 Nov 2005 00:26
- Location: Brazil
solution..
Hi GuzunNicolae, see MySQL variables:GuzunNicolae wrote:I have set the FetchRows=25 and it still does not work
connect_timeout
interactive_timeout
wait_timeout
net_read_timeout
net_write_timeout
slave_net_timeout
and
Try to Set in TMyConnection.Options.LocalFailOver := True;
in the Event OnConnectionLost of TMyConnection write a code:
Code: Select all
procedure TFrmMain.MyConnConnectionLost(Sender: TObject;Component: TComponent; ConnLostCause: TConnLostCause; var RetryMode: TRetryMode);
begin
RetryMode := rmReconnectExecute;
end;
see em MyDAC Help about LocalFailOver and DisconnectedModel...
good look.
-
GuzunNicolae
- Posts: 78
- Joined: Wed 17 Jan 2007 14:16
These are the values for all my variables that contains timeout:
I have created an event for connection loss, but it does not even go there when the connection is lost. I have put break point, ShowMessages, even RetryMode := rmReconnectExecute; and nothing
Code: Select all
| connect_timeout | 5 |
| delayed_insert_timeout | 300 |
| innodb_lock_wait_timeout | 50 |
| interactive_timeout | 28800 |
| net_read_timeout | 30 |
| net_write_timeout | 60 |
| slave_net_timeout | 3600 |
| sync_replication_timeout | 10 |
| table_lock_wait_timeout | 50 |
| wait_timeout | 28800-
GuzunNicolae
- Posts: 78
- Joined: Wed 17 Jan 2007 14:16
No. If I set at least FetchAll to false the problem does not occur.Antaeus wrote:Does the problem occurs when you set both FetchAll and Unidirectional to False?
Yes. It appears if I run it out of IDE. But this way I get several Lost connection messages. When I run it outside of the IDE I get only one message of Connection lossAntaeus wrote: Does the error message appear when you run your application out of IDE control?
It is true.Antaeus wrote: The OnConnectionLost event occurs if you set the TMyConnection.Options.LocalFailover to True.
-
eduardosic
- Posts: 387
- Joined: Fri 18 Nov 2005 00:26
- Location: Brazil
increase variables..
Hi,GuzunNicolae wrote:These are the values for all my variables that contains timeout:I have created an event for connection loss, but it does not even go there when the connection is lost. I have put break point, ShowMessages, even RetryMode := rmReconnectExecute; and nothingCode: Select all
| connect_timeout | 5 | | delayed_insert_timeout | 300 | | innodb_lock_wait_timeout | 50 | | interactive_timeout | 28800 | | net_read_timeout | 30 | | net_write_timeout | 60 | | slave_net_timeout | 3600 | | sync_replication_timeout | 10 | | table_lock_wait_timeout | 50 | | wait_timeout | 28800
the value for you connect_timeout variable is very small, try do increase this..
i use a max Value for all variables...
connect_timeout = 31536000
interactive_timeout = 31536000
wait_timeout = 31536000
net_read_timeout = 31536000
net_write_timeout = 31536000
slave_net_timeout = 31536000
max_connections = 31536000
max_user_connections = 31536000
the OnConnectionLost work's perfect for me.
Wait.. Antaeus go help you...
-
GuzunNicolae
- Posts: 78
- Joined: Wed 17 Jan 2007 14:16
-
GuzunNicolae
- Posts: 78
- Joined: Wed 17 Jan 2007 14:16
Sorry I messed up FetchAll = True and False.GuzunNicolae wrote:No. If I set at least FetchAll to false the problem does not occur.Antaeus wrote:Does the problem occurs when you set both FetchAll and Unidirectional to False?
If I set FetchAll=False no matter what value Unidirectional has (it might be either True or False) I get the error.
If I set FetchAll = True everything works well. But this way I cannot load 2mln records. And I may have 10mln in the future.
-
eduardosic
- Posts: 387
- Joined: Fri 18 Nov 2005 00:26
- Location: Brazil
i reproduce the problem..
Hi Antaeus.GuzunNicolae wrote:Sorry I messed up FetchAll = True and False.GuzunNicolae wrote:No. If I set at least FetchAll to false the problem does not occur.Antaeus wrote:Does the problem occurs when you set both FetchAll and Unidirectional to False?
If I set FetchAll=False no matter what value Unidirectional has (it might be either True or False) I get the error.
If I set FetchAll = True everything works well. But this way I cannot load 2mln records. And I may have 10mln in the future.
GuzunNicolae are rigth.
the OnConnectionLost don't is called while browsing on DataSet.
I go to make a small project to demonstrate it.
It will be difficult to continue investigation of this problem without an example. Could you prepare one and send it to us? Try to make it as simple as it is possible. Also try decrease amount of test data. You can send your test sample to mydac*crlab*com.GuzunNicolae wrote:If I set FetchAll=False no matter what value Unidirectional has (it might be either True or False) I get the error.
If I set FetchAll = True everything works well. But this way I cannot load 2mln records. And I may have 10mln in the future.
-
GuzunNicolae
- Posts: 78
- Joined: Wed 17 Jan 2007 14:16
-
eduardosic
- Posts: 387
- Joined: Fri 18 Nov 2005 00:26
- Location: Brazil
I made a example..
Hi Antaeus, a made a small project, I send to Mydac*crlab.comAntaeus wrote:It will be difficult to continue investigation of this problem without an example. Could you prepare one and send it to us? Try to make it as simple as it is possible. Also try decrease amount of test data. You can send your test sample to mydac*crlab*com.GuzunNicolae wrote:If I set FetchAll=False no matter what value Unidirectional has (it might be either True or False) I get the error.
If I set FetchAll = True everything works well. But this way I cannot load 2mln records. And I may have 10mln in the future.
you can download in http://www.drdsistemas.com/util/mydac/mydac.zip
-
eduardosic
- Posts: 387
- Joined: Fri 18 Nov 2005 00:26
- Location: Brazil
Re: I made a example..
Antaeus, you can reproduce the problem with my project?eduardosic wrote:Hi Antaeus, a made a small project, I send to Mydac*crlab.comAntaeus wrote:It will be difficult to continue investigation of this problem without an example. Could you prepare one and send it to us? Try to make it as simple as it is possible. Also try decrease amount of test data. You can send your test sample to mydac*crlab*com.GuzunNicolae wrote:If I set FetchAll=False no matter what value Unidirectional has (it might be either True or False) I get the error.
If I set FetchAll = True everything works well. But this way I cannot load 2mln records. And I may have 10mln in the future.
you can download in http://www.drdsistemas.com/util/mydac/mydac.zip