-
-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: insert ... select distinct,The correct test result was not detected #500
Labels
A-bug
Something isn't working
Milestone
Comments
mysql>
mysql> create table t1 (email varchar(50))engine=tianmu;
Query OK, 0 rows affected (0.01 sec)
mysql> insert into t1 values ('[email protected]'),('[email protected]'),('[email protected]'),('[email protected]'),('[email protected]');
Query OK, 5 rows affected (0.01 sec)
Records: 5 Duplicates: 0 Warnings: 0
mysql>
mysql> select distinct substring(email, locate('@', email)+1) from t1;
+----------------------------------------+
| substring(email, locate('@', email)+1) |
+----------------------------------------+
| mysql.com |
| hotmail.com |
| aol.com |
+----------------------------------------+
3 rows in set (0.00 sec)
|
The reason is that the insertion delay is setmysql> show variables like '%insert_delay%';
+----------------------------+-------+
| Variable_name | Value |
+----------------------------+-------+
| max_insert_delayed_threads | 20 |
| tianmu_insert_delayed | ON |
+----------------------------+-------+
2 rows in set (0.01 sec)
mysql> create table t1 (email varchar(50))engine=tianmu;
Query OK, 0 rows affected (0.00 sec)
mysql> insert into t1 values ('[email protected]'),('[email protected]'),('[email protected]'),('[email protected]'),('[email protected]');
Query OK, 5 rows affected (0.01 sec)
Records: 5 Duplicates: 0 Warnings: 0
mysql> select * from t1;
Empty set (0.00 sec)
mysql> select * from t1;
+-----------------+
| email |
+-----------------+
| sasha@mysql.com |
| monty@mysql.com |
| foo@hotmail.com |
| foo@aol.com |
| bar@aol.com |
+-----------------+
5 rows in set (0.00 sec)
mysql> create table t2(id int not null auto_increment primary key, t2 varchar(50), unique(t2))engine=tianmu;
Query OK, 0 rows affected (0.01 sec)
mysql> insert into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
Query OK, 3 rows affected, 1 warning (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 1
mysql> select * from t2;
Empty set (0.00 sec)
mysql> select * from t2;
+----+-------------+
| id | t2 |
+----+-------------+
| 1 | mysql.com |
| 2 | hotmail.com |
| 3 | aol.com |
+----+-------------+
3 rows in set (0.00 sec)
|
If the tianmu_insert_delayed parameter is disabled, the result is normalmysql>
mysql> show variables like '%insert_delay%';
+----------------------------+-------+
| Variable_name | Value |
+----------------------------+-------+
| max_insert_delayed_threads | 20 |
| tianmu_insert_delayed | OFF |
+----------------------------+-------+
2 rows in set (0.00 sec)
mysql>
mysql> create table t1 (email varchar(50))engine=tianmu;
Query OK, 0 rows affected (0.00 sec)
mysql> insert into t1 values ('[email protected]'),('[email protected]'),('[email protected]'),('[email protected]'),('[email protected]');
Query OK, 5 rows affected (0.02 sec)
Records: 5 Duplicates: 0 Warnings: 0
mysql> select * from t1;
+-----------------+
| email |
+-----------------+
| sasha@mysql.com |
| monty@mysql.com |
| foo@hotmail.com |
| foo@aol.com |
| bar@aol.com |
+-----------------+
5 rows in set (0.00 sec)
mysql>
mysql> create table t2(id int not null auto_increment primary key, t2 varchar(50), unique(t2))engine=tianmu;
Query OK, 0 rows affected (0.01 sec)
mysql> insert into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
Query OK, 3 rows affected, 1 warning (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 1
mysql> select * from t2;
+----+-------------+
| id | t2 |
+----+-------------+
| 1 | mysql.com |
| 2 | hotmail.com |
| 3 | aol.com |
+----+-------------+
3 rows in set (0.00 sec)
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the problem
Expected behavior
How To Reproduce
Environment
Are you interested in submitting a PR to solve the problem?
The text was updated successfully, but these errors were encountered: