Skip to content

Commit

Permalink
MDEV-32849 Spider: check if any table is actually locked when unlocking
Browse files Browse the repository at this point in the history
This avoids the scenario in MDEV-32849, when the unlock happens after
the connection has been freed, say in rollback. This is done in 10.5+
after the commit a26700c.

It may or may not prevent potential other scenarios where spider has
locked something, then for some reason the statement needs to be
rolled back and spider frees the connection, and then spider proceeds
to use the freed connection. But at least we fix the regression
introduced by MDEV-30014 to 10.4 and bring 10.4 closer in parity with
10.5+.
  • Loading branch information
mariadb-YuchenPei committed Nov 28, 2023
1 parent 83214c3 commit 2057820
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions storage/spider/ha_spider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1265,6 +1265,13 @@ int ha_spider::external_lock(
#ifdef HA_CAN_BULK_ACCESS
external_lock_cnt++;
#endif
if (lock_type == F_UNLCK)
{
if (!trx->locked_connections)
{
DBUG_RETURN(0); /* No remote table actually locked by Spider */
}
}
if (store_error_num)
DBUG_RETURN(store_error_num);
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
Expand Down

0 comments on commit 2057820

Please sign in to comment.