| Bug #10297 | Auto-increment not working with LOAD DATA INFILE and NDB storage | ||
|---|---|---|---|
| Submitted: | 1 May 2005 21:00 | Modified: | 9 May 2005 11:52 |
| Reporter: | Jim Hoadley | Email Updates: | |
| Status: | Can't repeat | Impact on me: | |
| Category: | MySQL Cluster: Cluster (NDB) storage engine | Severity: | S2 (Serious) |
| Version: | 4.1.11 | OS: | Linux (Linux (RHEL 3)) |
| Assigned to: | Martin Skold | CPU Architecture: | Any |
[1 May 2005 21:00]
Jim Hoadley
[3 May 2005 1:16]
Jorge del Conde
Thanks for your bug report. Tested w/4.1.12
[5 May 2005 9:34]
Martin Skold
Tried to reproduce, but cannot see any if the reported problems,
running on latest 4.1.12 src, two node cluster and using only one
(of two connected) mysql servers:
[marty@localhost mysql-4.1]$ ~/MySQL/run/bin/mysql -u root test
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9 to server version: 4.1.12-debug
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> CREATE DATABASE test_ndb;
Query OK, 1 row affected (0.00 sec)
mysql> USE test_ndb;
Database changed
mysql> CREATE TABLE increment_test ( id int(7) NOT NULL auto_increment, first varchar(30), last varchar(30), PRIMARY KEY (id) ) ENGINE=ndbcluster;
Query OK, 0 rows affected (0.60 sec)
mysql> quit
Bye
[marty@localhost mysql-4.1]$ ~/MySQL/run/bin/mysql -u root test_ndb
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10 to server version: 4.1.12-debug
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> LOAD DATA INFILE '/tmp/_x' INTO TABLE increment_test (first,last);
Query OK, 3 rows affected, 3 warnings (0.01 sec)
Records: 3 Deleted: 0 Skipped: 0 Warnings: 3
mysql> select * from increment_test;
+----+----------------+------+
| id | first | last |
+----+----------------+------+
| 2 | Terri Powell | NULL |
| 3 | Cara Stemle | NULL |
| 1 | Angie Land | NULL |
+----+----------------+------+
3 rows in set (0.05 sec)
mysql> LOAD DATA INFILE '/tmp/_x' INTO TABLE increment_test (first,last);
Query OK, 3 rows affected, 3 warnings (0.01 sec)
Records: 3 Deleted: 0 Skipped: 0 Warnings: 3
mysql> select * from increment_test;
+----+----------------+------+
| id | first | last |
+----+----------------+------+
| 6 | Cara Stemle | NULL |
| 2 | Terri Powell | NULL |
| 4 | Angie Land | NULL |
| 5 | Terri Powell | NULL |
| 3 | Cara Stemle | NULL |
| 1 | Angie Land | NULL |
+----+----------------+------+
6 rows in set (0.01 sec)
mysql> quit
Bye
[marty@localhost mysql-4.1]$ ~/MySQL/run/bin/mysql -u root test_ndb
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11 to server version: 4.1.12-debug
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> LOAD DATA INFILE '/tmp/_x' INTO TABLE increment_test (first,last);
Query OK, 3 rows affected, 3 warnings (0.01 sec)
Records: 3 Deleted: 0 Skipped: 0 Warnings: 3
mysql> select * from increment_test;
+----+----------------+------+
| id | first | last |
+----+----------------+------+
| 34 | Terri Powell | NULL |
| 35 | Cara Stemle | NULL |
| 6 | Cara Stemle | NULL |
| 2 | Terri Powell | NULL |
| 33 | Angie Land | NULL |
| 4 | Angie Land | NULL |
| 5 | Terri Powell | NULL |
| 3 | Cara Stemle | NULL |
| 1 | Angie Land | NULL |
+----+----------------+------+
9 rows in set (0.04 sec)
mysql> DROP TABLE increment_test;
Query OK, 0 rows affected (0.40 sec)
mysql> CREATE TABLE increment_test ( id int(7) NOT NULL auto_increment,
-> first varchar(30), last varchar(30), age int(3), PRIMARY KEY (id) )
-> ENGINE=ndbcluster;
Query OK, 0 rows affected (0.81 sec)
mysql> INSERT INTO increment_test (first,last,age) VALUES
-> ('Doug','Weert','13');
Query OK, 1 row affected (0.01 sec)
mysql> select * from increment_test;
+----+-------+-------+------+
| id | first | last | age |
+----+-------+-------+------+
| 1 | Doug | Weert | 13 |
+----+-------+-------+------+
1 row in set (0.01 sec)
mysql> DELETE FROM increment_test WHERE last = 'Weert';
Query OK, 1 row affected (0.01 sec)
mysql> select * from increment_test;
Empty set (0.01 sec)
mysql> LOAD DATA INFILE '/tmp/_x' INTO TABLE increment_test
-> (first,last,age);
Query OK, 3 rows affected, 6 warnings (0.01 sec)
Records: 3 Deleted: 0 Skipped: 0 Warnings: 6
mysql> select * from increment_test;
+----+----------------+------+------+
| id | first | last | age |
+----+----------------+------+------+
| 2 | Angie Land | NULL | NULL |
| 4 | Cara Stemle | NULL | NULL |
| 3 | Terri Powell | NULL | NULL |
+----+----------------+------+------+
3 rows in set (0.01 sec)
mysql> quit
Bye
[marty@localhost mysql-4.1]$ ~/MySQL/run/bin/mysql -u root test_ndb
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13 to server version: 4.1.12-debug
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> INSERT INTO increment_test (first,last,age) VALUES
-> ('Doug','Weert','13');
Query OK, 1 row affected (0.01 sec)
mysql> select * from increment_test;
+----+----------------+-------+------+
| id | first | last | age |
+----+----------------+-------+------+
| 34 | Doug | Weert | 13 |
| 2 | Angie Land | NULL | NULL |
| 4 | Cara Stemle | NULL | NULL |
| 3 | Terri Powell | NULL | NULL |
+----+----------------+-------+------+
4 rows in set (0.07 sec)
[9 May 2005 11:52]
Martin Skold
I cannot reproduce this one. Please add info how and on what setup it was verified.
[9 May 2005 18:16]
Jim Hoadley
Martin, thank you. You say you can't reproduce it. Did you try using 4.1.11? Not sure what additional information you requier. Besides the version difference in our tests, I already pointed out that I'm using hugemem kernel and have 2 NDB nodes per host (4 NDB nodes total). [root@db1 root]# uname -a Linux db1.dealerfusion.com 2.4.21-27.0.4.ELhugemem #1 SMP Sat Apr 16 18:22:53 EDT 2005 i686 i686 i386 GNU/Linux Is your conclusion that it has already been fixed in 4.1.12? Thx. -- Jim
[27 Nov 2007 12:56]
pawan katiyar
when i delete row from particular table then insert again data in my table then increment id is increment after that particular id deleted. how can possible my id increment by 1 that id exit in particular table. is it possible my id not count deleted row.
[27 Nov 2007 13:20]
Martin Skold
The auto_increment values in ndb comes from an ever increasing sequence (with possibly holes). There is no reuse of deleted values.
