Skip to content

Commit

Permalink
Merge branch 'fix-mysql-deadlock' into next
Browse files Browse the repository at this point in the history
* fix-mysql-deadlock:
  my_myql: Handle deadlocks in mysql_stmt_execute
  • Loading branch information
donald committed Aug 27, 2024
2 parents a4b1099 + cab3fe9 commit 2f63c50
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions mx_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,13 @@ static int mx__mysql_stmt_bind_result(struct mx_mysql_stmt *stmt)

static int mx__mysql_stmt_execute(struct mx_mysql_stmt *stmt)
{
int res;

assert(stmt);
assert(stmt->stmt);

res = mysql_stmt_execute(stmt->stmt);
if (res == 0)
return 0;
do {
if (mysql_stmt_execute(stmt->stmt) == 0)
return 0;
} while (mysql_stmt_errno(stmt->stmt) == ER_LOCK_DEADLOCK);

mx_mysql_save_error(mysql_stmt_error(stmt->stmt));

Expand Down

0 comments on commit 2f63c50

Please sign in to comment.