Commit 872ed8ab authored by unknown's avatar unknown

BUG#19502: Enable/Disable index routines not working for partitioned handlers

Implemented enable/disable index routines for partition handler


mysql-test/r/partition.result:
  New test case
mysql-test/t/partition.test:
  New test case
sql/ha_partition.cc:
  Implemented enable/disable index routines for partition handler
sql/ha_partition.h:
  Implemented enable/disable index routines for partition handler
parent 3065eeb3
...@@ -886,4 +886,8 @@ s1 ...@@ -886,4 +886,8 @@ s1
2 2
3 3
drop table t1; drop table t1;
CREATE TABLE t1 (a int, index(a)) PARTITION BY KEY(a);
ALTER TABLE t1 DISABLE KEYS;
ALTER TABLE t1 ENABLE KEYS;
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
...@@ -1009,4 +1009,11 @@ select auto_increment from information_schema.tables where table_name='t1'; ...@@ -1009,4 +1009,11 @@ select auto_increment from information_schema.tables where table_name='t1';
select * from t1; select * from t1;
drop table t1; drop table t1;
#
# BUG 19502: ENABLE/DISABLE Keys don't work for partitioned tables
#
CREATE TABLE t1 (a int, index(a)) PARTITION BY KEY(a);
ALTER TABLE t1 DISABLE KEYS;
ALTER TABLE t1 ENABLE KEYS;
DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -5318,6 +5318,82 @@ void ha_partition::init_table_handle_for_HANDLER() ...@@ -5318,6 +5318,82 @@ void ha_partition::init_table_handle_for_HANDLER()
} }
/****************************************************************************
MODULE enable/disable indexes
****************************************************************************/
/*
Disable indexes for a while
SYNOPSIS
disable_indexes()
mode Mode
RETURN VALUES
0 Success
!= 0 Error
*/
int ha_partition::disable_indexes(uint mode)
{
handler **file;
int error= 0;
for (file= m_file; *file; file++)
{
if ((error= (*file)->disable_indexes(mode)))
break;
}
return error;
}
/*
Enable indexes again
SYNOPSIS
enable_indexes()
mode Mode
RETURN VALUES
0 Success
!= 0 Error
*/
int ha_partition::enable_indexes(uint mode)
{
handler **file;
int error= 0;
for (file= m_file; *file; file++)
{
if ((error= (*file)->enable_indexes(mode)))
break;
}
return error;
}
/*
Check if indexes are disabled
SYNOPSIS
indexes_are_disabled()
RETURN VALUES
0 Indexes are enabled
!= 0 Indexes are disabled
*/
int ha_partition::indexes_are_disabled(void)
{
handler **file;
int error= 0;
for (file= m_file; *file; file++)
{
if ((error= (*file)->indexes_are_disabled()))
break;
}
return error;
}
/**************************************************************************** /****************************************************************************
MODULE Partition Share MODULE Partition Share
****************************************************************************/ ****************************************************************************/
......
...@@ -938,17 +938,18 @@ class ha_partition :public handler ...@@ -938,17 +938,18 @@ class ha_partition :public handler
virtual uint checksum() const; virtual uint checksum() const;
virtual bool is_crashed() const; virtual bool is_crashed() const;
virtual bool auto_repair() const; virtual bool auto_repair() const;
*/
/*
------------------------------------------------------------------------- -------------------------------------------------------------------------
MODULE enable/disable indexes MODULE enable/disable indexes
------------------------------------------------------------------------- -------------------------------------------------------------------------
Enable/Disable Indexes are not supported currently (Heap, MyISAM) Enable/Disable Indexes are only supported by HEAP and MyISAM.
This means that the following methods are not implemented:
------------------------------------------------------------------------- -------------------------------------------------------------------------
*/
virtual int disable_indexes(uint mode); virtual int disable_indexes(uint mode);
virtual int enable_indexes(uint mode); virtual int enable_indexes(uint mode);
virtual int indexes_are_disabled(void); virtual int indexes_are_disabled(void);
*/
/* /*
------------------------------------------------------------------------- -------------------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment