Bug #35373 Records donot get committed in transaction on switching connections
Submitted: 18 Mar 2008 7:09 Modified: 26 Mar 2008 17:13
Reporter: Salman Rawala Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.1.22 OS:Windows
Assigned to: CPU Architecture:Any

[18 Mar 2008 7:09] Salman Rawala
Description:
When you add some records with connection let say test_con1 and then switch to another connection and then add some more records, and after that switch to first connection and commit, the records do not get saved in table that you have inserted in test_con1.

How to repeat:
CREATE TABLE t1
(
id INT NOT NULL auto_increment,
PRIMARY KEY (id),
name varchar(30)
) ENGINE = INNODB;

## Creating new connection ##
CONNECT (test_con1,localhost,root,,);
CONNECTION test_con1;
 
## Setting value of variable to zero and inserting some rows ## 
SET @@autocommit = 0;
INSERT into t1(name) values('Record_1');
INSERT into t1(name) values('Record_2');
SELECT * from t1;
id	name
1	Record_1
2	Record_2
## Creating another connection and verifying records in table ## 
## New Connection test_con2 ##
CONNECT (test_con2,localhost,root,,);
CONNECTION test_con2;
SELECT * from t1;
id	name

## Verifying behavior of variable by commiting rows in test_con1 ##
## Connecting with connection # 01 ## 
connection test_con1;
SELECT * from t1;
id	name
1	Record_1
2	Record_2
COMMIT;

## Now verifying records in table from connection # 02 ## 
CONNECTION test_con2;
SELECT * from t1;
id	name
1	Record_1
2	Record_2

## Connecting with connection # 01 ##
connection test_con1; 
INSERT into t1(name) values('Record_3');

## Connection test_con2 ##
connection test_con2;
## Now verifying records in table from connection # 02 and changing value  ## 
## of autocommit to true ## 
SELECT * from t1;
id	name
1	Record_1
2	Record_2
SET @@autocommit = 1;
INSERT into t1(name) values('Record_4');
INSERT into t1(name) values('Record_5');
SELECT * from t1;
id	name
1	Record_1
2	Record_2
4	Record_4
5	Record_5
## Connecting with connection # 01 and inserting few records ## 
connection test_con1;
SELECT * from t1;
id	name
1	Record_1
2	Record_2
3	Record_3
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
## Bug: Here Record_4 & Record_5 should be in table ##
+++++++++++++++++++++++++++++++++++++++++++++++++++++++

INSERT into t1(name) values('Record_6');
SELECT * from t1;
id	name
1	Record_1
2	Record_2
3	Record_3
6	Record_6
[19 Mar 2008 12:58] Heikki Tuuri
What interface you are using?

It is unlikely this is an InnoDB problem, looks more like a client problem.
[20 Mar 2008 12:52] Susanne Ebrecht
Please let us know how you connect to the server.
[22 Mar 2008 7:46] Salman Rawala
I am using Test Framework of MySQL, and i've used --innodb in opt file to use innodb engine.
[26 Mar 2008 17:13] Sergei Golubchik
I don't see anything wrong here, records 4 and 5 should not be visible in the last select.

If you disagree, please explain why do you expect these records to be visible and re-open the bugreport.