Loading sql/ha_ndbcluster.cc +18 −10 Original line number Diff line number Diff line Loading @@ -9590,12 +9590,8 @@ ndbcluster_show_status(THD* thd, stat_print_fn *stat_print, /* Create a table in NDB Cluster */ static uint get_no_fragments(TABLE_SHARE *table_share) static uint get_no_fragments(ulonglong max_rows) { ha_rows max_rows= table_share->max_rows; ha_rows min_rows= table_share->min_rows; if (max_rows < min_rows) max_rows= min_rows; #if MYSQL_VERSION_ID >= 50000 uint acc_row_size= 25 + /*safety margin*/ 2; #else Loading Loading @@ -9632,10 +9628,22 @@ static bool adjusted_frag_count(uint no_fragments, uint no_nodes, return (reported_frags < no_fragments); } int ha_ndbcluster::get_default_no_partitions(TABLE_SHARE *table_share) int ha_ndbcluster::get_default_no_partitions(HA_CREATE_INFO *info) { ha_rows max_rows, min_rows; if (info) { max_rows= info->max_rows; min_rows= info->min_rows; } else { max_rows= table_share->max_rows; min_rows= table_share->min_rows; } uint reported_frags; uint no_fragments= get_no_fragments(table_share); uint no_fragments= get_no_fragments(max_rows >= min_rows ? max_rows : min_rows); uint no_nodes= g_ndb_cluster_connection->no_db_nodes(); if (adjusted_frag_count(no_fragments, no_nodes, reported_frags)) { Loading Loading @@ -9884,14 +9892,14 @@ uint ha_ndbcluster::set_up_partition_info(partition_info *part_info, tab->setDefaultNoPartitionsFlag(part_info->use_default_no_partitions); tab->setLinearFlag(part_info->linear_hash_ind); { ha_rows max_rows= form->s->max_rows; ha_rows min_rows= form->s->min_rows; ha_rows max_rows= table_share->max_rows; ha_rows min_rows= table_share->min_rows; if (max_rows < min_rows) max_rows= min_rows; if (max_rows != (ha_rows)0) /* default setting, don't set fragmentation */ { tab->setMaxRows(max_rows); tab->setMaxRows(min_rows); tab->setMinRows(min_rows); } } tab->setTablespaceNames(ts_names, fd_index*sizeof(char*)); Loading sql/ha_ndbcluster.h +1 −1 Original line number Diff line number Diff line Loading @@ -651,7 +651,7 @@ class ha_ndbcluster: public handler int create(const char *name, TABLE *form, HA_CREATE_INFO *info); int create_handler_files(const char *file, const char *old_name, int action_flag, HA_CREATE_INFO *info); int get_default_no_partitions(TABLE_SHARE *); int get_default_no_partitions(HA_CREATE_INFO *info); bool get_no_parts(const char *name, uint *no_parts); void set_auto_partitions(partition_info *part_info); Loading sql/handler.h +1 −1 Original line number Diff line number Diff line Loading @@ -1335,7 +1335,7 @@ class handler :public Sql_alloc virtual const char *table_type() const =0; virtual const char **bas_ext() const =0; virtual int get_default_no_partitions(TABLE_SHARE *) { return 1;} virtual int get_default_no_partitions(HA_CREATE_INFO *info) { return 1;} virtual void set_auto_partitions(partition_info *part_info) { return; } virtual bool get_no_parts(const char *name, uint *no_parts) Loading sql/partition_info.cc +14 −13 Original line number Diff line number Diff line Loading @@ -153,7 +153,7 @@ char *partition_info::create_subpartition_name(uint subpart_no, SYNOPSIS set_up_default_partitions() file A reference to a handler of the table max_rows Maximum number of rows stored in the table info Create info start_no Starting partition number RETURN VALUE Loading @@ -169,7 +169,8 @@ char *partition_info::create_subpartition_name(uint subpart_no, The external routine needing this code is check_partition_info */ bool partition_info::set_up_default_partitions(handler *file, ulonglong max_rows, bool partition_info::set_up_default_partitions(handler *file, HA_CREATE_INFO *info, uint start_no) { uint i; Loading @@ -188,7 +189,7 @@ bool partition_info::set_up_default_partitions(handler *file, ulonglong max_rows goto end; } if (no_parts == 0) no_parts= file->get_default_no_partitions(max_rows); no_parts= file->get_default_no_partitions(info); if (unlikely(no_parts > MAX_PARTITIONS)) { my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0)); Loading Loading @@ -228,7 +229,7 @@ bool partition_info::set_up_default_partitions(handler *file, ulonglong max_rows SYNOPSIS set_up_default_subpartitions() file A reference to a handler of the table max_rows Maximum number of rows stored in the table info Create info RETURN VALUE TRUE Error, attempted default values not possible Loading @@ -244,7 +245,7 @@ bool partition_info::set_up_default_partitions(handler *file, ulonglong max_rows */ bool partition_info::set_up_default_subpartitions(handler *file, ulonglong max_rows) HA_CREATE_INFO *info) { uint i, j; char *default_name, *name_ptr; Loading @@ -254,7 +255,7 @@ bool partition_info::set_up_default_subpartitions(handler *file, DBUG_ENTER("partition_info::set_up_default_subpartitions"); if (no_subparts == 0) no_subparts= file->get_default_no_partitions(max_rows); no_subparts= file->get_default_no_partitions(info); if (unlikely((no_parts * no_subparts) > MAX_PARTITIONS)) { my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0)); Loading Loading @@ -296,7 +297,7 @@ bool partition_info::set_up_default_subpartitions(handler *file, SYNOPSIS set_up_defaults_for_partitioning() file A reference to a handler of the table max_rows Maximum number of rows stored in the table info Create info start_no Starting partition number RETURN VALUE Loading @@ -309,7 +310,7 @@ bool partition_info::set_up_default_subpartitions(handler *file, */ bool partition_info::set_up_defaults_for_partitioning(handler *file, ulonglong max_rows, HA_CREATE_INFO *info, uint start_no) { DBUG_ENTER("partition_info::set_up_defaults_for_partitioning"); Loading @@ -318,10 +319,10 @@ bool partition_info::set_up_defaults_for_partitioning(handler *file, { default_partitions_setup= TRUE; if (use_default_partitions) DBUG_RETURN(set_up_default_partitions(file, max_rows, start_no)); DBUG_RETURN(set_up_default_partitions(file, info, start_no)); if (is_sub_partitioned() && use_default_subpartitions) DBUG_RETURN(set_up_default_subpartitions(file, max_rows)); DBUG_RETURN(set_up_default_subpartitions(file, info)); } DBUG_RETURN(FALSE); } Loading Loading @@ -692,7 +693,7 @@ bool partition_info::check_list_constants() SYNOPSIS check_partition_info() file A reference to a handler of the table max_rows Maximum number of rows stored in the table info Create info engine_type Return value for used engine in partitions RETURN VALUE Loading @@ -708,7 +709,7 @@ bool partition_info::check_list_constants() */ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type, handler *file, ulonglong max_rows) handler *file, HA_CREATE_INFO *info) { handlerton **engine_array= NULL; uint part_count= 0; Loading Loading @@ -743,7 +744,7 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type, my_error(ER_SUBPARTITION_ERROR, MYF(0)); goto end; } if (unlikely(set_up_defaults_for_partitioning(file, max_rows, (uint)0))) if (unlikely(set_up_defaults_for_partitioning(file, info, (uint)0))) goto end; tot_partitions= get_tot_partitions(); if (unlikely(tot_partitions > MAX_PARTITIONS)) Loading sql/partition_info.h +4 −4 Original line number Diff line number Diff line Loading @@ -243,21 +243,21 @@ class partition_info : public Sql_alloc return no_parts * (is_sub_partitioned() ? no_subparts : 1); } bool set_up_defaults_for_partitioning(handler *file, ulonglong max_rows, bool set_up_defaults_for_partitioning(handler *file, HA_CREATE_INFO *info, uint start_no); char *has_unique_names(); static bool check_engine_mix(handlerton **engine_array, uint no_parts); bool check_range_constants(); bool check_list_constants(); bool check_partition_info(THD *thd, handlerton **eng_type, handler *file, ulonglong max_rows); handler *file, HA_CREATE_INFO *info); void print_no_partition_found(TABLE *table); private: static int list_part_cmp(const void* a, const void* b); static int list_part_cmp_unsigned(const void* a, const void* b); bool set_up_default_partitions(handler *file, ulonglong max_rows, bool set_up_default_partitions(handler *file, HA_CREATE_INFO *info, uint start_no); bool set_up_default_subpartitions(handler *file, ulonglong max_rows); bool set_up_default_subpartitions(handler *file, HA_CREATE_INFO *info); char *create_default_partition_names(uint part_no, uint no_parts, uint start_no); char *create_subpartition_name(uint subpart_no, const char *part_name); Loading Loading
sql/ha_ndbcluster.cc +18 −10 Original line number Diff line number Diff line Loading @@ -9590,12 +9590,8 @@ ndbcluster_show_status(THD* thd, stat_print_fn *stat_print, /* Create a table in NDB Cluster */ static uint get_no_fragments(TABLE_SHARE *table_share) static uint get_no_fragments(ulonglong max_rows) { ha_rows max_rows= table_share->max_rows; ha_rows min_rows= table_share->min_rows; if (max_rows < min_rows) max_rows= min_rows; #if MYSQL_VERSION_ID >= 50000 uint acc_row_size= 25 + /*safety margin*/ 2; #else Loading Loading @@ -9632,10 +9628,22 @@ static bool adjusted_frag_count(uint no_fragments, uint no_nodes, return (reported_frags < no_fragments); } int ha_ndbcluster::get_default_no_partitions(TABLE_SHARE *table_share) int ha_ndbcluster::get_default_no_partitions(HA_CREATE_INFO *info) { ha_rows max_rows, min_rows; if (info) { max_rows= info->max_rows; min_rows= info->min_rows; } else { max_rows= table_share->max_rows; min_rows= table_share->min_rows; } uint reported_frags; uint no_fragments= get_no_fragments(table_share); uint no_fragments= get_no_fragments(max_rows >= min_rows ? max_rows : min_rows); uint no_nodes= g_ndb_cluster_connection->no_db_nodes(); if (adjusted_frag_count(no_fragments, no_nodes, reported_frags)) { Loading Loading @@ -9884,14 +9892,14 @@ uint ha_ndbcluster::set_up_partition_info(partition_info *part_info, tab->setDefaultNoPartitionsFlag(part_info->use_default_no_partitions); tab->setLinearFlag(part_info->linear_hash_ind); { ha_rows max_rows= form->s->max_rows; ha_rows min_rows= form->s->min_rows; ha_rows max_rows= table_share->max_rows; ha_rows min_rows= table_share->min_rows; if (max_rows < min_rows) max_rows= min_rows; if (max_rows != (ha_rows)0) /* default setting, don't set fragmentation */ { tab->setMaxRows(max_rows); tab->setMaxRows(min_rows); tab->setMinRows(min_rows); } } tab->setTablespaceNames(ts_names, fd_index*sizeof(char*)); Loading
sql/ha_ndbcluster.h +1 −1 Original line number Diff line number Diff line Loading @@ -651,7 +651,7 @@ class ha_ndbcluster: public handler int create(const char *name, TABLE *form, HA_CREATE_INFO *info); int create_handler_files(const char *file, const char *old_name, int action_flag, HA_CREATE_INFO *info); int get_default_no_partitions(TABLE_SHARE *); int get_default_no_partitions(HA_CREATE_INFO *info); bool get_no_parts(const char *name, uint *no_parts); void set_auto_partitions(partition_info *part_info); Loading
sql/handler.h +1 −1 Original line number Diff line number Diff line Loading @@ -1335,7 +1335,7 @@ class handler :public Sql_alloc virtual const char *table_type() const =0; virtual const char **bas_ext() const =0; virtual int get_default_no_partitions(TABLE_SHARE *) { return 1;} virtual int get_default_no_partitions(HA_CREATE_INFO *info) { return 1;} virtual void set_auto_partitions(partition_info *part_info) { return; } virtual bool get_no_parts(const char *name, uint *no_parts) Loading
sql/partition_info.cc +14 −13 Original line number Diff line number Diff line Loading @@ -153,7 +153,7 @@ char *partition_info::create_subpartition_name(uint subpart_no, SYNOPSIS set_up_default_partitions() file A reference to a handler of the table max_rows Maximum number of rows stored in the table info Create info start_no Starting partition number RETURN VALUE Loading @@ -169,7 +169,8 @@ char *partition_info::create_subpartition_name(uint subpart_no, The external routine needing this code is check_partition_info */ bool partition_info::set_up_default_partitions(handler *file, ulonglong max_rows, bool partition_info::set_up_default_partitions(handler *file, HA_CREATE_INFO *info, uint start_no) { uint i; Loading @@ -188,7 +189,7 @@ bool partition_info::set_up_default_partitions(handler *file, ulonglong max_rows goto end; } if (no_parts == 0) no_parts= file->get_default_no_partitions(max_rows); no_parts= file->get_default_no_partitions(info); if (unlikely(no_parts > MAX_PARTITIONS)) { my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0)); Loading Loading @@ -228,7 +229,7 @@ bool partition_info::set_up_default_partitions(handler *file, ulonglong max_rows SYNOPSIS set_up_default_subpartitions() file A reference to a handler of the table max_rows Maximum number of rows stored in the table info Create info RETURN VALUE TRUE Error, attempted default values not possible Loading @@ -244,7 +245,7 @@ bool partition_info::set_up_default_partitions(handler *file, ulonglong max_rows */ bool partition_info::set_up_default_subpartitions(handler *file, ulonglong max_rows) HA_CREATE_INFO *info) { uint i, j; char *default_name, *name_ptr; Loading @@ -254,7 +255,7 @@ bool partition_info::set_up_default_subpartitions(handler *file, DBUG_ENTER("partition_info::set_up_default_subpartitions"); if (no_subparts == 0) no_subparts= file->get_default_no_partitions(max_rows); no_subparts= file->get_default_no_partitions(info); if (unlikely((no_parts * no_subparts) > MAX_PARTITIONS)) { my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0)); Loading Loading @@ -296,7 +297,7 @@ bool partition_info::set_up_default_subpartitions(handler *file, SYNOPSIS set_up_defaults_for_partitioning() file A reference to a handler of the table max_rows Maximum number of rows stored in the table info Create info start_no Starting partition number RETURN VALUE Loading @@ -309,7 +310,7 @@ bool partition_info::set_up_default_subpartitions(handler *file, */ bool partition_info::set_up_defaults_for_partitioning(handler *file, ulonglong max_rows, HA_CREATE_INFO *info, uint start_no) { DBUG_ENTER("partition_info::set_up_defaults_for_partitioning"); Loading @@ -318,10 +319,10 @@ bool partition_info::set_up_defaults_for_partitioning(handler *file, { default_partitions_setup= TRUE; if (use_default_partitions) DBUG_RETURN(set_up_default_partitions(file, max_rows, start_no)); DBUG_RETURN(set_up_default_partitions(file, info, start_no)); if (is_sub_partitioned() && use_default_subpartitions) DBUG_RETURN(set_up_default_subpartitions(file, max_rows)); DBUG_RETURN(set_up_default_subpartitions(file, info)); } DBUG_RETURN(FALSE); } Loading Loading @@ -692,7 +693,7 @@ bool partition_info::check_list_constants() SYNOPSIS check_partition_info() file A reference to a handler of the table max_rows Maximum number of rows stored in the table info Create info engine_type Return value for used engine in partitions RETURN VALUE Loading @@ -708,7 +709,7 @@ bool partition_info::check_list_constants() */ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type, handler *file, ulonglong max_rows) handler *file, HA_CREATE_INFO *info) { handlerton **engine_array= NULL; uint part_count= 0; Loading Loading @@ -743,7 +744,7 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type, my_error(ER_SUBPARTITION_ERROR, MYF(0)); goto end; } if (unlikely(set_up_defaults_for_partitioning(file, max_rows, (uint)0))) if (unlikely(set_up_defaults_for_partitioning(file, info, (uint)0))) goto end; tot_partitions= get_tot_partitions(); if (unlikely(tot_partitions > MAX_PARTITIONS)) Loading
sql/partition_info.h +4 −4 Original line number Diff line number Diff line Loading @@ -243,21 +243,21 @@ class partition_info : public Sql_alloc return no_parts * (is_sub_partitioned() ? no_subparts : 1); } bool set_up_defaults_for_partitioning(handler *file, ulonglong max_rows, bool set_up_defaults_for_partitioning(handler *file, HA_CREATE_INFO *info, uint start_no); char *has_unique_names(); static bool check_engine_mix(handlerton **engine_array, uint no_parts); bool check_range_constants(); bool check_list_constants(); bool check_partition_info(THD *thd, handlerton **eng_type, handler *file, ulonglong max_rows); handler *file, HA_CREATE_INFO *info); void print_no_partition_found(TABLE *table); private: static int list_part_cmp(const void* a, const void* b); static int list_part_cmp_unsigned(const void* a, const void* b); bool set_up_default_partitions(handler *file, ulonglong max_rows, bool set_up_default_partitions(handler *file, HA_CREATE_INFO *info, uint start_no); bool set_up_default_subpartitions(handler *file, ulonglong max_rows); bool set_up_default_subpartitions(handler *file, HA_CREATE_INFO *info); char *create_default_partition_names(uint part_no, uint no_parts, uint start_no); char *create_subpartition_name(uint subpart_no, const char *part_name); Loading