473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Connection seems to cache data

I open MySQL Manager and connect to my database.

I then insert one record in to an InnoDB table in MySQL (4.0 and 4.1
alpha hosted on XP running mysqld --console).

I then retrieve the record successfully in MySQL Manager using the
existing connection. This indicates that commit is running
successfully, (I have seen this on the database trace too).

I then try to retrieve the record (through a small MySQL/TomCat
application). Sometimes it is retrieved successfully, and sometimes an
empty record set is returned.

If I reduce connection pooling (on the connection script (in
components.xconf))to min 1 max 1 connections, the record is retrieved
successfully every time.

This seems to me to indicate that existing connections created for my
TomCat app are searching on an old (maybe cached?) version of the
database. However, when by chance I get the same connection I used to
insert the record, the record is retrieved successfully.

However, the record is retrieved more often than not even when there
are 10 connections pooled, although I understand that connections are
not round-robbined and some are used more commonly than others,
supporting my suspision.

This is the only insert that uses transactions in my app, and it works
fine with Oracle. All other inserts (not using transactions) work fine
on both database servers (and both MySQL 4.1.1-alpha and 4.0.16).

Thanks very much for any time spent on this and any recommendations
for further tests or fixes.
Jul 19 '05 #1
4 2249
up*********@hotmail.com (chris) wrote in message news:<c6*************************@posting.google.c om>...
I open MySQL Manager and connect to my database.

I then insert one record in to an InnoDB table in MySQL (4.0 and 4.1
alpha hosted on XP running mysqld --console).

I then retrieve the record successfully in MySQL Manager using the
existing connection. This indicates that commit is running
successfully, (I have seen this on the database trace too).

I then try to retrieve the record (through a small MySQL/TomCat
application). Sometimes it is retrieved successfully, and sometimes an
empty record set is returned.

If I reduce connection pooling (on the connection script (in
components.xconf))to min 1 max 1 connections, the record is retrieved
successfully every time.

This seems to me to indicate that existing connections created for my
TomCat app are searching on an old (maybe cached?) version of the
database. However, when by chance I get the same connection I used to
insert the record, the record is retrieved successfully.

However, the record is retrieved more often than not even when there
are 10 connections pooled, although I understand that connections are
not round-robbined and some are used more commonly than others,
supporting my suspision.

This is the only insert that uses transactions in my app, and it works
fine with Oracle. All other inserts (not using transactions) work fine
on both database servers (and both MySQL 4.1.1-alpha and 4.0.16).

Thanks very much for any time spent on this and any recommendations
for further tests or fixes.


The Workaround, further indicating that this is indeed a bug in MySQL.

