20 #include "sql_plugin.h"
21 #include "sql_partition.h"
23 #include "partition_info.h"
24 #include "sql_parse.h"
27 #include "my_bitmap.h"
30 #ifdef WITH_PARTITION_STORAGE_ENGINE
31 #include "ha_partition.h"
36 DBUG_ENTER(
"partition_info::get_clone");
48 memset(&(clone->read_partitions), 0,
sizeof(clone->read_partitions));
49 memset(&(clone->lock_partitions), 0,
sizeof(clone->lock_partitions));
50 clone->bitmaps_are_initialized= FALSE;
51 clone->partitions.empty();
53 while ((part= (part_it++)))
64 part_clone->subpartitions.empty();
65 while ((subpart= (subpart_it++)))
74 part_clone->subpartitions.push_back(subpart_clone);
76 clone->partitions.push_back(part_clone);
93 bool partition_info::add_named_partition(
const char *part_name,
99 DBUG_ENTER(
"partition_info::add_named_partition");
103 part_name_hash= &part_share->partition_name_hash;
104 DBUG_ASSERT(part_name_hash->records);
107 (
const uchar*) part_name,
111 my_error(ER_UNKNOWN_PARTITION, MYF(0), part_name,
table->alias);
115 if (part_def->is_subpart)
117 bitmap_set_bit(&read_partitions, part_def->part_id);
121 if (is_sub_partitioned())
124 uint j, start= part_def->part_id;
125 uint end= start + num_subparts;
126 for (j= start; j < end; j++)
127 bitmap_set_bit(&read_partitions, j);
130 bitmap_set_bit(&read_partitions, part_def->part_id);
132 DBUG_PRINT(
"info", (
"Found partition %u is_subpart %d for name %s",
133 part_def->part_id, part_def->is_subpart,
145 bool partition_info::set_named_partition_bitmap(
const char *part_name,
148 DBUG_ENTER(
"partition_info::set_named_partition_bitmap");
149 bitmap_clear_all(&read_partitions);
150 if (add_named_partition(part_name, length))
152 bitmap_copy(&lock_partitions, &read_partitions);
168 bool partition_info::prune_partition_bitmaps(
TABLE_LIST *table_list)
171 uint num_names= table_list->partition_names->elements;
173 DBUG_ENTER(
"partition_info::prune_partition_bitmaps");
183 bitmap_clear_all(&read_partitions);
187 DBUG_PRINT(
"info", (
"Searching through partition_name_hash"));
190 String *part_name_str= partition_names_it++;
191 if (add_named_partition(part_name_str->c_ptr(), part_name_str->length()))
193 }
while (++i < num_names);
212 bool partition_info::set_partition_bitmaps(
TABLE_LIST *table_list)
214 DBUG_ENTER(
"partition_info::set_partition_bitmaps");
216 DBUG_ASSERT(bitmaps_are_initialized);
219 if (!bitmaps_are_initialized)
223 table_list->partition_names &&
224 table_list->partition_names->elements)
226 if (
table->s->db_type()->partition_flags() & HA_USE_AUTO_PARTITION)
233 my_error(ER_PARTITION_CLAUSE_ON_NONPARTITIONED, MYF(0));
236 if (prune_partition_bitmaps(table_list))
241 bitmap_set_all(&read_partitions);
242 DBUG_PRINT(
"info", (
"Set all partitions"));
244 bitmap_copy(&lock_partitions, &read_partitions);
245 DBUG_ASSERT(bitmap_get_first_set(&lock_partitions) != MY_BIT_NONE);
270 bool partition_info::can_prune_insert(THD* thd,
271 enum_duplicates duplic,
276 enum_can_prune *can_prune_partitions,
277 bool *prune_needs_default_values,
282 uint num_partitions= 0;
283 *can_prune_partitions= PRUNE_NO;
284 DBUG_ASSERT(bitmaps_are_initialized);
285 DBUG_ENTER(
"partition_info::can_prune_insert");
287 if (
table->s->db_type()->partition_flags() & HA_USE_AUTO_PARTITION)
298 if (
table->triggers &&
299 table->triggers->has_triggers(TRG_EVENT_INSERT, TRG_ACTION_BEFORE) &&
300 table->triggers->is_fields_updated_in_trigger(&full_part_field_set,
305 if (
table->found_next_number_field)
312 if (bitmap_is_set(&full_part_field_set,
313 table->found_next_number_field->field_index))
326 if (duplic == DUP_UPDATE)
338 if (is_field_in_part_expr(update_fields))
346 if (
table->triggers &&
347 table->triggers->has_triggers(TRG_EVENT_UPDATE,
348 TRG_ACTION_BEFORE) &&
349 table->triggers->is_fields_updated_in_trigger(&full_part_field_set,
366 *prune_needs_default_values=
false;
369 if (!is_full_part_expr_in_fields(fields))
370 *prune_needs_default_values=
true;
372 else if (empty_values)
374 *prune_needs_default_values=
true;
386 num_partitions= lock_partitions.n_bits;
387 bitmap_bytes= bitmap_buffer_size(num_partitions);
388 if (!(bitmap_buf= (uint32*) thd->alloc(bitmap_bytes)))
390 mem_alloc_error(bitmap_bytes);
394 if (bitmap_init(used_partitions, bitmap_buf, num_partitions,
false))
398 mem_alloc_error(bitmap_bytes);
405 if (fields.elements &&
406 !is_field_in_part_expr(fields))
407 *can_prune_partitions= PRUNE_DEFAULTS;
409 *can_prune_partitions= PRUNE_YES;
429 bool partition_info::set_used_partition(
List<Item> &fields,
432 bool copy_default_values,
435 THD *thd=
table->in_use;
438 Dummy_error_handler error_handler;
440 DBUG_ENTER(
"set_partition");
446 thd->push_internal_handler(&error_handler);
449 if (!item->const_item())
453 if (copy_default_values)
454 restore_record(
table,s->default_values);
456 if (fields.elements || !values.elements)
458 if (fill_record(thd, fields, values,
false, &full_part_field_set))
463 if (fill_record(thd,
table->field, values,
false, &full_part_field_set))
466 DBUG_ASSERT(!
table->auto_increment_field_not_null);
483 my_bitmap_map *old_map= dbug_tmp_use_all_columns(
table,
table->read_set);
484 const int rc= get_partition_id(
this, &part_id, &func_value);
485 dbug_tmp_restore_column_map(
table->read_set, old_map);
490 DBUG_PRINT(
"info", (
"Insert into partition %u", part_id));
491 bitmap_set_bit(used_partitions, part_id);
495 thd->pop_internal_handler();
520 #define MAX_PART_NAME_SIZE 8
522 char *partition_info::create_default_partition_names(uint part_no,
526 char *ptr= (
char*) sql_calloc(num_parts_arg*MAX_PART_NAME_SIZE);
529 DBUG_ENTER(
"create_default_partition_names");
531 if (likely(ptr != 0))
535 sprintf(move_ptr,
"p%u", (start_no + i));
536 move_ptr+= MAX_PART_NAME_SIZE;
537 }
while (++i < num_parts_arg);
541 mem_alloc_error(num_parts_arg*MAX_PART_NAME_SIZE);
557 void partition_info::set_show_version_string(
String *packet)
561 packet->append(STRING_WITH_LEN(
"\n/*!50500"));
565 part_expr->walk(&Item::intro_version, 0, (uchar*)&version);
567 subpart_expr->walk(&Item::intro_version, 0, (uchar*)&version);
571 packet->append(STRING_WITH_LEN(
"\n/*!50100"));
576 char *buf_ptr= longlong10_to_str((longlong)version, buf, 10);
577 packet->append(STRING_WITH_LEN(
"\n/*!"));
578 packet->append(buf, (
size_t)(buf_ptr - buf));
594 char *partition_info::create_default_subpartition_name(uint subpart_no,
595 const char *part_name)
597 uint size_alloc= strlen(part_name) + MAX_PART_NAME_SIZE;
598 char *ptr= (
char*) sql_calloc(size_alloc);
599 DBUG_ENTER(
"create_default_subpartition_name");
601 if (likely(ptr != NULL))
603 my_snprintf(ptr, size_alloc,
"%ssp%u", part_name, subpart_no);
607 mem_alloc_error(size_alloc);
637 bool partition_info::set_up_default_partitions(
handler *
file,
644 DBUG_ENTER(
"partition_info::set_up_default_partitions");
646 if (part_type != HASH_PARTITION)
648 const char *error_string;
649 if (part_type == RANGE_PARTITION)
650 error_string= partition_keywords[PKW_RANGE].str;
652 error_string= partition_keywords[PKW_LIST].str;
653 my_error(ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0), error_string);
657 if ((num_parts == 0) &&
658 ((num_parts= file->get_default_no_partitions(info)) == 0))
660 my_error(ER_PARTITION_NOT_DEFINED_ERROR, MYF(0),
"partitions");
664 if (unlikely(num_parts > MAX_PARTITIONS))
666 my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0));
669 if (unlikely((!(default_name= create_default_partition_names(0, num_parts,
676 if (likely(part_elem != 0 &&
677 (!partitions.push_back(part_elem))))
679 part_elem->engine_type= default_engine_type;
680 part_elem->partition_name= default_name;
681 default_name+=MAX_PART_NAME_SIZE;
688 }
while (++i < num_parts);
718 bool partition_info::set_up_default_subpartitions(
handler *file,
725 DBUG_ENTER(
"partition_info::set_up_default_subpartitions");
727 if (num_subparts == 0)
728 num_subparts= file->get_default_no_partitions(info);
729 if (unlikely((num_parts * num_subparts) > MAX_PARTITIONS))
731 my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0));
737 part_elem= part_it++;
742 if (likely(subpart_elem != 0 &&
743 (!part_elem->subpartitions.push_back(subpart_elem))))
745 char *ptr= create_default_subpartition_name(j,
746 part_elem->partition_name);
749 subpart_elem->engine_type= default_engine_type;
750 subpart_elem->partition_name= ptr;
757 }
while (++j < num_subparts);
758 }
while (++i < num_parts);
783 bool partition_info::set_up_defaults_for_partitioning(
handler *file,
787 DBUG_ENTER(
"partition_info::set_up_defaults_for_partitioning");
789 if (!default_partitions_setup)
791 default_partitions_setup= TRUE;
792 if (use_default_partitions)
793 DBUG_RETURN(set_up_default_partitions(file, info, start_no));
794 if (is_sub_partitioned() &&
795 use_default_subpartitions)
796 DBUG_RETURN(set_up_default_subpartitions(file, info));
817 char* partition_info::find_duplicate_field()
819 char *field_name_outer, *field_name_inner;
821 uint num_fields= part_field_list.elements;
823 DBUG_ENTER(
"partition_info::find_duplicate_field");
825 for (i= 0; i < num_fields; i++)
827 field_name_outer= it_outer++;
829 for (j= 0; j < num_fields; j++)
831 field_name_inner= it_inner++;
834 if (!(my_strcasecmp(system_charset_info,
838 DBUG_RETURN(field_name_outer);
867 DBUG_ENTER(
"partition_info::get_part_elem");
868 DBUG_ASSERT(part_id);
869 *part_id= NOT_A_PARTITION_ID;
873 if (is_sub_partitioned())
880 if (!my_strcasecmp(system_charset_info,
881 sub_part_elem->partition_name, partition_name))
884 create_subpartition_name(file_name,
"",
885 part_elem->partition_name,
888 *part_id= j + (i * num_subparts);
889 DBUG_RETURN(sub_part_elem);
891 }
while (++j < num_subparts);
894 if (!my_strcasecmp(system_charset_info,
895 part_elem->partition_name, partition_name))
896 DBUG_RETURN(part_elem);
898 else if (!my_strcasecmp(system_charset_info,
899 part_elem->partition_name, partition_name))
902 create_partition_name(file_name,
"", partition_name,
903 NORMAL_PART_NAME, TRUE);
905 DBUG_RETURN(part_elem);
907 }
while (++i < num_parts);
916 static const char *get_part_name_from_elem(
const char *
name,
size_t *length,
917 my_bool not_used __attribute__((unused)))
919 *length= strlen(name);
939 char *partition_info::find_duplicate_name()
941 HASH partition_names;
943 const uchar *curr_name= NULL;
947 DBUG_ENTER(
"partition_info::find_duplicate_name");
955 max_names= num_parts;
956 if (is_sub_partitioned())
957 max_names+= num_parts * num_subparts;
958 if (my_hash_init(&partition_names, system_charset_info, max_names, 0, 0,
959 (my_hash_get_key) get_part_name_from_elem, 0, HASH_UNIQUE))
962 curr_name= (
const uchar*)
"Internal failure";
965 while ((p_elem= (parts_it++)))
967 curr_name= (
const uchar*) p_elem->partition_name;
968 if (my_hash_insert(&partition_names, curr_name))
971 if (!p_elem->subpartitions.is_empty())
975 while ((subp_elem= (subparts_it++)))
977 curr_name= (
const uchar*) subp_elem->partition_name;
978 if (my_hash_insert(&partition_names, curr_name))
983 my_hash_free(&partition_names);
986 my_hash_free(&partition_names);
987 DBUG_RETURN((
char*) curr_name);
1031 bool table_engine_set,
1035 DBUG_ENTER(
"check_engine_condition");
1037 DBUG_PRINT(
"enter", (
"p_eng %s t_eng %s t_eng_set %u first %u state %u",
1038 ha_resolve_storage_engine_name(p_elem->engine_type),
1039 ha_resolve_storage_engine_name(*engine_type),
1040 table_engine_set, *first, p_elem->part_state));
1041 if (*first && !table_engine_set)
1043 *engine_type= p_elem->engine_type;
1044 DBUG_PRINT(
"info", (
"setting table_engine = %s",
1045 ha_resolve_storage_engine_name(*engine_type)));
1048 if ((table_engine_set &&
1049 (p_elem->engine_type != (*engine_type) &&
1050 p_elem->engine_type)) ||
1051 (!table_engine_set &&
1052 p_elem->engine_type != (*engine_type)))
1086 bool partition_info::check_engine_mix(
handlerton *engine_type,
1087 bool table_engine_set)
1091 uint n_parts= partitions.elements;
1092 DBUG_ENTER(
"partition_info::check_engine_mix");
1093 DBUG_PRINT(
"info", (
"in: engine_type = %s, table_engine_set = %u",
1094 ha_resolve_storage_engine_name(engine_type),
1103 DBUG_PRINT(
"info", (
"part = %d engine = %s table_engine_set %u",
1104 i, ha_resolve_storage_engine_name(part_elem->engine_type),
1106 if (is_sub_partitioned() &&
1107 part_elem->subpartitions.elements)
1109 uint n_subparts= part_elem->subpartitions.elements;
1115 DBUG_PRINT(
"info", (
"sub = %d engine = %s table_engie_set %u",
1116 j, ha_resolve_storage_engine_name(sub_elem->engine_type),
1118 if (check_engine_condition(sub_elem, table_engine_set,
1119 &engine_type, &first))
1121 }
while (++j < n_subparts);
1123 if (check_engine_condition(part_elem, table_engine_set,
1124 &engine_type, &first))
1127 else if (check_engine_condition(part_elem, table_engine_set,
1128 &engine_type, &first))
1130 }
while (++i < n_parts);
1132 DBUG_PRINT(
"info", (
"engine_type = %s",
1133 ha_resolve_storage_engine_name(engine_type)));
1135 engine_type= old_engine_type;
1136 if (engine_type->flags & HTON_NO_PARTITION)
1138 my_error(ER_PARTITION_MERGE_ERROR, MYF(0));
1141 DBUG_PRINT(
"info", (
"out: engine_type = %s",
1142 ha_resolve_storage_engine_name(engine_type)));
1143 DBUG_ASSERT(engine_type != partition_hton);
1175 bool partition_info::check_range_constants(THD *thd)
1182 DBUG_ENTER(
"partition_info::check_range_constants");
1183 DBUG_PRINT(
"enter", (
"RANGE with %d parts, column_list = %u", num_parts,
1190 uint num_column_values= part_field_list.elements;
1194 if (unlikely(range_col_array == NULL))
1196 mem_alloc_error(num_parts * size_entries);
1199 loc_range_col_array= range_col_array;
1208 DBUG_ASSERT(part_def->list_val_list.elements == 1);
1210 if (fix_column_value_functions(thd, range_val, i))
1212 memcpy(loc_range_col_array, (
const void*)col_val, size_entries);
1213 loc_range_col_array+= num_column_values;
1216 if (compare_column_values((
const void*)current_largest_col_val,
1217 (
const void*)col_val) >= 0)
1218 goto range_not_increasing_error;
1220 current_largest_col_val= col_val;
1223 }
while (++i < num_parts);
1227 longlong UNINIT_VAR(current_largest);
1228 longlong part_range_value;
1229 bool signed_flag= !part_expr->unsigned_flag;
1231 range_int_array= (longlong*)sql_alloc(num_parts *
sizeof(longlong));
1232 if (unlikely(range_int_array == NULL))
1234 mem_alloc_error(num_parts *
sizeof(longlong));
1241 if ((i != (num_parts - 1)) || !defined_max_value)
1243 part_range_value= part_def->range_value;
1245 part_range_value-= 0x8000000000000000ULL;
1248 part_range_value= LONGLONG_MAX;
1252 if (unlikely(current_largest > part_range_value) ||
1253 (unlikely(current_largest == part_range_value) &&
1254 (part_range_value < LONGLONG_MAX ||
1255 i != (num_parts - 1) ||
1256 !defined_max_value)))
1257 goto range_not_increasing_error;
1259 range_int_array[
i]= part_range_value;
1260 current_largest= part_range_value;
1262 }
while (++i < num_parts);
1266 DBUG_RETURN(result);
1268 range_not_increasing_error:
1269 my_error(ER_RANGE_NOT_INCREASING_ERROR, MYF(0));
1291 int partition_info_list_part_cmp(
const void* a,
const void* b)
1304 int partition_info::list_part_cmp(
const void* a,
const void* b)
1306 return partition_info_list_part_cmp(a, b);
1323 int partition_info_compare_column_values(
const void *first_arg,
1324 const void *second_arg)
1331 for (field= part_info->part_field_array; *field;
1332 field++, first++, second++)
1334 if (first->max_value || second->max_value)
1336 if (first->max_value && second->max_value)
1338 if (second->max_value)
1343 if (first->null_value || second->null_value)
1345 if (first->null_value && second->null_value)
1347 if (second->null_value)
1352 int res= (*field)->cmp((
const uchar*)first->column_value,
1353 (
const uchar*)second->column_value);
1361 int partition_info::compare_column_values(
const void *first_arg,
1362 const void *second_arg)
1364 return partition_info_compare_column_values(first_arg, second_arg);
1389 bool partition_info::check_list_constants(THD *thd)
1391 uint
i, size_entries, num_column_values;
1395 longlong type_add, calc_value;
1397 void *UNINIT_VAR(prev_value);
1399 bool found_null= FALSE;
1400 qsort_cmp compare_func;
1403 DBUG_ENTER(
"partition_info::check_list_constants");
1424 part_def= list_func_it++;
1425 if (part_def->has_null_value)
1429 my_error(ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR, MYF(0));
1432 has_null_value= TRUE;
1433 has_null_part_id=
i;
1437 while (list_val_it1++)
1439 }
while (++i < num_parts);
1440 list_func_it.rewind();
1441 num_column_values= part_field_list.elements;
1442 size_entries= column_list ?
1445 ptr= sql_calloc((num_list_values+1) * size_entries);
1446 if (unlikely(ptr == NULL))
1448 mem_alloc_error(num_list_values * size_entries);
1456 compare_func= partition_info_compare_column_values;
1460 part_def= list_func_it++;
1462 while ((list_value= list_val_it2++))
1465 if (unlikely(fix_column_value_functions(thd, list_value, i)))
1469 memcpy(loc_list_col_array, (
const void*)col_val, size_entries);
1470 loc_list_col_array+= num_column_values;
1472 }
while (++i < num_parts);
1476 compare_func= partition_info_list_part_cmp;
1483 type_add= (longlong)(part_expr->unsigned_flag ?
1484 0x8000000000000000ULL :
1489 part_def= list_func_it++;
1491 while ((list_value= list_val_it2++))
1493 calc_value= list_value->value - type_add;
1494 list_array[list_index].list_value= calc_value;
1495 list_array[list_index++].partition_id=
i;
1497 }
while (++i < num_parts);
1500 if (num_list_values)
1507 my_qsort((
void*)list_array, num_list_values, size_entries,
1513 DBUG_ASSERT(i < num_list_values);
1514 curr_value= column_list ? (
void*)&list_col_array[num_column_values * i] :
1515 (
void*)&list_array[
i];
1516 if (likely(first || compare_func(curr_value, prev_value)))
1518 prev_value= curr_value;
1523 my_error(ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR, MYF(0));
1526 }
while (++i < num_list_values);
1530 DBUG_RETURN(result);
1541 if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)
1543 if (part_elem->data_file_name)
1544 push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
1545 WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
1547 if (part_elem->index_file_name)
1548 push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
1549 WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
1551 part_elem->data_file_name= part_elem->index_file_name= NULL;
1579 bool partition_info::check_partition_info(THD *thd,
handlerton **eng_type,
1581 bool add_or_reorg_part)
1583 handlerton *table_engine= default_engine_type;
1584 uint
i, tot_partitions;
1585 bool result= TRUE, table_engine_set;
1587 DBUG_ENTER(
"partition_info::check_partition_info");
1588 DBUG_ASSERT(default_engine_type != partition_hton);
1590 DBUG_PRINT(
"info", (
"default table_engine = %s",
1591 ha_resolve_storage_engine_name(table_engine)));
1592 if (!add_or_reorg_part)
1596 if (!list_of_part_fields)
1598 DBUG_ASSERT(part_expr);
1599 err= part_expr->walk(&Item::check_partition_func_processor, 0,
1601 if (!err && is_sub_partitioned() && !list_of_subpart_fields)
1602 err= subpart_expr->walk(&Item::check_partition_func_processor, 0,
1607 my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
1610 if (thd->lex->sql_command == SQLCOM_CREATE_TABLE &&
1611 fix_parser_data(thd))
1614 if (unlikely(!is_sub_partitioned() &&
1615 !(use_default_subpartitions && use_default_num_subpartitions)))
1617 my_error(ER_SUBPARTITION_ERROR, MYF(0));
1620 if (unlikely(is_sub_partitioned() &&
1621 (!(part_type == RANGE_PARTITION ||
1622 part_type == LIST_PARTITION))))
1625 my_error(ER_SUBPARTITION_ERROR, MYF(0));
1628 if (unlikely(set_up_defaults_for_partitioning(file, info, (uint)0)))
1630 if (!(tot_partitions= get_tot_partitions()))
1632 my_error(ER_PARTITION_NOT_DEFINED_ERROR, MYF(0),
"partitions");
1635 if (unlikely(tot_partitions > MAX_PARTITIONS))
1637 my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0));
1650 if (info && info->used_fields & HA_CREATE_USED_ENGINE)
1652 table_engine_set= TRUE;
1653 table_engine= info->db_type;
1655 if (table_engine == partition_hton)
1656 table_engine= thd->lex->create_info.db_type;
1657 DBUG_ASSERT(table_engine != partition_hton);
1658 DBUG_PRINT(
"info", (
"Using table_engine = %s",
1659 ha_resolve_storage_engine_name(table_engine)));
1663 table_engine_set= FALSE;
1664 if (thd->lex->sql_command != SQLCOM_CREATE_TABLE)
1666 table_engine_set= TRUE;
1667 DBUG_PRINT(
"info", (
"No create, table_engine = %s",
1668 ha_resolve_storage_engine_name(table_engine)));
1669 DBUG_ASSERT(table_engine && table_engine != partition_hton);
1673 if (part_field_list.elements > 0 &&
1674 (same_name= find_duplicate_field()))
1676 my_error(ER_SAME_NAME_PARTITION_FIELD, MYF(0), same_name);
1679 if ((same_name= find_duplicate_name()))
1681 my_error(ER_SAME_NAME_PARTITION, MYF(0), same_name);
1687 uint num_parts_not_set= 0;
1688 uint prev_num_subparts_not_set= num_subparts + 1;
1692 warn_if_dir_in_part_elem(thd, part_elem);
1693 if (!is_sub_partitioned())
1695 if (part_elem->engine_type == NULL)
1697 num_parts_not_set++;
1698 part_elem->engine_type= default_engine_type;
1700 enum_ident_name_check ident_check_status=
1701 check_table_name(part_elem->partition_name,
1702 strlen(part_elem->partition_name), FALSE);
1703 if (ident_check_status == IDENT_NAME_WRONG)
1705 my_error(ER_WRONG_PARTITION_NAME, MYF(0));
1708 else if (ident_check_status == IDENT_NAME_TOO_LONG)
1710 my_error(ER_TOO_LONG_IDENT, MYF(0));
1713 DBUG_PRINT(
"info", (
"part = %d engine = %s",
1714 i, ha_resolve_storage_engine_name(part_elem->engine_type)));
1719 uint num_subparts_not_set= 0;
1725 warn_if_dir_in_part_elem(thd, sub_elem);
1726 enum_ident_name_check ident_check_status=
1727 check_table_name(sub_elem->partition_name,
1728 strlen(sub_elem->partition_name), FALSE);
1729 if (ident_check_status == IDENT_NAME_WRONG)
1731 my_error(ER_WRONG_PARTITION_NAME, MYF(0));
1734 else if (ident_check_status == IDENT_NAME_TOO_LONG)
1736 my_error(ER_TOO_LONG_IDENT, MYF(0));
1739 if (sub_elem->engine_type == NULL)
1741 if (part_elem->engine_type != NULL)
1742 sub_elem->engine_type= part_elem->engine_type;
1745 sub_elem->engine_type= default_engine_type;
1746 num_subparts_not_set++;
1749 DBUG_PRINT(
"info", (
"part = %d sub = %d engine = %s", i, j,
1750 ha_resolve_storage_engine_name(sub_elem->engine_type)));
1751 }
while (++j < num_subparts);
1753 if (prev_num_subparts_not_set == (num_subparts + 1) &&
1754 (num_subparts_not_set == 0 ||
1755 num_subparts_not_set == num_subparts))
1756 prev_num_subparts_not_set= num_subparts_not_set;
1758 if (!table_engine_set &&
1759 prev_num_subparts_not_set != num_subparts_not_set)
1761 DBUG_PRINT(
"info", (
"num_subparts_not_set = %u num_subparts = %u",
1762 num_subparts_not_set, num_subparts));
1763 my_error(ER_MIX_HANDLER_ERROR, MYF(0));
1767 if (part_elem->engine_type == NULL)
1769 if (num_subparts_not_set == 0)
1770 part_elem->engine_type= sub_elem->engine_type;
1773 num_parts_not_set++;
1774 part_elem->engine_type= default_engine_type;
1778 }
while (++i < num_parts);
1779 if (!table_engine_set &&
1780 num_parts_not_set != 0 &&
1781 num_parts_not_set != num_parts)
1783 DBUG_PRINT(
"info", (
"num_parts_not_set = %u num_parts = %u",
1784 num_parts_not_set, num_subparts));
1785 my_error(ER_MIX_HANDLER_ERROR, MYF(0));
1789 if (unlikely(check_engine_mix(table_engine, table_engine_set)))
1791 my_error(ER_MIX_HANDLER_ERROR, MYF(0));
1795 DBUG_ASSERT(table_engine != partition_hton &&
1796 default_engine_type == table_engine);
1798 *eng_type= table_engine;
1807 if (add_or_reorg_part)
1809 if (unlikely((part_type == RANGE_PARTITION &&
1810 check_range_constants(thd)) ||
1811 (part_type == LIST_PARTITION &&
1812 check_list_constants(thd))))
1817 DBUG_RETURN(result);
1831 void partition_info::print_no_partition_found(
TABLE *table_arg)
1834 char *buf_ptr= (
char*)&buf;
1837 memset(&table_list, 0,
sizeof(table_list));
1838 table_list.db= table_arg->s->db.str;
1839 table_list.table_name= table_arg->s->table_name.str;
1842 SELECT_ACL, &table_list, TRUE))
1844 my_message(ER_NO_PARTITION_FOR_GIVEN_VALUE,
1845 ER(ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT), MYF(0));
1850 buf_ptr= (
char*)
"from column_list";
1853 my_bitmap_map *old_map= dbug_tmp_use_all_columns(table_arg, table_arg->read_set);
1854 if (part_expr->null_value)
1855 buf_ptr= (
char*)
"NULL";
1857 longlong2str(err_value, buf,
1858 part_expr->unsigned_flag ? 10 : -10);
1859 dbug_tmp_restore_column_map(table_arg->read_set, old_map);
1861 my_error(ER_NO_PARTITION_FOR_GIVEN_VALUE, MYF(0), buf_ptr);
1879 bool partition_info::set_part_expr(
char *start_token,
Item *item_ptr,
1880 char *end_token,
bool is_subpart)
1882 uint expr_len= end_token - start_token;
1883 char *func_string= (
char*) sql_memdup(start_token, expr_len);
1887 mem_alloc_error(expr_len);
1892 list_of_subpart_fields= FALSE;
1893 subpart_expr= item_ptr;
1894 subpart_func_string= func_string;
1895 subpart_func_len= expr_len;
1899 list_of_part_fields= FALSE;
1900 part_expr= item_ptr;
1901 part_func_string= func_string;
1902 part_func_len= expr_len;
1919 bool partition_info::check_partition_field_length()
1921 uint store_length= 0;
1923 DBUG_ENTER(
"partition_info::check_partition_field_length");
1925 for (i= 0; i < num_part_fields; i++)
1926 store_length+= get_partition_field_store_length(part_field_array[i]);
1927 if (store_length > MAX_KEY_LENGTH)
1930 for (i= 0; i < num_subpart_fields; i++)
1931 store_length+= get_partition_field_store_length(subpart_field_array[i]);
1932 if (store_length > MAX_KEY_LENGTH)
1954 bool partition_info::set_up_charset_field_preps()
1956 Field *field, **ptr;
1961 uint tot_part_fields= 0;
1962 uint tot_subpart_fields= 0;
1963 DBUG_ENTER(
"set_up_charset_field_preps");
1965 if (!(part_type == HASH_PARTITION &&
1966 list_of_part_fields) &&
1967 check_part_func_fields(part_field_array, FALSE))
1969 ptr= part_field_array;
1971 while ((field= *(ptr++)))
1973 if (field_is_partition_charset(field))
1979 size= tot_part_fields *
sizeof(
char*);
1980 if (!(char_ptrs= (uchar**)sql_calloc(size)))
1982 part_field_buffers= char_ptrs;
1983 if (!(char_ptrs= (uchar**)sql_calloc(size)))
1985 restore_part_field_ptrs= char_ptrs;
1986 size= (tot_part_fields + 1) *
sizeof(
Field*);
1987 if (!(char_ptrs= (uchar**)sql_alloc(size)))
1989 part_charset_field_array= (
Field**)char_ptrs;
1990 ptr= part_field_array;
1992 while ((field= *(ptr++)))
1994 if (field_is_partition_charset(field))
1997 size= field->pack_length();
1998 if (!(field_buf= (uchar*) sql_calloc(size)))
2000 part_charset_field_array[
i]= field;
2001 part_field_buffers[i++]= field_buf;
2004 part_charset_field_array[
i]= NULL;
2006 if (is_sub_partitioned() && !list_of_subpart_fields &&
2007 check_part_func_fields(subpart_field_array, FALSE))
2010 ptr= subpart_field_array;
2011 while ((field= *(ptr++)))
2013 if (field_is_partition_charset(field))
2015 tot_subpart_fields++;
2019 size= tot_subpart_fields *
sizeof(
char*);
2020 if (!(char_ptrs= (uchar**) sql_calloc(size)))
2022 subpart_field_buffers= char_ptrs;
2023 if (!(char_ptrs= (uchar**) sql_calloc(size)))
2025 restore_subpart_field_ptrs= char_ptrs;
2026 size= (tot_subpart_fields + 1) *
sizeof(
Field*);
2027 if (!(char_ptrs= (uchar**) sql_alloc(size)))
2029 subpart_charset_field_array= (
Field**)char_ptrs;
2030 ptr= subpart_field_array;
2032 while ((field= *(ptr++)))
2035 LINT_INIT(field_buf);
2037 if (!field_is_partition_charset(field))
2039 size= field->pack_length();
2040 if (!(field_buf= (uchar*) sql_calloc(size)))
2042 subpart_charset_field_array[
i]= field;
2043 subpart_field_buffers[i++]= field_buf;
2045 subpart_charset_field_array[
i]= NULL;
2049 mem_alloc_error(size);
2074 while ((part_elem= part_it++))
2076 if (part_elem->subpartitions.elements)
2080 while ((subpart_elem= sub_it++))
2082 if (test_if_data_home_dir(subpart_elem->data_file_name))
2084 if (test_if_data_home_dir(subpart_elem->index_file_name))
2090 if (test_if_data_home_dir(part_elem->data_file_name))
2092 if (test_if_data_home_dir(part_elem->index_file_name))
2099 my_error(ER_WRONG_ARGUMENTS,MYF(0),
"DATA DIRECTORY");
2103 my_error(ER_WRONG_ARGUMENTS,MYF(0),
"INDEX DIRECTORY");
2114 void partition_info::report_part_expr_error(
bool use_subpart_expr)
2116 Item *expr= part_expr;
2117 DBUG_ENTER(
"partition_info::report_part_expr_error");
2118 if (use_subpart_expr)
2121 if (expr->type() == Item::FIELD_ITEM)
2123 partition_type
type= part_type;
2124 bool list_of_fields= list_of_part_fields;
2130 if (use_subpart_expr)
2133 list_of_fields= list_of_subpart_fields;
2136 item_field->field &&
2137 item_field->field->result_type() != INT_RESULT &&
2138 !(type == HASH_PARTITION && list_of_fields))
2140 my_error(ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD, MYF(0),
2141 item_field->item_name.
ptr());
2145 if (use_subpart_expr)
2146 my_error(ER_PARTITION_FUNC_NOT_ALLOWED_ERROR, MYF(0),
"SUBPARTITION");
2148 my_error(ER_PARTITION_FUNC_NOT_ALLOWED_ERROR, MYF(0),
"PARTITION");
2163 bool partition_info::is_field_in_part_expr(
List<Item> &fields)
2168 DBUG_ENTER(
"is_fields_in_part_expr");
2169 while ((item= it++))
2171 field= item->field_for_view_update();
2172 DBUG_ASSERT(field->field->table ==
table);
2173 if (bitmap_is_set(&full_part_field_set, field->field->field_index))
2184 bool partition_info::is_full_part_expr_in_fields(
List<Item> &fields)
2186 Field **part_field= full_part_field_array;
2187 DBUG_ASSERT(*part_field);
2188 DBUG_ENTER(
"is_full_part_expr_in_fields");
2201 while ((item= it++))
2203 field= item->field_for_view_update();
2204 DBUG_ASSERT(field->field->table ==
table);
2205 if (*part_field == field->field)
2213 }
while (*(++part_field));
2228 bool partition_info::add_max_value()
2230 DBUG_ENTER(
"partition_info::add_max_value");
2233 if (!(col_val= add_column_value()))
2237 col_val->max_value= TRUE;
2255 uint max_val= num_columns ? num_columns : MAX_REF_PARTS;
2256 DBUG_ENTER(
"add_column_value");
2257 DBUG_PRINT(
"enter", (
"num_columns = %u, curr_list_object %u, max_val = %u",
2258 num_columns, curr_list_object, max_val));
2259 if (curr_list_object < max_val)
2261 curr_list_val->added_items++;
2262 DBUG_RETURN(&curr_list_val->col_val_array[curr_list_object++]);
2264 if (!num_columns && part_type == LIST_PARTITION)
2275 if (!reorganize_into_single_field_col_val() && !init_column_part())
2277 DBUG_RETURN(add_column_value());
2283 my_error(ER_PARTITION_COLUMN_LIST_ERROR, MYF(0));
2287 if (part_type == RANGE_PARTITION)
2288 my_error(ER_TOO_MANY_VALUES_ERROR, MYF(0),
"RANGE");
2290 my_error(ER_TOO_MANY_VALUES_ERROR, MYF(0),
"LIST");
2311 DBUG_ENTER(
"partition_info::init_col_val");
2313 col_val->item_expression= item;
2314 col_val->null_value= item->null_value;
2315 if (item->result_type() == INT_RESULT)
2322 curr_list_val->value= item->val_int();
2323 curr_list_val->unsigned_flag= TRUE;
2324 if (!item->unsigned_flag &&
2325 curr_list_val->value < 0)
2326 curr_list_val->unsigned_flag= FALSE;
2327 if (!curr_list_val->unsigned_flag)
2328 curr_part_elem->signed_flag= TRUE;
2330 col_val->part_info= NULL;
2348 bool partition_info::add_column_list_value(THD *thd,
Item *item)
2353 const char *save_where= thd->where;
2354 DBUG_ENTER(
"partition_info::add_column_list_value");
2356 if (part_type == LIST_PARTITION &&
2359 if (init_column_part())
2365 context->table_list= 0;
2367 thd->where=
"field list";
2369 thd->where=
"partition function";
2371 if (item->walk(&Item::check_partition_func_processor, 0,
2374 my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
2377 if (item->fix_fields(thd, (
Item**)0) ||
2378 ((context->table_list= save_list), FALSE) ||
2379 (!item->const_item()))
2381 context->table_list= save_list;
2382 thd->where= save_where;
2383 my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
2386 thd->where= save_where;
2388 if (!(col_val= add_column_value()))
2392 init_col_val(col_val, item);
2409 bool partition_info::init_column_part()
2414 uint loc_num_columns;
2415 DBUG_ENTER(
"partition_info::init_column_part");
2419 p_elem->list_val_list.push_back(list_val))
2425 loc_num_columns= num_columns;
2427 loc_num_columns= MAX_REF_PARTS;
2428 if (!(col_val_array=
2435 list_val->col_val_array= col_val_array;
2436 list_val->added_items= 0;
2437 curr_list_val= list_val;
2438 curr_list_object= 0;
2464 bool partition_info::reorganize_into_single_field_col_val()
2468 uint num_values= num_columns;
2470 DBUG_ENTER(
"partition_info::reorganize_into_single_field_col_val");
2471 DBUG_ASSERT(part_type == LIST_PARTITION);
2472 DBUG_ASSERT(!num_columns || num_columns == val->added_items);
2475 num_values= val->added_items;
2477 val->added_items= 1
U;
2478 col_val= &val->col_val_array[0];
2479 init_col_val(col_val, col_val->item_expression);
2480 for (i= 1; i < num_values; i++)
2482 col_val= &val->col_val_array[
i];
2483 if (init_column_part())
2487 if (!(new_col_val= add_column_value()))
2491 memcpy(new_col_val, col_val,
sizeof(*col_val));
2492 init_col_val(new_col_val, col_val->item_expression);
2516 bool partition_info::fix_partition_values(THD *thd,
2522 DBUG_ENTER(
"partition_info::fix_partition_values");
2528 if (val->added_items != 1)
2530 my_error(ER_PARTITION_COLUMN_LIST_ERROR, MYF(0));
2533 if (col_val->max_value)
2536 DBUG_ASSERT(part_type == RANGE_PARTITION);
2537 if (defined_max_value)
2539 my_error(ER_PARTITION_MAXVALUE_ERROR, MYF(0));
2542 if (part_id == (num_parts - 1))
2544 defined_max_value= TRUE;
2545 part_elem->max_value= TRUE;
2546 part_elem->range_value= LONGLONG_MAX;
2550 my_error(ER_PARTITION_MAXVALUE_ERROR, MYF(0));
2556 Item *item_expr= col_val->item_expression;
2557 if ((val->null_value= item_expr->null_value))
2559 if (part_elem->has_null_value)
2561 my_error(ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR, MYF(0));
2564 part_elem->has_null_value= TRUE;
2566 else if (item_expr->result_type() != INT_RESULT)
2568 my_error(ER_VALUES_IS_NOT_INT_TYPE_ERROR, MYF(0),
2569 part_elem->partition_name);
2572 if (part_type == RANGE_PARTITION)
2574 if (part_elem->has_null_value)
2576 my_error(ER_NULL_IN_VALUES_LESS_THAN, MYF(0));
2579 part_elem->range_value= val->value;
2598 Item* partition_info::get_column_item(
Item *item,
Field *field)
2600 if (field->result_type() == STRING_RESULT &&
2601 item->collation.collation != field->charset())
2603 if (!(item= convert_charset_partition_constant(item,
2606 my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
2628 bool partition_info::fix_column_value_functions(THD *thd,
2632 uint n_columns= part_field_list.elements;
2636 DBUG_ENTER(
"partition_info::fix_column_value_functions");
2638 if (col_val->fixed > 1)
2642 for (i= 0; i < n_columns; col_val++, i++)
2644 Item *column_item= col_val->item_expression;
2645 Field *field= part_field_array[
i];
2646 col_val->part_info=
this;
2647 col_val->partition_id= part_id;
2648 if (col_val->max_value)
2649 col_val->column_value= NULL;
2652 col_val->column_value= NULL;
2653 if (!col_val->null_value)
2656 uint len= field->pack_length();
2657 sql_mode_t save_sql_mode;
2658 bool save_got_warning;
2660 if (!(column_item= get_column_item(column_item,
2666 save_sql_mode= thd->variables.sql_mode;
2667 thd->variables.sql_mode= 0;
2668 save_got_warning= thd->got_warning;
2669 thd->got_warning= 0;
2673 my_error(ER_WRONG_TYPE_COLUMN_VALUE_ERROR, MYF(0));
2677 thd->got_warning= save_got_warning;
2678 thd->variables.sql_mode= save_sql_mode;
2679 if (!(val_ptr= (uchar*) sql_calloc(len)))
2681 mem_alloc_error(len);
2685 col_val->column_value= val_ptr;
2686 memcpy(val_ptr, field->ptr, len);
2692 DBUG_RETURN(result);
2738 bool partition_info::fix_parser_data(THD *thd)
2744 DBUG_ENTER(
"partition_info::fix_parser_data");
2746 if (!(part_type == RANGE_PARTITION ||
2747 part_type == LIST_PARTITION))
2749 if (part_type == HASH_PARTITION && list_of_part_fields)
2752 if (key_algorithm > KEY_ALGORITHM_55)
2754 my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
2758 if ((thd_sql_command(thd) == SQLCOM_CREATE_TABLE ||
2759 thd_sql_command(thd) == SQLCOM_ALTER_TABLE) &&
2760 key_algorithm == KEY_ALGORITHM_NONE)
2761 key_algorithm= KEY_ALGORITHM_55;
2765 if (is_sub_partitioned() && list_of_subpart_fields)
2768 if (key_algorithm > KEY_ALGORITHM_55)
2770 my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
2774 if ((thd_sql_command(thd) == SQLCOM_CREATE_TABLE ||
2775 thd_sql_command(thd) == SQLCOM_ALTER_TABLE) &&
2776 key_algorithm == KEY_ALGORITHM_NONE)
2777 key_algorithm= KEY_ALGORITHM_55;
2783 num_elements= part_elem->list_val_list.elements;
2784 DBUG_ASSERT(part_type == RANGE_PARTITION ?
2785 num_elements == 1
U : TRUE);
2786 for (j= 0; j < num_elements; j++)
2791 if (val->added_items != num_columns)
2793 my_error(ER_PARTITION_COLUMN_LIST_ERROR, MYF(0));
2796 for (k= 0; k < num_columns; k++)
2799 if (col_val->null_value && part_type == RANGE_PARTITION)
2801 my_error(ER_NULL_IN_VALUES_LESS_THAN, MYF(0));
2808 if (fix_partition_values(thd, val, part_elem, i))
2812 if (val->null_value)
2818 list_val_it.remove();
2822 }
while (++i < num_parts);
2839 static bool strcmp_null(
const char *a,
const char *b)
2843 if (a && b && !strcmp(a, b))
2866 bool partition_info::has_same_partitioning(
partition_info *new_part_info)
2868 DBUG_ENTER(
"partition_info::has_same_partitioning");
2870 DBUG_ASSERT(part_field_array && part_field_array[0]);
2877 if (part_field_array[0]->
table->s->mysql_version >= 50503)
2880 if (!new_part_info ||
2881 part_type != new_part_info->part_type ||
2882 num_parts != new_part_info->num_parts ||
2883 use_default_partitions != new_part_info->use_default_partitions ||
2884 new_part_info->is_sub_partitioned() != is_sub_partitioned())
2887 if (part_type != HASH_PARTITION)
2893 if (!is_sub_partitioned() ||
2894 !new_part_info->is_sub_partitioned() ||
2896 new_part_info->column_list ||
2897 !list_of_subpart_fields ||
2898 !new_part_info->list_of_subpart_fields ||
2899 new_part_info->num_subparts != num_subparts ||
2900 new_part_info->subpart_field_list.elements !=
2901 subpart_field_list.elements ||
2902 new_part_info->use_default_subpartitions !=
2903 use_default_subpartitions)
2909 if (!new_part_info->list_of_part_fields ||
2910 !list_of_part_fields ||
2911 new_part_info->part_field_list.elements != part_field_list.elements)
2918 char *old_name, *new_name;
2919 while ((old_name= old_field_name_it++))
2921 new_name= new_field_name_it++;
2922 if (!new_name || my_strcasecmp(system_charset_info,
2928 if (is_sub_partitioned())
2933 char *old_name, *new_name;
2934 while ((old_name= old_field_name_it++))
2936 new_name= new_field_name_it++;
2937 if (!new_name || my_strcasecmp(system_charset_info,
2944 if (!use_default_partitions)
2967 if (!part_elem || !new_part_elem ||
2968 strcmp(part_elem->partition_name,
2969 new_part_elem->partition_name) ||
2970 part_elem->part_state != PART_NORMAL ||
2971 new_part_elem->part_state != PART_NORMAL ||
2972 part_elem->max_value != new_part_elem->max_value ||
2973 part_elem->signed_flag != new_part_elem->signed_flag ||
2974 part_elem->has_null_value != new_part_elem->has_null_value)
2978 if (new_part_elem->engine_type &&
2979 part_elem->engine_type != new_part_elem->engine_type)
2982 if (is_sub_partitioned())
2988 if (part_type == LIST_PARTITION)
2992 new_list_vals(new_part_elem->list_val_list);
2995 while ((val= list_vals++))
2997 new_val= new_list_vals++;
3000 if ((!val->null_value && !new_val->null_value) &&
3001 val->value != new_val->value)
3004 if (new_list_vals++)
3009 DBUG_ASSERT(part_type == RANGE_PARTITION);
3010 if (new_part_elem->range_value != part_elem->range_value)
3014 if (!use_default_subpartitions)
3017 sub_part_it(part_elem->subpartitions);
3019 new_sub_part_it(new_part_elem->subpartitions);
3026 if (new_sub_part_elem->engine_type &&
3027 sub_part_elem->engine_type != new_sub_part_elem->engine_type)
3030 if (strcmp(sub_part_elem->partition_name,
3031 new_sub_part_elem->partition_name) ||
3032 sub_part_elem->part_state != PART_NORMAL ||
3033 new_sub_part_elem->part_state != PART_NORMAL ||
3034 sub_part_elem->part_min_rows !=
3035 new_sub_part_elem->part_min_rows ||
3036 sub_part_elem->part_max_rows !=
3037 new_sub_part_elem->part_max_rows ||
3038 sub_part_elem->nodegroup_id !=
3039 new_sub_part_elem->nodegroup_id)
3042 if (strcmp_null(sub_part_elem->data_file_name,
3043 new_sub_part_elem->data_file_name) ||
3044 strcmp_null(sub_part_elem->index_file_name,
3045 new_sub_part_elem->index_file_name) ||
3046 strcmp_null(sub_part_elem->tablespace_name,
3047 new_sub_part_elem->tablespace_name))
3050 }
while (++j < num_subparts);
3055 if (part_elem->part_min_rows != new_part_elem->part_min_rows ||
3056 part_elem->part_max_rows != new_part_elem->part_max_rows ||
3057 part_elem->nodegroup_id != new_part_elem->nodegroup_id)
3060 if (strcmp_null(part_elem->data_file_name,
3061 new_part_elem->data_file_name) ||
3062 strcmp_null(part_elem->index_file_name,
3063 new_part_elem->index_file_name) ||
3064 strcmp_null(part_elem->tablespace_name,
3065 new_part_elem->tablespace_name))
3068 }
while (++i < num_parts);
3075 if (key_algorithm != partition_info::KEY_ALGORITHM_NONE ||
3076 new_part_info->key_algorithm == partition_info::KEY_ALGORITHM_NONE)
3083 void partition_info::print_debug(
const char *str, uint *value)
3085 DBUG_ENTER(
"print_debug");
3087 DBUG_PRINT(
"info", (
"parser: %s, val = %u", str, *value));
3089 DBUG_PRINT(
"info", (
"parser: %s", str));
3104 bool partition_info::set_part_expr(
char *start_token,
Item *item_ptr,
3105 char *end_token,
bool is_subpart)
3114 bool partition_info::reorganize_into_single_field_col_val()
3119 bool partition_info::init_column_part()
3124 bool partition_info::add_column_list_value(THD *thd,
Item *item)
3129 bool partition_info::add_max_value()
3134 void partition_info::print_debug(
const char *str, uint *value)