#At file:///home/msvensson/mysql/tmp/FwQjPEojt_/7.1/ based on revid:magnus.blaudd@strippedo1vfyqev86
4170 Magnus Blåudd 2011-04-19 [merge]
Merge 7.0 -> 7.1
modified:
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.h
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2011-04-11 14:40:49 +0000
+++ b/sql/ha_ndbcluster.cc 2011-04-19 07:55:56 +0000
@@ -8182,7 +8182,6 @@ int ha_ndbcluster::create(const char *na
bool use_disk= FALSE;
NdbDictionary::Table::SingleUserMode single_user_mode= NdbDictionary::Table::SingleUserModeLocked;
bool ndb_sys_table= FALSE;
- partition_info *part_info;
int result= 0;
NdbDictionary::ObjectId objId;
@@ -8225,7 +8224,7 @@ int ha_ndbcluster::create(const char *na
*/
if ((my_errno= write_ndb_file(name)))
DBUG_RETURN(my_errno);
- ndbcluster_create_binlog_setup(thd, get_ndb(thd), name, strlen(name),
+ ndbcluster_create_binlog_setup(thd, ndb, name, strlen(name),
m_dbname, m_tabname, FALSE);
DBUG_RETURN(my_errno);
}
@@ -8504,8 +8503,7 @@ int ha_ndbcluster::create(const char *na
}
// Check partition info
- part_info= form->part_info;
- if ((my_errno= set_up_partition_info(part_info, form, (void*)&tab)))
+ if ((my_errno= set_up_partition_info(form->part_info, tab)))
goto abort;
if (tab.getFragmentType() == NDBTAB::HashMapPartition &&
@@ -13713,10 +13711,11 @@ void ha_ndbcluster::set_auto_partitions(
}
-int ha_ndbcluster::set_range_data(void *tab_ref, partition_info *part_info)
+int
+ha_ndbcluster::set_range_data(const partition_info *part_info,
+ NdbDictionary::Table& ndbtab) const
{
const uint num_parts = partition_info_num_parts(part_info);
- NDBTAB *tab= (NDBTAB*)tab_ref;
int error= 0;
bool unsigned_flag= part_info->part_expr->unsigned_flag;
DBUG_ENTER("set_range_data");
@@ -13745,16 +13744,18 @@ int ha_ndbcluster::set_range_data(void *
}
range_data[i]= (int32)range_val;
}
- tab->setRangeListData(range_data, num_parts);
+ ndbtab.setRangeListData(range_data, num_parts);
error:
my_free((char*)range_data, MYF(0));
DBUG_RETURN(error);
}
-int ha_ndbcluster::set_list_data(void *tab_ref, partition_info *part_info)
+
+int
+ha_ndbcluster::set_list_data(const partition_info *part_info,
+ NdbDictionary::Table& ndbtab) const
{
const uint num_list_values = partition_info_num_list_values(part_info);
- NDBTAB *tab= (NDBTAB*)tab_ref;
int32 *list_data= (int32*)my_malloc(num_list_values*2*sizeof(int32), MYF(0));
int error= 0;
bool unsigned_flag= part_info->part_expr->unsigned_flag;
@@ -13780,7 +13781,7 @@ int ha_ndbcluster::set_list_data(void *t
list_data[2*i]= (int32)list_val;
list_data[2*i+1]= list_entry->partition_id;
}
- tab->setRangeListData(list_data, 2*num_list_values);
+ ndbtab.setRangeListData(list_data, 2*num_list_values);
error:
my_free((char*)list_data, MYF(0));
DBUG_RETURN(error);
@@ -13799,18 +13800,15 @@ error:
implement the function to map to a partition.
*/
-uint ha_ndbcluster::set_up_partition_info(partition_info *part_info,
- TABLE *table,
- void *tab_par)
+int
+ha_ndbcluster::set_up_partition_info(partition_info *part_info,
+ NdbDictionary::Table& ndbtab) const
{
uint32 frag_data[MAX_PARTITIONS];
char *ts_names[MAX_PARTITIONS];
ulong fd_index= 0, i, j;
- NDBTAB *tab= (NDBTAB*)tab_par;
NDBTAB::FragmentType ftype= NDBTAB::UserDefined;
partition_element *part_elem;
- bool first= TRUE;
- uint tot_ts_name_len;
List_iterator<partition_element> part_it(part_info->partitions);
int error;
DBUG_ENTER("ha_ndbcluster::set_up_partition_info");
@@ -13824,7 +13822,7 @@ uint ha_ndbcluster::set_up_partition_inf
for (i= 0; i < part_info->part_field_list.elements; i++)
{
- NDBCOL *col= tab->getColumn(fields[i]->field_index);
+ NDBCOL *col= ndbtab.getColumn(fields[i]->field_index);
DBUG_PRINT("info",("setting dist key on %s", col->getName()));
col->setPartitionKey(TRUE);
}
@@ -13856,25 +13854,24 @@ uint ha_ndbcluster::set_up_partition_inf
col.setNullable(FALSE);
col.setPrimaryKey(FALSE);
col.setAutoIncrement(FALSE);
- tab->addColumn(col);
+ ndbtab.addColumn(col);
if (part_info->part_type == RANGE_PARTITION)
{
- if ((error= set_range_data((void*)tab, part_info)))
+ if ((error= set_range_data(part_info, ndbtab)))
{
DBUG_RETURN(error);
}
}
else if (part_info->part_type == LIST_PARTITION)
{
- if ((error= set_list_data((void*)tab, part_info)))
+ if ((error= set_list_data(part_info, ndbtab)))
{
DBUG_RETURN(error);
}
}
}
- tab->setFragmentType(ftype);
+ ndbtab.setFragmentType(ftype);
i= 0;
- tot_ts_name_len= 0;
do
{
uint ng;
@@ -13897,13 +13894,12 @@ uint ha_ndbcluster::set_up_partition_inf
frag_data[fd_index++]= ng;
} while (++j < partition_info_num_subparts(part_info));
}
- first= FALSE;
} while (++i < partition_info_num_parts(part_info));
const bool use_default_num_parts =
partition_info_use_default_num_partitions(part_info);
- tab->setDefaultNoPartitionsFlag(use_default_num_parts);
- tab->setLinearFlag(part_info->linear_hash_ind);
+ ndbtab.setDefaultNoPartitionsFlag(use_default_num_parts);
+ ndbtab.setLinearFlag(part_info->linear_hash_ind);
{
ha_rows max_rows= table_share->max_rows;
ha_rows min_rows= table_share->min_rows;
@@ -13911,12 +13907,12 @@ uint ha_ndbcluster::set_up_partition_inf
max_rows= min_rows;
if (max_rows != (ha_rows)0) /* default setting, don't set fragmentation */
{
- tab->setMaxRows(max_rows);
- tab->setMinRows(min_rows);
+ ndbtab.setMaxRows(max_rows);
+ ndbtab.setMinRows(min_rows);
}
}
- tab->setFragmentCount(fd_index);
- tab->setFragmentData(frag_data, fd_index);
+ ndbtab.setFragmentCount(fd_index);
+ ndbtab.setFragmentData(frag_data, fd_index);
DBUG_RETURN(0);
}
=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h 2011-03-15 14:03:56 +0000
+++ b/sql/ha_ndbcluster.h 2011-04-19 07:55:56 +0000
@@ -640,11 +640,12 @@ private:
bool has_null_in_unique_index(uint idx_no) const;
bool check_index_fields_not_null(KEY *key_info);
- uint set_up_partition_info(partition_info *part_info,
- TABLE *table,
- void *tab);
- int set_range_data(void *tab, partition_info* part_info);
- int set_list_data(void *tab, partition_info* part_info);
+ int set_up_partition_info(partition_info *part_info,
+ NdbDictionary::Table&) const;
+ int set_range_data(const partition_info* part_info,
+ NdbDictionary::Table&) const;
+ int set_list_data(const partition_info* part_info,
+ NdbDictionary::Table&) const;
int ndb_pk_update_row(THD *thd,
const uchar *old_data, uchar *new_data,
uint32 old_part_id);
No bundle (reason: revision is a merge).| Thread |
|---|
| • bzr commit into mysql-5.1-telco-7.1 branch (magnus.blaudd:4170) | Magnus Blåudd | 19 Apr |