summaryrefslogtreecommitdiff
path: root/sql/ha_partition.h
diff options
context:
space:
mode:
authorV Narayanan <v.narayanan@sun.com>2009-09-04 09:27:11 +0530
committerV Narayanan <v.narayanan@sun.com>2009-09-04 09:27:11 +0530
commit097023fee7ae0d14a5357a2c553bee4a0f21e61a (patch)
tree0e345e3057ba85d121432059d70f4f519fe4fa99 /sql/ha_partition.h
parent73a5527e466c77fbd494337336ce3cac0c0e8c44 (diff)
downloadmariadb-git-097023fee7ae0d14a5357a2c553bee4a0f21e61a.tar.gz
Bug#45823 Assertion failure in file row/row0mysql.c line 1386
Inserting a negative value in the autoincrement column of a partitioned innodb table was causing the value of the auto increment counter to wrap around into a very large positive value. The consequences are the same as if a very large positive value was inserted into a column, e.g. reduced autoincrement range, failure to read autoincrement counter. The current patch ensures that before calculating the next auto increment value, the current value is within the positive maximum allowed limit.
Diffstat (limited to 'sql/ha_partition.h')
-rw-r--r--sql/ha_partition.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index 8a81a759e2a..d0301e24a93 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -936,9 +936,11 @@ private:
auto_increment_lock= FALSE;
}
}
- virtual void set_auto_increment_if_higher(const ulonglong nr)
+ virtual void set_auto_increment_if_higher(Field *field)
{
HA_DATA_PARTITION *ha_data= (HA_DATA_PARTITION*) table_share->ha_data;
+ ulonglong nr= (((Field_num*) field)->unsigned_flag ||
+ field->val_int() > 0) ? field->val_int() : 0;
lock_auto_increment();
DBUG_ASSERT(ha_data->auto_inc_initialized == TRUE);
/* must check when the mutex is taken */