mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-31 15:50:51 +03:00 
			
		
		
		
	Bug#11733 (COMMITs should not happen if read-only is set) Bug#22009 (Can write to a read-only server under some circumstances) See the work log for details The change consist of a) acquiring the global read lock in SET GLOBAL READONLY b) honoring opt_readonly in ha_commit_trans(), c) honoring opt_readonly in mysql_lock_tables(). a) takes care of the server stability, b) makes the transactional tables safe (Bug 11733) c) makes the non transactional tables safe (Bug 22009) mysql-test/r/read_only.result: WL#3602 (SET GLOBAL READONLY) mysql-test/t/read_only.test: WL#3602 (SET GLOBAL READONLY) sql/handler.cc: WL#3602 (SET GLOBAL READONLY) sql/lock.cc: WL#3602 (SET GLOBAL READONLY) sql/set_var.cc: WL#3602 (SET GLOBAL READONLY) sql/set_var.h: WL#3602 (SET GLOBAL READONLY) mysql-test/r/read_only_innodb.result: WL#3602 (SET GLOBAL READONLY) mysql-test/t/read_only_innodb.test: WL#3602 (SET GLOBAL READONLY)
		
			
				
	
	
		
			44 lines
		
	
	
		
			882 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			882 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| # should work with embedded server after mysqltest is fixed
 | |
| -- source include/not_embedded.inc
 | |
| -- source include/have_innodb.inc
 | |
| 
 | |
| #
 | |
| # BUG#11733: COMMITs should not happen if read-only is set
 | |
| #
 | |
| 
 | |
| --disable_warnings
 | |
| DROP TABLE IF EXISTS table_11733 ;
 | |
| --enable_warnings
 | |
| 
 | |
| # READ_ONLY does nothing to SUPER users
 | |
| # so we use a non-SUPER one:
 | |
| 
 | |
| grant CREATE, SELECT, DROP on *.* to test@localhost;
 | |
| 
 | |
| connect (con1,localhost,test,,test);
 | |
| 
 | |
| connection default;
 | |
| set global read_only=0;
 | |
| 
 | |
| # Any transactional engine will do
 | |
| create table table_11733 (a int) engine=InnoDb;
 | |
| 
 | |
| connection con1;
 | |
| BEGIN;
 | |
| insert into table_11733 values(11733);
 | |
| 
 | |
| connection default;
 | |
| set global read_only=1;
 | |
| 
 | |
| connection con1;
 | |
| select @@global.read_only;
 | |
| select * from table_11733 ;
 | |
| -- error ER_OPTION_PREVENTS_STATEMENT
 | |
| COMMIT;
 | |
| 
 | |
| connection default;
 | |
| set global read_only=0;
 | |
| drop table table_11733 ;
 | |
| drop user test@localhost;
 | |
| 
 |