2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * @package phpMyAdmin-Engines
9 * @package phpMyAdmin-Engines
11 class PMA_StorageEngine_innodb
extends PMA_StorageEngine
16 function getVariables()
19 'innodb_data_home_dir' => array(
20 'title' => __('Data home directory'),
21 'desc' => __('The common part of the directory path for all InnoDB data files.'),
23 'innodb_data_file_path' => array(
24 'title' => __('Data files'),
26 'innodb_autoextend_increment' => array(
27 'title' => __('Autoextend increment'),
28 'desc' => __('The increment size for extending the size of an autoextending tablespace when it becomes full.'),
29 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
31 'innodb_buffer_pool_size' => array(
32 'title' => __('Buffer pool size'),
33 'desc' => __('The size of the memory buffer InnoDB uses to cache data and indexes of its tables.'),
34 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE
,
36 'innodb_additional_mem_pool_size' => array(
37 'title' => 'innodb_additional_mem_pool_size',
38 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE
,
40 'innodb_buffer_pool_awe_mem_mb' => array(
41 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE
,
43 'innodb_checksums' => array(
45 'innodb_commit_concurrency' => array(
47 'innodb_concurrency_tickets' => array(
48 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
50 'innodb_doublewrite' => array(
52 'innodb_fast_shutdown' => array(
54 'innodb_file_io_threads' => array(
55 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
57 'innodb_file_per_table' => array(
59 'innodb_flush_log_at_trx_commit' => array(
61 'innodb_flush_method' => array(
63 'innodb_force_recovery' => array(
65 'innodb_lock_wait_timeout' => array(
66 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
68 'innodb_locks_unsafe_for_binlog' => array(
70 'innodb_log_arch_dir' => array(
72 'innodb_log_archive' => array(
74 'innodb_log_buffer_size' => array(
75 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE
,
77 'innodb_log_file_size' => array(
78 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE
,
80 'innodb_log_files_in_group' => array(
81 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
83 'innodb_log_group_home_dir' => array(
85 'innodb_max_dirty_pages_pct' => array(
86 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
88 'innodb_max_purge_lag' => array(
90 'innodb_mirrored_log_groups' => array(
91 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
93 'innodb_open_files' => array(
94 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
96 'innodb_support_xa' => array(
98 'innodb_sync_spin_loops' => array(
99 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
101 'innodb_table_locks' => array(
102 'type' => PMA_ENGINE_DETAILS_TYPE_BOOLEAN
,
104 'innodb_thread_concurrency' => array(
105 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
107 'innodb_thread_sleep_delay' => array(
108 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
,
114 * @return string SQL query LIKE pattern
116 function getVariablesLikePattern()
122 * @return array detail pages
124 function getInfoPages()
126 if ($this->support
< PMA_ENGINE_SUPPORT_YES
) {
130 $pages['Bufferpool'] = __('Buffer Pool');
131 $pages['Status'] = __('InnoDB Status');
136 * returns html tables with stats over inno db buffer pool
138 * @return string html table with stats
140 function getPageBufferpool()
142 // The following query is only possible because we know
143 // that we are on MySQL 5 here (checked above)!
144 // side note: I love MySQL 5 for this. :-)
147 WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\'
148 OR Variable_name = \'Innodb_page_size\';';
149 $status = PMA_DBI_fetch_result($sql, 0, 1);
151 $output = '<table class="data" id="table_innodb_bufferpool_usage">' . "\n"
152 . ' <caption class="tblHeaders">' . "\n"
153 . ' ' . __('Buffer Pool Usage') . "\n"
154 . ' </caption>' . "\n"
157 . ' <th colspan="2">' . "\n"
158 . ' ' . __('Total') . "\n"
159 . ' : ' . PMA_formatNumber(
160 $status['Innodb_buffer_pool_pages_total'], 0)
161 . ' ' . __('pages')
164 PMA_formatByteDown($status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size'])) . "\n"
169 . ' <tr class="odd">' . "\n"
170 . ' <th>' . __('Free pages') . '</th>' . "\n"
171 . ' <td class="value">'
172 . PMA_formatNumber($status['Innodb_buffer_pool_pages_free'], 0)
175 . ' <tr class="even">' . "\n"
176 . ' <th>' . __('Dirty pages') . '</th>' . "\n"
177 . ' <td class="value">'
178 . PMA_formatNumber($status['Innodb_buffer_pool_pages_dirty'], 0)
181 . ' <tr class="odd">' . "\n"
182 . ' <th>' . __('Pages containing data') . '</th>' . "\n"
183 . ' <td class="value">'
184 . PMA_formatNumber($status['Innodb_buffer_pool_pages_data'], 0) . "\n"
187 . ' <tr class="even">' . "\n"
188 . ' <th>' . __('Pages to be flushed') . '</th>' . "\n"
189 . ' <td class="value">'
190 . PMA_formatNumber($status['Innodb_buffer_pool_pages_flushed'], 0) . "\n"
193 . ' <tr class="odd">' . "\n"
194 . ' <th>' . __('Busy pages') . '</th>' . "\n"
195 . ' <td class="value">'
196 . PMA_formatNumber($status['Innodb_buffer_pool_pages_misc'], 0) . "\n"
200 // not present at least since MySQL 5.1.40
201 if (isset($status['Innodb_buffer_pool_pages_latched'])) {
202 $output .= ' <tr class="even">'
203 . ' <th>' . __('Latched pages') . '</th>'
204 . ' <td class="value">'
205 . PMA_formatNumber($status['Innodb_buffer_pool_pages_latched'], 0)
210 $output .= ' </tbody>' . "\n"
211 . '</table>' . "\n\n"
212 . '<table class="data" id="table_innodb_bufferpool_activity">' . "\n"
213 . ' <caption class="tblHeaders">' . "\n"
214 . ' ' . __('Buffer Pool Activity') . "\n"
215 . ' </caption>' . "\n"
217 . ' <tr class="odd">' . "\n"
218 . ' <th>' . __('Read requests') . '</th>' . "\n"
219 . ' <td class="value">'
220 . PMA_formatNumber($status['Innodb_buffer_pool_read_requests'], 0) . "\n"
223 . ' <tr class="even">' . "\n"
224 . ' <th>' . __('Write requests') . '</th>' . "\n"
225 . ' <td class="value">'
226 . PMA_formatNumber($status['Innodb_buffer_pool_write_requests'], 0) . "\n"
229 . ' <tr class="odd">' . "\n"
230 . ' <th>' . __('Read misses') . '</th>' . "\n"
231 . ' <td class="value">'
232 . PMA_formatNumber($status['Innodb_buffer_pool_reads'], 0) . "\n"
235 . ' <tr class="even">' . "\n"
236 . ' <th>' . __('Write waits') . '</th>' . "\n"
237 . ' <td class="value">'
238 . PMA_formatNumber($status['Innodb_buffer_pool_wait_free'], 0) . "\n"
241 . ' <tr class="odd">' . "\n"
242 . ' <th>' . __('Read misses in %') . '</th>' . "\n"
243 . ' <td class="value">'
244 . ($status['Innodb_buffer_pool_read_requests'] == 0
246 : htmlspecialchars(PMA_formatNumber($status['Innodb_buffer_pool_reads'] * 100 / $status['Innodb_buffer_pool_read_requests'], 3, 2)) . ' %') . "\n"
249 . ' <tr class="even">' . "\n"
250 . ' <th>' . __('Write waits in %') . '</th>' . "\n"
251 . ' <td class="value">'
252 . ($status['Innodb_buffer_pool_write_requests'] == 0
254 : htmlspecialchars(PMA_formatNumber($status['Innodb_buffer_pool_wait_free'] * 100 / $status['Innodb_buffer_pool_write_requests'], 3, 2)) . ' %') . "\n"
263 * returns InnoDB status
265 * @return string result of SHOW INNODB STATUS inside pre tags
267 function getPageStatus()
269 return '<pre id="pre_innodb_status">' . "\n"
270 . htmlspecialchars(PMA_DBI_fetch_value('SHOW INNODB STATUS;', 0, 'Status')) . "\n"
275 * returns content for page $id
277 * @param string $id page id
278 * @return string html output
280 function getPage($id)
282 if (! array_key_exists($id, $this->getInfoPages())) {
286 $id = 'getPage' . $id;
292 * returns string with filename for the MySQL helppage
293 * about this storage engne
295 * @return string mysql helppage filename
297 function getMysqlHelpPage()
304 * Gets the InnoDB plugin version number
305 * http://www.innodb.com/products/innodb_plugin
306 * (do not confuse this with phpMyAdmin's storage engine plugins!)
308 * @return string the version number, or empty if not running as a plugin
310 function getInnodbPluginVersion()
312 return PMA_DBI_fetch_value('SELECT @@innodb_version;');
317 * Gets the InnoDB file format
318 * (works only for the InnoDB plugin)
319 * http://www.innodb.com/products/innodb_plugin
320 * (do not confuse this with phpMyAdmin's storage engine plugins!)
322 * @return string the InnoDB file format
324 function getInnodbFileFormat()
326 return PMA_DBI_fetch_value("SHOW GLOBAL VARIABLES LIKE 'innodb_file_format';", 0, 1);
331 * Verifies if this server supports the innodb_file_per_table feature
332 * (works only for the InnoDB plugin)
333 * http://www.innodb.com/products/innodb_plugin
334 * (do not confuse this with phpMyAdmin's storage engine plugins!)
336 * @return boolean whether this feature is supported or not
338 function supportsFilePerTable()
340 $innodb_file_per_table = PMA_DBI_fetch_value("SHOW GLOBAL VARIABLES LIKE 'innodb_file_per_table';", 0, 1);
341 if ($innodb_file_per_table == 'ON') {