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.
This commit is contained in:
parent
511313b9d6
commit
eb32dfd809
@ -3238,6 +3238,7 @@ bool Delayed_insert::handle_inserts(void)
|
|||||||
max_rows= 0; // For DBUG output
|
max_rows= 0; // For DBUG output
|
||||||
#endif
|
#endif
|
||||||
/* Remove all not used rows */
|
/* Remove all not used rows */
|
||||||
|
mysql_mutex_lock(&mutex);
|
||||||
while ((row=rows.get()))
|
while ((row=rows.get()))
|
||||||
{
|
{
|
||||||
if (table->s->blob_fields)
|
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));
|
DBUG_PRINT("error", ("dropped %lu rows after an error", max_rows));
|
||||||
thread_safe_increment(delayed_insert_errors, &LOCK_delayed_status);
|
thread_safe_increment(delayed_insert_errors, &LOCK_delayed_status);
|
||||||
mysql_mutex_lock(&mutex);
|
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
#endif /* EMBEDDED_LIBRARY */
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user