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

Background compaction is not interrupted when closing the connection

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT11.2.0, 7.2.0-rc0
    • Affects Version/s: None
    • Component/s: Compaction
    • Labels:
      None
    • 3
    • Joker - StorEng - 2023-10-17

      In WT-11524, we introduce the following code:

          /* If compaction has been interrupted, we return WT_ERROR to the caller. */
          if (session == conn->background_compact.session) {
              background_compaction = true;
              /* Only check for interruption when the connection is not being opened/closed. */
              if (!F_ISSET(conn, WT_CONN_CLOSING | WT_CONN_MINIMAL)) {
                  __wt_spin_lock(session, &conn->background_compact.lock);
                  if (!conn->background_compact.running)
                      ret = WT_ERROR;
                  __wt_spin_unlock(session, &conn->background_compact.lock);
              }
          }
      

      We are killing compaction if it has been interrupted by the caller but only if we are not closing the connection which can be unexpected. This code slows down the connection to be closed if background compaction has work to do since the connection will wait for it to finish.

      The motivation of WT-11524 was not to print a WT_ERROR message. We are now printing a warning when compaction is interrupted by the application. When closing the connection, we could either keep the warning or reduce the log level to a notice.

            Assignee:
            etienne.petrel@mongodb.com Etienne Petrel
            Reporter:
            etienne.petrel@mongodb.com Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: