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

MONITOR_INC_VALUE_CUMULATIVE is executed regardless of "if" condition

    XMLWordPrintable

Details

    Description

      storage/innobase/buf/buf0flu.cc
      Missing { } brackets:

      if (scanned)
          MONITOR_INC_VALUE_CUMULATIVE(MONITOR_LRU_BATCH_SCANNED,
                                       MONITOR_LRU_BATCH_SCANNED_NUM_CALL,
                                       MONITOR_LRU_BATCH_SCANNED_PER_CALL,
                                       scanned);
      

      MONITOR_INC_VALUE_CUMULATIVE is a multiline macro, so the second statement will be executed always, regardless of “if” condition:

      #define MONITOR_INC_VALUE_CUMULATIVE(                                                                               \
                                      monitor, monitor_n_calls, monitor_per_call, value)      \
                      MONITOR_CHECK_DEFINED(value);                                                                    \
                      if (MONITOR_IS_ON(monitor)) {                                                                               \
                                      MONITOR_VALUE(monitor_n_calls)++;                                               \
                                      MONITOR_VALUE(monitor_per_call) = (mon_type_t) (value);   \
                                      if (MONITOR_VALUE(monitor_per_call)                                               \
                                          > MONITOR_MAX_VALUE(monitor_per_call)) {                             \
                                                      MONITOR_MAX_VALUE(monitor_per_call) =                     \
                                                                      (mon_type_t) (value);                                   \
                                      }                                                                                                               \
                                      MONITOR_VALUE(monitor) += (mon_type_t) (value);                    \
                                      if (MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) {  \
                                                      MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor);\
                                      }                                                                                                               \
                      }
      

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              yury.chaikou Yury Chaikou
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.