[MDEV-11308] Read_only Clarification Created: 2016-11-18 Updated: 2017-01-30 Resolved: 2017-01-30 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Documentation, Locale Settings, Storage Engine - InnoDB |
| Affects Version/s: | 10.1 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Chris Calender (Inactive) | Assignee: | Ian Gilfillan |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The manual states this about read_only option: "Changing this to 1 will fail if you have table locks or transactions pending, while it will wait until other locks are released or transactions are completed." https://mariadb.com/kb/en/mariadb/server-system-variables/#read_only I have several issues with this sentence. 1. It almost seems contradictory, but if not, then it needs some further clarification. For instance, it says, "Changing this to 1 will fail if you have ... transactions pending, while it will wait until other ... transactions are completed." I'm not quite sure what the difference in a pending transaction and a transaction that is not yet completed but is working on being completed (perhaps it means the COMMIT was already issued?). 2. It says, "Changing this to 1 will fail if you have... transactions pending...". In my tests, if I have a transaction pending, and I issue the "SET @@GLOBAL.read_only=1", then the SET commands takes effect, and then if I try to COMMIT the pending transaction, it fails. Thus this is the opposite of what the manual states. I don't know if the manual is incorrect, or if the behavior from read_only is incorrect. 3. It says, "Changing this to 1 will fail if you have table locks... pending..." Again, I tested this, and if I issue a TABLE LOCK on a table, and then issue SET @@GLOBAL.read_only=1" in another session, the SET command waits until you UNLOCK TABLES. So it does not fail either. Again, I don't know if the manual is incorrect, or if the behavior from read_only is incorrect. #2 test case: Session #1:
Session #2:
Session #1:
#3 test case: Session #1:
Session #2:
Session #1:
Session #2:
(See how long it waited?) |
| Comments |
| Comment by Elena Stepanova [ 2016-11-18 ] | |||||||||||||||||||||||
|
Regardless the rest of this comment, I agree with (1), it does sound confusing. I hope greenman can find a better wording for it. I think the part about "pending" relates to your own session (yes, it's a bad choice of words). That's how it really looks (no other sessions are involved):
If we agree that it accounts for the "if" part in this sentence
the test case #3 seems to be working as expected, SET GLOBAL read_only waits until "other locks" are released. MySQL 5.6 manual has a bit different wording, but it does not explain anything either, and the behavior is the same as with MariaDB. It says "The attempt blocks if there are active transactions that hold metadata locks, until those transactions end.", which sounds clear enough, but it simply does not happen. Assigning to jplindst for the opinion about "pending/active transactions". If everything appears to be working as expected, please reassign to greenman for fixing documentation. | |||||||||||||||||||||||
| Comment by Ian Gilfillan [ 2017-01-30 ] | |||||||||||||||||||||||
|
I have clarified that "you" meant the current session, and also removed the mention of transactions that didn't seem to apply. |