diff --git a/libraries/engines/innodb.lib.php b/libraries/engines/innodb.lib.php
index 2e6b56d36..b540b39a1 100644
--- a/libraries/engines/innodb.lib.php
+++ b/libraries/engines/innodb.lib.php
@@ -2,191 +2,328 @@
/* $Id$ */
// vim: expandtab sw=4 ts=4 sts=4:
-class PMA_StorageEngine_innodb extends PMA_StorageEngine {
- function getVariables() {
+class PMA_StorageEngine_innodb extends PMA_StorageEngine
+{
+ /**
+ * @uses $GLOBALS['strInnoDBDataHomeDir']
+ * @uses $GLOBALS['strInnoDBDataHomeDirDesc']
+ * @uses $GLOBALS['strInnoDBDataFilePath']
+ * @uses $GLOBALS['strInnoDBAutoextendIncrement']
+ * @uses $GLOBALS['strInnoDBAutoextendIncrementDesc']
+ * @uses $GLOBALS['strInnoDBBufferPoolSize']
+ * @uses $GLOBALS['strInnoDBBufferPoolSizeDesc']
+ * @uses PMA_ENGINE_DETAILS_TYPE_NUMERIC
+ * @uses PMA_ENGINE_DETAILS_TYPE_SIZE
+ * @return array
+ */
+ function getVariables()
+ {
return array(
'innodb_data_home_dir' => array(
'title' => $GLOBALS['strInnoDBDataHomeDir'],
- 'desc' => $GLOBALS['strInnoDBDataHomeDirDesc']
+ 'desc' => $GLOBALS['strInnoDBDataHomeDirDesc'],
),
'innodb_data_file_path' => array(
- 'title' => $GLOBALS['strInnoDBDataFilePath']
+ 'title' => $GLOBALS['strInnoDBDataFilePath'],
),
'innodb_autoextend_increment' => array(
'title' => $GLOBALS['strInnoDBAutoextendIncrement'],
'desc' => $GLOBALS['strInnoDBAutoextendIncrementDesc'],
- 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
+ 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
),
'innodb_buffer_pool_size' => array(
'title' => $GLOBALS['strInnoDBBufferPoolSize'],
'desc' => $GLOBALS['strInnoDBBufferPoolSizeDesc'],
- 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE
- )
- );
+ 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
+ ),
+ 'innodb_additional_mem_pool_size' => array(
+ 'title' => 'innodb_additional_mem_pool_size',
+ 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
+ ),
+ 'innodb_buffer_pool_awe_mem_mb' => array(
+ 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
+ ),
+ 'innodb_checksums' => array(
+ ),
+ 'innodb_commit_concurrency' => array(
+ ),
+ 'innodb_concurrency_tickets' => array(
+ 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
+ ),
+ 'innodb_doublewrite' => array(
+ ),
+ 'innodb_fast_shutdown' => array(
+ ),
+ 'innodb_file_io_threads' => array(
+ 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
+ ),
+ 'innodb_file_per_table' => array(
+ ),
+ 'innodb_flush_log_at_trx_commit' => array(
+ ),
+ 'innodb_flush_method' => array(
+ ),
+ 'innodb_force_recovery' => array(
+ ),
+ 'innodb_lock_wait_timeout' => array(
+ 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
+ ),
+ 'innodb_locks_unsafe_for_binlog' => array(
+ ),
+ 'innodb_log_arch_dir' => array(
+ ),
+ 'innodb_log_archive' => array(
+ ),
+ 'innodb_log_buffer_size' => array(
+ 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
+ ),
+ 'innodb_log_file_size' => array(
+ 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE,
+ ),
+ 'innodb_log_files_in_group' => array(
+ 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
+ ),
+ 'innodb_log_group_home_dir' => array(
+ ),
+ 'innodb_max_dirty_pages_pct' => array(
+ 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
+ ),
+ 'innodb_max_purge_lag' => array(
+ ),
+ 'innodb_mirrored_log_groups' => array(
+ 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
+ ),
+ 'innodb_open_files' => array(
+ 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
+ ),
+ 'innodb_support_xa' => array(
+ ),
+ 'innodb_sync_spin_loops' => array(
+ 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
+ ),
+ 'innodb_table_locks' => array(
+ 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
+ ),
+ 'innodb_thread_concurrency' => array(
+ 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
+ ),
+ 'innodb_thread_sleep_delay' => array(
+ 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC,
+ ),
+ );
}
- function getVariablesLikePattern () {
+ /**
+ * @return string SQL query LIKE pattern
+ */
+ function getVariablesLikePattern()
+ {
return 'innodb\\_%';
}
- function getInfoPages () {
+ /**
+ * @uses $this->support
+ * @uses PMA_ENGINE_SUPPORT_YES
+ * @uses PMA_MYSQL_INT_VERSION
+ * @uses $GLOBALS['strBufferPool']
+ * @uses $GLOBALS['strInnodbStat']
+ * @return array detail pages
+ */
+ function getInfoPages()
+ {
if ($this->support < PMA_ENGINE_SUPPORT_YES) {
return array();
}
$pages = array();
if (PMA_MYSQL_INT_VERSION >= 50002) {
- $pages['bufferpool'] = $GLOBALS['strBufferPool'];
+ $pages['Bufferpool'] = $GLOBALS['strBufferPool'];
}
- $pages['status'] = $GLOBALS['strInnodbStat'];
+ $pages['Status'] = $GLOBALS['strInnodbStat'];
return $pages;
}
- function getPage($id) {
- global $cfg;
-
- switch ($id) {
- case 'bufferpool':
- if (PMA_MYSQL_INT_VERSION < 50002) {
- return FALSE;
- }
- // rabus: The following query is only possible because we know
- // that we are on MySQL 5 here (checked above)!
- // side note: I love MySQL 5 for this. :-)
- $res = PMA_DBI_query('SHOW STATUS WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\' OR Variable_name = \'Innodb_page_size\';');
- $status = array();
- while ($row = PMA_DBI_fetch_row($res)) {
- $status[$row[0]] = $row[1];
- }
- PMA_DBI_free_result($res);
- unset($res, $row);
- $output = '
' . "\n"
- . ' ' . "\n"
- . ' ' . "\n"
- . ' ' . "\n"
- . ' ' . $GLOBALS['strBufferPoolUsage'] . "\n"
- . ' | ' . "\n"
- . '
' . "\n"
- . ' ' . "\n"
- . ' ' . "\n"
- . ' ' . "\n"
- . ' ' . "\n"
- . ' ' . $GLOBALS['strTotalUC'] . "\n"
- . ' | ' . "\n"
- . ' ' . "\n"
- . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_total']) . ' ' . $GLOBALS['strInnoDBPages'] . ' / ' . join(' ', PMA_formatByteDown($status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size'])) . "\n"
- . ' | ' . "\n"
- . '
' . "\n"
- . ' ' . "\n"
- . ' ' . "\n"
- . ' ' . "\n"
- . ' ' . "\n"
- . ' ' . $GLOBALS['strFreePages'] . ' ' . "\n"
- . ' | ' . "\n"
- . ' ' . "\n"
- . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_free']) . "\n"
- . ' | ' . "\n"
- . ' ' . "\n"
- . ' ' . $GLOBALS['strDirtyPages'] . ' ' . "\n"
- . ' | ' . "\n"
- . ' ' . "\n"
- . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_dirty']) . "\n"
- . ' | ' . "\n"
- . '
' . "\n"
- . ' ' . "\n"
- . ' ' . "\n"
- . ' ' . $GLOBALS['strDataPages'] . ' ' . "\n"
- . ' | ' . "\n"
- . ' ' . "\n"
- . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_data']) . "\n"
- . ' | ' . "\n"
- . ' ' . "\n"
- . ' ' . $GLOBALS['strPagesToBeFlushed'] . ' ' . "\n"
- . ' | ' . "\n"
- . ' ' . "\n"
- . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_flushed']) . "\n"
- . ' | ' . "\n"
- . '
' . "\n"
- . ' ' . "\n"
- . ' ' . "\n"
- . ' ' . $GLOBALS['strBusyPages'] . ' ' . "\n"
- . ' | ' . "\n"
- . ' ' . "\n"
- . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_misc']) . "\n"
- . ' | ' . "\n"
- . ' ' . "\n"
- . ' ' . $GLOBALS['strLatchedPages'] . ' ' . "\n"
- . ' | ' . "\n"
- . ' ' . "\n"
- . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_latched']) . "\n"
- . ' | ' . "\n"
- . '
' . "\n"
- . ' ' . "\n"
- . '
' . "\n\n"
- . '
' . "\n\n"
- . '' . "\n"
- . ' ' . "\n"
- . ' ' . "\n"
- . ' ' . "\n"
- . ' ' . $GLOBALS['strBufferPoolActivity'] . "\n"
- . ' | ' . "\n"
- . '
' . "\n"
- . ' ' . "\n"
- . ' ' . "\n"
- . ' ' . "\n"
- . ' ' . "\n"
- . ' ' . $GLOBALS['strReadRequests'] . ' ' . "\n"
- . ' | ' . "\n"
- . ' ' . "\n"
- . ' ' . htmlspecialchars($status['Innodb_buffer_pool_read_requests']) . "\n"
- . ' | ' . "\n"
- . ' ' . "\n"
- . ' ' . $GLOBALS['strWriteRequests'] . ' ' . "\n"
- . ' | ' . "\n"
- . ' ' . "\n"
- . ' ' . htmlspecialchars($status['Innodb_buffer_pool_write_requests']) . "\n"
- . ' | ' . "\n"
- . '
' . "\n"
- . ' ' . "\n"
- . ' ' . "\n"
- . ' ' . $GLOBALS['strBufferReadMisses'] . ' ' . "\n"
- . ' | ' . "\n"
- . ' ' . "\n"
- . ' ' . htmlspecialchars($status['Innodb_buffer_pool_reads']) . "\n"
- . ' | ' . "\n"
- . ' ' . "\n"
- . ' ' . $GLOBALS['strBufferWriteWaits'] . ' ' . "\n"
- . ' | ' . "\n"
- . ' ' . "\n"
- . ' ' . htmlspecialchars($status['Innodb_buffer_pool_wait_free']) . "\n"
- . ' | ' . "\n"
- . '
' . "\n"
- . ' ' . "\n"
- . ' ' . "\n"
- . ' ' . $GLOBALS['strBufferReadMissesInPercent'] . ' ' . "\n"
- . ' | ' . "\n"
- . ' ' . "\n"
- . ' ' . ($status['Innodb_buffer_pool_read_requests'] == 0 ? '---' : 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"
- . ' | ' . "\n"
- . ' ' . "\n"
- . ' ' . $GLOBALS['strBufferWriteWaitsInPercent'] . ' ' . "\n"
- . ' | ' . "\n"
- . ' ' . "\n"
- . ' ' . ($status['Innodb_buffer_pool_write_requests'] == 0 ? '---' : 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"
- . ' | ' . "\n"
- . '
' . "\n"
- . ' ' . "\n"
- . '
' . "\n";
- return $output;
- case 'status':
- $res = PMA_DBI_query('SHOW INNODB STATUS;');
- $row = PMA_DBI_fetch_row($res);
- PMA_DBI_free_result($res);
- return '' . "\n"
- . htmlspecialchars($row[0]) . "\n"
- . '
' . "\n";
- default:
- return FALSE;
+ /**
+ * returns html tables with stats over inno db buffer pool
+ *
+ * @uses PMA_MYSQL_INT_VERSION
+ * @uses PMA_DBI_fetch_result()
+ * @uses PMA_formatNumber()
+ * @uses PMA_formatByteDown()
+ * @uses $GLOBALS['number_decimal_separator']
+ * @uses $GLOBALS['number_thousands_separator']
+ * @uses $GLOBALS['strBufferPoolUsage']
+ * @uses $GLOBALS['strTotalUC']
+ * @uses $GLOBALS['strInnoDBPages']
+ * @uses $GLOBALS['strFreePages']
+ * @uses $GLOBALS['strDirtyPages']
+ * @uses $GLOBALS['strDataPages']
+ * @uses $GLOBALS['strPagesToBeFlushed']
+ * @uses $GLOBALS['strBusyPages']
+ * @uses $GLOBALS['strLatchedPages']
+ * @uses $GLOBALS['strBufferPoolActivity']
+ * @uses $GLOBALS['strReadRequests']
+ * @uses $GLOBALS['strWriteRequests']
+ * @uses $GLOBALS['strBufferReadMisses']
+ * @uses $GLOBALS['strBufferWriteWaits']
+ * @uses $GLOBALS['strBufferReadMissesInPercent']
+ * @uses $GLOBALS['strBufferWriteWaitsInPercent']
+ * @uses join()
+ * @uses htmlspecialchars()
+ * @uses number_format()
+ * @return string html table with stats
+ */
+ function getPageBufferpool()
+ {
+ if (PMA_MYSQL_INT_VERSION < 50002) {
+ return false;
}
+ // rabus: The following query is only possible because we know
+ // that we are on MySQL 5 here (checked above)!
+ // side note: I love MySQL 5 for this. :-)
+ $sql = '
+ SHOW STATUS
+ WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\'
+ OR Variable_name = \'Innodb_page_size\';';
+ $status = PMA_DBI_fetch_result( $sql, 0, 1 );
+
+ $output = '' . "\n"
+ . ' ' . "\n"
+ . ' ' . "\n"
+ . ' ' . "\n"
+ . ' ' . "\n"
+ . ' ' . $GLOBALS['strTotalUC'] . "\n"
+ . ' : ' . PMA_formatNumber(
+ $status['Innodb_buffer_pool_pages_total'], 0)
+ . ' ' . $GLOBALS['strInnoDBPages']
+ . ' / '
+ . join(' ',
+ PMA_formatByteDown($status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size'])) . "\n"
+ . ' | ' . "\n"
+ . '
' . "\n"
+ . ' ' . "\n"
+ . ' ' . "\n"
+ . ' ' . "\n"
+ . ' ' . $GLOBALS['strFreePages'] . ' | ' . "\n"
+ . ' '
+ . PMA_formatNumber($status['Innodb_buffer_pool_pages_free'], 0)
+ . ' | ' . "\n"
+ . '
' . "\n"
+ . ' ' . "\n"
+ . ' ' . $GLOBALS['strDirtyPages'] . ' | ' . "\n"
+ . ' '
+ . PMA_formatNumber($status['Innodb_buffer_pool_pages_dirty'], 0)
+ . ' | ' . "\n"
+ . '
' . "\n"
+ . ' ' . "\n"
+ . ' ' . $GLOBALS['strDataPages'] . ' | ' . "\n"
+ . ' '
+ . PMA_formatNumber($status['Innodb_buffer_pool_pages_data'], 0) . "\n"
+ . ' | ' . "\n"
+ . '
' . "\n"
+ . ' ' . "\n"
+ . ' ' . $GLOBALS['strPagesToBeFlushed'] . ' | ' . "\n"
+ . ' '
+ . PMA_formatNumber($status['Innodb_buffer_pool_pages_flushed'], 0) . "\n"
+ . ' | ' . "\n"
+ . '
' . "\n"
+ . ' ' . "\n"
+ . ' ' . $GLOBALS['strBusyPages'] . ' | ' . "\n"
+ . ' '
+ . PMA_formatNumber($status['Innodb_buffer_pool_pages_misc'], 0) . "\n"
+ . ' | ' . "\n"
+ . '
' . "\n"
+ . ' ' . "\n"
+ . ' ' . $GLOBALS['strLatchedPages'] . ' | ' . "\n"
+ . ' '
+ . PMA_formatNumber($status['Innodb_buffer_pool_pages_latched'], 0) . "\n"
+ . ' | ' . "\n"
+ . '
' . "\n"
+ . ' ' . "\n"
+ . '
' . "\n\n"
+ . '
' . "\n\n"
+ . '' . "\n"
+ . ' ' . "\n"
+ . ' ' . "\n"
+ . ' ' . "\n"
+ . ' ' . $GLOBALS['strReadRequests'] . ' | ' . "\n"
+ . ' '
+ . PMA_formatNumber($status['Innodb_buffer_pool_read_requests'], 0) . "\n"
+ . ' | ' . "\n"
+ . '
' . "\n"
+ . ' ' . "\n"
+ . ' ' . $GLOBALS['strWriteRequests'] . ' | ' . "\n"
+ . ' '
+ . PMA_formatNumber($status['Innodb_buffer_pool_write_requests'], 0) . "\n"
+ . ' | ' . "\n"
+ . '
' . "\n"
+ . ' ' . "\n"
+ . ' ' . $GLOBALS['strBufferReadMisses'] . ' | ' . "\n"
+ . ' '
+ . PMA_formatNumber($status['Innodb_buffer_pool_reads'], 0) . "\n"
+ . ' | ' . "\n"
+ . '
' . "\n"
+ . ' ' . "\n"
+ . ' ' . $GLOBALS['strBufferWriteWaits'] . ' | ' . "\n"
+ . ' '
+ . PMA_formatNumber($status['Innodb_buffer_pool_wait_free'], 0) . "\n"
+ . ' | ' . "\n"
+ . '
' . "\n"
+ . ' ' . "\n"
+ . ' ' . $GLOBALS['strBufferReadMissesInPercent'] . ' | ' . "\n"
+ . ' '
+ . ($status['Innodb_buffer_pool_read_requests'] == 0
+ ? '---'
+ : 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"
+ . ' | ' . "\n"
+ . '
' . "\n"
+ . ' ' . "\n"
+ . ' ' . $GLOBALS['strBufferWriteWaitsInPercent'] . ' | ' . "\n"
+ . ' '
+ . ($status['Innodb_buffer_pool_write_requests'] == 0
+ ? '---'
+ : 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"
+ . ' | ' . "\n"
+ . '
' . "\n"
+ . ' ' . "\n"
+ . '
' . "\n";
+ return $output;
+ }
+
+ /**
+ * returns InnoDB status
+ *
+ * @uses htmlspecialchars()
+ * @uses PMA_DBI_fetch_value()
+ * @return string result of SHOW INNODB STATUS inside pre tags
+ */
+ function getPageStatus()
+ {
+ return '' . "\n"
+ . htmlspecialchars(PMA_DBI_fetch_value('SHOW INNODB STATUS;')) . "\n"
+ . '
' . "\n";
+ }
+
+ /**
+ * returns content for page $id
+ *
+ * @uses $this->getInfoPages()
+ * @uses array_key_exists()
+ * @param string $id page id
+ * @return string html output
+ */
+ function getPage($id)
+ {
+ if ( ! array_key_exists( $id, $this->getInfoPages() ) ) {
+ return false;
+ }
+
+ $id = 'getPage' . $id;
+
+ return $this->$id();
}
}