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

Background compaction does not reset stats with run_once

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT11.3.0, 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: Compaction
    • None
    • Storage Engines
    • 3
    • StorEng - Defined Pipeline
    • v8.0

      Background compaction should reset stats when disabled. However, when it was set up with run_once=true, it does not.

      We should reset the stats after the thread is done parsing all the files:

      diff --git a/src/conn/conn_compact.c b/src/conn/conn_compact.c
      index b651567346..aa10859b76 100644
      --- a/src/conn/conn_compact.c
      +++ b/src/conn/conn_compact.c
      @@ -546,6 +546,7 @@ __background_compact_server(void *arg)
                   __wt_atomic_storebool(&conn->background_compact.running, false);
                   running = false;
                   WT_STAT_CONN_SET(session, background_compact_running, running);
      +            __background_compact_list_cleanup(session, BACKGROUND_COMPACT_CLEANUP_OFF);
                   __wt_spin_unlock(session, &conn->background_compact.lock);
               }
      
      

      Or we could do this as well:

      diff --git a/src/conn/conn_compact.c b/src/conn/conn_compact.c
      index b651567346..7d791652bf 100644
      --- a/src/conn/conn_compact.c
      +++ b/src/conn/conn_compact.c
      @@ -566,7 +566,9 @@ __background_compact_server(void *arg)
                       full_iteration = false;
                       WT_ERR(__wt_buf_set(session, uri, WT_BACKGROUND_COMPACT_URI_PREFIX,
                         strlen(WT_BACKGROUND_COMPACT_URI_PREFIX) + 1));
      -                __background_compact_list_cleanup(session, BACKGROUND_COMPACT_CLEANUP_STALE_STAT);
      +                __background_compact_list_cleanup(session,
      +                  conn->background_compact.run_once ? BACKGROUND_COMPACT_CLEANUP_OFF :
      +                                                      BACKGROUND_COMPACT_CLEANUP_STALE_STAT);
                   }
       
                   if (cache_pressure) {
      

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

              Created:
              Updated:
              Resolved: