2 /* vim: set expandtab sw=4 ts=4 sts=4: */
10 class PMA_StorageEngine_innodb
extends PMA_StorageEngine
13 * @uses $GLOBALS['strInnoDBDataHomeDir']
14 * @uses $GLOBALS['strInnoDBDataHomeDirDesc']
15 * @uses $GLOBALS['strInnoDBDataFilePath']
16 * @uses $GLOBALS['strInnoDBAutoextendIncrement']
17 * @uses $GLOBALS['strInnoDBAutoextendIncrementDesc']
18 * @uses $GLOBALS['strInnoDBBufferPoolSize']
19 * @uses $GLOBALS['strInnoDBBufferPoolSizeDesc']
20 * @uses PMA_ENGINE_DETAILS_TYPE_NUMERIC
21 * @uses PMA_ENGINE_DETAILS_TYPE_SIZE
24 function getVariables()
27 'innodb_data_home_dir' => array(
28 'title' => $GLOBALS['strInnoDBDataHomeDir'],
29 'desc' => $GLOBALS['strInnoDBDataHomeDirDesc'],
31 'innodb_data_file_path' => array(
32 'title' => $GLOBALS['strInnoDBDataFilePath'],
34 'innodb_autoextend_increment' => array(
35 'title' => $GLOBALS['strInnoDBAutoextendIncrement'],
36 'desc' => $GLOBALS['strInnoDBAutoextendIncrementDesc'],
37 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
39 'innodb_buffer_pool_size' => array(
40 'title' => $GLOBALS['strInnoDBBufferPoolSize'],
41 'desc' => $GLOBALS['strInnoDBBufferPoolSizeDesc'],
42 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE
,
44 'innodb_additional_mem_pool_size' => array(
45 'title' => 'innodb_additional_mem_pool_size',
46 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE
,
48 'innodb_buffer_pool_awe_mem_mb' => array(
49 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE
,
51 'innodb_checksums' => array(
53 'innodb_commit_concurrency' => array(
55 'innodb_concurrency_tickets' => array(
56 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
58 'innodb_doublewrite' => array(
60 'innodb_fast_shutdown' => array(
62 'innodb_file_io_threads' => array(
63 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
65 'innodb_file_per_table' => array(
67 'innodb_flush_log_at_trx_commit' => array(
69 'innodb_flush_method' => array(
71 'innodb_force_recovery' => array(
73 'innodb_lock_wait_timeout' => array(
74 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
76 'innodb_locks_unsafe_for_binlog' => array(
78 'innodb_log_arch_dir' => array(
80 'innodb_log_archive' => array(
82 'innodb_log_buffer_size' => array(
83 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE
,
85 'innodb_log_file_size' => array(
86 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE
,
88 'innodb_log_files_in_group' => array(
89 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
91 'innodb_log_group_home_dir' => array(
93 'innodb_max_dirty_pages_pct' => array(
94 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
96 'innodb_max_purge_lag' => array(
98 'innodb_mirrored_log_groups' => array(
99 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
101 'innodb_open_files' => array(
102 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
104 'innodb_support_xa' => array(
106 'innodb_sync_spin_loops' => array(
107 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
109 'innodb_table_locks' => array(
110 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
112 'innodb_thread_concurrency' => array(
113 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
115 'innodb_thread_sleep_delay' => array(
116 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
122 * @return string SQL query LIKE pattern
124 function getVariablesLikePattern()
130 * @uses $this->support
131 * @uses PMA_ENGINE_SUPPORT_YES
132 * @uses PMA_MYSQL_INT_VERSION
133 * @uses $GLOBALS['strBufferPool']
134 * @uses $GLOBALS['strInnodbStat']
135 * @return array detail pages
137 function getInfoPages()
139 if ($this->support
< PMA_ENGINE_SUPPORT_YES
) {
143 if (PMA_MYSQL_INT_VERSION
>= 50002) {
144 $pages['Bufferpool'] = $GLOBALS['strBufferPool'];
146 $pages['Status'] = $GLOBALS['strInnodbStat'];
151 * returns html tables with stats over inno db buffer pool
153 * @uses PMA_MYSQL_INT_VERSION
154 * @uses PMA_DBI_fetch_result()
155 * @uses PMA_formatNumber()
156 * @uses PMA_formatByteDown()
157 * @uses $GLOBALS['strBufferPoolUsage']
158 * @uses $GLOBALS['strTotalUC']
159 * @uses $GLOBALS['strInnoDBPages']
160 * @uses $GLOBALS['strFreePages']
161 * @uses $GLOBALS['strDirtyPages']
162 * @uses $GLOBALS['strDataPages']
163 * @uses $GLOBALS['strPagesToBeFlushed']
164 * @uses $GLOBALS['strBusyPages']
165 * @uses $GLOBALS['strLatchedPages']
166 * @uses $GLOBALS['strBufferPoolActivity']
167 * @uses $GLOBALS['strReadRequests']
168 * @uses $GLOBALS['strWriteRequests']
169 * @uses $GLOBALS['strBufferReadMisses']
170 * @uses $GLOBALS['strBufferWriteWaits']
171 * @uses $GLOBALS['strBufferReadMissesInPercent']
172 * @uses $GLOBALS['strBufferWriteWaitsInPercent']
174 * @uses htmlspecialchars()
175 * @uses PMA_formatNumber()
176 * @return string html table with stats
178 function getPageBufferpool()
180 if (PMA_MYSQL_INT_VERSION
< 50002) {
183 // rabus: The following query is only possible because we know
184 // that we are on MySQL 5 here (checked above)!
185 // side note: I love MySQL 5 for this. :-)
188 WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\'
189 OR Variable_name = \'Innodb_page_size\';';
190 $status = PMA_DBI_fetch_result($sql, 0, 1);
192 $output = '<table class="data" id="table_innodb_bufferpool_usage">' . "\n"
193 . ' <caption class="tblHeaders">' . "\n"
194 . ' ' . $GLOBALS['strBufferPoolUsage'] . "\n"
195 . ' </caption>' . "\n"
198 . ' <th colspan="2">' . "\n"
199 . ' ' . $GLOBALS['strTotalUC'] . "\n"
200 . ' : ' . PMA_formatNumber(
201 $status['Innodb_buffer_pool_pages_total'], 0)
202 . ' ' . $GLOBALS['strInnoDBPages']
205 PMA_formatByteDown($status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size'])) . "\n"
210 . ' <tr class="odd">' . "\n"
211 . ' <th>' . $GLOBALS['strFreePages'] . '</th>' . "\n"
212 . ' <td class="value">'
213 . PMA_formatNumber($status['Innodb_buffer_pool_pages_free'], 0)
216 . ' <tr class="even">' . "\n"
217 . ' <th>' . $GLOBALS['strDirtyPages'] . '</th>' . "\n"
218 . ' <td class="value">'
219 . PMA_formatNumber($status['Innodb_buffer_pool_pages_dirty'], 0)
222 . ' <tr class="odd">' . "\n"
223 . ' <th>' . $GLOBALS['strDataPages'] . '</th>' . "\n"
224 . ' <td class="value">'
225 . PMA_formatNumber($status['Innodb_buffer_pool_pages_data'], 0) . "\n"
228 . ' <tr class="even">' . "\n"
229 . ' <th>' . $GLOBALS['strPagesToBeFlushed'] . '</th>' . "\n"
230 . ' <td class="value">'
231 . PMA_formatNumber($status['Innodb_buffer_pool_pages_flushed'], 0) . "\n"
234 . ' <tr class="odd">' . "\n"
235 . ' <th>' . $GLOBALS['strBusyPages'] . '</th>' . "\n"
236 . ' <td class="value">'
237 . PMA_formatNumber($status['Innodb_buffer_pool_pages_misc'], 0) . "\n"
240 . ' <tr class="even">' . "\n"
241 . ' <th>' . $GLOBALS['strLatchedPages'] . '</th>' . "\n"
242 . ' <td class="value">'
243 . PMA_formatNumber($status['Innodb_buffer_pool_pages_latched'], 0) . "\n"
247 . '</table>' . "\n\n"
248 . '<table class="data" id="table_innodb_bufferpool_activity">' . "\n"
249 . ' <caption class="tblHeaders">' . "\n"
250 . ' ' . $GLOBALS['strBufferPoolActivity'] . "\n"
251 . ' </caption>' . "\n"
253 . ' <tr class="odd">' . "\n"
254 . ' <th>' . $GLOBALS['strReadRequests'] . '</th>' . "\n"
255 . ' <td class="value">'
256 . PMA_formatNumber($status['Innodb_buffer_pool_read_requests'], 0) . "\n"
259 . ' <tr class="even">' . "\n"
260 . ' <th>' . $GLOBALS['strWriteRequests'] . '</th>' . "\n"
261 . ' <td class="value">'
262 . PMA_formatNumber($status['Innodb_buffer_pool_write_requests'], 0) . "\n"
265 . ' <tr class="odd">' . "\n"
266 . ' <th>' . $GLOBALS['strBufferReadMisses'] . '</th>' . "\n"
267 . ' <td class="value">'
268 . PMA_formatNumber($status['Innodb_buffer_pool_reads'], 0) . "\n"
271 . ' <tr class="even">' . "\n"
272 . ' <th>' . $GLOBALS['strBufferWriteWaits'] . '</th>' . "\n"
273 . ' <td class="value">'
274 . PMA_formatNumber($status['Innodb_buffer_pool_wait_free'], 0) . "\n"
277 . ' <tr class="odd">' . "\n"
278 . ' <th>' . $GLOBALS['strBufferReadMissesInPercent'] . '</th>' . "\n"
279 . ' <td class="value">'
280 . ($status['Innodb_buffer_pool_read_requests'] == 0
282 : htmlspecialchars(PMA_formatNumber($status['Innodb_buffer_pool_reads'] * 100 / $status['Innodb_buffer_pool_read_requests'], 3, 2)) . ' %') . "\n"
285 . ' <tr class="even">' . "\n"
286 . ' <th>' . $GLOBALS['strBufferWriteWaitsInPercent'] . '</th>' . "\n"
287 . ' <td class="value">'
288 . ($status['Innodb_buffer_pool_write_requests'] == 0
290 : htmlspecialchars(PMA_formatNumber($status['Innodb_buffer_pool_wait_free'] * 100 / $status['Innodb_buffer_pool_write_requests'], 3, 2)) . ' %') . "\n"
299 * returns InnoDB status
301 * @uses htmlspecialchars()
302 * @uses PMA_DBI_fetch_value()
303 * @return string result of SHOW INNODB STATUS inside pre tags
305 function getPageStatus()
307 return '<pre id="pre_innodb_status">' . "\n"
308 . htmlspecialchars(PMA_DBI_fetch_value('SHOW INNODB STATUS;')) . "\n"
313 * returns content for page $id
315 * @uses $this->getInfoPages()
316 * @uses array_key_exists()
317 * @param string $id page id
318 * @return string html output
320 function getPage($id)
322 if (! array_key_exists($id, $this->getInfoPages())) {
326 $id = 'getPage' . $id;
332 * returns string with filename for the MySQL helppage
333 * about this storage engne
335 * @return string mysql helppage filename
337 function getMysqlHelpPage()