summaryrefslogtreecommitdiff
path: root/sql/ha_partition.h
diff options
context:
space:
mode:
authorMattias Jonsson <mattias.jonsson@sun.com>2008-11-05 20:44:19 +0100
committerMattias Jonsson <mattias.jonsson@sun.com>2008-11-05 20:44:19 +0100
commit7c5d066b397b88c9c867544d6ea034c4242d8cef (patch)
tree323a2990c7c47dcff5b8bfa65bfb5f3c89bac5d1 /sql/ha_partition.h
parent50baafeb8bb4da172e3738512c8aa8c7ae733db6 (diff)
parentb72d1507db95326119afdcb4764fa457a7f888b7 (diff)
downloadmariadb-git-7c5d066b397b88c9c867544d6ea034c4242d8cef.tar.gz
merge
Diffstat (limited to 'sql/ha_partition.h')
-rw-r--r--sql/ha_partition.h50
1 files changed, 45 insertions, 5 deletions
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index 9b2a496507c..1f684b80f6c 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -48,6 +48,13 @@ typedef struct st_ha_data_partition
} HA_DATA_PARTITION;
#define PARTITION_BYTES_IN_POS 2
+#define PARTITION_ENABLED_TABLE_FLAGS (HA_FILE_BASED | HA_REC_NOT_IN_SEQ)
+#define PARTITION_DISABLED_TABLE_FLAGS (HA_CAN_GEOMETRY | \
+ HA_CAN_FULLTEXT | \
+ HA_DUPLICATE_POS | \
+ HA_CAN_SQL_HANDLER | \
+ HA_CAN_INSERT_DELAYED | \
+ HA_PRIMARY_KEY_REQUIRED_FOR_POSITION)
class ha_partition :public handler
{
private:
@@ -92,8 +99,15 @@ private:
for this since the MySQL Server sometimes allocating the handler object
without freeing them.
*/
- longlong m_table_flags;
ulong m_low_byte_first;
+ enum enum_handler_status
+ {
+ handler_not_initialized= 0,
+ handler_initialized,
+ handler_opened,
+ handler_closed
+ };
+ enum_handler_status m_handler_status;
uint m_reorged_parts; // Number of reorganised parts
uint m_tot_parts; // Total number of partitions;
@@ -189,7 +203,7 @@ public:
enable later calls of the methods to retrieve constants from the under-
lying handlers. Returns false if not successful.
*/
- bool initialise_partition(MEM_ROOT *mem_root);
+ bool initialize_partition(MEM_ROOT *mem_root);
/*
-------------------------------------------------------------------------
@@ -594,6 +608,8 @@ public:
The partition handler will support whatever the underlying handlers
support except when specifically mentioned below about exceptions
to this rule.
+ NOTE: This cannot be cached since it can depend on TRANSACTION ISOLATION
+ LEVEL which is dynamic, see bug#39084.
HA_READ_RND_SAME:
Not currently used. (Means that the handler supports the rnd_same() call)
@@ -718,9 +734,33 @@ public:
transfer those calls into index_read and other calls in the
index scan module.
(NDB)
+
+ HA_PRIMARY_KEY_REQUIRED_FOR_POSITION:
+ Does the storage engine need a PK for position?
+ Used with hidden primary key in InnoDB.
+ Hidden primary keys cannot be supported by partitioning, since the
+ partitioning expressions columns must be a part of the primary key.
+ (InnoDB)
+
+ HA_FILE_BASED is always set for partition handler since we use a
+ special file for handling names of partitions, engine types.
+ HA_REC_NOT_IN_SEQ is always set for partition handler since we cannot
+ guarantee that the records will be returned in sequence.
+ HA_CAN_GEOMETRY, HA_CAN_FULLTEXT, HA_CAN_SQL_HANDLER, HA_DUPLICATE_POS,
+ HA_CAN_INSERT_DELAYED, HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is disabled
+ until further investigated.
*/
- virtual ulonglong table_flags() const
- { return m_table_flags; }
+ virtual Table_flags table_flags() const
+ {
+ DBUG_ENTER("ha_partition::table_flags");
+ if (m_handler_status < handler_initialized ||
+ m_handler_status >= handler_closed)
+ DBUG_RETURN(PARTITION_ENABLED_TABLE_FLAGS);
+ else
+ DBUG_RETURN((m_file[0]->ha_table_flags() &
+ ~(PARTITION_DISABLED_TABLE_FLAGS)) |
+ (PARTITION_ENABLED_TABLE_FLAGS));
+ }
/*
This is a bitmap of flags that says how the storage engine
@@ -903,7 +943,7 @@ public:
/*
-------------------------------------------------------------------------
- MODULE initialise handler for HANDLER call
+ MODULE initialize handler for HANDLER call
-------------------------------------------------------------------------
This method is a special InnoDB method called before a HANDLER query.
-------------------------------------------------------------------------