Bug #78793 | Create as select put LOCK_S when read record. | ||
---|---|---|---|
Submitted: | 10 Oct 2015 8:48 | Modified: | 16 Oct 2015 13:20 |
Reporter: | Zhao Jianwei | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S4 (Feature request) |
Version: | 5.6 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[10 Oct 2015 8:48]
Zhao Jianwei
[10 Oct 2015 8:53]
Zhao Jianwei
Sorry. correct as below: but this statement will be blocked by 'update t1 set col1=2 where id=1'
[13 Oct 2015 15:47]
MySQL Verification Team
Hi! Thank you for your bug report. After a study of the problem that you expounded here, I can inform you that it is not a bug. The UPDATE statement requires exclusive lock on the row(s) in the table where id = 1. On the other hand, the SELECT part of that CREATE statement requires a shared lock on the same set of rows, or a single row. Upon committing first statement, the second one will pass, irrespective of the order. Not a bug.
[16 Oct 2015 7:14]
Zhao Jianwei
Hi Sorry for again, I still have doubt on this case。 I have neither violate repeatable read, nor result in data unconsistent between master and slave if InnoDB didn't put on LOCK_S on row(s) when executing create as select statement。 If it is not a bug. Could I report it as a feature request?
[16 Oct 2015 13:20]
MySQL Verification Team
Actually it is not as simple as it seems. The issue about CREATE...SELECT is that it is 2 transactions internally: one for the CREATE and another for INSERT...SELECT. Hence, a lock is necessary so that row is available for the INSERT part of the command. But, this statement will be fixed in WL#7743/WL#7141 to be a single transaction. Then, the improvement for the lock might be considered. Verified as the feature request.