summaryrefslogtreecommitdiff
path: root/sql/ha_partition.cc
diff options
context:
space:
mode:
authorSatya B <satya.bn@sun.com>2009-07-08 17:41:34 +0530
committerSatya B <satya.bn@sun.com>2009-07-08 17:41:34 +0530
commit02e70f1691bdbd9001e4d17b69606624f1f1fa39 (patch)
treee9c57ad4b1bc6dc0c37c1b2d26c04ff1bf3a12fe /sql/ha_partition.cc
parent5069a3e9ef20db76652cb63a2124bb63b30b6ff4 (diff)
downloadmariadb-git-02e70f1691bdbd9001e4d17b69606624f1f1fa39.tar.gz
Bug#35111 - Truncate a MyISAM partitioned table does not reset
the auto_increment value This is an alternative patch that instead of allowing RECREATE TABLE on TRUNCATE TABLE it implements reset_auto_increment that is called after delete_all_rows. Note: this bug was fixed by Mattias Jonsson: Pusing this patch: http://lists.mysql.com/commits/70370 mysql-test/suite/parts/r/partition_auto_increment_memory.result: Bug#35111: Truncate a MyISAM partitioned table does not reset the auto_increment value mysql-test/suite/parts/r/partition_auto_increment_myisam.result: Bug#35111: Truncate a MyISAM partitioned table does not reset the auto_increment value sql/ha_partition.cc: Bug#35111: Truncate a MyISAM partitioned table does not reset the auto_increment value Added reset_auto_increment, to be used after delete_all_rows to simulate truncate. storage/heap/ha_heap.cc: Bug#35111: Truncate a MyISAM partitioned table does not reset the auto_increment value Added reset_auto_increment, to be used after delete_all_rows to simulate truncate storage/heap/ha_heap.h: Bug#35111: Truncate a MyISAM partitioned table does not reset the auto_increment value Added reset_auto_increment, to be used after delete_all_rows to simulate truncate storage/myisam/ha_myisam.cc: Bug#35111: Truncate a MyISAM partitioned table does not reset the auto_increment value Added reset_auto_increment, to be used after delete_all_rows to simulate truncate. storage/myisam/ha_myisam.h: Bug#35111: Truncate a MyISAM partitioned table does not reset the auto_increment value Added reset_auto_increment, to be used after delete_all_rows to simulate truncate.
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r--sql/ha_partition.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 67bc3156260..74742f58028 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -3179,6 +3179,7 @@ int ha_partition::delete_row(const uchar *buf)
int ha_partition::delete_all_rows()
{
int error;
+ bool truncate= FALSE;
handler **file;
THD *thd= ha_thd();
DBUG_ENTER("ha_partition::delete_all_rows");
@@ -3190,12 +3191,16 @@ int ha_partition::delete_all_rows()
ha_data->next_auto_inc_val= 0;
ha_data->auto_inc_initialized= FALSE;
unlock_auto_increment();
+ truncate= TRUE;
}
file= m_file;
do
{
if ((error= (*file)->ha_delete_all_rows()))
DBUG_RETURN(error);
+ /* Ignore the error */
+ if (truncate)
+ (void) (*file)->ha_reset_auto_increment(0);
} while (*(++file));
DBUG_RETURN(0);
}