Skip to content

Commit f74fde2

Browse files
committed
Add in a way to specify if you are using the old table structure or the new table structure for the history tables
1 parent 0441277 commit f74fde2

File tree

4 files changed

+37
-7
lines changed

4 files changed

+37
-7
lines changed

config.php.example

+16
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,22 @@ $settings['title'] = null;
77
// Syntax highlight queries?
88
$settings['sqlColor'] = true;
99

10+
// Sometime in the past, percona changed the format
11+
// that slow queries dumped out
12+
// This causes the tmp disk table/disk filesort
13+
// fields to be named incorrectly. The old names were
14+
15+
// Disk_tmp_table_cnt Disk_tmp_table_sum
16+
// Disk_filesort_cnt Disk_filesort_sum
17+
18+
// and the new names are
19+
20+
// Tmp_table_on_disk_cnt Tmp_table_on_disk_sum
21+
// Filesort_on_disk_cnt Filesort_on_disk_sum
22+
23+
// You can use this setting to swap between the column names
24+
$settings['oldSlowQueryFormat'] = false;
25+
1026
// What columns are visible by default
1127
/*
1228
$settings['defaultColumnVis']['Checksum'] = true;

init.php

+14
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
$settings['sqlColor'] = true;
99
$settings['title'] = null;
1010
$settings['sampleLimit'] = 1;
11+
$settings['oldSlowQueryFormat'] = false;
1112

1213
$settings['defaultColumnVis']['Checksum'] = true;
1314
$settings['defaultColumnVis']['Count'] = true;
@@ -29,6 +30,19 @@
2930
$settings['defaultColumnVis']['AvgMS'] = false;
3031
}
3132

33+
if ($settings['oldSlowQueryFormat']) {
34+
define('Tmp_table_on_disk_cnt', 'Disk_tmp_table_cnt');
35+
define('Tmp_table_on_disk_sum', 'Disk_tmp_table_sum');
36+
define('Filesort_on_disk_cnt', 'Disk_filesort_cnt');
37+
define('Filesort_on_disk_sum', 'Disk_filesort_sum');
38+
}
39+
else {
40+
define('Tmp_table_on_disk_cnt', 'Tmp_table_on_disk_cnt');
41+
define('Tmp_table_on_disk_sum', 'Tmp_table_on_disk_sum');
42+
define('Filesort_on_disk_cnt', 'Filesort_on_disk_cnt');
43+
define('Filesort_on_disk_sum', 'Filesort_on_disk_sum');
44+
}
45+
3246
require_once('util.php');
3347
require_once('libs/Database/Database.php');
3448

list-ajax.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
$query .= ' ROUND(SUM(history.query_time_sum), 2)*1000 AS `time`,';
5757
$query .= ' ROUND(SUM(history.query_time_sum)*1000/SUM(history.ts_cnt), 2) AS time_avg,';
5858

59-
$query .= ' IFNULL(SUM(history.Disk_tmp_table_sum), 0) AS disk_tmp_table,';
59+
$query .= ' IFNULL(SUM(history.'.Tmp_table_on_disk_sum.'), 0) AS disk_tmp_table,';
6060
$query .= ' IFNULL(SUM(history.Tmp_table_sum), 0) AS tmp_table';
6161

6262
$query .= ' FROM '.Database::escapeField($reviewhost['review_table']).' AS review';

review.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -258,17 +258,17 @@
258258
<td class="number"><?php echo $historyData['Tmp_table_sum']; ?></td>
259259
<td class="number"><?php if ($historyData['Tmp_table_cnt']) echo round($historyData['Tmp_table_sum']/$historyData['Tmp_table_cnt']*100, 0); ?></td></tr>
260260
<tr><td>On Disk Temporary Tables</td>
261-
<td class="number"><?php echo $historyData['Disk_tmp_table_cnt']; ?></td>
262-
<td class="number"><?php echo $historyData['Disk_tmp_table_sum']; ?></td>
263-
<td class="number"><?php if ($historyData['Disk_tmp_table_cnt']) echo round($historyData['Disk_tmp_table_sum']/$historyData['Disk_tmp_table_cnt']*100, 0); ?></td></tr>
261+
<td class="number"><?php echo $historyData[Tmp_table_on_disk_cnt]; ?></td>
262+
<td class="number"><?php echo $historyData[Tmp_table_on_disk_sum]; ?></td>
263+
<td class="number"><?php if ($historyData[Tmp_table_on_disk_cnt]) echo round($historyData[Tmp_table_on_disk_sum]/$historyData[Tmp_table_on_disk_cnt]*100, 0); ?></td></tr>
264264
<tr><td>File Sorts</td>
265265
<td class="number"><?php echo $historyData['Filesort_cnt']; ?></td>
266266
<td class="number"><?php echo $historyData['Filesort_sum']; ?></td>
267267
<td class="number"><?php if ($historyData['Filesort_cnt']) echo round($historyData['Filesort_sum']/$historyData['Filesort_cnt']*100, 0); ?></td></tr>
268268
<tr><td>On Disk File Sorts</td>
269-
<td class="number"><?php echo $historyData['Disk_filesort_cnt']; ?></td>
270-
<td class="number"><?php echo $historyData['Disk_filesort_sum']; ?></td>
271-
<td class="number"><?php if ($historyData['Disk_filesort_cnt']) echo round($historyData['Disk_filesort_sum']/$historyData['Disk_filesort_cnt']*100, 0); ?></td></tr>
269+
<td class="number"><?php echo $historyData[Filesort_on_disk_cnt]; ?></td>
270+
<td class="number"><?php echo $historyData[Filesort_on_disk_sum]; ?></td>
271+
<td class="number"><?php if ($historyData[Filesort_on_disk_cnt]) echo round($historyData[Filesort_on_disk_sum]/$historyData[Filesort_on_disk_cnt]*100, 0); ?></td></tr>
272272
</tbody>
273273
</table>
274274
<br>

0 commit comments

Comments
 (0)