summaryrefslogtreecommitdiff
path: root/sql/ha_partition.h
diff options
context:
space:
mode:
authorMattias Jonsson <mattias.jonsson@oracle.com>2010-10-01 13:39:04 +0200
committerMattias Jonsson <mattias.jonsson@oracle.com>2010-10-01 13:39:04 +0200
commit814fbc5b6f2bf40c91bfb01dfa1bcf711af01d76 (patch)
tree7fe8671cad7f06c8a5522b17b3dedf8bd449e3d2 /sql/ha_partition.h
parent8822ecff2dea2e83fdad84d7a9307e8aa5905bce (diff)
downloadmariadb-git-814fbc5b6f2bf40c91bfb01dfa1bcf711af01d76.tar.gz
Bug#51851: Server with SBR locks mutex twice on
LOAD DATA into partitioned MyISAM table Problem was that both partitioning and myisam used the same table_share->mutex for different protections (auto inc and repair). Solved by adding a specific mutex for the partitioning auto_increment. Also adding destroying the ha_data structure in free_table_share (which is to be propagated into 5.5). This is a 5.1 ONLY patch, already fixed in 5.5+.
Diffstat (limited to 'sql/ha_partition.h')
-rw-r--r--sql/ha_partition.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index e3dc7d17c6d..cb5440a0b69 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -44,6 +44,7 @@ typedef struct st_partition_share
typedef struct st_ha_data_partition
{
ulonglong next_auto_inc_val; /**< first non reserved value */
+ pthread_mutex_t LOCK_auto_inc;
bool auto_inc_initialized;
} HA_DATA_PARTITION;
@@ -944,8 +945,9 @@ private:
DBUG_ASSERT(table_share->ha_data && !auto_increment_lock);
if(table_share->tmp_table == NO_TMP_TABLE)
{
+ HA_DATA_PARTITION *ha_data= (HA_DATA_PARTITION*) table_share->ha_data;
auto_increment_lock= TRUE;
- pthread_mutex_lock(&table_share->mutex);
+ pthread_mutex_lock(&ha_data->LOCK_auto_inc);
}
}
virtual void unlock_auto_increment()
@@ -958,7 +960,8 @@ private:
*/
if(auto_increment_lock && !auto_increment_safe_stmt_log_lock)
{
- pthread_mutex_unlock(&table_share->mutex);
+ HA_DATA_PARTITION *ha_data= (HA_DATA_PARTITION*) table_share->ha_data;
+ pthread_mutex_unlock(&ha_data->LOCK_auto_inc);
auto_increment_lock= FALSE;
}
}