Introduction of innodb_read_views_memory overwrites the InnoDB total memory allocated output in cacti
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Monitoring Plugins |
Fix Released
|
Medium
|
Unassigned |
Bug Description
With the innodb_
The second line is the additional line introduced by this feature:
Total memory allocated 31173672960 in additional pool allocated 0
Total memory allocated by read views 88
As the Cacti poller only matches the first three words of the output it will match both lines. Also PHP is not croaking about a non-existent array key that also gets assigned to the additional pool allocation (additional_
To reproduce I created a simple php script that shows you how it will overwrite the output:
<?php
ini_set(
function to_int ( $str ) {
global $debug;
preg_
if ( isset($m[1]) ) {
return $m[1];
}
elseif ( $debug ) {
print_
}
else {
return 0;
}
}
// Example data. This is the actual order of fields in the SHOW ENGINE InnoDB STATUS
$lines = array(
"Total memory allocated 31173672960 in additional pool allocated 0",
"Total memory allocated by read views 88"
);
foreach($lines as $line) {
//Split the line in the same manner as ss_get_
$row = preg_split('/ +/', $line);
//This is the actual line we're parsing now
print $line."\n";
if (strpos($line, "Total memory allocated") === 0 ) {
# Total memory allocated 29642194944; in additional pool allocated 0
$results[
$results[
}
//And here you can see that it actually overwrites the data
print_
}
?>
I also submitted a simple patch that only checks for the number of items in row to only match the first line. Of course in the future it might be beneficial to also capture the second line and graph this accordingly.
Changed in percona-monitoring-plugins: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Changed in percona-monitoring-plugins: | |
status: | Confirmed → Fix Committed |
Changed in percona-monitoring-plugins: | |
milestone: | none → 1.0.4 |
Changed in percona-monitoring-plugins: | |
status: | Fix Committed → Fix Released |
Thanks for the report.
This way it should be more stable in case of future changes:
- elseif (strpos($line, "Total memory allocated") === 0 ) {
+ elseif (strpos($line, "Total memory allocated") === 0 && strpos($line, "in additional pool allocated") > 0 ) {