94 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			94 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| 
								 | 
							
								# Tests for the partition storage engine in connection with the
							 | 
						||
| 
								 | 
							
								# storage engine CSV.
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Creation:
							 | 
						||
| 
								 | 
							
								# 2007-10-18 mleich  - Move CSV related sub tests of partition.test to
							 | 
						||
| 
								 | 
							
								#                      this test. Reason: CSV is not everytime available.
							 | 
						||
| 
								 | 
							
								#                    - Minor cleanup
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--source include/have_partition.inc
							 | 
						||
| 
								 | 
							
								--source include/have_csv.inc
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								call mtr.add_suppression("Failed to write to mysql.general_log");
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug#19307: Partitions: csv delete failure
							 | 
						||
| 
								 | 
							
								#            = CSV engine crashes
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								--disable_warnings
							 | 
						||
| 
								 | 
							
								drop table if exists t1;
							 | 
						||
| 
								 | 
							
								--enable_warnings
							 | 
						||
| 
								 | 
							
								--error ER_PARTITION_MERGE_ERROR
							 | 
						||
| 
								 | 
							
								create table t1 (a int)
							 | 
						||
| 
								 | 
							
								engine = csv
							 | 
						||
| 
								 | 
							
								partition by list (a)
							 | 
						||
| 
								 | 
							
								(partition p0 values in (null));
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								# Bug #27816: Log tables ran with partitions crashes the server when logging
							 | 
						||
| 
								 | 
							
								#             is enabled.
							 | 
						||
| 
								 | 
							
								#
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								USE mysql;
							 | 
						||
| 
								 | 
							
								TRUNCATE TABLE general_log;
							 | 
						||
| 
								 | 
							
								SET @old_general_log_state = @@global.general_log;
							 | 
						||
| 
								 | 
							
								SET GLOBAL general_log = 0;
							 | 
						||
| 
								 | 
							
								ALTER TABLE general_log ENGINE = MyISAM;
							 | 
						||
| 
								 | 
							
								--error ER_WRONG_USAGE
							 | 
						||
| 
								 | 
							
								ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
							 | 
						||
| 
								 | 
							
								  (PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000));
							 | 
						||
| 
								 | 
							
								ALTER TABLE general_log ENGINE = CSV;
							 | 
						||
| 
								 | 
							
								SET GLOBAL general_log = @old_general_log_state;
							 | 
						||
| 
								 | 
							
								use test;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo #
							 | 
						||
| 
								 | 
							
								--echo # Bug#40281: partitioning the general log table crashes the server
							 | 
						||
| 
								 | 
							
								--echo #
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo # set up partitioned log, and switch to it
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								USE mysql;
							 | 
						||
| 
								 | 
							
								SET @old_general_log_state = @@global.general_log;
							 | 
						||
| 
								 | 
							
								SET GLOBAL general_log = 0;
							 | 
						||
| 
								 | 
							
								CREATE TABLE gl_partitioned LIKE general_log;
							 | 
						||
| 
								 | 
							
								ALTER TABLE gl_partitioned ENGINE=myisam;
							 | 
						||
| 
								 | 
							
								ALTER TABLE gl_partitioned PARTITION BY HASH (thread_id) PARTITIONS 10;
							 | 
						||
| 
								 | 
							
								ALTER TABLE general_log RENAME TO gl_nonpartitioned;
							 | 
						||
| 
								 | 
							
								ALTER TABLE gl_partitioned RENAME TO general_log;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								SELECT @@global.log_output INTO @old_glo;
							 | 
						||
| 
								 | 
							
								SET GLOBAL log_output='table';
							 | 
						||
| 
								 | 
							
								SET GLOBAL general_log =1;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo # do some things to be logged to partitioned log, should fail
							 | 
						||
| 
								 | 
							
								USE /* 1 */ test;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								CREATE TABLE t1 (i INT);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								connect (con1,localhost,root,,);
							 | 
						||
| 
								 | 
							
								INSERT INTO t1 VALUES (1);
							 | 
						||
| 
								 | 
							
								SELECT * FROM t1;
							 | 
						||
| 
								 | 
							
								disconnect con1;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								connection default;
							 | 
						||
| 
								 | 
							
								USE mysql;
							 | 
						||
| 
								 | 
							
								SET GLOBAL general_log =0;
							 | 
						||
| 
								 | 
							
								ALTER TABLE general_log RENAME TO gl_partitioned;
							 | 
						||
| 
								 | 
							
								ALTER TABLE gl_nonpartitioned RENAME TO general_log;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo # show whether we actually logged anything (no) to general_log
							 | 
						||
| 
								 | 
							
								SELECT COUNT(argument) FROM gl_partitioned;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								DROP TABLE gl_partitioned;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								SET GLOBAL log_output = @old_glo;
							 | 
						||
| 
								 | 
							
								SET GLOBAL general_log = 1;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								USE /* 2 */ test;
							 | 
						||
| 
								 | 
							
								DROP TABLE t1;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								SET GLOBAL general_log = @old_general_log_state;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								--echo End of 5.1 tests
							 |