Skip to content

Commit eb32dfd

Browse files
committed
MDEV-10365 - Race condition in error handling of INSERT DELAYED
Shared variables of Delayed_insert may be updated without mutex protection when delayed insert thread gets an error. Re-acquire mutex earlier, so that shared variables are protected.
1 parent 511313b commit eb32dfd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sql/sql_insert.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3238,6 +3238,7 @@ bool Delayed_insert::handle_inserts(void)
32383238
max_rows= 0; // For DBUG output
32393239
#endif
32403240
/* Remove all not used rows */
3241+
mysql_mutex_lock(&mutex);
32413242
while ((row=rows.get()))
32423243
{
32433244
if (table->s->blob_fields)
@@ -3254,7 +3255,6 @@ bool Delayed_insert::handle_inserts(void)
32543255
}
32553256
DBUG_PRINT("error", ("dropped %lu rows after an error", max_rows));
32563257
thread_safe_increment(delayed_insert_errors, &LOCK_delayed_status);
3257-
mysql_mutex_lock(&mutex);
32583258
DBUG_RETURN(1);
32593259
}
32603260
#endif /* EMBEDDED_LIBRARY */

0 commit comments

Comments
 (0)