Commit 935817e9 authored by Sergei Golubchik's avatar Sergei Golubchik

Fix to compile without partitioning.

Remove few ifdef's
parent 68a6705e
...@@ -90,7 +90,8 @@ MACRO(MYSQL_ADD_PLUGIN) ...@@ -90,7 +90,8 @@ MACRO(MYSQL_ADD_PLUGIN)
AND NOT ARG_MODULE_ONLY) AND NOT ARG_MODULE_ONLY)
SET(WITH_${plugin} 1) 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(WITHOUT_${plugin} 1)
SET(WITH_${plugin}_STORAGE_ENGINE 0) SET(WITH_${plugin}_STORAGE_ENGINE 0)
SET(WITH_${plugin} 0) SET(WITH_${plugin} 0)
......
...@@ -103,6 +103,12 @@ ...@@ -103,6 +103,12 @@
#define HAVE_EXTERNAL_CLIENT #define HAVE_EXTERNAL_CLIENT
#endif #endif
#ifdef WITH_PARTITION_STORAGE_ENGINE
#define IF_PARTITIONING(A,B) A
#else
#define IF_PARTITIONING(A,B) B
#endif
#if defined (_WIN32) #if defined (_WIN32)
/* /*
off_t is 32 bit long. We do not use C runtime functions off_t is 32 bit long. We do not use C runtime functions
......
...@@ -3,7 +3,7 @@ FLUSH TABLES; ...@@ -3,7 +3,7 @@ FLUSH TABLES;
SELECT * FROM t1; SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'partition' ERROR 42000: Unknown storage engine 'partition'
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
ERROR 42S02: Table 'test.t1' doesn't exist ERROR 42000: Unknown storage engine 'partition'
ANALYZE TABLE t1; ANALYZE TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze Error Unknown storage engine 'partition' test.t1 analyze Error Unknown storage engine 'partition'
...@@ -21,17 +21,17 @@ Table Op Msg_type Msg_text ...@@ -21,17 +21,17 @@ Table Op Msg_type Msg_text
test.t1 repair Error Unknown storage engine 'partition' test.t1 repair Error Unknown storage engine 'partition'
test.t1 repair error Corrupt test.t1 repair error Corrupt
ALTER TABLE t1 REPAIR PARTITION ALL; 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; 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; 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; 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; ALTER TABLE t1 REBUILD PARTITION ALL;
ERROR 42000: Unknown storage engine 'partition' ERROR 42000: Unknown storage engine 'partition'
ALTER TABLE t1 TRUNCATE PARTITION ALL; 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; ALTER TABLE t1 ENGINE Memory;
ERROR 42000: Unknown storage engine 'partition' ERROR 42000: Unknown storage engine 'partition'
ALTER TABLE t1 ADD (new INT); ALTER TABLE t1 ADD (new INT);
...@@ -46,9 +46,9 @@ joined DATE NOT NULL ...@@ -46,9 +46,9 @@ joined DATE NOT NULL
) )
PARTITION BY KEY(joined) PARTITION BY KEY(joined)
PARTITIONS 6; 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; 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; drop table t1;
ERROR 42S02: Unknown table 't1' ERROR 42S02: Unknown table 't1'
CREATE TABLE t1 ( CREATE TABLE t1 (
...@@ -65,7 +65,7 @@ PARTITION p2 VALUES LESS THAN (1980), ...@@ -65,7 +65,7 @@ PARTITION p2 VALUES LESS THAN (1980),
PARTITION p3 VALUES LESS THAN (1990), PARTITION p3 VALUES LESS THAN (1990),
PARTITION p4 VALUES LESS THAN MAXVALUE 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; drop table t1;
ERROR 42S02: Unknown table 't1' ERROR 42S02: Unknown table 't1'
CREATE TABLE t1 (id INT, purchased DATE) CREATE TABLE t1 (id INT, purchased DATE)
...@@ -76,7 +76,7 @@ PARTITION p0 VALUES LESS THAN (1990), ...@@ -76,7 +76,7 @@ PARTITION p0 VALUES LESS THAN (1990),
PARTITION p1 VALUES LESS THAN (2000), PARTITION p1 VALUES LESS THAN (2000),
PARTITION p2 VALUES LESS THAN MAXVALUE 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; drop table t1;
ERROR 42S02: Unknown table 't1' ERROR 42S02: Unknown table 't1'
create table t1 (a varchar(10) charset latin1 collate latin1_bin); create table t1 (a varchar(10) charset latin1 collate latin1_bin);
......
...@@ -3609,6 +3609,44 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond) ...@@ -3609,6 +3609,44 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond)
/**************************************************************************** /****************************************************************************
* Partition pruning module * 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 #ifdef WITH_PARTITION_STORAGE_ENGINE
/* /*
...@@ -3943,44 +3981,6 @@ end: ...@@ -3943,44 +3981,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 For SEL_ARG* array, store sel_arg->min values into table record buffer
......
...@@ -1046,8 +1046,8 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond); ...@@ -1046,8 +1046,8 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond);
#ifdef WITH_PARTITION_STORAGE_ENGINE #ifdef WITH_PARTITION_STORAGE_ENGINE
bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond); bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond);
void store_key_image_to_rec(Field *field, uchar *ptr, uint len);
#endif #endif
void store_key_image_to_rec(Field *field, uchar *ptr, uint len);
extern String null_string; extern String null_string;
......
...@@ -2125,7 +2125,7 @@ bool TABLE_SHARE::write_frm_image(const uchar *frm, size_t len) ...@@ -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) 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); DBUG_ASSERT(db_type()->discover_table == 0);
return 1; return 1;
......
...@@ -72,9 +72,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, ...@@ -72,9 +72,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
ulong filepos, data_offset; ulong filepos, data_offset;
uint options_len; uint options_len;
uchar fileinfo[FRM_HEADER_SIZE],forminfo[FRM_FORMINFO_SIZE]; uchar fileinfo[FRM_HEADER_SIZE],forminfo[FRM_FORMINFO_SIZE];
#ifdef WITH_PARTITION_STORAGE_ENGINE const partition_info *part_info= IF_PARTITIONING(thd->work_part_info, 0);
partition_info *part_info= thd->work_part_info;
#endif
int error; int error;
uchar *frm_ptr, *pos; uchar *frm_ptr, *pos;
LEX_CUSTRING frm= {0,0}; LEX_CUSTRING frm= {0,0};
...@@ -106,12 +104,8 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, ...@@ -106,12 +104,8 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
=> Total 6 byte => Total 6 byte
*/ */
create_info->extra_size+= 6; create_info->extra_size+= 6;
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (part_info) if (part_info)
{
create_info->extra_size+= part_info->part_info_len; create_info->extra_size+= part_info->part_info_len;
}
#endif
for (i= 0; i < keys; i++) for (i= 0; i < keys; i++)
{ {
...@@ -266,13 +260,12 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, ...@@ -266,13 +260,12 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
(create_info->min_rows == 1) && (keys == 0)); (create_info->min_rows == 1) && (keys == 0));
int2store(fileinfo+28,key_info_length); int2store(fileinfo+28,key_info_length);
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (part_info) if (part_info)
{ {
fileinfo[61]= (uchar) ha_legacy_type(part_info->default_engine_type); fileinfo[61]= (uchar) ha_legacy_type(part_info->default_engine_type);
DBUG_PRINT("info", ("part_db_type = %d", fileinfo[61])); DBUG_PRINT("info", ("part_db_type = %d", fileinfo[61]));
} }
#endif
int2store(fileinfo+59,db_file->extra_rec_buf_length()); int2store(fileinfo+59,db_file->extra_rec_buf_length());
memcpy(frm_ptr, fileinfo, FRM_HEADER_SIZE); memcpy(frm_ptr, fileinfo, FRM_HEADER_SIZE);
...@@ -292,7 +285,6 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, ...@@ -292,7 +285,6 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
memcpy(pos, str_db_type.str, str_db_type.length); memcpy(pos, str_db_type.str, str_db_type.length);
pos+= str_db_type.length; pos+= str_db_type.length;
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (part_info) if (part_info)
{ {
char auto_partitioned= part_info->is_auto_partitioned ? 1 : 0; char auto_partitioned= part_info->is_auto_partitioned ? 1 : 0;
...@@ -303,7 +295,6 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, ...@@ -303,7 +295,6 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
*pos++= auto_partitioned; *pos++= auto_partitioned;
} }
else else
#endif
{ {
pos+= 6; pos+= 6;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment