2
/* $Id: innodb.lib.php 8107 2005-12-07 11:24:38Z cybot_tm $ */
3
// vim: expandtab sw=4 ts=4 sts=4:
5
class PMA_StorageEngine_innodb extends PMA_StorageEngine
8
* @uses $GLOBALS['strInnoDBDataHomeDir']
9
* @uses $GLOBALS['strInnoDBDataHomeDirDesc']
10
* @uses $GLOBALS['strInnoDBDataFilePath']
11
* @uses $GLOBALS['strInnoDBAutoextendIncrement']
12
* @uses $GLOBALS['strInnoDBAutoextendIncrementDesc']
13
* @uses $GLOBALS['strInnoDBBufferPoolSize']
14
* @uses $GLOBALS['strInnoDBBufferPoolSizeDesc']
15
* @uses PMA_ENGINE_DETAILS_TYPE_NUMERIC
16
* @uses PMA_ENGINE_DETAILS_TYPE_SIZE
19
function getVariables()
22
'innodb_data_home_dir' => array(
23
'title' => $GLOBALS['strInnoDBDataHomeDir'],
24
'desc' => $GLOBALS['strInnoDBDataHomeDirDesc'],
26
'innodb_data_file_path' => array(
27
'title' => $GLOBALS['strInnoDBDataFilePath'],
29
'innodb_autoextend_increment' => array(
30
'title' => $GLOBALS['strInnoDBAutoextendIncrement'],
31
'desc' => $GLOBALS['strInnoDBAutoextendIncrementDesc'],
32
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
34
'innodb_buffer_pool_size' => array(
35
'title' => $GLOBALS['strInnoDBBufferPoolSize'],
36
'desc' => $GLOBALS['strInnoDBBufferPoolSizeDesc'],
37
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
39
'innodb_additional_mem_pool_size' => array(
40
'title' => 'innodb_additional_mem_pool_size',
41
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
43
'innodb_buffer_pool_awe_mem_mb' => array(
44
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
46
'innodb_checksums' => array(
48
'innodb_commit_concurrency' => array(
50
'innodb_concurrency_tickets' => array(
51
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
53
'innodb_doublewrite' => array(
55
'innodb_fast_shutdown' => array(
57
'innodb_file_io_threads' => array(
58
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
60
'innodb_file_per_table' => array(
62
'innodb_flush_log_at_trx_commit' => array(
64
'innodb_flush_method' => array(
66
'innodb_force_recovery' => array(
68
'innodb_lock_wait_timeout' => array(
69
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
71
'innodb_locks_unsafe_for_binlog' => array(
73
'innodb_log_arch_dir' => array(
75
'innodb_log_archive' => array(
77
'innodb_log_buffer_size' => array(
78
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
80
'innodb_log_file_size' => array(
81
'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
83
'innodb_log_files_in_group' => array(
84
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
86
'innodb_log_group_home_dir' => array(
88
'innodb_max_dirty_pages_pct' => array(
89
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
91
'innodb_max_purge_lag' => array(
93
'innodb_mirrored_log_groups' => array(
94
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
96
'innodb_open_files' => array(
97
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
99
'innodb_support_xa' => array(
101
'innodb_sync_spin_loops' => array(
102
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
104
'innodb_table_locks' => array(
105
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
107
'innodb_thread_concurrency' => array(
108
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
110
'innodb_thread_sleep_delay' => array(
111
'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
117
* @return string SQL query LIKE pattern
119
function getVariablesLikePattern()
125
* @uses $this->support
126
* @uses PMA_ENGINE_SUPPORT_YES
127
* @uses PMA_MYSQL_INT_VERSION
128
* @uses $GLOBALS['strBufferPool']
129
* @uses $GLOBALS['strInnodbStat']
130
* @return array detail pages
132
function getInfoPages()
134
if ($this->support < PMA_ENGINE_SUPPORT_YES) {
138
if (PMA_MYSQL_INT_VERSION >= 50002) {
139
$pages['Bufferpool'] = $GLOBALS['strBufferPool'];
141
$pages['Status'] = $GLOBALS['strInnodbStat'];
146
* returns html tables with stats over inno db buffer pool
148
* @uses PMA_MYSQL_INT_VERSION
149
* @uses PMA_DBI_fetch_result()
150
* @uses PMA_formatNumber()
151
* @uses PMA_formatByteDown()
152
* @uses $GLOBALS['number_decimal_separator']
153
* @uses $GLOBALS['number_thousands_separator']
154
* @uses $GLOBALS['strBufferPoolUsage']
155
* @uses $GLOBALS['strTotalUC']
156
* @uses $GLOBALS['strInnoDBPages']
157
* @uses $GLOBALS['strFreePages']
158
* @uses $GLOBALS['strDirtyPages']
159
* @uses $GLOBALS['strDataPages']
160
* @uses $GLOBALS['strPagesToBeFlushed']
161
* @uses $GLOBALS['strBusyPages']
162
* @uses $GLOBALS['strLatchedPages']
163
* @uses $GLOBALS['strBufferPoolActivity']
164
* @uses $GLOBALS['strReadRequests']
165
* @uses $GLOBALS['strWriteRequests']
166
* @uses $GLOBALS['strBufferReadMisses']
167
* @uses $GLOBALS['strBufferWriteWaits']
168
* @uses $GLOBALS['strBufferReadMissesInPercent']
169
* @uses $GLOBALS['strBufferWriteWaitsInPercent']
171
* @uses htmlspecialchars()
172
* @uses number_format()
173
* @return string html table with stats
175
function getPageBufferpool()
177
if (PMA_MYSQL_INT_VERSION < 50002) {
180
// rabus: The following query is only possible because we know
181
// that we are on MySQL 5 here (checked above)!
182
// side note: I love MySQL 5 for this. :-)
185
WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\'
186
OR Variable_name = \'Innodb_page_size\';';
187
$status = PMA_DBI_fetch_result( $sql, 0, 1 );
189
$output = '<table class="data" id="table_innodb_bufferpool_usage">' . "\n"
190
. ' <caption class="tblHeaders">' . "\n"
191
. ' ' . $GLOBALS['strBufferPoolUsage'] . "\n"
192
. ' </caption>' . "\n"
195
. ' <th colspan="2">' . "\n"
196
. ' ' . $GLOBALS['strTotalUC'] . "\n"
197
. ' : ' . PMA_formatNumber(
198
$status['Innodb_buffer_pool_pages_total'], 0)
199
. ' ' . $GLOBALS['strInnoDBPages']
202
PMA_formatByteDown($status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size'])) . "\n"
207
. ' <tr class="odd">' . "\n"
208
. ' <th>' . $GLOBALS['strFreePages'] . '</th>' . "\n"
209
. ' <td class="value">'
210
. PMA_formatNumber($status['Innodb_buffer_pool_pages_free'], 0)
213
. ' <tr class="even">' . "\n"
214
. ' <th>' . $GLOBALS['strDirtyPages'] . '</th>' . "\n"
215
. ' <td class="value">'
216
. PMA_formatNumber($status['Innodb_buffer_pool_pages_dirty'], 0)
219
. ' <tr class="odd">' . "\n"
220
. ' <th>' . $GLOBALS['strDataPages'] . '</th>' . "\n"
221
. ' <td class="value">'
222
. PMA_formatNumber($status['Innodb_buffer_pool_pages_data'], 0) . "\n"
225
. ' <tr class="even">' . "\n"
226
. ' <th>' . $GLOBALS['strPagesToBeFlushed'] . '</th>' . "\n"
227
. ' <td class="value">'
228
. PMA_formatNumber($status['Innodb_buffer_pool_pages_flushed'], 0) . "\n"
231
. ' <tr class="odd">' . "\n"
232
. ' <th>' . $GLOBALS['strBusyPages'] . '</th>' . "\n"
233
. ' <td class="value">'
234
. PMA_formatNumber($status['Innodb_buffer_pool_pages_misc'], 0) . "\n"
237
. ' <tr class="even">' . "\n"
238
. ' <th>' . $GLOBALS['strLatchedPages'] . '</th>' . "\n"
239
. ' <td class="value">'
240
. PMA_formatNumber($status['Innodb_buffer_pool_pages_latched'], 0) . "\n"
244
. '</table>' . "\n\n"
245
. '<table class="data" id="table_innodb_bufferpool_activity">' . "\n"
246
. ' <caption class="tblHeaders">' . "\n"
247
. ' ' . $GLOBALS['strBufferPoolActivity'] . "\n"
248
. ' </caption>' . "\n"
250
. ' <tr class="odd">' . "\n"
251
. ' <th>' . $GLOBALS['strReadRequests'] . '</th>' . "\n"
252
. ' <td class="value">'
253
. PMA_formatNumber($status['Innodb_buffer_pool_read_requests'], 0) . "\n"
256
. ' <tr class="even">' . "\n"
257
. ' <th>' . $GLOBALS['strWriteRequests'] . '</th>' . "\n"
258
. ' <td class="value">'
259
. PMA_formatNumber($status['Innodb_buffer_pool_write_requests'], 0) . "\n"
262
. ' <tr class="odd">' . "\n"
263
. ' <th>' . $GLOBALS['strBufferReadMisses'] . '</th>' . "\n"
264
. ' <td class="value">'
265
. PMA_formatNumber($status['Innodb_buffer_pool_reads'], 0) . "\n"
268
. ' <tr class="even">' . "\n"
269
. ' <th>' . $GLOBALS['strBufferWriteWaits'] . '</th>' . "\n"
270
. ' <td class="value">'
271
. PMA_formatNumber($status['Innodb_buffer_pool_wait_free'], 0) . "\n"
274
. ' <tr class="odd">' . "\n"
275
. ' <th>' . $GLOBALS['strBufferReadMissesInPercent'] . '</th>' . "\n"
276
. ' <td class="value">'
277
. ($status['Innodb_buffer_pool_read_requests'] == 0
279
: htmlspecialchars(number_format($status['Innodb_buffer_pool_reads'] * 100 / $status['Innodb_buffer_pool_read_requests'], 2, $GLOBALS['number_decimal_separator'], $GLOBALS['number_thousands_separator'])) . ' %') . "\n"
282
. ' <tr class="even">' . "\n"
283
. ' <th>' . $GLOBALS['strBufferWriteWaitsInPercent'] . '</th>' . "\n"
284
. ' <td class="value">'
285
. ($status['Innodb_buffer_pool_write_requests'] == 0
287
: htmlspecialchars(number_format($status['Innodb_buffer_pool_wait_free'] * 100 / $status['Innodb_buffer_pool_write_requests'], 2, $GLOBALS['number_decimal_separator'], $GLOBALS['number_thousands_separator'])) . ' %') . "\n"
296
* returns InnoDB status
298
* @uses htmlspecialchars()
299
* @uses PMA_DBI_fetch_value()
300
* @return string result of SHOW INNODB STATUS inside pre tags
302
function getPageStatus()
304
return '<pre id="pre_innodb_status">' . "\n"
305
. htmlspecialchars(PMA_DBI_fetch_value('SHOW INNODB STATUS;')) . "\n"
310
* returns content for page $id
312
* @uses $this->getInfoPages()
313
* @uses array_key_exists()
314
* @param string $id page id
315
* @return string html output
317
function getPage($id)
319
if ( ! array_key_exists( $id, $this->getInfoPages() ) ) {
323
$id = 'getPage' . $id;
329
* returns string with filename for the MySQL helppage
330
* about this storage engne
332
* @return string mysql helppage filename
334
function getMysqlHelpPage()