summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc19
1 files changed, 11 insertions, 8 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 7418140517c..829300859cf 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -258,7 +258,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
if (fields.elements || !value_count)
{
restore_record(table,default_values); // Get empty record
- if (fill_record(fields,*values)|| thd->net.report_error ||
+ if (fill_record(fields, *values, 0)|| thd->net.report_error ||
check_null_fields(thd,table))
{
if (values_list.elements != 1 && !thd->net.report_error)
@@ -276,7 +276,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
restore_record(table,default_values); // Get empty record
else
table->record[0][0]=table->default_values[0]; // Fix delete marker
- if (fill_record(table->field,*values) || thd->net.report_error)
+ if (fill_record(table->field,*values, 0) || thd->net.report_error)
{
if (values_list.elements != 1 && ! thd->net.report_error)
{
@@ -708,6 +708,9 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list)
/* no match; create a new thread to handle the table */
if (!(tmp=find_handler(thd,table_list)))
{
+ /* Don't create more than max_insert_delayed_threads */
+ if (delayed_insert_threads >= max_insert_delayed_threads)
+ DBUG_RETURN(0);
thd->proc_info="Creating delayed handler";
pthread_mutex_lock(&LOCK_delayed_create);
if (!(tmp=find_handler(thd,table_list))) // Was just created
@@ -1086,12 +1089,12 @@ extern "C" pthread_handler_decl(handle_delayed_insert,arg)
while (!thd->killed)
{
int error;
-#if (defined(HAVE_BROKEN_COND_TIMEDWAIT) || defined(HAVE_LINUXTHREADS))
+#if defined(HAVE_BROKEN_COND_TIMEDWAIT)
error=pthread_cond_wait(&di->cond,&di->mutex);
#else
error=pthread_cond_timedwait(&di->cond,&di->mutex,&abstime);
#ifdef EXTRA_DEBUG
- if (error && error != EINTR)
+ if (error && error != EINTR && error != ETIMEDOUT)
{
fprintf(stderr, "Got error %d from pthread_cond_timedwait\n",error);
DBUG_PRINT("error",("Got error %d from pthread_cond_timedwait",
@@ -1393,9 +1396,9 @@ bool select_insert::send_data(List<Item> &values)
return 0;
}
if (fields->elements)
- fill_record(*fields,values);
+ fill_record(*fields, values, 1);
else
- fill_record(table->field,values);
+ fill_record(table->field, values, 1);
if (thd->net.report_error || write_record(table,&info))
return 1;
if (table->next_number_field) // Clear for next record
@@ -1460,7 +1463,7 @@ bool select_insert::send_eof()
thd->cuted_fields);
if (last_insert_id)
thd->insert_id(last_insert_id); // For update log
- ::send_ok(thd,info.copied,last_insert_id,buff);
+ ::send_ok(thd,info.copied+info.deleted,last_insert_id,buff);
mysql_update_log.write(thd,thd->query,thd->query_length);
return 0;
}
@@ -1510,7 +1513,7 @@ bool select_create::send_data(List<Item> &values)
unit->offset_limit_cnt--;
return 0;
}
- fill_record(field,values);
+ fill_record(field, values, 1);
if (thd->net.report_error ||write_record(table,&info))
return 1;
if (table->next_number_field) // Clear for next record