Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-10-14 12:12:40+02:00, tomas@stripped +1 -0
WL#3682
- fix valgrind warning, write outside of allocated buffer
- solution to allocate 4 bytes extra to be used for TC selection
sql/ha_ndbcluster.cc@stripped, 2007-10-14 12:12:37+02:00, tomas@stripped +13 -8
WL#3682
- fix valgrind warning, write outside of allocated buffer
- solution to allocate 4 bytes extra to be used for TC selection
diff -Nrup a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
--- a/sql/ha_ndbcluster.cc 2007-10-13 08:52:33 +02:00
+++ b/sql/ha_ndbcluster.cc 2007-10-14 12:12:37 +02:00
@@ -904,6 +904,7 @@ ha_ndbcluster::set_partition_function_va
/* The partition function value is stored just after the hidden primary
key (if any). */
uint32 offset= offset_user_partition_function();
+ DBUG_ASSERT(offset + 4 <= table->s->reclength + m_extra_reclength);
memcpy(&row[offset], &func_value, 4);
}
@@ -1792,7 +1793,11 @@ ha_ndbcluster::add_table_ndb_record(NDBD
else
m_ndb_record_fragment= NULL;
- m_extra_reclength= size;
+ /*
+ allways allocate atleast 4 bytes extra that can be used to store
+ partion id for TC selection. See set_partition_function_value()
+ */
+ m_extra_reclength= size ? size : 4;
rec= ndb_get_table_statistics_ndbrecord(dict, m_table);
if (! rec)
@@ -3424,11 +3429,11 @@ int ha_ndbcluster::ndb_write_row(uchar *
bool primary_key_update,
bool batched_update)
{
- bool has_auto_increment;
- NdbTransaction *trans;
+ bool has_auto_increment, use_tc_selection;
NdbOperation *op;
THD *thd= table->in_use;
Thd_ndb *thd_ndb= m_thd_ndb;
+ NdbTransaction *trans= thd_ndb->trans;
uint32 part_id;
uchar *row;
bool need_execute;
@@ -3436,6 +3441,8 @@ int ha_ndbcluster::ndb_write_row(uchar *
DBUG_ENTER("ha_ndbcluster::ndb_write_row");
has_auto_increment= (table->next_number_field && record == table->record[0]);
+ use_tc_selection=
+ m_user_defined_partitioning || (m_use_partition_pruning && !trans);
if (has_auto_increment && table_share->primary_key != MAX_KEY)
{
@@ -3498,7 +3505,7 @@ int ha_ndbcluster::ndb_write_row(uchar *
{
DBUG_PRINT("info", ("Non-bulk insert."));
need_execute= TRUE;
- if (table_share->primary_key == MAX_KEY || m_user_defined_partitioning)
+ if (table_share->primary_key == MAX_KEY || use_tc_selection)
{
DBUG_PRINT("info", ("Getting single buffer for oversize record."));
row= copy_row_to_buffer(thd_ndb, record);
@@ -3534,9 +3541,9 @@ int ha_ndbcluster::ndb_write_row(uchar *
set_hidden_key(row, auto_value);
}
- if (m_user_defined_partitioning ||
- (m_use_partition_pruning && !thd_ndb->trans))
+ if (use_tc_selection)
{
+ DBUG_ASSERT(trans == 0);
longlong func_value= 0;
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
error= m_part_info->get_partition_id(m_part_info, &part_id, &func_value);
@@ -3560,8 +3567,6 @@ int ha_ndbcluster::ndb_write_row(uchar *
DBUG_RETURN(error);
}
}
- else
- trans= thd_ndb->trans;
DBUG_ASSERT(trans);
ha_statistic_increment(&SSV::ha_write_count);
| Thread |
|---|
| • bk commit into 5.1 tree (tomas:1.2637) | tomas | 14 Oct |