diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index c60ef6fcc6e..70a12faafb5 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -3238,6 +3238,7 @@ bool Delayed_insert::handle_inserts(void) max_rows= 0; // For DBUG output #endif /* Remove all not used rows */ + mysql_mutex_lock(&mutex); while ((row=rows.get())) { if (table->s->blob_fields) @@ -3254,7 +3255,6 @@ bool Delayed_insert::handle_inserts(void) } DBUG_PRINT("error", ("dropped %lu rows after an error", max_rows)); thread_safe_increment(delayed_insert_errors, &LOCK_delayed_status); - mysql_mutex_lock(&mutex); DBUG_RETURN(1); } #endif /* EMBEDDED_LIBRARY */