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

Avoid duplicate code in __wt_block_compact_progress

    • Storage Engines
    • 2
    • 2024-03-05 - Claronald

      The following code can be refactored to avoid duplication:

              if (block->compact_pages_rewritten_expected == 0) {
                  __wt_verbose_debug1(session, WT_VERB_COMPACT_PROGRESS,
                    "compacting %s for %" PRIu64 " seconds; reviewed %" PRIu64
                    " pages, rewritten %" PRIu64 " pages (%" PRIu64 "MB)",
                    block->name, time_diff, block->compact_pages_reviewed, block->compact_pages_rewritten,
                    block->compact_bytes_rewritten / WT_MEGABYTE);
                  __wt_verbose_debug1(session, WT_VERB_COMPACT,
                    "%s: still collecting information for estimating the progress", block->name);
              } else {
                  progress = WT_MIN(
                    (int)(100 * block->compact_pages_rewritten / block->compact_pages_rewritten_expected),
                    100);
                  __wt_verbose_debug1(session, WT_VERB_COMPACT_PROGRESS,
                    "compacting %s for %" PRIu64 " seconds; reviewed %" PRIu64
                    " pages, rewritten %" PRIu64 " pages (%" PRIu64 "MB), approx. %d%% done",
                    block->name, time_diff, block->compact_pages_reviewed, block->compact_pages_rewritten,
                    block->compact_bytes_rewritten / WT_MEGABYTE, progress);
              }
      

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

              Created:
              Updated:
              Resolved: