diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-06-15 19:09:40 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-06-15 19:09:40 +0200 |
commit | 935817e985d15ce0d4f339ee7006ee891df11489 (patch) | |
tree | 0caaace72efcf645161c694ea2b1a190e56f9d6d | |
parent | 68a6705ed1dc7a0ff5c86910e23989f97788e741 (diff) | |
download | mariadb-git-935817e985d15ce0d4f339ee7006ee891df11489.tar.gz |
Fix to compile without partitioning.
Remove few ifdef's
-rw-r--r-- | cmake/plugin.cmake | 3 | ||||
-rw-r--r-- | include/my_global.h | 6 | ||||
-rw-r--r-- | mysql-test/r/not_partition.result | 20 | ||||
-rw-r--r-- | sql/opt_range.cc | 76 | ||||
-rw-r--r-- | sql/opt_range.h | 2 | ||||
-rw-r--r-- | sql/table.cc | 2 | ||||
-rw-r--r-- | sql/unireg.cc | 13 |
7 files changed, 60 insertions, 62 deletions
diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index 2f1ebc8f428..cc8788b22bc 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -90,7 +90,8 @@ MACRO(MYSQL_ADD_PLUGIN) AND NOT ARG_MODULE_ONLY) SET(WITH_${plugin} 1) - ELSEIF(WITHOUT_${plugin}_STORAGE_ENGINE OR WITH_NONE OR ${plugin}_DISABLED) + ELSEIF(WITHOUT_${plugin} OR WITHOUT_${plugin}_STORAGE_ENGINE OR + WITH_NONE OR ${plugin}_DISABLED) SET(WITHOUT_${plugin} 1) SET(WITH_${plugin}_STORAGE_ENGINE 0) SET(WITH_${plugin} 0) diff --git a/include/my_global.h b/include/my_global.h index 67dd08b4a43..9aa9b4bd91e 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -103,6 +103,12 @@ #define HAVE_EXTERNAL_CLIENT #endif +#ifdef WITH_PARTITION_STORAGE_ENGINE +#define IF_PARTITIONING(A,B) A +#else +#define IF_PARTITIONING(A,B) B +#endif + #if defined (_WIN32) /* off_t is 32 bit long. We do not use C runtime functions diff --git a/mysql-test/r/not_partition.result b/mysql-test/r/not_partition.result index 3c0523279a9..adda476da95 100644 --- a/mysql-test/r/not_partition.result +++ b/mysql-test/r/not_partition.result @@ -3,7 +3,7 @@ FLUSH TABLES; SELECT * FROM t1; ERROR 42000: Unknown storage engine 'partition' TRUNCATE TABLE t1; -ERROR 42S02: Table 'test.t1' doesn't exist +ERROR 42000: Unknown storage engine 'partition' ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze Error Unknown storage engine 'partition' @@ -21,17 +21,17 @@ Table Op Msg_type Msg_text test.t1 repair Error Unknown storage engine 'partition' test.t1 repair error Corrupt ALTER TABLE t1 REPAIR PARTITION ALL; -ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working +ERROR HY000: The 'partitioning' feature is disabled; you need MariaDB built with '--with-plugin-partition' to have it working ALTER TABLE t1 CHECK PARTITION ALL; -ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working +ERROR HY000: The 'partitioning' feature is disabled; you need MariaDB built with '--with-plugin-partition' to have it working ALTER TABLE t1 OPTIMIZE PARTITION ALL; -ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working +ERROR HY000: The 'partitioning' feature is disabled; you need MariaDB built with '--with-plugin-partition' to have it working ALTER TABLE t1 ANALYZE PARTITION ALL; -ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working +ERROR HY000: The 'partitioning' feature is disabled; you need MariaDB built with '--with-plugin-partition' to have it working ALTER TABLE t1 REBUILD PARTITION ALL; ERROR 42000: Unknown storage engine 'partition' ALTER TABLE t1 TRUNCATE PARTITION ALL; -ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working +ERROR HY000: The 'partitioning' feature is disabled; you need MariaDB built with '--with-plugin-partition' to have it working ALTER TABLE t1 ENGINE Memory; ERROR 42000: Unknown storage engine 'partition' ALTER TABLE t1 ADD (new INT); @@ -46,9 +46,9 @@ joined DATE NOT NULL ) PARTITION BY KEY(joined) PARTITIONS 6; -ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working +ERROR HY000: The 'partitioning' feature is disabled; you need MariaDB built with '--with-plugin-partition' to have it working ALTER TABLE t1 PARTITION BY KEY(joined) PARTITIONS 2; -ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working +ERROR HY000: The 'partitioning' feature is disabled; you need MariaDB built with '--with-plugin-partition' to have it working drop table t1; ERROR 42S02: Unknown table 't1' CREATE TABLE t1 ( @@ -65,7 +65,7 @@ PARTITION p2 VALUES LESS THAN (1980), PARTITION p3 VALUES LESS THAN (1990), PARTITION p4 VALUES LESS THAN MAXVALUE ); -ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working +ERROR HY000: The 'partitioning' feature is disabled; you need MariaDB built with '--with-plugin-partition' to have it working drop table t1; ERROR 42S02: Unknown table 't1' CREATE TABLE t1 (id INT, purchased DATE) @@ -76,7 +76,7 @@ PARTITION p0 VALUES LESS THAN (1990), PARTITION p1 VALUES LESS THAN (2000), PARTITION p2 VALUES LESS THAN MAXVALUE ); -ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working +ERROR HY000: The 'partitioning' feature is disabled; you need MariaDB built with '--with-plugin-partition' to have it working drop table t1; ERROR 42S02: Unknown table 't1' create table t1 (a varchar(10) charset latin1 collate latin1_bin); diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 0373c582207..c6fbb579509 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -3609,6 +3609,44 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond) /**************************************************************************** * Partition pruning module ****************************************************************************/ + +/* + Store field key image to table record + + SYNOPSIS + store_key_image_to_rec() + field Field which key image should be stored + ptr Field value in key format + len Length of the value, in bytes + + DESCRIPTION + Copy the field value from its key image to the table record. The source + is the value in key image format, occupying len bytes in buffer pointed + by ptr. The destination is table record, in "field value in table record" + format. +*/ + +void store_key_image_to_rec(Field *field, uchar *ptr, uint len) +{ + /* Do the same as print_key() does */ + my_bitmap_map *old_map; + + if (field->real_maybe_null()) + { + if (*ptr) + { + field->set_null(); + return; + } + field->set_notnull(); + ptr++; + } + old_map= dbug_tmp_use_all_columns(field->table, + field->table->write_set); + field->set_key_image(ptr, len); + dbug_tmp_restore_column_map(field->table->write_set, old_map); +} + #ifdef WITH_PARTITION_STORAGE_ENGINE /* @@ -3944,44 +3982,6 @@ end: /* - Store field key image to table record - - SYNOPSIS - store_key_image_to_rec() - field Field which key image should be stored - ptr Field value in key format - len Length of the value, in bytes - - DESCRIPTION - Copy the field value from its key image to the table record. The source - is the value in key image format, occupying len bytes in buffer pointed - by ptr. The destination is table record, in "field value in table record" - format. -*/ - -void store_key_image_to_rec(Field *field, uchar *ptr, uint len) -{ - /* Do the same as print_key() does */ - my_bitmap_map *old_map; - - if (field->real_maybe_null()) - { - if (*ptr) - { - field->set_null(); - return; - } - field->set_notnull(); - ptr++; - } - old_map= dbug_tmp_use_all_columns(field->table, - field->table->write_set); - field->set_key_image(ptr, len); - dbug_tmp_restore_column_map(field->table->write_set, old_map); -} - - -/* For SEL_ARG* array, store sel_arg->min values into table record buffer SYNOPSIS diff --git a/sql/opt_range.h b/sql/opt_range.h index ddaa5c5e59a..ccddd40686c 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -1046,8 +1046,8 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond); #ifdef WITH_PARTITION_STORAGE_ENGINE bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond); -void store_key_image_to_rec(Field *field, uchar *ptr, uint len); #endif +void store_key_image_to_rec(Field *field, uchar *ptr, uint len); extern String null_string; diff --git a/sql/table.cc b/sql/table.cc index caed8ed4107..08903db93e1 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -2125,7 +2125,7 @@ bool TABLE_SHARE::write_frm_image(const uchar *frm, size_t len) bool TABLE_SHARE::read_frm_image(const uchar **frm, size_t *len) { - if (partition_info_str) // cannot discover a partition + if (IF_PARTITIONING(partition_info_str, 0)) // cannot discover a partition { DBUG_ASSERT(db_type()->discover_table == 0); return 1; diff --git a/sql/unireg.cc b/sql/unireg.cc index 0940b34308f..099f8ccbc78 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -72,9 +72,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, ulong filepos, data_offset; uint options_len; uchar fileinfo[FRM_HEADER_SIZE],forminfo[FRM_FORMINFO_SIZE]; -#ifdef WITH_PARTITION_STORAGE_ENGINE - partition_info *part_info= thd->work_part_info; -#endif + const partition_info *part_info= IF_PARTITIONING(thd->work_part_info, 0); int error; uchar *frm_ptr, *pos; LEX_CUSTRING frm= {0,0}; @@ -106,12 +104,8 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, => Total 6 byte */ create_info->extra_size+= 6; -#ifdef WITH_PARTITION_STORAGE_ENGINE if (part_info) - { create_info->extra_size+= part_info->part_info_len; - } -#endif for (i= 0; i < keys; i++) { @@ -266,13 +260,12 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, (create_info->min_rows == 1) && (keys == 0)); int2store(fileinfo+28,key_info_length); -#ifdef WITH_PARTITION_STORAGE_ENGINE if (part_info) { fileinfo[61]= (uchar) ha_legacy_type(part_info->default_engine_type); DBUG_PRINT("info", ("part_db_type = %d", fileinfo[61])); } -#endif + int2store(fileinfo+59,db_file->extra_rec_buf_length()); memcpy(frm_ptr, fileinfo, FRM_HEADER_SIZE); @@ -292,7 +285,6 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, memcpy(pos, str_db_type.str, str_db_type.length); pos+= str_db_type.length; -#ifdef WITH_PARTITION_STORAGE_ENGINE if (part_info) { char auto_partitioned= part_info->is_auto_partitioned ? 1 : 0; @@ -303,7 +295,6 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, *pos++= auto_partitioned; } else -#endif { pos+= 6; } |