mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-31 10:56:12 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			174 lines
		
	
	
	
		
			5.2 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			174 lines
		
	
	
	
		
			5.2 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| --source include/have_partition.inc
 | |
| --source include/have_innodb.inc
 | |
| --source include/big_test.inc
 | |
| --source include/master-slave.inc
 | |
| 
 | |
| --vertical_results
 | |
| 
 | |
| let $engine_type= 'innodb';
 | |
| 
 | |
| set @old_global_binlog_format=  @@global.binlog_format;
 | |
| set @old_session_binlog_format=  @@session.binlog_format;
 | |
| SET GLOBAL binlog_format = 'ROW';
 | |
| SET SESSION binlog_format = 'ROW';
 | |
| select @@global.binlog_format, @@session.binlog_format;
 | |
| connection slave;
 | |
| set @old_global_binlog_format=  @@global.binlog_format;
 | |
| set @old_session_binlog_format=  @@session.binlog_format;
 | |
| SET GLOBAL binlog_format = 'ROW';
 | |
| SET SESSION binlog_format = 'ROW';
 | |
| select @@global.binlog_format, @@session.binlog_format;
 | |
| # restart slave so that slave sql thread's binlog format is re-read
 | |
| # from @@global.binlog_format
 | |
| --source include/stop_slave.inc
 | |
| --source include/start_slave.inc
 | |
| connection master;
 | |
| 
 | |
| eval CREATE TABLE t1(id MEDIUMINT NOT NULL AUTO_INCREMENT,
 | |
|                            dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
 | |
|                            fkid MEDIUMINT, filler VARCHAR(255),
 | |
|                            PRIMARY KEY(id)) ENGINE=$engine_type;
 | |
| 
 | |
| eval CREATE TABLE t2(id MEDIUMINT NOT NULL AUTO_INCREMENT,
 | |
|                            dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
 | |
|                            fkid MEDIUMINT, filler VARCHAR(255),
 | |
|                            PRIMARY KEY(id)) ENGINE=$engine_type
 | |
| 				PARTITION BY KEY(id) partitions 5;
 | |
| 
 | |
| eval CREATE TABLE t3(id MEDIUMINT NOT NULL AUTO_INCREMENT,
 | |
|                            dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
 | |
|                            fkid MEDIUMINT, filler VARCHAR(255),
 | |
|                            PRIMARY KEY(id)) ENGINE=$engine_type 
 | |
| 				PARTITION BY RANGE(id) 
 | |
|                                 SUBPARTITION BY hash(id) subpartitions 2
 | |
| 				(PARTITION pa1 values less than (10),
 | |
| 				 PARTITION pa2 values less than (20),
 | |
| 				 PARTITION pa3 values less than (30),
 | |
| 				 PARTITION pa4 values less than (40),
 | |
| 				 PARTITION pa5 values less than (50),
 | |
| 				 PARTITION pa6 values less than (60),
 | |
| 				 PARTITION pa7 values less than (70),
 | |
| 				 PARTITION pa8 values less than (80),
 | |
| 				 PARTITION pa9 values less than (90),
 | |
| 				 PARTITION pa10 values less than (100),
 | |
| 				 PARTITION pa11 values less than MAXVALUE);
 | |
| 
 | |
| ######## Create SPs, Functions, Views and Triggers Section ##############
 | |
| 
 | |
| delimiter |;
 | |
| CREATE PROCEDURE p1()
 | |
| BEGIN
 | |
|    DECLARE ins_count INT DEFAULT 1000; 
 | |
|    DECLARE del_count INT;
 | |
|    DECLARE cur_user VARCHAR(255);
 | |
|    DECLARE local_uuid VARCHAR(255);
 | |
|    DECLARE local_time TIMESTAMP;
 | |
| 
 | |
|    SET local_time= NOW();
 | |
|    SET cur_user= CURRENT_USER();
 | |
|    SET local_uuid= UUID();
 | |
|  
 | |
|    WHILE ins_count > 0 DO
 | |
|      INSERT INTO t1 VALUES (NULL, NOW(), USER() , UUID(),
 | |
|                                    ins_count,'Going to test MBR for MySQL');
 | |
|      SET ins_count = ins_count - 1;
 | |
|    END WHILE;
 | |
|    
 | |
|    SELECT MAX(id) INTO del_count FROM t1;
 | |
