mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-31 15:50:51 +03:00 
			
		
		
		
	myisam-recover options changed from OFF to 'DEFAULT' to get less change of data loss when using MyISAM. (The disadvantage is that changed MyISAM tables will be checked at access time; Use --myisam-recover=OFF for old behavior) Don't call extra(HA_EXTRA_FORCE_REOPEN) in ALTER TABLE if table is locked as this will mark table as crashed! Added assert to detect if we accidently would use MyISAM versioning in MySQL include/my_base.h: Mark NOT_USED as USED, as we now use this as a flag to not call extra() mysql-test/mysql-test-run.pl: Don't write all options when there is something wrong with the arguments mysql-test/r/sp-destruct.result: Add missing flush of mysql.proc (as the test copied live tables) mysql-test/r/variables.result: myisam-recover options changed to 'default' mysql-test/r/view.result: Don't show create time in result mysql-test/suite/maria/t/maria-recovery2-master.opt: Don't run test with myisam-recover (as this produces extra warnings during simulated death) mysql-test/t/sp-destruct.test: Add missing flush of mysql.proc (as the test copied live tables) mysql-test/t/view.test: Don't show create time in result sql/lock.cc: Added marker if table was deleted to argument list sql/mysql_priv.h: Added marker if table was deleted to argument list sql/mysqld.cc: myisam-recover options changed from OFF to 'DEFAULT' to get less change of data loss when using MyISAM Allow one to specify OFF as argument to myisam-recover (was default before but one couldn't specify it) sql/sql_base.cc: Mark if table is going to be deleted sql/sql_delete.cc: Mark if table is going to be deleted sql/sql_table.cc: Mark if table is going to be deleted Don't call extra(HA_EXTRA_FORCE_REOPEN) in ALTER TABLE if table is locked as this will mark table as crashed! sql/table.cc: Signal to handler if table is getting deleted as part of getting droped from table cache. sql/table.h: Added marker if table is going to be deleted. storage/maria/ha_maria.cc: Don't search for transaction handler if file is not transactional or outside of transaction (Fixed possible core dump) storage/maria/ma_blockrec.c: Don't write changed information if table is going to be deleted. storage/maria/ma_close.c: Don't write changed information if table is going to be deleted. storage/maria/ma_extra.c: Mark tables that are deleted as crased, to ensure good behavior on restart if we suddenly crash. storage/maria/ma_locking.c: Cleanup storage/maria/ma_recovery.c: We need trnman to be inited during redo phase (to be able to open tables checked with maria_chk) storage/maria/maria_def.h: Added marker if table is going to be deleted. storage/myisam/mi_close.c: Don't write changed information if table is going to be deleted. storage/myisam/mi_extra.c: Mark tables that are deleted as crased, to ensure good behavior on restart if we suddenly crash. storage/myisam/mi_open.c: Added assert to detect if we accidently would use MyISAM versioning in MySQL storage/myisam/myisamdef.h: Added marker if table is going to be deleted.
		
			
				
	
	
		
			201 lines
		
	
	
		
			5.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			201 lines
		
	
	
		
			5.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| #
 | |
| # Destructive stored procedure tests
 | |
| #
 | |
| # We do horrible things to the mysql.proc table here, so any unexpected
 | |
| # failures here might leave it in an undetermined state.
 | |
| #
 | |
| # In the case of trouble you might want to skip this.
 | |
| #
 | |
| 
 | |
| # embedded server returns different paths in error messages
 | |
| # in lines like 'call bug14233();'
 | |
| # mysqltest should be fixed to allow REPLACE_RESULT in error message
 | |
| -- source include/not_embedded.inc
 | |
| 
 | |
| # Supress warnings written to the log file
 | |
| call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted");
 | |
| 
 | |
| # Backup proc table
 | |
| let $MYSQLD_DATADIR= `select @@datadir`;
 | |
| flush table mysql.proc;
 | |
| --copy_file $MYSQLD_DATADIR/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/proc.frm
 | |
| --copy_file $MYSQLD_DATADIR/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/proc.MYD
 | |
| --copy_file $MYSQLD_DATADIR/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/proc.MYI
 | |
| 
 | |
| use test;
 | |
| 
 | |
| --disable_warnings
 | |
| drop procedure if exists bug14233;
 | |
