Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-26274

On timeout, fts_lock_table() attempts to release unreserved dict_sys.mutex

    XMLWordPrintable

    Details

      Description

      In MDEV-25936, we inadvertently introduced a problem that would cause safe_mutex failures in workloads that involve DDL on tables that contain FULLTEXT INDEX. The fix describes it best:

      diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
      index 21a3567f33a..885b0432ebf 100644
      --- a/storage/innobase/fts/fts0fts.cc
      +++ b/storage/innobase/fts/fts0fts.cc
      @@ -1556,12 +1556,13 @@ static dberr_t fts_lock_table(trx_t *trx, const char *table_name)
             if (!--n)
             {
               err= DB_LOCK_WAIT_TIMEOUT;
      -        break;
      +        goto fail;
             }
             std::this_thread::sleep_for(std::chrono::milliseconds(50));
             dict_sys.mutex_lock();
           }
           dict_sys.mutex_unlock();
      +fail:
           table->release();
           return err;
         }
      

      If a timeout occurs, we would wrongly attempt to release {{dict_sys.mutex}, which the current thread is not holding.
      The failure would look something like this:

      safe_mutex: Trying to unlock mutex mutex that wasn't locked at /data/Server/bb-10.6-MDEV-25919/storage/innobase/include/dict0dict.h, line 1570
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              marko Marko Mäkelä
              Reporter:
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration