summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-09-27 20:09:46 +0200
committerSergei Golubchik <sergii@pisem.net>2012-09-27 20:09:46 +0200
commit474fe6d9d9e0b4d8803bdf439dd017ba0c729729 (patch)
tree6b088655217934bf0cbb6cdf85df0a217ef1d939 /sql/sql_insert.cc
parentcd9f773020c6ddfc1ea39e9037e4258b8bc32a08 (diff)
downloadmariadb-git-474fe6d9d9e0b4d8803bdf439dd017ba0c729729.tar.gz
fixes for test failures
and small collateral changes mysql-test/lib/My/Test.pm: somehow with "print" we get truncated writes sometimes mysql-test/suite/perfschema/r/digest_table_full.result: md5 hashes of statement digests differ, because yacc token codes are different in mariadb mysql-test/suite/perfschema/r/dml_handler.result: host table is not ported over yet mysql-test/suite/perfschema/r/information_schema.result: host table is not ported over yet mysql-test/suite/perfschema/r/nesting.result: this differs, because we don't rewrite general log queries, and multi-statement packets are logged as a one entry. this result file is identical to what mysql-5.6.5 produces with the --log-raw option. mysql-test/suite/perfschema/r/relaylog.result: MariaDB modifies the binlog index file directly, while MySQL 5.6 has a feature "crash-safe binlog index" and modifies a special "crash-safe" shadow copy of the index file and then moves it over. That's why this test shows "NONE" index file writes in MySQL and "MANY" in MariaDB. mysql-test/suite/perfschema/r/server_init.result: MariaDB initializes the "manager" resources from the "manager" thread, and starts this thread only when --flush-time is not 0. MySQL 5.6 initializes "manager" resources unconditionally on server startup. mysql-test/suite/perfschema/r/stage_mdl_global.result: this differs, because MariaDB disables query cache when query_cache_size=0. MySQL does not do that, and this causes useless mutex locks and waits. mysql-test/suite/perfschema/r/statement_digest.result: md5 hashes of statement digests differ, because yacc token codes are different in mariadb mysql-test/suite/perfschema/r/statement_digest_consumers.result: md5 hashes of statement digests differ, because yacc token codes are different in mariadb mysql-test/suite/perfschema/r/statement_digest_long_query.result: md5 hashes of statement digests differ, because yacc token codes are different in mariadb mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result: will be updated to match 5.6 when alfranio.correia@oracle.com-20110512172919-c1b5kmum4h52g0ni and anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y are merged mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result: will be updated to match 5.6 when anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y is merged
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc38
1 files changed, 18 insertions, 20 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index adc3d9d875a..023792dddd0 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -750,7 +750,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
lock_type= table_list->lock_type;
- thd_proc_info(thd, "init");
+ THD_STAGE_INFO(thd, stage_init);
thd->lex->used_tables=0;
values= its++;
value_count= values->elements;
@@ -835,7 +835,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
#endif
error=0;
- thd_proc_info(thd, "update");
+ THD_STAGE_INFO(thd, stage_update);
if (duplic == DUP_REPLACE &&
(!table->triggers || !table->triggers->has_delete_triggers()))
table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
@@ -1086,7 +1086,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
DBUG_ASSERT(transactional_table || !changed ||
thd->transaction.stmt.modified_non_trans_table);
}
- thd_proc_info(thd, "end");
+ THD_STAGE_INFO(thd, stage_end);
/*
We'll report to the client this id:
- if the table contains an autoincrement column and we successfully
@@ -1970,7 +1970,7 @@ public:
strmake(thd.security_ctx->priv_user, thd.security_ctx->user,
USERNAME_LENGTH);
thd.current_tablenr=0;
- thd.command=COM_DELAYED_INSERT;
+ thd.set_command(COM_DELAYED_INSERT);
thd.lex->current_select= 0; // for my_message_sql
thd.lex->sql_command= SQLCOM_INSERT; // For innodb::store_lock()
/*
@@ -2058,7 +2058,7 @@ I_List<Delayed_insert> delayed_threads;
static
Delayed_insert *find_handler(THD *thd, TABLE_LIST *table_list)
{
- thd_proc_info(thd, "waiting for delay_list");
+ THD_STAGE_INFO(thd, stage_waiting_for_delay_list);
mysql_mutex_lock(&LOCK_delayed_insert); // Protect master list
I_List_iterator<Delayed_insert> it(delayed_threads);
Delayed_insert *di;
@@ -2140,7 +2140,7 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request,
*/
if (delayed_insert_threads >= thd->variables.max_insert_delayed_threads)
DBUG_RETURN(0);
- thd_proc_info(thd, "Creating delayed handler");
+ THD_STAGE_INFO(thd, stage_creating_delayed_handler);
mysql_mutex_lock(&LOCK_delayed_create);
/*
The first search above was done without LOCK_delayed_create.
@@ -2201,14 +2201,14 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request,
handler thread has been properly initialized before exiting. Otherwise
we risk doing clone_ticket() on a ticket that is no longer valid.
*/
- thd_proc_info(thd, "waiting for handler open");
+ THD_STAGE_INFO(thd, stage_waiting_for_handler_open);
while (!di->handler_thread_initialized ||
(!di->thd.killed && !di->table && !thd->killed))
{
mysql_cond_wait(&di->cond_client, &di->mutex);
}
mysql_mutex_unlock(&di->mutex);
- thd_proc_info(thd, "got old table");
+ THD_STAGE_INFO(thd, stage_got_old_table);
if (thd->killed)
{
di->unlock();
@@ -2290,13 +2290,13 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd)
tables_in_use++;
if (!thd.lock) // Table is not locked
{
- thd_proc_info(client_thd, "waiting for handler lock");
+ THD_STAGE_INFO(client_thd, stage_waiting_for_handler_lock);
mysql_cond_signal(&cond); // Tell handler to lock table
while (!thd.killed && !thd.lock && ! client_thd->killed)
{
mysql_cond_wait(&cond_client, &mutex);
}
- thd_proc_info(client_thd, "got handler lock");
+ THD_STAGE_INFO(client_thd, stage_got_handler_lock);
if (client_thd->killed)
goto error;
if (thd.killed)
@@ -2330,7 +2330,7 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd)
bytes. Since the table copy is used for creating one record only,
the other record buffers and alignment are unnecessary.
*/
- thd_proc_info(client_thd, "allocating local table");
+ THD_STAGE_INFO(client_thd, stage_allocating_local_table);
copy_tmp= (char*) client_thd->alloc(sizeof(*copy)+
(share->fields+1)*sizeof(Field**)+
share->reclength +
@@ -2419,11 +2419,11 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
DBUG_PRINT("enter", ("query = '%s' length %lu", query.str,
(ulong) query.length));
- thd_proc_info(thd, "waiting for handler insert");
+ THD_STAGE_INFO(thd, stage_waiting_for_handler_insert);
mysql_mutex_lock(&di->mutex);
while (di->stacked_inserts >= delayed_queue_size && !thd->killed)
mysql_cond_wait(&di->cond_client, &di->mutex);
- thd_proc_info(thd, "storing row into queue");
+ THD_STAGE_INFO(thd, stage_storing_row_into_queue);
if (thd->killed)
goto err;
@@ -2781,7 +2781,7 @@ pthread_handler_t handle_delayed_insert(void *arg)
/* Information for pthread_kill */
di->thd.mysys_var->current_mutex= &di->mutex;
di->thd.mysys_var->current_cond= &di->cond;
- thd_proc_info(&(di->thd), "Waiting for INSERT");
+ THD_STAGE_INFO(&(di->thd), stage_waiting_for_insert);
DBUG_PRINT("info",("Waiting for someone to insert rows"));
while (!thd->killed && !di->status)
@@ -2812,7 +2812,6 @@ pthread_handler_t handle_delayed_insert(void *arg)
mysql_mutex_unlock(&di->thd.mysys_var->mutex);
mysql_mutex_lock(&di->mutex);
}
- thd_proc_info(&(di->thd), 0);
if (di->tables_in_use && ! thd->lock && !thd->killed)
{
@@ -2939,7 +2938,7 @@ bool Delayed_insert::handle_inserts(void)
table->next_number_field=table->found_next_number_field;
table->use_all_columns();
- thd_proc_info(&thd, "upgrading lock");
+ THD_STAGE_INFO(&thd, stage_upgrading_lock);
if (thr_upgrade_write_delay_lock(*thd.lock->locks, delayed_lock,
thd.variables.lock_wait_timeout))
{
@@ -2953,7 +2952,7 @@ bool Delayed_insert::handle_inserts(void)
goto err;
}
- thd_proc_info(&thd, "insert");
+ THD_STAGE_INFO(&thd, stage_insert);
max_rows= delayed_insert_limit;
if (thd.killed || table->s->has_old_version())
{
@@ -3091,7 +3090,7 @@ bool Delayed_insert::handle_inserts(void)
{
if (tables_in_use)
mysql_cond_broadcast(&cond_client); // If waiting clients
- thd_proc_info(&thd, "reschedule");
+ THD_STAGE_INFO(&thd, stage_reschedule);
mysql_mutex_unlock(&mutex);
if ((error=table->file->extra(HA_EXTRA_NO_CACHE)))
{
@@ -3114,13 +3113,12 @@ bool Delayed_insert::handle_inserts(void)
if (!using_bin_log)
table->file->extra(HA_EXTRA_WRITE_CACHE);
mysql_mutex_lock(&mutex);
- thd_proc_info(&thd, "insert");
+ THD_STAGE_INFO(&thd, stage_insert);
}
if (tables_in_use)
mysql_cond_broadcast(&cond_client); // If waiting clients
}
}
- thd_proc_info(&thd, 0);
mysql_mutex_unlock(&mutex);
/*