| drop function if exists bug14233;
 | |
| drop table if exists t1;
 | |
| drop view if exists v1;
 | |
| --enable_warnings
 | |
| 
 | |
| create procedure bug14233()
 | |
|   set @x = 42;
 | |
| 
 | |
| create function bug14233_f() returns int
 | |
|   return 42;
 | |
| 
 | |
| create table t1 (id int);
 | |
| create trigger t1_ai after insert on t1 for each row call bug14233();
 | |
| 
 | |
| # Unsupported tampering with the mysql.proc definition
 | |
| alter table mysql.proc drop type;
 | |
| --error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED
 | |
| call bug14233();
 | |
| --error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED
 | |
| create view v1 as select bug14233_f();
 | |
| --error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED
 | |
| insert into t1 values (0);
 | |
| --error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED
 | |
| show procedure status;
 | |
| 
 | |
| flush table mysql.proc;
 | |
| 
 | |
| # Thrashing the .frm file
 | |
| --remove_file $MYSQLD_DATADIR/mysql/proc.frm
 | |
| --write_file $MYSQLD_DATADIR/mysql/proc.frm
 | |
| saljdfa
 | |
| EOF
 | |
| --replace_result $MYSQLTEST_VARDIR . master-data// '' '\\' '/'
 | |
| --error ER_NOT_FORM_FILE
 | |
| call bug14233();
 | |
| --replace_result $MYSQLTEST_VARDIR . master-data// '' '\\' '/'
 | |
| --error ER_NOT_FORM_FILE
 | |
| create view v1 as select bug14233_f();
 | |
| --replace_result $MYSQLTEST_VARDIR . master-data// '' '\\' '/'
 | |
| --error ER_NOT_FORM_FILE
 | |
| insert into t1 values (0);
 | |
| 
 | |
| flush table mysql.proc;
 | |
| 
 | |
| # Drop the mysql.proc table
 | |
| --remove_file $MYSQLD_DATADIR/mysql/proc.frm
 | |
| --remove_file $MYSQLD_DATADIR/mysql/proc.MYD
 | |
| --remove_file $MYSQLD_DATADIR/mysql/proc.MYI
 | |
| --error ER_NO_SUCH_TABLE
 | |
| call bug14233();
 | |
| --error ER_NO_SUCH_TABLE
 | |
| create view v1 as select bug14233_f();
 | |
| --error ER_NO_SUCH_TABLE
 | |
| insert into t1 values (0);
 | |
| 
 | |
| # Restore mysql.proc
 | |
| --copy_file $MYSQLTEST_VARDIR/tmp/proc.frm $MYSQLD_DATADIR/mysql/proc.frm
 | |
| --copy_file $MYSQLTEST_VARDIR/tmp/proc.MYD $MYSQLD_DATADIR/mysql/proc.MYD
 | |
| --copy_file $MYSQLTEST_VARDIR/tmp/proc.MYI $MYSQLD_DATADIR/mysql/proc.MYI 
 | |
| --remove_file $MYSQLTEST_VARDIR/tmp/proc.frm
 | |
| --remove_file $MYSQLTEST_VARDIR/tmp/proc.MYD
 | |
| --remove_file $MYSQLTEST_VARDIR/tmp/proc.MYI
 | |
| 
 | |
| flush table mysql.proc;
 | |
| flush privileges;
 | |
| 
 | |
| delete from mysql.proc where name like 'bug14233%';
 | |
| 
 | |
| # Unsupported editing of mysql.proc, circumventing checks in "create ..."
 | |
| insert into mysql.proc
 | |
| (
 | |
|   db, name, type, specific_name, language, sql_data_access, is_deterministic,
 | |
|   security_type, param_list, returns, body, definer, created, modified,
 | |
|   sql_mode, comment, character_set_client, collation_connection, db_collation,
 | |
|   body_utf8
 | |
| )
 | |
| values
 | |
| (
 | |
|   'test', 'bug14233_1', 'FUNCTION', 'bug14233_1', 'SQL', 'READS_SQL_DATA', 'NO',
 | |
|   'DEFINER', '', 'int(10)',
 | |
|   'select count(*) from mysql.user',
 | |
|   'root@localhost', NOW() , '0000-00-00 00:00:00', '', '',
 | |
|   '', '', '',
 | |
|   'select count(*) from mysql.user'
 | |
| ),
 | |
| (
 | |
|   'test', 'bug14233_2', 'FUNCTION', 'bug14233_2', 'SQL', 'READS_SQL_DATA', 'NO',
 | |
|   'DEFINER', '', 'int(10)',
 | |
|   'begin declare x int; select count(*) into x from mysql.user; end',
 | |
|   'root@localhost', NOW() , '0000-00-00 00:00:00', '', '',
 | |
|   '', '', '',
 | |
|   'begin declare x int; select count(*) into x from mysql.user; end'
 | |
| ),
 | |
| (
 | |
|   'test', 'bug14233_3', 'PROCEDURE', 'bug14233_3', 'SQL', 'READS_SQL_DATA','NO',
 | |
|   'DEFINER', '', '',
 | |
|   'alksj wpsj sa ^#!@ ',
 | |
|   'root@localhost', NOW() , '0000-00-00 00:00:00', '', '',
 | |
|   '', '', '',
 | |
|   'alksj wpsj sa ^#!@ '
 | |
| );
 | |
| 
 | |
| --error ER_SP_PROC_TABLE_CORRUPT
 | |
| select bug14233_1();
 | |
| --error ER_SP_PROC_TABLE_CORRUPT
 | |
| create view v1 as select bug14233_1();
 | |
| 
 | |
| --error ER_SP_PROC_TABLE_CORRUPT
 | |
| select bug14233_2();
 | |
| --error ER_SP_PROC_TABLE_CORRUPT
 | |
| create view v1 as select bug14233_2();
 | |
| 
 | |
| --error ER_SP_PROC_TABLE_CORRUPT
 | |
| call bug14233_3();
 | |
| drop trigger t1_ai;
 | |
| create trigger t1_ai after insert on t1 for each row call bug14233_3();
 | |
| --error ER_SP_PROC_TABLE_CORRUPT
 | |
| insert into t1 values (0);
 | |
| 
 | |
| # Clean-up
 | |
| drop trigger t1_ai;
 | |
| drop table t1;
 | |
| 
 | |
| #
 | |
| # BUG#16303: erroneus stored procedures and functions should be droppable
 | |
| #
 | |
| drop function bug14233_1;
 | |
| drop function bug14233_2;
 | |
| drop procedure bug14233_3;
 | |
| # Assert: These should show nothing.
 | |
| show procedure status where db=DATABASE();
 | |
| show function status where db=DATABASE();
 | |
| 
 | |
| #
 | |
| # Bug#41726 upgrade from 5.0 to 5.1.30 crashes if you didn't run mysql_upgrade
 | |
| #
 | |
| 
 | |
| 
 | |
| --disable_warnings
 | |
| DROP TABLE IF EXISTS proc_backup;
 | |
| DROP PROCEDURE IF EXISTS p1;
 | |
| --enable_warnings
 | |
| 
 | |
| --echo # Backup the proc table
 | |
| 
 | |
| RENAME TABLE mysql.proc TO proc_backup;
 | |
| CREATE TABLE mysql.proc LIKE proc_backup;
 | |
| FLUSH TABLE mysql.proc;
 | |
| 
 | |
| --echo # Test with a valid table.
 | |
| 
 | |
| CREATE PROCEDURE p1()
 | |
|   SET @foo = 10;
 | |
| CALL p1();
 | |
| --replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
 | |
| SHOW PROCEDURE STATUS;
 | |
| 
 | |
| --echo # Modify a field of the table.
 | |
| 
 | |
| ALTER TABLE mysql.proc MODIFY comment CHAR (32);
 | |
| 
 | |
| --error ER_CANNOT_LOAD_FROM_TABLE
 | |
| CREATE PROCEDURE p2()
 | |
|   SET @foo = 10;
 | |
| --echo # Procedure loaded from the cache
 | |
| CALL p1();
 | |
| --error ER_CANNOT_LOAD_FROM_TABLE
 | |
| SHOW PROCEDURE STATUS;
 | |
| 
 | |
| DROP TABLE mysql.proc;
 | |
| RENAME TABLE proc_backup TO mysql.proc;
 | |
| FLUSH TABLE mysql.proc;
 |