summaryrefslogtreecommitdiff
path: root/sql/ha_partition.h
diff options
context:
space:
mode:
authorMattias Jonsson <mattias.jonsson@oracle.com>2011-04-20 17:52:33 +0200
committerMattias Jonsson <mattias.jonsson@oracle.com>2011-04-20 17:52:33 +0200
commitbd92ea43116b8ce606de5e6fc825e1a8b87a7740 (patch)
tree6909873a2b00805bf2a43dffb077f8115662e92f /sql/ha_partition.h
parente0887df8e1127c0f1410b9d4ad61647cb5f93be2 (diff)
downloadmariadb-git-bd92ea43116b8ce606de5e6fc825e1a8b87a7740.tar.gz
Bug#11766249 bug#59316: PARTITIONING AND INDEX_MERGE MEMORY LEAK
Update for previous patch according to reviewers comments. Updated the constructors for ha_partitions to use the common init_handler_variables functions Added use of defines for size and offset to get better readability for the code that reads and writes the .par file. Also refactored the get_from_handler_file function.
Diffstat (limited to 'sql/ha_partition.h')
-rw-r--r--sql/ha_partition.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index a38d56af8ff..cd90c4cc1d5 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -55,6 +55,16 @@ typedef struct st_ha_data_partition
HA_DUPLICATE_POS | \
HA_CAN_SQL_HANDLER | \
HA_CAN_INSERT_DELAYED)
+
+/* First 4 bytes in the .par file is the number of 32-bit words in the file */
+#define PAR_WORD_SIZE 4
+/* offset to the .par file checksum */
+#define PAR_CHECKSUM_OFFSET 4
+/* offset to the total number of partitions */
+#define PAR_NUM_PARTS_OFFSET 8
+/* offset to the engines array */
+#define PAR_ENGINES_OFFSET 12
+
class ha_partition :public handler
{
private:
@@ -71,7 +81,7 @@ private:
/* Data for the partition handler */
int m_mode; // Open mode
uint m_open_test_lock; // Open test_if_locked
- char *m_file_buffer; // Buffer with names
+ char *m_file_buffer; // Content of the .par file
char *m_name_buffer_ptr; // Pointer to first partition name
plugin_ref *m_engine_array; // Array of types of the handlers
handler **m_file; // Array of references to handler inst.
@@ -281,7 +291,10 @@ private:
And one method to read it in.
*/
bool create_handler_file(const char *name);
- bool get_from_handler_file(const char *name, MEM_ROOT *mem_root, bool clone);
+ bool setup_engine_array(MEM_ROOT *mem_root);
+ bool read_par_file(const char *name);
+ bool get_from_handler_file(const char *name, MEM_ROOT *mem_root,
+ bool is_clone);
bool new_handlers_from_part_info(MEM_ROOT *mem_root);
bool create_handlers(MEM_ROOT *mem_root);
void clear_handler_file();