I installed MySQL server 3.23.53, enabled InnoDB tables in my.cnf
(with the line innodb_data_file_path=ibdata:30M under the [mysqld]
section) and ran mysqld-max.exe and the problem seems to have
disappeared and transactions are working as they should. (But MySQL <
4.1.1 doesn't do subqueries etc...)

I have sent a bug report to MySQL.

Thanks again for any time anyone has spent on this. I am still
confused that I cannot find any sign of this defect anywhere on the
net.
Jul 19 '05 #2
up*********@hotmail.com (chris) wrote in message news:<c6*************************@posting.google.c om>...
I open MySQL Manager and connect to my database.

I then insert one record in to an InnoDB table in MySQL (4.0 and 4.1
alpha hosted on XP running mysqld --console).

I then retrieve the record successfully in MySQL Manager using the
existing connection. This indicates that commit is running
successfully, (I have seen this on the database trace too).

I then try to retrieve the record (through a small MySQL/TomCat
application). Sometimes it is retrieved successfully, and sometimes an
empty record set is returned.

If I reduce connection pooling (on the connection script (in
components.xconf))to min 1 max 1 connections, the record is retrieved
successfully every time.

This seems to me to indicate that existing connections created for my
TomCat app are searching on an old (maybe cached?) version of the
database. However, when by chance I get the same connection I used to
insert the record, the record is retrieved successfully.

However, the record is retrieved more often than not even when there
are 10 connections pooled, although I understand that connections are
not round-robbined and some are used more commonly than others,
supporting my suspision.

This is the only insert that uses transactions in my app, and it works
fine with Oracle. All other inserts (not using transactions) work fine
on both database servers (and both MySQL 4.1.1-alpha and 4.0.16).

Thanks very much for any time spent on this and any recommendations
for further tests or fixes.


The Workaround, further indicating that this is indeed a bug in MySQL.

I installed MySQL server 3.23.53, enabled InnoDB tables in my.cnf
(with the line innodb_data_file_path=ibdata:30M under the [mysqld]
section) and ran mysqld-max.exe and the problem seems to have
disappeared and transactions are working as they should. (But MySQL <
4.1.1 doesn't do subqueries etc...)

I have sent a bug report to MySQL.

Thanks again for any time anyone has spent on this. I am still
confused that I cannot find any sign of this defect anywhere on the
net.
Jul 19 '05 #3
up*********@hotmail.com (chris) wrote in message news:<c6**************************@posting.google. com>...
up*********@hotmail.com (chris) wrote in message news:<c6*************************@posting.google.c om>...
I open MySQL Manager and connect to my database.

I then insert one record in to an InnoDB table in MySQL (4.0 and 4.1
alpha hosted on XP running mysqld --console).

I then retrieve the record successfully in MySQL Manager using the
existing connection. This indicates that commit is running
successfully, (I have seen this on the database trace too).

I then try to retrieve the record (through a small MySQL/TomCat
application). Sometimes it is retrieved successfully, and sometimes an
empty record set is returned.

If I reduce connection pooling (on the connection script (in
components.xconf))to min 1 max 1 connections, the record is retrieved
successfully every time.

This seems to me to indicate that existing connections created for my
TomCat app are searching on an old (maybe cached?) version of the
database. However, when by chance I get the same connection I used to
insert the record, the record is retrieved successfully.

However, the record is retrieved more often than not even when there
are 10 connections pooled, although I understand that connections are
not round-robbined and some are used more commonly than others,
supporting my suspision.

This is the only insert that uses transactions in my app, and it works
fine with Oracle. All other inserts (not using transactions) work fine
on both database servers (and both MySQL 4.1.1-alpha and 4.0.16).

Thanks very much for any time spent on this and any recommendations
for further tests or fixes.


The Workaround, further indicating that this is indeed a bug in MySQL.

I installed MySQL server 3.23.53, enabled InnoDB tables in my.cnf
(with the line innodb_data_file_path=ibdata:30M under the [mysqld]
section) and ran mysqld-max.exe and the problem seems to have
disappeared and transactions are working as they should. (But MySQL <
4.1.1 doesn't do subqueries etc...)

I have sent a bug report to MySQL.

Thanks again for any time anyone has spent on this. I am still
confused that I cannot find any sign of this defect anywhere on the
net.


Thanks to some great support from MySQL, I can confirm that this is
not a bug. Their explanation is concise:

It is due to InnoDB being multiversioning and the default isolation
level is REPEATABLE_READ, so therefore each connection is working off
a snapshot of any particular table at a point-in-time when that
connection's transaction started. If you already have a transaction in
progress on another connection, and you want to 'see' the results of a
subsequent transaction on a different connection, you have to make
sure you have a new 'snapshot' of the data, by calling 'commit' before
trying to reference the data. See:

http://www.innodb.com/ibman.php#Exam...onsistent_read

My guess is your application on Oracle is running in an isolation
level
of 'READ_COMMITTED' (which is their default, I believe)[this is all
correct]. If your application ran in an isolation level of
'REPEATABLE_READ', I would
venture to say you would see similar behavior.

I inserted a commit before the SELECT statement in question, and that
solved the problem. I removed it and added the line:

transaction-isolation = READ-UNCOMMITTED

...to the [mysqld] section of my C:\my.cnf file and that also fixed the
problem.
Jul 19 '05 #4
up*********@hotmail.com (chris) wrote in message news:<c6**************************@posting.google. com>...
up*********@hotmail.com (chris) wrote in message news:<c6*************************@posting.google.c om>...
I open MySQL Manager and connect to my database.

I then insert one record in to an InnoDB table in MySQL (4.0 and 4.1
alpha hosted on XP running mysqld --console).

I then retrieve the record successfully in MySQL Manager using the
existing connection. This indicates that commit is running
successfully, (I have seen this on the database trace too).

I then try to retrieve the record (through a small MySQL/TomCat
application). Sometimes it is retrieved successfully, and sometimes an
empty record set is returned.

If I reduce connection pooling (on the connection script (in
components.xconf))to min 1 max 1 connections, the record is retrieved
successfully every time.

This seems to me to indicate that existing connections created for my
TomCat app are searching on an old (maybe cached?) version of the
database. However, when by chance I get the same connection I used to
insert the record, the record is retrieved successfully.

However, the record is retrieved more often than not even when there
are 10 connections pooled, although I understand that connections are
not round-robbined and some are used more commonly than others,
supporting my suspision.

This is the only insert that uses transactions in my app, and it works
fine with Oracle. All other inserts (not using transactions) work fine
on both database servers (and both MySQL 4.1.1-alpha and 4.0.16).

Thanks very much for any time spent on this and any recommendations
for further tests or fixes.


The Workaround, further indicating that this is indeed a bug in MySQL.

I installed MySQL server 3.23.53, enabled InnoDB tables in my.cnf
(with the line innodb_data_file_path=ibdata:30M under the [mysqld]
section) and ran mysqld-max.exe and the problem seems to have
disappeared and transactions are working as they should. (But MySQL <
4.1.1 doesn't do subqueries etc...)

I have sent a bug report to MySQL.

Thanks again for any time anyone has spent on this. I am still
confused that I cannot find any sign of this defect anywhere on the
net.


Thanks to some great support from MySQL, I can confirm that this is
not a bug. Their explanation is concise:

It is due to InnoDB being multiversioning and the default isolation
level is REPEATABLE_READ, so therefore each connection is working off
a snapshot of any particular table at a point-in-time when that
connection's transaction started. If you already have a transaction in
progress on another connection, and you want to 'see' the results of a
subsequent transaction on a different connection, you have to make
sure you have a new 'snapshot' of the data, by calling 'commit' before
trying to reference the data. See:

http://www.innodb.com/ibman.php#Exam...onsistent_read

My guess is your application on Oracle is running in an isolation
level
of 'READ_COMMITTED' (which is their default, I believe)[this is all
correct]. If your application ran in an isolation level of
'REPEATABLE_READ', I would
venture to say you would see similar behavior.

I inserted a commit before the SELECT statement in question, and that
solved the problem. I removed it and added the line:

transaction-isolation = READ-UNCOMMITTED

...to the [mysqld] section of my C:\my.cnf file and that also fixed the
problem.
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Cliff Wells | last post by:
Hi, I'm writing an application that needs to know if an Internet connection is available. Basically, I want to have something similar to what a lot of email clients have, where the app can work...
15
by: The Fumigator | last post by:
Hi. I want to be able to create a persistent connection between an XML-RPC client and server... i.e. I want to be able to login once, carry out a number of calls and then logout rather than send...
0
by: chris | last post by:
I open MySQL Manager and connect to my database. I then insert one record in to an InnoDB table in MySQL (4.0 and 4.1 alpha hosted on XP running mysqld --console). I then retrieve the record...
4
by: refer_to_website | last post by:
How can I use the Server.MapPath(".") value inside of the web.config? For example, when I add the following just before the </configuration>, and run via CTRL-F5, I receive error The '&'...
3
by: John | last post by:
Hi I have a dataset from a web service. I want to use a dataadapter with the dataset. What connection string should I use so the da knows that it is acting on the remote db associated with the...
3
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database...
0
by: jdn4929 | last post by:
The state server has closed an expired TCP/IP connection. The IP address of the client is 127.0.0.1. The expired Read operation began at 11/16/2007 14:31:49. This one has been bothering me for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.