|    WHILE del_count > 0 DO
 | |
|      DELETE FROM t1 WHERE id = del_count;
 | |
|      SET del_count = del_count - 2;
 | |
|    END WHILE;
 | |
| END|   
 | |
| 
 | |
| CREATE PROCEDURE p2()
 | |
| BEGIN
 | |
|    DECLARE ins_count INT DEFAULT 1000; 
 | |
|    DECLARE del_count INT;
 | |
|    DECLARE cur_user VARCHAR(255);
 | |
|    DECLARE local_uuid VARCHAR(255);
 | |
|    DECLARE local_time TIMESTAMP;
 | |
| 
 | |
|    SET local_time= NOW();
 | |
|    SET cur_user= CURRENT_USER();
 | |
|    SET local_uuid= UUID();
 | |
|  
 | |
|    WHILE ins_count > 0 DO
 | |
|      INSERT INTO t2 VALUES (NULL, NOW(), USER() , UUID(),
 | |
|                                    ins_count,'Going to test MBR for MySQL');
 | |
|      SET ins_count = ins_count - 1;
 | |
|    END WHILE;
 | |
|    
 | |
|    SELECT MAX(id) INTO del_count FROM t2;
 | |
|    WHILE del_count > 0 DO
 | |
|      DELETE FROM t2 WHERE id = del_count;
 | |
|      SET del_count = del_count - 2;
 | |
|    END WHILE;
 | |
| END|   
 | |
| 
 | |
| CREATE PROCEDURE p3()
 | |
| BEGIN
 | |
|    DECLARE ins_count INT DEFAULT 1000; 
 | |
|    DECLARE del_count INT;
 | |
|    DECLARE cur_user VARCHAR(255);
 | |
|    DECLARE local_uuid VARCHAR(255);
 | |
|    DECLARE local_time TIMESTAMP;
 | |
| 
 | |
|    SET local_time= NOW();
 | |
|    SET cur_user = CURRENT_USER();
 | |
|    SET local_uuid=UUID();
 | |
| 
 | |
|    WHILE ins_count > 0 DO
 | |
|      INSERT INTO t3 VALUES (NULL, NOW(), USER(), UUID(),
 | |
|                                     ins_count,'Going to test MBR for MySQL');
 | |
|      SET ins_count = ins_count - 1;
 | |
|    END WHILE;
 | |
| 
 | |
|    SELECT MAX(id) INTO del_count FROM t3;
 | |
|    WHILE del_count > 0 DO
 | |
|      DELETE FROM t3 WHERE id = del_count;
 | |
|    SET del_count = del_count - 2;
 | |
|    END WHILE;
 | |
| END|
 | |
| 
 | |
| delimiter ;|
 | |
| 
 | |
| ############ Finish Setup Section ###################
 | |
| 
 | |
| 
 | |
| ############ Test Section ###################
 | |
| 
 | |
| begin;
 | |
| CALL p1();
 | |
| commit;
 | |
| SELECT count(*) as "Master regular" FROM t1;
 | |
| begin;
 | |
| CALL p2();
 | |
| commit;
 | |
| SELECT count(*) as "Master bykey" FROM t2;
 | |
| begin;
 | |
| CALL p3();
 | |
| commit;
 | |
| SELECT count(*) as "Master byrange" FROM t3;
 | |
| 
 | |
| --sync_slave_with_master
 | |
| connection slave;
 | |
| show create table t3; 
 | |
| --source include/check_slave_is_running.inc
 | |
| SELECT count(*) "Slave norm" FROM t1;
 | |
| SELECT count(*) "Slave bykey" FROM t2;
 | |
| SELECT count(*) "Slave byrange" FROM t3;
 | |
| 
 | |
| connection master;
 | |
| set @@global.binlog_format=  @old_global_binlog_format;
 | |
| set @@session.binlog_format=  @old_session_binlog_format;
 | |
| DROP TABLE t1, t2, t3;
 | |
| DROP PROCEDURE p1;
 | |
| DROP PROCEDURE p2;
 | |
| DROP PROCEDURE p3;
 | |
| sync_slave_with_master;
 | |
| set @@global.binlog_format=  @old_global_binlog_format;
 | |
| set @@session.binlog_format=  @old_session_binlog_format;
 | |
| 
 | |
| # End of 5.1 tests
 | |
| --source include/rpl_end.inc
 | 
