Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-793

Passing the "schema locked" flag to another thread can race

    • Type: Icon: Task Task
    • Resolution: Done
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      If a thread is updating its session flags, this code in __lsm_tree_close can race and fail to set the WT_SESSION_SCHEMA_LOCKED flag, so the thread blocks forever instead of completing its operations.

      Consider either switching to atomic flags, or (better) adding a field to the session structure that can be set and cleared atomically for this case (and checked inside WT_WITH_SCHEMA_LOCK).

                      /*
                       * Signal all threads to wake them up, then wait for them to
                       * exit.
                       *
                       * !!!
                       * If we have the schema lock, have the LSM worker sessions
                       * inherit the flag before we do anything.  The thread may
                       * already be waiting for the schema lock, but the loop in the
                       * WT_WITH_SCHEMA_LOCK macro takes care of that.
                       */
                      if (F_ISSET(S2C(session), WT_CONN_LSM_MERGE))
                              for (i = 0; i < lsm_tree->merge_threads; i++) {
                                      F_SET(lsm_tree->worker_sessions[i],
                                          F_ISSET(session, WT_SESSION_SCHEMA_LOCKED));
      

            Assignee:
            michael.cahill@mongodb.com Michael Cahill (Inactive)
            Reporter:
            michael.cahill@mongodb.com Michael Cahill (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: