post merge fix

This commit is contained in:
Mattias Jonsson 2010-10-28 12:08:09 +02:00
parent f523b5771a
commit 1a9083b94a
2 changed files with 2 additions and 12 deletions

View file

@ -935,22 +935,16 @@ private:
/* lock already taken */ /* lock already taken */
if (auto_increment_safe_stmt_log_lock) if (auto_increment_safe_stmt_log_lock)
return; return;
#ifdef WITH_PARTITION_STORAGE_ENGINE
DBUG_ASSERT(table_share->ha_part_data && !auto_increment_lock); DBUG_ASSERT(table_share->ha_part_data && !auto_increment_lock);
#endif
if(table_share->tmp_table == NO_TMP_TABLE) if(table_share->tmp_table == NO_TMP_TABLE)
{ {
auto_increment_lock= TRUE; auto_increment_lock= TRUE;
#ifdef WITH_PARTITION_STORAGE_ENGINE
mysql_mutex_lock(&table_share->ha_part_data->LOCK_auto_inc); mysql_mutex_lock(&table_share->ha_part_data->LOCK_auto_inc);
#endif
} }
} }
virtual void unlock_auto_increment() virtual void unlock_auto_increment()
{ {
#ifdef WITH_PARTITION_STORAGE_ENGINE
DBUG_ASSERT(table_share->ha_part_data); DBUG_ASSERT(table_share->ha_part_data);
#endif
/* /*
If auto_increment_safe_stmt_log_lock is true, we have to keep the lock. If auto_increment_safe_stmt_log_lock is true, we have to keep the lock.
It will be set to false and thus unlocked at the end of the statement by It will be set to false and thus unlocked at the end of the statement by
@ -958,25 +952,19 @@ private:
*/ */
if(auto_increment_lock && !auto_increment_safe_stmt_log_lock) if(auto_increment_lock && !auto_increment_safe_stmt_log_lock)
{ {
#ifdef WITH_PARTITION_STORAGE_ENGINE
mysql_mutex_unlock(&table_share->ha_part_data->LOCK_auto_inc); mysql_mutex_unlock(&table_share->ha_part_data->LOCK_auto_inc);
#endif
auto_increment_lock= FALSE; auto_increment_lock= FALSE;
} }
} }
virtual void set_auto_increment_if_higher(Field *field) virtual void set_auto_increment_if_higher(Field *field)
{ {
#ifdef WITH_PARTITION_STORAGE_ENGINE
ulonglong nr= (((Field_num*) field)->unsigned_flag || ulonglong nr= (((Field_num*) field)->unsigned_flag ||
field->val_int() > 0) ? field->val_int() : 0; field->val_int() > 0) ? field->val_int() : 0;
#endif
lock_auto_increment(); lock_auto_increment();
#ifdef WITH_PARTITION_STORAGE_ENGINE
DBUG_ASSERT(table_share->ha_part_data->auto_inc_initialized == TRUE); DBUG_ASSERT(table_share->ha_part_data->auto_inc_initialized == TRUE);
/* must check when the mutex is taken */ /* must check when the mutex is taken */
if (nr >= table_share->ha_part_data->next_auto_inc_val) if (nr >= table_share->ha_part_data->next_auto_inc_val)
table_share->ha_part_data->next_auto_inc_val= nr + 1; table_share->ha_part_data->next_auto_inc_val= nr + 1;
#endif
unlock_auto_increment(); unlock_auto_increment();
} }

View file

@ -18,7 +18,9 @@
#include "sql_lex.h" // Sql_statement #include "sql_lex.h" // Sql_statement
#include "sql_admin.h" // Analyze/Check/.._table_statement #include "sql_admin.h" // Analyze/Check/.._table_statement
#include "sql_partition_admin.h" // Alter_table_*_partition #include "sql_partition_admin.h" // Alter_table_*_partition
#ifdef WITH_PARTITION_STORAGE_ENGINE
#include "ha_partition.h" // ha_partition #include "ha_partition.h" // ha_partition
#endif
#include "sql_base.h" // open_and_lock_tables #include "sql_base.h" // open_and_lock_tables
#ifndef WITH_PARTITION_STORAGE_ENGINE #ifndef WITH_PARTITION_STORAGE_ENGINE