summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorRich Prohaska <prohaska@tokutek.com>2014-02-12 15:07:44 -0500
committerRich Prohaska <prohaska@tokutek.com>2014-02-12 15:07:44 -0500
commitbc07ccf8a7844f4a2bfb306713e80a91744d74d8 (patch)
tree8e2f1b2013c94e966c83c7899283768ab75b4569 /storage
parentd06d73633d2c79c9114979fb4306420edb885cbd (diff)
downloadmariadb-git-bc07ccf8a7844f4a2bfb306713e80a91744d74d8.tar.gz
#182 fix dbt array memory leak
Diffstat (limited to 'storage')
-rw-r--r--storage/tokudb/ha_tokudb.cc24
-rw-r--r--storage/tokudb/hatoku_defines.h24
2 files changed, 30 insertions, 18 deletions
diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc
index 7c69ea5b0f7..8b0d8523057 100644
--- a/storage/tokudb/ha_tokudb.cc
+++ b/storage/tokudb/ha_tokudb.cc
@@ -1197,9 +1197,8 @@ static int generate_row_for_put(
);
}
-ha_tokudb::ha_tokudb(handlerton * hton, TABLE_SHARE * table_arg):handler(hton, table_arg)
- // flags defined in sql\handler.h
-{
+ha_tokudb::ha_tokudb(handlerton * hton, TABLE_SHARE * table_arg):handler(hton, table_arg) {
+ TOKUDB_HANDLER_DBUG_ENTER("");
share = NULL;
int_table_flags = HA_REC_NOT_IN_SEQ | HA_NULL_IN_KEY | HA_CAN_INDEX_BLOBS | HA_PRIMARY_KEY_IN_READ_INDEX | HA_PRIMARY_KEY_REQUIRED_FOR_POSITION |
HA_FILE_BASED | HA_AUTO_PART_KEY | HA_TABLE_SCAN_ON_INDEX | HA_CAN_WRITE_DURING_OPTIMIZE;
@@ -1256,9 +1255,18 @@ ha_tokudb::ha_tokudb(handlerton * hton, TABLE_SHARE * table_arg):handler(hton, t
tokudb_active_index = MAX_KEY;
invalidate_icp();
trx_handler_list.data = this;
+ TOKUDB_HANDLER_DBUG_VOID_RETURN;
}
ha_tokudb::~ha_tokudb() {
+ TOKUDB_HANDLER_DBUG_ENTER("");
+ for (uint32_t i = 0; i < sizeof(mult_key_dbt_array)/sizeof(mult_key_dbt_array[0]); i++) {
+ toku_dbt_array_destroy(&mult_key_dbt_array[i]);
+ }
+ for (uint32_t i = 0; i < sizeof(mult_rec_dbt_array)/sizeof(mult_rec_dbt_array[0]); i++) {
+ toku_dbt_array_destroy(&mult_rec_dbt_array[i]);
+ }
+ TOKUDB_HANDLER_DBUG_VOID_RETURN;
}
//
@@ -3010,7 +3018,7 @@ void ha_tokudb::init_hidden_prim_key_info() {
share->status |= STATUS_PRIMARY_KEY_INIT;
}
tokudb_pthread_mutex_unlock(&share->mutex);
- DBUG_VOID_RETURN;
+ TOKUDB_HANDLER_DBUG_VOID_RETURN;
}
@@ -3293,7 +3301,7 @@ void ha_tokudb::start_bulk_insert(ha_rows rows) {
share->try_table_lock = false;
tokudb_pthread_mutex_unlock(&share->mutex);
}
- DBUG_VOID_RETURN;
+ TOKUDB_HANDLER_DBUG_VOID_RETURN;
}
//
@@ -4649,7 +4657,7 @@ void ha_tokudb::read_key_only(uchar * buf, uint keynr, DBT const *found_key) {
if (!(hidden_primary_key && keynr == primary_key)) {
unpack_key(buf, found_key, keynr);
}
- DBUG_VOID_RETURN;
+ TOKUDB_HANDLER_DBUG_VOID_RETURN;
}
//
@@ -5821,7 +5829,7 @@ void ha_tokudb::position(const uchar * record) {
//
memcpy(ref, &key.size, sizeof(uint32_t));
}
- DBUG_VOID_RETURN;
+ TOKUDB_HANDLER_DBUG_VOID_RETURN;
}
//
@@ -7521,7 +7529,7 @@ void ha_tokudb::get_auto_increment(ulonglong offset, ulonglong increment, ulongl
*first_value = nr;
*nb_reserved_values = nb_desired_values;
tokudb_pthread_mutex_unlock(&share->mutex);
- DBUG_VOID_RETURN;
+ TOKUDB_HANDLER_DBUG_VOID_RETURN;
}
bool ha_tokudb::is_optimize_blocking() {
diff --git a/storage/tokudb/hatoku_defines.h b/storage/tokudb/hatoku_defines.h
index 65b9e960a6b..3e3e0051ba3 100644
--- a/storage/tokudb/hatoku_defines.h
+++ b/storage/tokudb/hatoku_defines.h
@@ -215,23 +215,22 @@ extern ulong tokudb_debug;
#define TOKUDB_DEBUG_CHECK (1<<14)
#define TOKUDB_DEBUG_ANALYZE (1<<15)
-#define TOKUDB_TRACE(f, ...) \
- fprintf(stderr, "%u %s:%u %s " f "\n", my_tid(), __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__);
+#define TOKUDB_TRACE(f, ...) { \
+ fprintf(stderr, "%u %s:%u %s " f "\n", my_tid(), __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); \
+}
static inline unsigned int my_tid() {
return (unsigned int)toku_os_gettid();
}
-#define TOKUDB_DBUG_ENTER(f, ...) \
-{ \
+#define TOKUDB_DBUG_ENTER(f, ...) { \
if (tokudb_debug & TOKUDB_DEBUG_ENTER) { \
TOKUDB_TRACE(f, ##__VA_ARGS__); \
} \
} \
DBUG_ENTER(__FUNCTION__);
-#define TOKUDB_DBUG_RETURN(r) \
-{ \
+#define TOKUDB_DBUG_RETURN(r) { \
int rr = (r); \
if ((tokudb_debug & TOKUDB_DEBUG_RETURN) || (rr != 0 && (tokudb_debug & TOKUDB_DEBUG_ERROR))) { \
TOKUDB_TRACE("return %d", rr); \
@@ -242,16 +241,14 @@ static inline unsigned int my_tid() {
#define TOKUDB_HANDLER_TRACE(f, ...) \
fprintf(stderr, "%u %p %s:%u ha_tokudb::%s " f "\n", my_tid(), this, __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__);
-#define TOKUDB_HANDLER_DBUG_ENTER(f, ...) \
-{ \
+#define TOKUDB_HANDLER_DBUG_ENTER(f, ...) { \
if (tokudb_debug & TOKUDB_DEBUG_ENTER) { \
TOKUDB_HANDLER_TRACE(f, ##__VA_ARGS__); \
} \
} \
DBUG_ENTER(__FUNCTION__);
-#define TOKUDB_HANDLER_DBUG_RETURN(r) \
-{ \
+#define TOKUDB_HANDLER_DBUG_RETURN(r) { \
int rr = (r); \
if ((tokudb_debug & TOKUDB_DEBUG_RETURN) || (rr != 0 && (tokudb_debug & TOKUDB_DEBUG_ERROR))) { \
TOKUDB_HANDLER_TRACE("return %d", rr); \
@@ -259,6 +256,13 @@ static inline unsigned int my_tid() {
DBUG_RETURN(rr); \
}
+#define TOKUDB_HANDLER_DBUG_VOID_RETURN { \
+ if (tokudb_debug & TOKUDB_DEBUG_RETURN) { \
+ TOKUDB_HANDLER_TRACE("return"); \
+ } \
+ DBUG_VOID_RETURN; \
+}
+
#define TOKUDB_DBUG_DUMP(s, p, len) \
{ \
TOKUDB_TRACE("%s", s); \