BLOB streaming documentation
[phpmyadmin/crack.git] / libraries / engines / innodb.lib.php
blob729751274ba2ff887752954ebce08637b593445a
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * @version $Id$
5 */
7 /**
9 */
10 class PMA_StorageEngine_innodb extends PMA_StorageEngine
12 /**
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
22 * @return array
24 function getVariables()
26 return array(
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()
126 return 'innodb\\_%';
130 * @uses $this->support
131 * @uses PMA_ENGINE_SUPPORT_YES
132 * @uses $GLOBALS['strBufferPool']
133 * @uses $GLOBALS['strInnodbStat']
134 * @return array detail pages
136 function getInfoPages()
138 if ($this->support < PMA_ENGINE_SUPPORT_YES) {
139 return array();
141 $pages = array();
142 $pages['Bufferpool'] = $GLOBALS['strBufferPool'];
143 $pages['Status'] = $GLOBALS['strInnodbStat'];
144 return $pages;
148 * returns html tables with stats over inno db buffer pool
150 * @uses PMA_DBI_fetch_result()
151 * @uses PMA_formatNumber()
152 * @uses PMA_formatByteDown()
153 * @uses $GLOBALS['strBufferPoolUsage']
154 * @uses $GLOBALS['strTotalUC']
155 * @uses $GLOBALS['strInnoDBPages']
156 * @uses $GLOBALS['strFreePages']
157 * @uses $GLOBALS['strDirtyPages']
158 * @uses $GLOBALS['strDataPages']
159 * @uses $GLOBALS['strPagesToBeFlushed']
160 * @uses $GLOBALS['strBusyPages']
161 * @uses $GLOBALS['strLatchedPages']
162 * @uses $GLOBALS['strBufferPoolActivity']
163 * @uses $GLOBALS['strReadRequests']
164 * @uses $GLOBALS['strWriteRequests']
165 * @uses $GLOBALS['strBufferReadMisses']
166 * @uses $GLOBALS['strBufferWriteWaits']
167 * @uses $GLOBALS['strBufferReadMissesInPercent']
168 * @uses $GLOBALS['strBufferWriteWaitsInPercent']
169 * @uses join()
170 * @uses htmlspecialchars()
171 * @uses PMA_formatNumber()
172 * @return string html table with stats
174 function getPageBufferpool()
176 // rabus: The following query is only possible because we know
177 // that we are on MySQL 5 here (checked above)!
178 // side note: I love MySQL 5 for this. :-)
179 $sql = '
180 SHOW STATUS
181 WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\'
182 OR Variable_name = \'Innodb_page_size\';';
183 $status = PMA_DBI_fetch_result($sql, 0, 1);
185 $output = '<table class="data" id="table_innodb_bufferpool_usage">' . "\n"
186 . ' <caption class="tblHeaders">' . "\n"
187 . ' ' . $GLOBALS['strBufferPoolUsage'] . "\n"
188 . ' </caption>' . "\n"
189 . ' <tfoot>' . "\n"
190 . ' <tr>' . "\n"
191 . ' <th colspan="2">' . "\n"
192 . ' ' . $GLOBALS['strTotalUC'] . "\n"
193 . ' : ' . PMA_formatNumber(
194 $status['Innodb_buffer_pool_pages_total'], 0)
195 . '&nbsp;' . $GLOBALS['strInnoDBPages']
196 . ' / '
197 . join('&nbsp;',
198 PMA_formatByteDown($status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size'])) . "\n"
199 . ' </th>' . "\n"
200 . ' </tr>' . "\n"
201 . ' </tfoot>' . "\n"
202 . ' <tbody>' . "\n"
203 . ' <tr class="odd">' . "\n"
204 . ' <th>' . $GLOBALS['strFreePages'] . '</th>' . "\n"
205 . ' <td class="value">'
206 . PMA_formatNumber($status['Innodb_buffer_pool_pages_free'], 0)
207 . '</td>' . "\n"
208 . ' </tr>' . "\n"
209 . ' <tr class="even">' . "\n"
210 . ' <th>' . $GLOBALS['strDirtyPages'] . '</th>' . "\n"
211 . ' <td class="value">'
212 . PMA_formatNumber($status['Innodb_buffer_pool_pages_dirty'], 0)
213 . '</td>' . "\n"
214 . ' </tr>' . "\n"
215 . ' <tr class="odd">' . "\n"
216 . ' <th>' . $GLOBALS['strDataPages'] . '</th>' . "\n"
217 . ' <td class="value">'
218 . PMA_formatNumber($status['Innodb_buffer_pool_pages_data'], 0) . "\n"
219 . '</td>' . "\n"
220 . ' </tr>' . "\n"
221 . ' <tr class="even">' . "\n"
222 . ' <th>' . $GLOBALS['strPagesToBeFlushed'] . '</th>' . "\n"
223 . ' <td class="value">'
224 . PMA_formatNumber($status['Innodb_buffer_pool_pages_flushed'], 0) . "\n"
225 . '</td>' . "\n"
226 . ' </tr>' . "\n"
227 . ' <tr class="odd">' . "\n"
228 . ' <th>' . $GLOBALS['strBusyPages'] . '</th>' . "\n"
229 . ' <td class="value">'
230 . PMA_formatNumber($status['Innodb_buffer_pool_pages_misc'], 0) . "\n"
231 . '</td>' . "\n"
232 . ' </tr>' . "\n"
233 . ' <tr class="even">' . "\n"
234 . ' <th>' . $GLOBALS['strLatchedPages'] . '</th>' . "\n"
235 . ' <td class="value">'
236 . PMA_formatNumber($status['Innodb_buffer_pool_pages_latched'], 0) . "\n"
237 . '</td>' . "\n"
238 . ' </tr>' . "\n"
239 . ' </tbody>' . "\n"
240 . '</table>' . "\n\n"
241 . '<table class="data" id="table_innodb_bufferpool_activity">' . "\n"
242 . ' <caption class="tblHeaders">' . "\n"
243 . ' ' . $GLOBALS['strBufferPoolActivity'] . "\n"
244 . ' </caption>' . "\n"
245 . ' <tbody>' . "\n"
246 . ' <tr class="odd">' . "\n"
247 . ' <th>' . $GLOBALS['strReadRequests'] . '</th>' . "\n"
248 . ' <td class="value">'
249 . PMA_formatNumber($status['Innodb_buffer_pool_read_requests'], 0) . "\n"
250 . '</td>' . "\n"
251 . ' </tr>' . "\n"
252 . ' <tr class="even">' . "\n"
253 . ' <th>' . $GLOBALS['strWriteRequests'] . '</th>' . "\n"
254 . ' <td class="value">'
255 . PMA_formatNumber($status['Innodb_buffer_pool_write_requests'], 0) . "\n"
256 . '</td>' . "\n"
257 . ' </tr>' . "\n"
258 . ' <tr class="odd">' . "\n"
259 . ' <th>' . $GLOBALS['strBufferReadMisses'] . '</th>' . "\n"
260 . ' <td class="value">'
261 . PMA_formatNumber($status['Innodb_buffer_pool_reads'], 0) . "\n"
262 . '</td>' . "\n"
263 . ' </tr>' . "\n"
264 . ' <tr class="even">' . "\n"
265 . ' <th>' . $GLOBALS['strBufferWriteWaits'] . '</th>' . "\n"
266 . ' <td class="value">'
267 . PMA_formatNumber($status['Innodb_buffer_pool_wait_free'], 0) . "\n"
268 . '</td>' . "\n"
269 . ' </tr>' . "\n"
270 . ' <tr class="odd">' . "\n"
271 . ' <th>' . $GLOBALS['strBufferReadMissesInPercent'] . '</th>' . "\n"
272 . ' <td class="value">'
273 . ($status['Innodb_buffer_pool_read_requests'] == 0
274 ? '---'
275 : htmlspecialchars(PMA_formatNumber($status['Innodb_buffer_pool_reads'] * 100 / $status['Innodb_buffer_pool_read_requests'], 3, 2)) . ' %') . "\n"
276 . '</td>' . "\n"
277 . ' </tr>' . "\n"
278 . ' <tr class="even">' . "\n"
279 . ' <th>' . $GLOBALS['strBufferWriteWaitsInPercent'] . '</th>' . "\n"
280 . ' <td class="value">'
281 . ($status['Innodb_buffer_pool_write_requests'] == 0
282 ? '---'
283 : htmlspecialchars(PMA_formatNumber($status['Innodb_buffer_pool_wait_free'] * 100 / $status['Innodb_buffer_pool_write_requests'], 3, 2)) . ' %') . "\n"
284 . '</td>' . "\n"
285 . ' </tr>' . "\n"
286 . ' </tbody>' . "\n"
287 . '</table>' . "\n";
288 return $output;
292 * returns InnoDB status
294 * @uses htmlspecialchars()
295 * @uses PMA_DBI_fetch_value()
296 * @return string result of SHOW INNODB STATUS inside pre tags
298 function getPageStatus()
300 return '<pre id="pre_innodb_status">' . "\n"
301 . htmlspecialchars(PMA_DBI_fetch_value('SHOW INNODB STATUS;')) . "\n"
302 . '</pre>' . "\n";
306 * returns content for page $id
308 * @uses $this->getInfoPages()
309 * @uses array_key_exists()
310 * @param string $id page id
311 * @return string html output
313 function getPage($id)
315 if (! array_key_exists($id, $this->getInfoPages())) {
316 return false;
319 $id = 'getPage' . $id;
321 return $this->$id();
325 * returns string with filename for the MySQL helppage
326 * about this storage engne
328 * @return string mysql helppage filename
330 function getMysqlHelpPage()
332 return 'innodb';