diff options
author | mikael/pappa@dator5.(none) <> | 2006-09-28 06:16:16 -0400 |
---|---|---|
committer | mikael/pappa@dator5.(none) <> | 2006-09-28 06:16:16 -0400 |
commit | fef3cb337c3e9bad0c874ccff6953167efaddf27 (patch) | |
tree | 73ffda1ee6b72f34b6bcd0d58fafdbd8354883f0 | |
parent | c7a3df765d08a42fe38ccbe92c4324e1f7e030a2 (diff) | |
parent | ea9014043b3c809e210bc8a2c80fb253359ad7f3 (diff) | |
download | mariadb-git-fef3cb337c3e9bad0c874ccff6953167efaddf27.tar.gz |
Merge dator5.(none):/home/pappa/clean-mysql-5.1-kt
into dator5.(none):/home/pappa/bug18198
-rw-r--r-- | mysql-test/r/partition.result | 37 | ||||
-rw-r--r-- | mysql-test/r/partition_error.result | 41 | ||||
-rw-r--r-- | mysql-test/r/partition_innodb.result | 71 | ||||
-rw-r--r-- | mysql-test/r/partition_range.result | 10 | ||||
-rw-r--r-- | mysql-test/t/partition-master.opt | 1 | ||||
-rw-r--r-- | mysql-test/t/partition.test | 37 | ||||
-rw-r--r-- | mysql-test/t/partition_error.test | 40 | ||||
-rw-r--r-- | mysql-test/t/partition_innodb.test | 68 | ||||
-rw-r--r-- | mysql-test/t/partition_range.test | 12 | ||||
-rw-r--r-- | sql/ha_partition.cc | 27 | ||||
-rw-r--r-- | sql/ha_partition.h | 7 | ||||
-rw-r--r-- | sql/sql_table.cc | 27 |
12 files changed, 191 insertions, 187 deletions
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 97d6275a835..36f3610efe1 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -16,32 +16,6 @@ partition by key(a) partitions 1e+300; ERROR 42000: Only normal integers allowed as number here near '1e+300' at line 3 create table t1 (a int) -engine = innodb -partition by key (a); -show table status; -Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 InnoDB 10 Compact 2 8192 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned -insert into t1 values (0), (1), (2), (3); -show table status; -Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 InnoDB 10 Compact 4 4096 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned -drop table t1; -create table t1 (a int auto_increment primary key) -engine = innodb -partition by key (a); -show table status; -Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 InnoDB 10 Compact 2 8192 16384 0 0 0 1 NULL NULL NULL latin1_swedish_ci NULL partitioned -insert into t1 values (NULL), (NULL), (NULL), (NULL); -show table status; -Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 InnoDB 10 Compact 4 4096 16384 0 0 0 5 NULL NULL NULL latin1_swedish_ci NULL partitioned -insert into t1 values (NULL), (NULL), (NULL), (NULL); -show table status; -Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 InnoDB 10 Compact 8 2048 16384 0 0 0 9 NULL NULL NULL latin1_swedish_ci NULL partitioned -drop table t1; -create table t1 (a int) partition by key (a) (partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data'); ERROR 42000: Incorrect table name 'part-data' @@ -1037,17 +1011,6 @@ set session sql_mode=''; drop table t1; create table t1 (a int) partition by key (a) -(partition p1 engine = innodb); -alter table t1 rebuild partition p1; -alter table t1 rebuild partition p1; -alter table t1 rebuild partition p1; -alter table t1 rebuild partition p1; -alter table t1 rebuild partition p1; -alter table t1 rebuild partition p1; -alter table t1 rebuild partition p1; -drop table t1; -create table t1 (a int) -partition by key (a) (partition p0 engine = MERGE); ERROR HY000: MyISAM Merge handler cannot be used in partitioned tables create table t1 (a varchar(1)) diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result index 6ded066c3ec..4b01b759902 100644 --- a/mysql-test/r/partition_error.result +++ b/mysql-test/r/partition_error.result @@ -1,45 +1,4 @@ drop table if exists t1; -create table t1 (a int) -partition by range (a) -(partition p0 values less than ((select count(*) from t1))); -ERROR HY000: This partition function is not allowed -create table t1 (a int) -partition by range (a) -(partition p0 values less than (a); -ERROR 42S22: Unknown column 'a' in 'partition function' -create table t1 (a int) -partition by range (a) -(partition p0 values less than (1)); -alter table t1 add partition (partition p1 values less than (a)); -ERROR 42S22: Unknown column 'a' in 'partition function' -alter table t1 add partition -(partition p1 values less than ((select count(*) from t1))); -ERROR HY000: This partition function is not allowed -drop table t1; -create table t1 (a int) -engine = x -partition by key (a); -Warnings: -Error 1286 Unknown table engine 'x' -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) */ -drop table t1; -create table t1 (a int) -engine = innodb -partition by list (a) -(partition p0 values in (0)); -alter table t1 engine = x; -Warnings: -Error 1286 Unknown table engine 'x' -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0) ENGINE = InnoDB) */ -drop table t1; partition by list (a) partitions 3 (partition x1 values in (1,2,9,4) tablespace ts1, diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result index f4e75ccdb05..8619d0909ee 100644 --- a/mysql-test/r/partition_innodb.result +++ b/mysql-test/r/partition_innodb.result @@ -3,3 +3,74 @@ show table status like 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment t1 InnoDB 10 Compact 2 8192 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned drop table t1; +create table t1 (a int) +engine = innodb +partition by key (a); +show table status; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 InnoDB 10 Compact 2 8192 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned +insert into t1 values (0), (1), (2), (3); +show table status; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 InnoDB 10 Compact 4 4096 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned +drop table t1; +create table t1 (a int auto_increment primary key) +engine = innodb +partition by key (a); +show table status; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 InnoDB 10 Compact 2 8192 16384 0 0 0 1 NULL NULL NULL latin1_swedish_ci NULL partitioned +insert into t1 values (NULL), (NULL), (NULL), (NULL); +show table status; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 InnoDB 10 Compact 4 4096 16384 0 0 0 5 NULL NULL NULL latin1_swedish_ci NULL partitioned +insert into t1 values (NULL), (NULL), (NULL), (NULL); +show table status; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 InnoDB 10 Compact 8 2048 16384 0 0 0 9 NULL NULL NULL latin1_swedish_ci NULL partitioned +drop table t1; +create table t1 (a int) +partition by key (a) +(partition p1 engine = innodb); +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +drop table t1; +create table t1 (a date) +engine = innodb +partition by range (year(a)) +(partition p0 values less than (2006), +partition p1 values less than (2007)); +explain partitions select * from t1 +where a between '2006-01-01' and '2007-06-01'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where +drop table t1; +create table t1 (a int) +engine = x +partition by key (a); +Warnings: +Error 1286 Unknown table engine 'x' +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) */ +drop table t1; +create table t1 (a int) +engine = innodb +partition by list (a) +(partition p0 values in (0)); +alter table t1 engine = x; +Warnings: +Error 1286 Unknown table engine 'x' +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0) ENGINE = InnoDB) */ +drop table t1; diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result index 99f29fa4156..2fa40b44815 100644 --- a/mysql-test/r/partition_range.result +++ b/mysql-test/r/partition_range.result @@ -1,14 +1,4 @@ drop table if exists t1; -create table t1 (a date) -engine = innodb -partition by range (year(a)) -(partition p0 values less than (2006), -partition p1 values less than (2007)); -explain partitions select * from t1 -where a between '2006-01-01' and '2007-06-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where -drop table t1; create table t1 (a int unsigned) partition by range (a) (partition pnull values less than (0), diff --git a/mysql-test/t/partition-master.opt b/mysql-test/t/partition-master.opt new file mode 100644 index 00000000000..b1392bfd485 --- /dev/null +++ b/mysql-test/t/partition-master.opt @@ -0,0 +1 @@ +--symbolic-links=1 diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 488d2ccda3f..42fd0426d01 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -34,27 +34,6 @@ partition by key(a) partitions 1e+300; # -# Bug 21173: SHOW TABLE STATUS crashes server in InnoDB -# -create table t1 (a int) -engine = innodb -partition by key (a); -show table status; -insert into t1 values (0), (1), (2), (3); -show table status; -drop table t1; - -create table t1 (a int auto_increment primary key) -engine = innodb -partition by key (a); -show table status; -insert into t1 values (NULL), (NULL), (NULL), (NULL); -show table status; -insert into t1 values (NULL), (NULL), (NULL), (NULL); -show table status; -drop table t1; - -# # Bug 21350: Data Directory problems # -- error 1103 @@ -1185,22 +1164,6 @@ set session sql_mode=''; drop table t1; # -# BUG 19122 Crash after ALTER TABLE t1 REBUILD PARTITION p1 -# -create table t1 (a int) -partition by key (a) -(partition p1 engine = innodb); - -alter table t1 rebuild partition p1; -alter table t1 rebuild partition p1; -alter table t1 rebuild partition p1; -alter table t1 rebuild partition p1; -alter table t1 rebuild partition p1; -alter table t1 rebuild partition p1; -alter table t1 rebuild partition p1; -drop table t1; - -# # BUG 19304 Partitions: MERGE handler not allowed in partitioned tables # --error ER_PARTITION_MERGE_ERROR diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index a9efbc587be..20703b979f1 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -9,46 +9,6 @@ drop table if exists t1; --enable_warnings # -# Bug 18198: Partitions: Too flexible functions -# --- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED -create table t1 (a int) -partition by range (a) -(partition p0 values less than ((select count(*) from t1))); --- error 1054 -create table t1 (a int) -partition by range (a) -(partition p0 values less than (a); - -create table t1 (a int) -partition by range (a) -(partition p0 values less than (1)); --- error 1054 -alter table t1 add partition (partition p1 values less than (a)); --- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED -alter table t1 add partition -(partition p1 values less than ((select count(*) from t1))); -drop table t1; - -# -# Bug 20397: Partitions: Crash when using non-existing engine -# -create table t1 (a int) -engine = x -partition by key (a); -show create table t1; -drop table t1; - -create table t1 (a int) -engine = innodb -partition by list (a) -(partition p0 values in (0)); - -alter table t1 engine = x; -show create table t1; -drop table t1; - -# # Partition by key stand-alone error # --error 1064 diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test index a110fb30a3b..782e204742f 100644 --- a/mysql-test/t/partition_innodb.test +++ b/mysql-test/t/partition_innodb.test @@ -8,3 +8,71 @@ create table t1 (a int) engine=innodb partition by hash(a) ; show table status like 't1'; drop table t1; +# +# Bug 21173: SHOW TABLE STATUS crashes server in InnoDB +# +create table t1 (a int) +engine = innodb +partition by key (a); +show table status; +insert into t1 values (0), (1), (2), (3); +show table status; +drop table t1; + +create table t1 (a int auto_increment primary key) +engine = innodb +partition by key (a); +show table status; +insert into t1 values (NULL), (NULL), (NULL), (NULL); +show table status; +insert into t1 values (NULL), (NULL), (NULL), (NULL); +show table status; +drop table t1; + +# +# BUG 19122 Crash after ALTER TABLE t1 REBUILD PARTITION p1 +# +create table t1 (a int) +partition by key (a) +(partition p1 engine = innodb); + +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +drop table t1; + +# +# Bug 21339: Crash in Explain Partitions +# +create table t1 (a date) +engine = innodb +partition by range (year(a)) +(partition p0 values less than (2006), + partition p1 values less than (2007)); +explain partitions select * from t1 +where a between '2006-01-01' and '2007-06-01'; +drop table t1; + +# +# Bug 20397: Partitions: Crash when using non-existing engine +# +create table t1 (a int) +engine = x +partition by key (a); +show create table t1; +drop table t1; + +create table t1 (a int) +engine = innodb +partition by list (a) +(partition p0 values in (0)); + +alter table t1 engine = x; +show create table t1; +drop table t1; + + diff --git a/mysql-test/t/partition_range.test b/mysql-test/t/partition_range.test index 6a4d61864e0..8cf2313e39c 100644 --- a/mysql-test/t/partition_range.test +++ b/mysql-test/t/partition_range.test @@ -10,18 +10,6 @@ drop table if exists t1; --enable_warnings # -# Bug 21339: Crash in Explain Partitions -# -create table t1 (a date) -engine = innodb -partition by range (year(a)) -(partition p0 values less than (2006), - partition p1 values less than (2007)); -explain partitions select * from t1 -where a between '2006-01-01' and '2007-06-01'; -drop table t1; - -# # More checks for partition pruning # create table t1 (a int unsigned) diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index e435b356def..3cb855b1035 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1364,6 +1364,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, i= 0; part_count= 0; orig_count= 0; + first= TRUE; part_it.rewind(); do { @@ -1391,9 +1392,16 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, DBUG_RETURN(ER_OUTOFMEMORY); } } while (++j < no_subparts); + if (part_elem->part_state == PART_CHANGED) + orig_count+= no_subparts; + else if (temp_partitions && first) + { + orig_count+= (no_subparts * temp_partitions); + first= FALSE; + } } } while (++i < no_parts); - + first= FALSE; /* Step 5: Create the new partitions and also open, lock and call external_lock @@ -3655,7 +3663,10 @@ int ha_partition::read_range_first(const key_range *start_key, if (!start_key) // Read first record { - m_index_scan_type= partition_index_first; + if (m_ordered) + m_index_scan_type= partition_index_first; + else + m_index_scan_type= partition_index_first_unordered; error= common_first_last(m_rec0); } else @@ -3869,6 +3880,18 @@ int ha_partition::handle_unordered_scan_next_partition(byte * buf) DBUG_PRINT("info", ("index_first on partition %d", i)); error= file->index_first(buf); break; + case partition_index_first_unordered: + /* + We perform a scan without sorting and this means that we + should not use the index_first since not all handlers + support it and it is also unnecessary to restrict sort + order. + */ + DBUG_PRINT("info", ("read_range_first on partition %d", i)); + table->record[0]= buf; + error= file->read_range_first(0, end_range, eq_range, 0); + table->record[0]= m_rec0; + break; default: DBUG_ASSERT(FALSE); DBUG_RETURN(1); diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 97086d7b632..d76591b7514 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -45,9 +45,10 @@ private: { partition_index_read= 0, partition_index_first= 1, - partition_index_last= 2, - partition_index_read_last= 3, - partition_no_index_scan= 4 + partition_index_first_unordered= 2, + partition_index_last= 3, + partition_index_read_last= 4, + partition_no_index_scan= 5 }; /* Data for the partition handler */ int m_mode; // Open mode diff --git a/sql/sql_table.cc b/sql/sql_table.cc index bbed97e28a4..4658ebb6cf4 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1133,6 +1133,26 @@ bool execute_ddl_log_entry(THD *thd, uint first_entry) /* + Close the ddl log + SYNOPSIS + close_ddl_log() + RETURN VALUES + NONE +*/ + +static void close_ddl_log() +{ + DBUG_ENTER("close_ddl_log"); + if (global_ddl_log.file_id >= 0) + { + VOID(my_close(global_ddl_log.file_id, MYF(MY_WME))); + global_ddl_log.file_id= (File) -1; + } + DBUG_VOID_RETURN; +} + + +/* Execute the ddl log at recovery of MySQL Server SYNOPSIS execute_ddl_log_recovery() @@ -1183,6 +1203,7 @@ void execute_ddl_log_recovery() } } } + close_ddl_log(); create_ddl_log_file_name(file_name); VOID(my_delete(file_name, MYF(0))); global_ddl_log.recovery_phase= FALSE; @@ -1220,11 +1241,7 @@ void release_ddl_log() my_free((char*)free_list, MYF(0)); free_list= tmp; } - if (global_ddl_log.file_id >= 0) - { - VOID(my_close(global_ddl_log.file_id, MYF(MY_WME))); - global_ddl_log.file_id= (File) -1; - } + close_ddl_log(); global_ddl_log.inited= 0; pthread_mutex_unlock(&LOCK_gdl); VOID(pthread_mutex_destroy(&LOCK_gdl)); |