Skip to content

Commit 2057820

Browse files
MDEV-32849 Spider: check if any table is actually locked when unlocking
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+.
1 parent 83214c3 commit 2057820

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

storage/spider/ha_spider.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,13 @@ int ha_spider::external_lock(
12651265
#ifdef HA_CAN_BULK_ACCESS
12661266
external_lock_cnt++;
12671267
#endif
1268+
if (lock_type == F_UNLCK)
1269+
{
1270+
if (!trx->locked_connections)
1271+
{
1272+
DBUG_RETURN(0); /* No remote table actually locked by Spider */
1273+
}
1274+
}
12681275
if (store_error_num)
12691276
DBUG_RETURN(store_error_num);
12701277
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)

0 commit comments

Comments
 (0)