Skip to content

Commit f0590db

Browse files
committed
MDEV-33591 MONITOR_INC_VALUE_CUMULATIVE is executed regardless of "if" condition
MONITOR_INC_VALUE_CUMULATIVE is a multiline macro, so the second statement will be executed always, regardless of "if" condition. These problems first started with commit b1ab211 (MDEV-15053). Thanks to Yury Chaikou from ServiceNow for the report.
1 parent 7d36919 commit f0590db

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

storage/innobase/buf/buf0flu.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,10 +1389,12 @@ static void buf_flush_LRU_list_batch(ulint max, bool evict,
13891389
mysql_mutex_assert_owner(&buf_pool.mutex);
13901390

13911391
if (scanned)
1392+
{
13921393
MONITOR_INC_VALUE_CUMULATIVE(MONITOR_LRU_BATCH_SCANNED,
13931394
MONITOR_LRU_BATCH_SCANNED_NUM_CALL,
13941395
MONITOR_LRU_BATCH_SCANNED_PER_CALL,
13951396
scanned);
1397+
}
13961398
}
13971399

13981400
/** Flush and move pages from LRU or unzip_LRU list to the free list.
@@ -1543,15 +1545,19 @@ static ulint buf_do_flush_list_batch(ulint max_n, lsn_t lsn)
15431545
space->release();
15441546

15451547
if (scanned)
1548+
{
15461549
MONITOR_INC_VALUE_CUMULATIVE(MONITOR_FLUSH_BATCH_SCANNED,
15471550
MONITOR_FLUSH_BATCH_SCANNED_NUM_CALL,
15481551
MONITOR_FLUSH_BATCH_SCANNED_PER_CALL,
15491552
scanned);
1553+
}
15501554
if (count)
1555+
{
15511556
MONITOR_INC_VALUE_CUMULATIVE(MONITOR_FLUSH_BATCH_TOTAL_PAGE,
15521557
MONITOR_FLUSH_BATCH_COUNT,
15531558
MONITOR_FLUSH_BATCH_PAGES,
15541559
count);
1560+
}
15551561
mysql_mutex_assert_owner(&buf_pool.mutex);
15561562
return count;
15571563
}

0 commit comments

Comments
 (0)