Commit 02ba9d61 authored by Sergey Vojtovich's avatar Sergey Vojtovich

Applying InnoDB plugin snashot

Detailed revision comments:

r6113 | vasil | 2009-10-29 18:15:50 +0200 (Thu, 29 Oct 2009) | 93 lines
branches/zip: Merge r5912:6112 from branches/5.1:

(after this merge the innodb-autoinc test starts to fail, but
I commit anyway because it would be easier to investigate the
failure this way)

  ------------------------------------------------------------------------
  r5952 | calvin | 2009-09-22 19:45:07 +0300 (Tue, 22 Sep 2009) | 7 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
  
  branches/5.1: fix bug#42383: Can't create table 'test.bug39438'
  
  For embedded server, MySQL may pass in full path, which is
  currently disallowed. It is needed to relax the condition by
  accepting full paths in the embedded case.
  
  Approved by: Heikki (on IM)
  ------------------------------------------------------------------------
  r6032 | vasil | 2009-10-01 15:55:49 +0300 (Thu, 01 Oct 2009) | 8 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
  
  branches/5.1:
  
  Fix Bug#38996 Race condition in ANALYZE TABLE
  
  by serializing ANALYZE TABLE inside InnoDB.
  
  Approved by:	Heikki (rb://175)
  
  ------------------------------------------------------------------------
  r6045 | jyang | 2009-10-08 02:27:08 +0300 (Thu, 08 Oct 2009) | 7 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
     A /branches/5.1/mysql-test/innodb_bug47777.result
     A /branches/5.1/mysql-test/innodb_bug47777.test
  
  branches/5.1: Fix bug #47777. Treat the Geometry data same as
  Binary BLOB in ha_innobase::store_key_val_for_row(), since the
  Geometry data is stored as Binary BLOB in Innodb.
  
  Review: rb://180 approved by Marko Makela.
  
  
  ------------------------------------------------------------------------
  r6051 | sunny | 2009-10-12 07:05:00 +0300 (Mon, 12 Oct 2009) | 6 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
     M /branches/5.1/mysql-test/innodb-autoinc.result
     M /branches/5.1/mysql-test/innodb-autoinc.test
  
  branches/5.1: Ignore negative values supplied by the user when calculating the
  next value to store in dict_table_t. Setting autoincrement columns top negative
  values is undefined behavior and this change should bring the behavior of
  InnoDB closer to what users expect. Added several tests to check.
  rb://162
  
  ------------------------------------------------------------------------
  r6052 | sunny | 2009-10-12 07:09:56 +0300 (Mon, 12 Oct 2009) | 4 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
     M /branches/5.1/mysql-test/innodb-autoinc.result
     M /branches/5.1/mysql-test/innodb-autoinc.test
  
  branches/5.1: Reset the statement level autoinc counter on ROLLBACK. Fix
  the test results too.
  rb://164
  
  ------------------------------------------------------------------------
  r6053 | sunny | 2009-10-12 07:37:49 +0300 (Mon, 12 Oct 2009) | 6 lines
  Changed paths:
     M /branches/5.1/handler/ha_innodb.cc
     M /branches/5.1/mysql-test/innodb-autoinc.result
     M /branches/5.1/mysql-test/innodb-autoinc.test
  
  branches/5.1: Copy the maximum AUTOINC value from the old table to the new
  table when MySQL does a CREATE INDEX ON T. This is required because MySQL
  does a table copy, rename and drops the old table.
  Fix Bug#47125: auto_increment start value is ignored if an index is created and engine=innodb
  rb://168
  
  ------------------------------------------------------------------------
  r6076 | vasil | 2009-10-14 19:30:12 +0300 (Wed, 14 Oct 2009) | 4 lines
  Changed paths:
     M /branches/5.1/row/row0mysql.c
  
  branches/5.1:
  
  Fix typo.
  
  ------------------------------------------------------------------------
parent 7559c6ae
...@@ -129,6 +129,7 @@ static ulong commit_threads = 0; ...@@ -129,6 +129,7 @@ static ulong commit_threads = 0;
static pthread_mutex_t commit_threads_m; static pthread_mutex_t commit_threads_m;
static pthread_cond_t commit_cond; static pthread_cond_t commit_cond;
static pthread_mutex_t commit_cond_m; static pthread_mutex_t commit_cond_m;
static pthread_mutex_t analyze_mutex;
static bool innodb_inited = 0; static bool innodb_inited = 0;
#define INSIDE_HA_INNOBASE_CC #define INSIDE_HA_INNOBASE_CC
...@@ -2251,6 +2252,7 @@ innobase_change_buffering_inited_ok: ...@@ -2251,6 +2252,7 @@ innobase_change_buffering_inited_ok:
pthread_mutex_init(&prepare_commit_mutex, MY_MUTEX_INIT_FAST); pthread_mutex_init(&prepare_commit_mutex, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&commit_threads_m, MY_MUTEX_INIT_FAST); pthread_mutex_init(&commit_threads_m, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&commit_cond_m, MY_MUTEX_INIT_FAST); pthread_mutex_init(&commit_cond_m, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&analyze_mutex, MY_MUTEX_INIT_FAST);
pthread_cond_init(&commit_cond, NULL); pthread_cond_init(&commit_cond, NULL);
innodb_inited= 1; innodb_inited= 1;
#ifdef MYSQL_DYNAMIC_PLUGIN #ifdef MYSQL_DYNAMIC_PLUGIN
...@@ -2305,6 +2307,7 @@ innobase_end( ...@@ -2305,6 +2307,7 @@ innobase_end(
pthread_mutex_destroy(&prepare_commit_mutex); pthread_mutex_destroy(&prepare_commit_mutex);
pthread_mutex_destroy(&commit_threads_m); pthread_mutex_destroy(&commit_threads_m);
pthread_mutex_destroy(&commit_cond_m); pthread_mutex_destroy(&commit_cond_m);
pthread_mutex_destroy(&analyze_mutex);
pthread_cond_destroy(&commit_cond); pthread_cond_destroy(&commit_cond);
} }
...@@ -2583,6 +2586,8 @@ innobase_rollback( ...@@ -2583,6 +2586,8 @@ innobase_rollback(
innobase_release_stat_resources(trx); innobase_release_stat_resources(trx);
trx->n_autoinc_rows = 0; /* Reset the number AUTO-INC rows required */
/* If we had reserved the auto-inc lock for some table (if /* If we had reserved the auto-inc lock for some table (if
we come here to roll back the latest SQL statement) we we come here to roll back the latest SQL statement) we
release it now before a possibly lengthy rollback */ release it now before a possibly lengthy rollback */
...@@ -3743,7 +3748,10 @@ ha_innobase::store_key_val_for_row( ...@@ -3743,7 +3748,10 @@ ha_innobase::store_key_val_for_row(
} else if (mysql_type == MYSQL_TYPE_TINY_BLOB } else if (mysql_type == MYSQL_TYPE_TINY_BLOB
|| mysql_type == MYSQL_TYPE_MEDIUM_BLOB || mysql_type == MYSQL_TYPE_MEDIUM_BLOB
|| mysql_type == MYSQL_TYPE_BLOB || mysql_type == MYSQL_TYPE_BLOB
|| mysql_type == MYSQL_TYPE_LONG_BLOB) { || mysql_type == MYSQL_TYPE_LONG_BLOB
/* MYSQL_TYPE_GEOMETRY data is treated
as BLOB data in innodb. */
|| mysql_type == MYSQL_TYPE_GEOMETRY) {
CHARSET_INFO* cs; CHARSET_INFO* cs;
ulint key_len; ulint key_len;
...@@ -6117,13 +6125,15 @@ ha_innobase::create( ...@@ -6117,13 +6125,15 @@ ha_innobase::create(
1. <database_name>/<table_name>: for normal table creation 1. <database_name>/<table_name>: for normal table creation
2. full path: for temp table creation, or sym link 2. full path: for temp table creation, or sym link
When srv_file_per_table is on, check for full path pattern, i.e. When srv_file_per_table is on and mysqld_embedded is off,
check for full path pattern, i.e.
X:\dir\..., X is a driver letter, or X:\dir\..., X is a driver letter, or
\\dir1\dir2\..., UNC path \\dir1\dir2\..., UNC path
returns error if it is in full path format, but not creating a temp. returns error if it is in full path format, but not creating a temp.
table. Currently InnoDB does not support symbolic link on Windows. */ table. Currently InnoDB does not support symbolic link on Windows. */
if (srv_file_per_table if (srv_file_per_table
&& !mysqld_embedded
&& (!create_info->options & HA_LEX_CREATE_TMP_TABLE)) { && (!create_info->options & HA_LEX_CREATE_TMP_TABLE)) {
if ((name[1] == ':') if ((name[1] == ':')
...@@ -6415,18 +6425,22 @@ ha_innobase::create( ...@@ -6415,18 +6425,22 @@ ha_innobase::create(
setup at this stage and so we use thd. */ setup at this stage and so we use thd. */
/* We need to copy the AUTOINC value from the old table if /* We need to copy the AUTOINC value from the old table if
this is an ALTER TABLE. */ this is an ALTER TABLE or CREATE INDEX because CREATE INDEX
does a table copy too. */
if (((create_info->used_fields & HA_CREATE_USED_AUTO) if (((create_info->used_fields & HA_CREATE_USED_AUTO)
|| thd_sql_command(thd) == SQLCOM_ALTER_TABLE) || thd_sql_command(thd) == SQLCOM_ALTER_TABLE
&& create_info->auto_increment_value != 0) { || thd_sql_command(thd) == SQLCOM_CREATE_INDEX)
&& create_info->auto_increment_value > 0) {
/* Query was ALTER TABLE...AUTO_INCREMENT = x; or
CREATE TABLE ...AUTO_INCREMENT = x; Find out a table /* Query was one of :
definition from the dictionary and get the current value CREATE TABLE ...AUTO_INCREMENT = x; or
of the auto increment field. Set a new value to the ALTER TABLE...AUTO_INCREMENT = x; or
auto increment field if the value is greater than the CREATE INDEX x on t(...);
maximum value in the column. */ Find out a table definition from the dictionary and get
the current value of the auto increment field. Set a new
value to the auto increment field if the value is greater
than the maximum value in the column. */
auto_inc_value = create_info->auto_increment_value; auto_inc_value = create_info->auto_increment_value;
...@@ -7280,9 +7294,15 @@ ha_innobase::analyze( ...@@ -7280,9 +7294,15 @@ ha_innobase::analyze(
THD* thd, /*!< in: connection thread handle */ THD* thd, /*!< in: connection thread handle */
HA_CHECK_OPT* check_opt) /*!< in: currently ignored */ HA_CHECK_OPT* check_opt) /*!< in: currently ignored */
{ {
/* Serialize ANALYZE TABLE inside InnoDB, see
Bug#38996 Race condition in ANALYZE TABLE */
pthread_mutex_lock(&analyze_mutex);
/* Simply call ::info() with all the flags */ /* Simply call ::info() with all the flags */
info(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE); info(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE);
pthread_mutex_unlock(&analyze_mutex);
return(0); return(0);
} }
...@@ -8759,6 +8779,7 @@ ha_innobase::get_auto_increment( ...@@ -8759,6 +8779,7 @@ ha_innobase::get_auto_increment(
AUTOINC counter after attempting to insert the row. */ AUTOINC counter after attempting to insert the row. */
if (innobase_autoinc_lock_mode != AUTOINC_OLD_STYLE_LOCKING) { if (innobase_autoinc_lock_mode != AUTOINC_OLD_STYLE_LOCKING) {
ulonglong need; ulonglong need;
ulonglong current;
ulonglong next_value; ulonglong next_value;
ulonglong col_max_value; ulonglong col_max_value;
...@@ -8767,11 +8788,12 @@ ha_innobase::get_auto_increment( ...@@ -8767,11 +8788,12 @@ ha_innobase::get_auto_increment(
col_max_value = innobase_get_int_col_max_value( col_max_value = innobase_get_int_col_max_value(
table->next_number_field); table->next_number_field);
current = *first_value > col_max_value ? autoinc : *first_value;
need = *nb_reserved_values * increment; need = *nb_reserved_values * increment;
/* Compute the last value in the interval */ /* Compute the last value in the interval */
next_value = innobase_next_autoinc( next_value = innobase_next_autoinc(
*first_value, need, offset, col_max_value); current, need, offset, col_max_value);
prebuilt->autoinc_last_value = next_value; prebuilt->autoinc_last_value = next_value;
......
...@@ -2068,7 +2068,7 @@ Scans a table create SQL string and adds to the data dictionary ...@@ -2068,7 +2068,7 @@ Scans a table create SQL string and adds to the data dictionary
the foreign key constraints declared in the string. This function the foreign key constraints declared in the string. This function
should be called after the indexes for a table have been created. should be called after the indexes for a table have been created.
Each foreign key constraint must be accompanied with indexes in Each foreign key constraint must be accompanied with indexes in
bot participating tables. The indexes are allowed to contain more both participating tables. The indexes are allowed to contain more
fields than mentioned in the constraint. Check also that foreign key fields than mentioned in the constraint. Check also that foreign key
constraints which reference this table are ok. constraints which reference this table are ok.
@return error code or DB_SUCCESS */ @return error code or DB_SUCCESS */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment