summaryrefslogtreecommitdiff
path: root/storage/archive
diff options
context:
space:
mode:
authorunknown <holyfoot/hf@mysql.com/hfmain.(none)>2007-12-06 16:39:42 +0400
committerunknown <holyfoot/hf@mysql.com/hfmain.(none)>2007-12-06 16:39:42 +0400
commitb6c0c1754c5d378de3d37ca02b21df7dfaa3b229 (patch)
tree1262241315c1aab40ae58d6b903e3ed0cfdbe98b /storage/archive
parentd742b9cb7d6ddbaa882df365ab3c4c656fc20d95 (diff)
downloadmariadb-git-b6c0c1754c5d378de3d37ca02b21df7dfaa3b229.tar.gz
Bug #32247 Test reports wrong value of "AUTO_INCREMENT" (on a partitioned InnoDB table).
ha_partition::update_create_info() just calls update_create_info of a first partition, so only get the autoincrement maximum of the first partition, so SHOW CREATE TABLE can show small AUTO_INCREMENT parameters. Fixed by implementing ha_partition::update_create_info() in a way other handlers work. HA_ARCHIVE:stats.auto_increment handling made consistent with other engines mysql-test/r/archive.result: Bug #32247 Test reports wrong value of "AUTO_INCREMENT" (on a partitioned InnoDB table). test result fixed mysql-test/r/partition.result: Bug #32247 Test reports wrong value of "AUTO_INCREMENT" (on a partitioned InnoDB table). test result mysql-test/suite/rpl/r/rpl_innodb_bug28430.result: Bug #32247 Test reports wrong value of "AUTO_INCREMENT" (on a partitioned InnoDB table). test result fixed mysql-test/t/partition.test: Bug #32247 Test reports wrong value of "AUTO_INCREMENT" (on a partitioned InnoDB table). test added as rpl_innodb_bug28430 is INNOBASE specific while the bug is not sql/ha_partition.cc: Bug #32247 Test reports wrong value of "AUTO_INCREMENT" (on a partitioned InnoDB table). ha_partition::update_create_info() implemented storage/archive/ha_archive.cc: Bug #32247 Test reports wrong value of "AUTO_INCREMENT" (on a partitioned InnoDB table). ha_archive.stats.auto_increment now contains next (not last used) value of auto_increment to be consistent with other engines
Diffstat (limited to 'storage/archive')
-rw-r--r--storage/archive/ha_archive.cc37
1 files changed, 14 insertions, 23 deletions
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index 84298e785d1..967e315d4a4 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -357,7 +357,7 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc)
{
DBUG_RETURN(NULL);
}
- stats.auto_increment_value= archive_tmp.auto_increment;
+ stats.auto_increment_value= archive_tmp.auto_increment + 1;
share->rows_recorded= (ha_rows)archive_tmp.rows;
share->crashed= archive_tmp.dirty;
azclose(&archive_tmp);
@@ -586,9 +586,7 @@ int ha_archive::create(const char *name, TABLE *table_arg,
DBUG_ENTER("ha_archive::create");
- stats.auto_increment_value= (create_info->auto_increment_value ?
- create_info->auto_increment_value -1 :
- (ulonglong) 0);
+ stats.auto_increment_value= create_info->auto_increment_value;
for (uint key= 0; key < table_arg->s->keys; key++)
{
@@ -673,7 +671,8 @@ int ha_archive::create(const char *name, TABLE *table_arg,
Yes you need to do this, because the starting value
for the autoincrement may not be zero.
*/
- create_stream.auto_increment= stats.auto_increment_value;
+ create_stream.auto_increment= stats.auto_increment_value ?
+ stats.auto_increment_value - 1 : 0;
if (azclose(&create_stream))
{
error= errno;
@@ -871,8 +870,8 @@ int ha_archive::write_row(uchar *buf)
else
{
if (temp_auto > share->archive_write.auto_increment)
- stats.auto_increment_value= share->archive_write.auto_increment=
- temp_auto;
+ stats.auto_increment_value=
+ (share->archive_write.auto_increment= temp_auto) + 1;
}
}
@@ -896,7 +895,7 @@ void ha_archive::get_auto_increment(ulonglong offset, ulonglong increment,
ulonglong *first_value,
ulonglong *nb_reserved_values)
{
- *nb_reserved_values= 1;
+ *nb_reserved_values= ULONGLONG_MAX;
*first_value= share->archive_write.auto_increment + 1;
}
@@ -1315,7 +1314,8 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt)
if (!rc)
{
share->rows_recorded= 0;
- stats.auto_increment_value= share->archive_write.auto_increment= 0;
+ stats.auto_increment_value= 1;
+ share->archive_write.auto_increment= 0;
my_bitmap_map *org_bitmap= dbug_tmp_use_all_columns(table, table->read_set);
while (!(rc= get_row(&archive, table->record[0])))
@@ -1332,8 +1332,8 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt)
(ulonglong) field->val_int(table->record[0] +
field->offset(table->record[0]));
if (share->archive_write.auto_increment < auto_value)
- stats.auto_increment_value= share->archive_write.auto_increment=
- auto_value;
+ stats.auto_increment_value=
+ (share->archive_write.auto_increment= auto_value) + 1;
}
}
@@ -1418,18 +1418,9 @@ void ha_archive::update_create_info(HA_CREATE_INFO *create_info)
DBUG_ENTER("ha_archive::update_create_info");
ha_archive::info(HA_STATUS_AUTO);
- if (create_info->used_fields & HA_CREATE_USED_AUTO)
+ if (!(create_info->used_fields & HA_CREATE_USED_AUTO))
{
- /*
- Internally Archive keeps track of last used, not next used.
- To make the output look like MyISAM we add 1 here.
-
- This is not completely compatible with MYISAM though, since
- MyISAM will record on "SHOW CREATE TABLE" the last position,
- where we will report the original position the table was
- created with.
- */
- create_info->auto_increment_value= stats.auto_increment_value + 1;
+ create_info->auto_increment_value= stats.auto_increment_value;
}
if (!(my_readlink(share->real_path, share->data_file_name, MYF(0))))
@@ -1494,7 +1485,7 @@ int ha_archive::info(uint flag)
pthread_mutex_lock(&share->mutex);
azflush(&archive, Z_SYNC_FLUSH);
pthread_mutex_unlock(&share->mutex);
- stats.auto_increment_value= archive.auto_increment;
+ stats.auto_increment_value= archive.auto_increment + 1;
}
DBUG_RETURN(0);