diff options
author | Nozomi Anzai | 2015-12-02 05:44:43 +0000 |
---|---|---|
committer | Nozomi Anzai | 2015-12-02 05:44:43 +0000 |
commit | 2d73b1f89b489b4064c80f12ea8423ae096c142c (patch) | |
tree | 45e75bc8f659d751e3dbe99a011f6cc1e27ec2f1 | |
parent | 8501e8863483331ef1c73482d02cde3ec6376724 (diff) |
Add new parameters in 3.5
-rw-r--r-- | common.php | 744 | ||||
-rw-r--r-- | config.php | 47 | ||||
-rw-r--r-- | definePgpoolConfParam.php | 211 | ||||
-rw-r--r-- | innerSystemCatalog.php | 31 | ||||
-rw-r--r-- | lang/en.lang.php | 25 | ||||
-rw-r--r-- | lang/ja.lang.php | 20 | ||||
-rw-r--r-- | libs/plugins/function.custom_input.php | 29 | ||||
-rw-r--r-- | libs/plugins/function.custom_radio_bool.php | 30 | ||||
-rw-r--r-- | libs/plugins/function.custom_select.php | 26 | ||||
-rw-r--r-- | libs/plugins/function.custom_table_pgconfig.php | 25 | ||||
-rw-r--r-- | pgconfig.php | 208 | ||||
-rw-r--r-- | queryCache.php | 16 | ||||
-rw-r--r-- | status.php | 32 | ||||
-rw-r--r-- | templates/config.tpl | 208 | ||||
-rw-r--r-- | templates/elements/pgconfig_submenu.tpl | 30 | ||||
-rw-r--r-- | templates/pgconfig.tpl | 2124 | ||||
-rw-r--r-- | version.php | 2 |
17 files changed, 1466 insertions, 2342 deletions
@@ -19,39 +19,33 @@ * is" without express or implied warranty. * * @author Ryuma Ando <[email protected]> - * @copyright 2003-2013 PgPool Global Development Group + * @copyright 2003-2015 PgPool Global Development Group * @version SVN: $Id$ */ require_once('version.php'); require_once('libs/Smarty.class.php'); +require_once('conf/pgmgt.conf.php'); require_once('bootstrap.php'); +require_once('definePgpoolConfParam.php'); error_reporting(E_ALL); -function versions() -{ - return array('3.4', '3.3', '3.2', '3.1', '3.0', - '2.3', '2.2', '2.1', '2.0'); -} - session_start(); /** * Initialize Smartry */ $tpl = new Smarty(); -//$tpl->error_reporting = E_ALL & ~E_NOTICE; +$tpl->error_reporting = E_ALL & ~E_NOTICE; $tpl->assign('version', $version); -if (!file_exists('conf/pgmgt.conf.php')) { +if (! file_exists('conf/pgmgt.conf.php')) { include('lang/en.lang.php'); $tpl->assign('message', $message); $tpl->display('pgmgtNotFound.tpl'); exit(); } -require_once('conf/pgmgt.conf.php'); - /** * Check login */ @@ -60,7 +54,7 @@ $tpl->assign('isHelp', FALSE); // If old pgmgt.conf is used, _PGPOOL2_VERSION doen't exist. // This defined var exists from pgpoolAdmin 3.2. -if (!defined('_PGPOOL2_VERSION')) { +if (! defined('_PGPOOL2_VERSION')) { $versions = versions(); define('_PGPOOL2_VERSION', $versions[0]); } @@ -69,21 +63,17 @@ if (!defined('_PGPOOL2_VERSION')) { * Check pgmgt.conf.php Parameter */ $errors = array(); -if (!defined('_PGPOOL2_LANG') || - !defined('_PGPOOL2_VERSION') || - !defined('_PGPOOL2_CONFIG_FILE') || - !defined('_PGPOOL2_PASSWORD_FILE') || - !defined('_PGPOOL2_COMMAND') || - !defined('_PGPOOL2_PCP_DIR') || - !defined('_PGPOOL2_PCP_HOSTNAME') || - !defined('_PGPOOL2_STATUS_REFRESH_TIME')) +if (! defined('_PGPOOL2_LANG') || + ! defined('_PGPOOL2_VERSION') || + ! defined('_PGPOOL2_CONFIG_FILE') || + ! defined('_PGPOOL2_PASSWORD_FILE') || + ! defined('_PGPOOL2_COMMAND') || + ! defined('_PGPOOL2_PCP_DIR') || + ! defined('_PGPOOL2_PCP_HOSTNAME') || + ! defined('_PGPOOL2_STATUS_REFRESH_TIME')) { include('lang/en.lang.php'); - $tpl->assign('message', $message); - $errorCode = 'e7'; - $tpl->assign('errorCode', $errorCode); - $tpl->display('error.tpl'); - exit(); + errorPage('e7'); } /** @@ -99,10 +89,7 @@ while ($file_name = readdir( $res_dir )) { $messageList[$message['lang']] = $message['strLang']; } else { - $errorCode = 'e2'; - $tpl->assign('errorCode', $errorCode); - $tpl->display('error.tpl'); - exit(); + errorPage('e2'); } } } @@ -117,34 +104,22 @@ include('lang/' . $lang . '.lang.php'); $tpl->assign('message', $message); $_SESSION[SESSION_MESSAGE] = $message; +/* --------------------------------------------------------------------- */ +/* function (DB) */ +/* --------------------------------------------------------------------- */ + /** * Open databse connection - * - * @param array $param - * @return resource */ -function openDBConnection($param) +function openDBConnection($arr) { - $host = $param['hostname']; - $port = $param['port']; - $dbname = $param['dbname']; - $user = $param['user']; - $password = $param['password']; - - if ($host != '') { - $conStr = "host=$host port=$port dbname=$dbname user=$user password=$password" ; - } else { - $conStr = "port=$port dbname=$dbname user=$user password=$password" ; - } - - $con = @pg_connect($conStr); - return $con; + $conStr = generateConstr($arr); + $conn = @pg_connect($conStr); + return $conn; } /** * Close database connection - * - * @param bool */ function closeDBConnection($connection) { @@ -153,10 +128,6 @@ function closeDBConnection($connection) /** * Execute query - * - * @param resource $conn - * @param string $sql - * @return resource */ function execQuery($conn, $sql) { @@ -169,104 +140,64 @@ function execQuery($conn, $sql) } /** - * Select language registred in conf directory - * - * @return string - */ -function selectLanguage($selectLang, $messageList) -{ - if ($selectLang == NULL || $selectLang == 'auto') { - if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { - $acceptLanguages = $_SERVER['HTTP_ACCEPT_LANGUAGE']; - } else { - $acceptLanguages = FALSE; - } - - $lang = NULL; - - if ($acceptLanguages == FALSE) { - $lang = 'en'; - - } else { - $langList = explode(',|;', $acceptLanguages); - foreach ($langList as $acceptLanguage) { - foreach (array_keys($messageList) as $messageLanguage) { - if ($acceptLanguage == $messageLanguage ) { - $lang = $messageLanguage; - break; - } - } - if ($lang != NULL) { break; } - } - } - } else { - $lang = $selectLang; - } - - $_SESSION[SESSION_LANG] = $lang; - return $lang; -} - -/** - * Whether pgpool is operating in the parallel mode or not? - * - * @return bool - */ -function isParallelMode() -{ - $params = readConfigParams(array('parallel_mode')); - - if (isTrue($params['parallel_mode'])) { - return TRUE; - } else { - return FALSE; - } -} - -/** * Confirmation whether node is active or is not. - * - * @return bool */ -function NodeActive($num) +function NodeActive($nodeNum) { - $conn = @pg_connect(conStr($num)); + $params = readConfigParams(array( + 'backend_hostname', 'backend_port', 'backend_weight', + 'health_check_user', 'health_check_password' + )); + + $conn = openDBConnection(array( + 'host' => $params['backend_hostname'][$nodeNum], + 'port' => $params['backend_port'][$nodeNum], + 'dbname' => 'template1', + 'user' => $params['health_check_user'], + 'password' => $params['health_check_password'], + )); if ($conn == FALSE) { - @pg_close($conn); return FALSE; } else { - @pg_close($conn); + closeDBConnection($conn); return TRUE; } } /** * Confirmation whether node is act as a standby server - * - * @return integer */ -function NodeStandby($num) +function NodeStandby($nodeNum) { if (isMasterSlaveMode() == FALSE || useStreaming() == FALSE) { return -1; } - $conn = @pg_connect(conStr($num, 'stream')); + $params = readConfigParams(array( + 'backend_hostname', 'backend_port', + 'sr_check_user','sr_check_password' + )); + + $conn = openDBConnection(array( + 'host' => $params['backend_hostname'][$nodeNum], + 'port' => $params['backend_port'][$nodeNum], + 'dbname' => 'template1', + 'user' => $params['sr_check_user'], + 'password' => $params['sr_check_password'], + )); if ($conn == FALSE) { - @pg_close($conn); return -1; } $result = pg_query($conn, 'SELECT pg_is_in_recovery()'); - if (!pg_result_status($result) == PGSQL_TUPLES_OK) { - @pg_close($conn); + if (! pg_result_status($result) == PGSQL_TUPLES_OK) { + closeDBConnection($conn); return -1; } $rr = pg_fetch_array($result); - if ($rr[0][0] == 't') { $r = 1; } else { @@ -274,294 +205,286 @@ function NodeStandby($num) } @pg_free_result($result); - @pg_close($conn); + closeDBConnection($conn); return $r; } /** - * Create connection str for pg_connect() + * Get if loginUser is super user */ -function conStr($num, $mode = NULL) +function isSuperUser($user_name) { - // check user info - if ($mode == 'login') { - $user = $_SESSION[SESSION_LOGIN_USER]; - $password = $_SESSION[SESSION_LOGIN_USER_PASSWORD]; - - } elseif ($mode == 'stream' && paramExists('sr_check_user')) { - $params = readConfigParams(array('sr_check_user', - 'sr_check_password')); - $user = $params['sr_check_user']; - $password = $params['sr_check_password']; + $params = readConfigParams(array('port')); + $conn = openDBConnection(array( + 'port' => $params['port'], + 'dbname' => 'template1', + 'user' => $_SESSION[SESSION_LOGIN_USER], + 'password' => $_SESSION[SESSION_LOGIN_USER_PASSWORD], + )); - } else { - $params = readConfigParams(array('health_check_user', - 'health_check_password')); - $user = $params['health_check_user']; - $password = (isset($params['health_check_user'])) ? - $params['health_check_password'] : NULL; + if ($conn == FALSE) { + return NULL; } - // backend info - $params = readConfigParams(array('backend_hostname', - 'backend_port', - 'backend_weight')); - $conStr = array(); - if ($params['backend_hostname'][$num] != '') { - $conStr[] = "host='{$params['backend_hostname'][$num]}'"; + $result = pg_query($conn, "SELECT usesuper FROM pg_user WHERE usename = '{$user_name}'"); + if (! pg_result_status($result) == PGSQL_TUPLES_OK) { + closeDBConnection($conn); + return NULL; } - $conStr[] = "port='{$params['backend_port'][$num]}'"; - $conStr[] = "dbname='template1'"; - $conStr[] = "user='{$user}'"; - $conStr[] = "password='{$password}'"; - $conStr = implode($conStr, ' '); - return $conStr; -} + $rr = pg_fetch_array($result); + $rtn = (isset($rr['usesuper']) && $rr['usesuper'] == 't') ? 'yes' : 'no'; -/** - * Existence confirmation of pgpool.pid - * - * @return bool - */ -function DoesPgpoolPidExist() -{ - $params = readConfigParams(array('pid_file_name')); - $pidFile = $params['pid_file_name']; - if (file_exists($pidFile) ) { - return TRUE; - } - return FALSE; -} + @pg_free_result($result); + closeDBConnection($conn); -/** - * Existence confirmation of pgpool.pid - * - * @return bool - */ -function readLogDir() -{ + $_SESSION[SESSION_IS_SUPER_USER] = $rtn; - $params = readConfigParams(array('logdir')); - return $params['logdir']; + return $rtn; } /** - * Whether pgpool is operating in the replication mode or not? - * - * @return bool + * Create connection str for pg_connect() */ -function isReplicationMode() -{ - $params = readConfigParams(array('replication_mode')); - if (isTrue($params['replication_mode'])) { - return TRUE; - } else { - return FALSE; - } -} - -/** - * Whether pgpool is operating in the master slave mode or not? - * - * @return bool - */ -function isMasterSlaveMode() +function generateConstr($params) { - $params = readConfigParams(array('master_slave_mode')); - - if (isTrue($params['master_slave_mode'])) { - return TRUE; - } else { - return FALSE; + $arr = array(); + foreach ($params as $param => $value) { + if ($value == '') { continue; } + switch ($param) { + case 'host': + case 'port': + case 'dbname': + case 'user': + case 'password': + $arr[] = "{$param}='{$value}'"; + } } + $conStr = implode(' ', $arr); + + return $conStr; } +/* --------------------------------------------------------------------- */ +/* function (pgpool) */ +/* --------------------------------------------------------------------- */ + /** - * Whether pgpool is using stream sub mode in master slave mode or not? - * - * @return bool + * Check if pgpool.pid exists */ -function useStreaming() +function DoesPgpoolPidExist() { - $params = readConfigParams(array('master_slave_sub_mode')); - - if (isMasterSlaveMode() && $params['master_slave_sub_mode'] == 'stream') { + $params = readConfigParams(array('pid_file_name')); + $pidFile = $params['pid_file_name']; + if (file_exists($pidFile) ) { return TRUE; - } else { - return FALSE; } + return FALSE; } +/* --------------------------------------------------------------------- */ +/* function (parameters) */ +/* --------------------------------------------------------------------- */ + /** - * Whether pgpool uses syslog or not? - * - * @return bool + * Get the value of "logdir" */ -function useSyslog() +function readLogDir() { - if (!paramExists('log_destination')) { return FALSE; } - - $params = readConfigParams(array('log_destination')); - - if ($params['log_destination'] == 'syslog') { - return TRUE; - } else { - return FALSE; - } + $params = readConfigParams(array('logdir')); + return $params['logdir']; } /** * Read parameters specified in $paramList from pgpool.conf. * If $paramList is not specified, all item is read from pgpool.conf. - * - * @param array $paramList - * @return array */ -function readConfigParams($paramList = FALSE) +function readConfigParams($paramList = array()) { - $results = array(); - $configParam = array(); + $rtn = array(); + global $pgpoolConfigParam, $pgpoolConfigBackendParam , + $pgpoolConfigWdOtherParam, $pgpoolConfigHbDestinationParam; + // Try to read pgpool.conf $configFile = @file(_PGPOOL2_CONFIG_FILE); if ($configFile == FALSE) { $errTpl = new Smarty(); $errTpl->assign('message', $_SESSION[SESSION_MESSAGE]); - $errorCode = 'e4'; - $errTpl->assign('errorCode', $errorCode); - $errTpl->display('error.tpl'); - exit(); + errorPage('e4'); } + // Defined array in definePgpoolConfParam.php + $defines_arr = $pgpoolConfigParam + $pgpoolConfigBackendParam + + $pgpoolConfigWdOtherParam + $pgpoolConfigHbDestinationParam; + + $arr = array(); + // Convert lines in files to array foreach ($configFile as $line_num => $line) { $line = trim($line); - if (preg_match("/^\w/", $line)) { - list($key, $value) = explode("=", $line); - - $key = trim($key); - $value = trim($value); - - // params about backend nodes - if (preg_match("/^backend_hostname/", $key)) { - $num = str_replace('backend_hostname', '', $key); - $configParam['backend_hostname'][$num] = str_replace("'", "", $value); + if (substr($line, 0, 1) == '#' || strpos($line, '=') === FALSE) { + continue; + } - } elseif (preg_match("/^backend_port/", $key)) { - $num = str_replace('backend_port', '', $key); - $configParam['backend_port'][$num] = $value; + list($key, $value) = explode('=', $line); + $key = trim($key); - } elseif (preg_match("/^backend_weight/", $key)) { - $num = str_replace('backend_weight', '', $key); - $configParam['backend_weight'][$num] = $value; + $num = preg_replace('/[^0-9]/', NULL, $key); + $key_wo_num = str_replace($num, NULL, $key); - } elseif (preg_match("/^backend_data_directory/", $key)) { - $num = str_replace('backend_data_directory', '', $key); - $configParam['backend_data_directory'][$num] =str_replace("'", "", $value); + // Ignore params not specified to read + if ($paramList && is_array($paramList) && ! in_array($key_wo_num, $paramList)) { + continue; + } - } elseif (preg_match("/^backend_flag/", $key)) { - $num = str_replace('backend_flag', '', $key); - $configParam['backend_flag'][$num] =str_replace("'", "", $value); + // Remove quotes and comments + $value = trimValue($value); - // params about watchdog monitoring - } elseif (preg_match("/^other_pgpool_hostname/", $key)) { - $num = str_replace('other_pgpool_hostname', '', $key); - $configParam['other_pgpool_hostname'][$num] = str_replace("'", "", $value); + if (! isset($defines_arr[$key_wo_num])) { + continue; - } elseif (preg_match("/^other_pgpool_port/", $key)) { - $num = str_replace('other_pgpool_port', '', $key); - $configParam['other_pgpool_port'][$num] = $value; + // Params with multiple values + // (backend_*, other_pgpool_*, heartbeat_destination_*, heartbeat_device*) + } elseif (isset($defines_arr[$key_wo_num]['multiple']) && + $defines_arr[$key_wo_num]['multiple'] == TRUE) + { + $rtn[$key_wo_num][$num] = $value; - } elseif (preg_match("/^other_wd_port/", $key)) { - $num = str_replace('other_wd_port', '', $key); - $configParam['other_wd_port'][$num] = $value; + } else { + // Ignore param not defined definePgpoolConfParam.php + $rtn[$key_wo_num] = $value; + } + } - // params about watchdog heartbeat - } elseif (preg_match("/^heartbeat_destination_port/", $key)) { - $num = str_replace('heartbeat_destination_port', '', $key); - $configParam['heartbeat_destination_port'][$num] = $value; + // Set default value if there is no line about the param + if ($paramList && is_array($paramList)) { + foreach ($paramList as $key) { + if (! isset($rtn[$key]) || $rtn[$key] == NULL) { + $default_value = $defines_arr[$key]['default']; - } elseif (preg_match("/^heartbeat_destination/", $key)) { - $num = str_replace('heartbeat_destination', '', $key); - $configParam['heartbeat_destination'][$num] = str_replace("'", "", $value); + if (isset($defines_arr[$key]['multiple']) && + $defines_arr[$key]['multiple']) + { + $rtn[$key][0] = $default_value; + } else { + $rtn[$key] = $default_value; + } + } + } - } elseif (preg_match("/^heartbeat_device/", $key)) { - $num = str_replace('heartbeat_device', '', $key); - $configParam['heartbeat_device'][$num] = str_replace("'", "", $value); + } elseif ($defines_arr) { + foreach ($defines_arr as $key => $param_info) { + if (! isset($rtn[$key])) { + $default_value = (isset($defines_arr[$key]['default'])) ? + $defines_arr[$key]['default'] : NULL; - } else { - $configParam[$key] = str_replace("'", "", $value); + if (isset($defines_arr[$key]['multiple']) && + $defines_arr[$key]['multiple']) + { + $rtn[$key][0] = $default_value; + } else { + $rtn[$key] = $default_value; + } } } } - if (is_array($paramList)) { - foreach ($paramList as $key) { - if (isset($configParam[$key])) { - $results[$key] = $configParam[$key]; + return $rtn; +} + +function trimValue($text) +{ + // Remove spaces + $text = trim($text); + + $rtn = ''; + $in_quotes = FALSE; + for ($i = 0; $i < strlen($text); $i++) { + $c = substr($text, $i, 1); + + switch ($c) { + // Ignore "'" + case "'": + if ($in_quotes) { + break 2; } else { - require_once('definePgpoolConfParam.php'); - if(!preg_match("/^backend_hostname/", $key) && - !preg_match("/^backend_port/", $key) && - !preg_match("/^backend_weight/", $key) && - !preg_match("/^backend_data_directory/", $key) && - !preg_match("/^backend_flag/", $key) && - !preg_match("/^other_pgpool_hostname/", $key) && - !preg_match("/^other_pgpool_port/", $key) && - !preg_match("/^other_wd_port/", $key) && - !preg_match("/^heartbeat_destination/", $key) && - !preg_match("/^heartbeat_destination_port/", $key) && - !preg_match("/^heartbeat_device/", $key) - ) - { - if (isset($configParam[$key])) { - $results[$key] = $configParam[$key]['default']; - } - } + $in_quotes = TRUE; + } + break; + + // Ignore "#" comment + case '#': + if (! $in_quotes) { + break; } + break; } - } else { - $results = $configParam; + $rtn .= $c; } - return $results; - + $rtn = trim($rtn, "'"); + return $rtn; } -function isPipe($str) - +/** + * Select language registred in conf directory + */ +function selectLanguage($selectLang, $messageList) { - return (strpos($str, '|') !== FALSE); -} + if ($selectLang == NULL || $selectLang == 'auto') { + if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { + $acceptLanguages = $_SERVER['HTTP_ACCEPT_LANGUAGE']; + } else { + $acceptLanguages = FALSE; + } -function isTrue($value) -{ - return in_array($value, array('on', 'true')); -} + $lang = NULL; -/* check version */ -function hasWatchdog() -{ - return (3.2 <= _PGPOOL2_VERSION); -} + if ($acceptLanguages == FALSE) { + $lang = 'en'; -function hasMemqcache() -{ - return (3.2 <= _PGPOOL2_VERSION); -} -// pgpool has pcp_promote_node ? -function hasPcpPromote() -{ - return (3.1 <= _PGPOOL2_VERSION); + } else { + $langList = explode(',|;', $acceptLanguages); + foreach ($langList as $acceptLanguage) { + foreach (array_keys($messageList) as $messageLanguage) { + if ($acceptLanguage == $messageLanguage ) { + $lang = $messageLanguage; + break; + } + } + if ($lang != NULL) { break; } + } + } + } else { + $lang = $selectLang; + } + + $_SESSION[SESSION_LANG] = $lang; + return $lang; } +/** + * Check if the parameter is used in the specified version + */ function paramExists($param) { $add_version = $del_version = 0; /* Add */ switch ($param) { + // params added in 3.5 + case 'if_cmd_path': + case 'health_check_database': + case 'pcp_listen_addresses': + case 'search_primary_node_timeout': + case 'serialize_accept': + case 'sr_check_database': + case 'wd_de_escalation_command': + case 'wd_ipc_socket_dir': + case 'wd_priority': + $add_version = 3.5; + break; // params added in 3.4 case 'listen_backlog_multiplier': @@ -677,6 +600,11 @@ function paramExists($param) /* Delete */ switch ($param) { + // params deleted in 3.5 + case 'ifconfig_path': + $del_version = 3.5; + break; + // params deleted in 3.4 case 'print_timestamp': case 'parallel_mode': @@ -705,55 +633,165 @@ function paramExists($param) break; } - if ($add_version && $add_version <= _PGPOOL2_VERSION) { + $rtn = TRUE; + if ($add_version && _PGPOOL2_VERSION < $add_version) { + $rtn = FALSE; + } + if ($del_version && $del_version <= _PGPOOL2_VERSION) { + $rtn = FALSE; + } + return $rtn; +} + +/* --------------------------------------------------------------------- */ +/* function (mode) */ +/* --------------------------------------------------------------------- */ + +function versions() +{ + return array('3.5', '3.4', '3.3', '3.2', '3.1', '3.0', + '2.3', '2.2', '2.1', '2.0'); +} + +/** + * Whether pgpool is operating in the replication mode or not? + */ +function isReplicationMode() +{ + $params = readConfigParams(array('replication_mode')); + + if (isTrue($params['replication_mode'])) { return TRUE; - } elseif ($del_version && _PGPOOL2_VERSION < $del_version) { + } else { + return FALSE; + } +} + +/** + * Whether pgpool is operating in the master slave mode or not? + */ +function isMasterSlaveMode() +{ + $params = readConfigParams(array('master_slave_mode')); + + if (isTrue($params['master_slave_mode'])) { return TRUE; + } else { + return FALSE; } - return FALSE; } -/* Get if loginUser is super user */ -function isSuperUser($user_name) +/** + * Whether pgpool is operating in the parallel mode or not? + */ +function isParallelMode() { - $conn = @pg_connect(conStrPgpool()); + $params = readConfigParams(array('parallel_mode')); - if ($conn == FALSE) { - @pg_close($conn); - return NULL; + if (isTrue($params['parallel_mode'])) { + return TRUE; + } else { + return FALSE; } +} - $result = pg_query($conn, "SELECT usesuper FROM pg_user WHERE usename = '{$user_name}'"); +/** + * Whether pgpool is using stream sub mode in master slave mode or not? + */ +function useStreaming() +{ + $params = readConfigParams(array('master_slave_sub_mode')); - if (!pg_result_status($result) == PGSQL_TUPLES_OK) { - @pg_close($conn); - return NULL; + if (isMasterSlaveMode() && $params['master_slave_sub_mode'] == 'stream') { + return TRUE; + } else { + return FALSE; } +} - $rr = pg_fetch_array($result); - $rtn = (isset($rr['usesuper']) && $rr['usesuper'] == 't') ? 'yes' : 'no'; +/** + * Whether pgpool uses syslog or not? + */ +function useSyslog() +{ + if (!paramExists('log_destination')) { return FALSE; } - @pg_free_result($result); - @pg_close($conn); + $params = readConfigParams(array('log_destination')); - $_SESSION[SESSION_IS_SUPER_USER] = $rtn; + if ($params['log_destination'] == 'syslog') { + return TRUE; + } else { + return FALSE; + } +} + +/** + * Return if pgpool has watchdog feature + */ +function hasWatchdog() +{ + return (3.2 <= _PGPOOL2_VERSION); +} + +/** + * Return if pgpool has memqcache + */ +function hasMemqcache() +{ + return (3.2 <= _PGPOOL2_VERSION); +} + +/** + * Return if pgpool has pcp_promote_node ? + */ +function hasPcpPromote() +{ + return (3.1 <= _PGPOOL2_VERSION); +} + +/* + * Return the list of parameters in a group + */ +function getMultiParams() +{ + $rtn = array(); + + $rtn['backend'] = array('backend_hostname', 'backend_port', 'backend_weight', 'backend_data_directory'); + if (paramExists('backend_flag')) { + $rtn['backend'][] = 'backend_flag'; + } + + $rtn['other_pgpool'] = array('other_pgpool_hostname', 'other_pgpool_port', 'other_wd_port'); + + $rtn['heartbeat'] = array('heartbeat_destination', 'heartbeat_destination_port', 'heartbeat_device'); return $rtn; } -function conStrPgpool() +/* --------------------------------------------------------------------- */ +/* function (other) */ +/* --------------------------------------------------------------------- */ + +function isPipe($str) + { - $params = readConfigParams(array('port')); - $conStr[] = "port='{$params['port']}'"; - $conStr[] = "dbname='template1'"; - $conStr[] = "user='{$_SESSION[SESSION_LOGIN_USER]}'"; - $conStr[] = "password='{$_SESSION[SESSION_LOGIN_USER_PASSWORD]}'"; + return (strpos($str, '|') !== FALSE); +} - $conStr = implode($conStr, ' '); - return $conStr; +function isTrue($value) +{ + return in_array($value, array('on', 'true')); +} + +function errorPage($errorCode) +{ + global $tpl; + + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); } -/* for debug */ function pr($array) { echo '<pre>'; @@ -19,7 +19,7 @@ * is" without express or implied warranty. * * @author Ryuma Ando <[email protected]> - * @copyright 2003-2012 PgPool Global Development Group + * @copyright 2003-2015 PgPool Global Development Group * @version CVS: $Id$ */ @@ -52,6 +52,21 @@ $params = array(); global $errors; $errors = array(); +/* --------------------------------------------------------------------- */ +/* define */ +/* --------------------------------------------------------------------- */ + +$select_options = array( + 'lang' => array('auto' => 'auto') + $messageList, + 'version' => array_combine(versions(), versions()), + 'm' => array('s' => 'smart', 'f' => 'fast', 'i' => 'immediate'), +); +$tpl->assign('select_options', $select_options); + +/* --------------------------------------------------------------------- */ +/* main */ +/* --------------------------------------------------------------------- */ + /* * Read current parameter */ @@ -89,7 +104,6 @@ $params['pcp_refresh_time'] = (defined('_PGPOOL2_STATUS_REFRESH_TIME')) ? $tpl->assign('status', NULL); switch ( $action ) { case 'update': - setValue('lang'); setValue('version'); setValue('pgpool_config_file'); @@ -108,13 +122,11 @@ switch ( $action ) { setBool('C'); setValue('pgpool_logfile'); - // pipe if ($params['pgpool_logfile'] != '' && isPipe($params['pgpool_logfile'])) { $tmp_str = trim($params['pgpool_logfile']); if ($tmp_str[0] != '|' || $tmp_str[strlen($tmp_str) - 1] == '|') { $errors['pgpool_logfile'] = $message['errIllegalPipe']; } - // file } elseif ($params['pgpool_logfile'] != '' && !is_writable(dirname($params['pgpool_logfile']))) { $errors['pgpool_logfile'] = $message['errFileNotWritable']; } @@ -141,20 +153,10 @@ switch ( $action ) { if (count($errors) == 0 ) { $pgmgtConfigFile = dirname(__FILE__) . '/conf/pgmgt.conf.php'; - if (!is_writable($pgmgtConfigFile)) { - $errorCode = 'e5003'; - $tpl->assign('errorCode', $errorCode); - $tpl->display('error.tpl'); - exit(); - } + if (! is_writable($pgmgtConfigFile)) { errorPage('e5003'); } $result = writePgmtConf($pgmgtConfigFile); - if (!$result) { - $errorCode = 'e5001'; - $tpl->assign('errorCode', $errorCode); - $tpl->display('error.tpl'); - exit(); - } + if (!$result) { errorPage('e5001'); } $tpl->assign('status', 'success'); @@ -205,8 +207,17 @@ function setBool($key) global $g_post; global $params; - if (isset($g_post[$key])) { - $params[$key] = 1; + switch ($key) { + case 'C': + $key_in_form = 'large_c'; break; + case 'D': + $key_in_form = 'large_d'; break; + default: + $key_in_form = $key; break; + } + + if (isset($g_post[$key_in_form])) { + $params[$key] = $g_post[$key_in_form]; } else { $params[$key] = 0; } diff --git a/definePgpoolConfParam.php b/definePgpoolConfParam.php index 5cf1cfd..9710125 100644 --- a/definePgpoolConfParam.php +++ b/definePgpoolConfParam.php @@ -18,7 +18,7 @@ * is" without express or implied warranty. * * @author Ryuma Ando <[email protected]> - * @copyright 2003-2013 PgPool Global Development Group + * @copyright 2003-2015 PgPool Global Development Group * @version CVS: $Id$ */ @@ -56,17 +56,20 @@ $key = 'listen_addresses'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'localhost'; $pgpoolConfigParam[$key]['regexp'] = $addressreg; +$pgpoolConfigParam[$key]['restart'] = TRUE; $key = 'port'; $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 9999; $pgpoolConfigParam[$key]['max'] = NUM_MAX; $pgpoolConfigParam[$key]['min'] = 1024; +$pgpoolConfigParam[$key]['restart'] = TRUE; $key = 'socket_dir'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = '/tmp'; $pgpoolConfigParam[$key]['regexp'] = $dirreg; +$pgpoolConfigParam[$key]['restart'] = TRUE; $key = 'listen_backlog_multiplier'; $pgpoolConfigParam[$key]['type'] = 'N'; @@ -74,18 +77,30 @@ $pgpoolConfigParam[$key]['default'] = 2; $pgpoolConfigParam[$key]['max'] = NUM_MAX; $pgpoolConfigParam[$key]['min'] = 1; +$key = 'serialize_accept'; +$pgpoolConfigParam[$key]['type'] = 'B'; +$pgpoolConfigParam[$key]['default'] = 'off'; + # - pgpool Communication Manager Connection Settings - +$key = 'pcp_listen_addresses'; +$pgpoolConfigParam[$key]['type'] = 'C'; +$pgpoolConfigParam[$key]['default'] = 'localhost'; +$pgpoolConfigParam[$key]['regexp'] = $addressreg; +$pgpoolConfigParam[$key]['restart'] = TRUE; + $key = 'pcp_port'; $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 9898; $pgpoolConfigParam[$key]['min'] = 1024; $pgpoolConfigParam[$key]['max'] = NUM_MAX; +$pgpoolConfigParam[$key]['restart'] = TRUE; $key = 'pcp_socket_dir'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = '/tmp'; $pgpoolConfigParam[$key]['regexp'] = $dirreg; +$pgpoolConfigParam[$key]['restart'] = TRUE; # - Backend Connection Settings - @@ -93,28 +108,34 @@ $key = 'backend_hostname'; $pgpoolConfigBackendParam[$key]['type'] = 'C'; $pgpoolConfigBackendParam[$key]['default'] = ''; $pgpoolConfigBackendParam[$key]['regexp'] = $hostreg; +$pgpoolConfigBackendParam[$key]['multiple'] = TRUE; $key = 'backend_port'; $pgpoolConfigBackendParam[$key]['type'] = 'N'; $pgpoolConfigBackendParam[$key]['default'] = 5432; $pgpoolConfigBackendParam[$key]['min'] = 1024; $pgpoolConfigBackendParam[$key]['max'] = NUM_MAX; +$pgpoolConfigBackendParam[$key]['multiple'] = TRUE; $key = 'backend_weight'; $pgpoolConfigBackendParam[$key]['type'] = 'F'; $pgpoolConfigBackendParam[$key]['default'] = 1; $pgpoolConfigBackendParam[$key]['min'] = 0.0; $pgpoolConfigBackendParam[$key]['max'] = 100.0; +$pgpoolConfigBackendParam[$key]['multiple'] = TRUE; $key = 'backend_data_directory'; $pgpoolConfigBackendParam[$key]['type'] = 'C'; $pgpoolConfigBackendParam[$key]['default'] = ''; $pgpoolConfigBackendParam[$key]['regexp'] = $anyelse; +$pgpoolConfigBackendParam[$key]['multiple'] = TRUE; $key = 'backend_flag'; $pgpoolConfigBackendParam[$key]['type'] = 'C'; $pgpoolConfigBackendParam[$key]['default'] = 'ALLOW_TO_FAILOVER'; -$pgpoolConfigBackendParam[$key]['regexp'] = selectreg(array('ALLOW_TO_FAILOVER', 'DISALLOW_TO_FAILOVER')); +$pgpoolConfigBackendParam[$key]['select'] = array('ALLOW_TO_FAILOVER', 'DISALLOW_TO_FAILOVER'); +$pgpoolConfigBackendParam[$key]['regexp'] = selectreg($pgpoolConfigBackendParam[$key]['select']); +$pgpoolConfigBackendParam[$key]['multiple'] = TRUE; # - Authentication - @@ -138,26 +159,35 @@ $pgpoolConfigParam[$key]['max'] = 10000; $key = 'ssl'; $pgpoolConfigParam[$key]['type'] = 'B'; $pgpoolConfigParam[$key]['default'] = 'off'; +$pgpoolConfigParam[$key]['restart'] = TRUE; $key = 'ssl_key'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $sslreg; +$pgpoolConfigParam[$key]['restart'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('ssl' => 'on'); $key = 'ssl_cert'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $sslreg; +$pgpoolConfigParam[$key]['restart'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('ssl' => 'on'); $key = 'ssl_ca_cert'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $sslreg; +$pgpoolConfigParam[$key]['restart'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('ssl' => 'on'); $key = 'ssl_ca_cert_dir'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $sslreg; +$pgpoolConfigParam[$key]['restart'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('ssl' => 'on'); #------------------------------------------------------------------------------ # POOLS @@ -170,12 +200,14 @@ $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = '32'; $pgpoolConfigParam[$key]['min'] = 1; $pgpoolConfigParam[$key]['max'] = NUM_MAX; +$pgpoolConfigParam[$key]['restart'] = TRUE; $key = 'max_pool'; $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 4; $pgpoolConfigParam[$key]['min'] = 1; $pgpoolConfigParam[$key]['max'] = NUM_MAX; +$pgpoolConfigParam[$key]['restart'] = TRUE; # - Life time - @@ -212,7 +244,8 @@ $pgpoolConfigParam[$key]['max'] = NUM_MAX; $key = 'log_destination'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'stderr'; -$pgpoolConfigParam[$key]['regexp'] = selectreg(array('stderr', 'syslog')); +$pgpoolConfigParam[$key]['select'] = array('stderr', 'syslog'); +$pgpoolConfigParam[$key]['regexp'] = selectreg($pgpoolConfigParam[$key]['select']); # - What to log - @@ -224,6 +257,7 @@ $pgpoolConfigParam[$key]['regexp'] = $anyelse; $key = 'print_timestamp'; $pgpoolConfigParam[$key]['type'] = 'B'; $pgpoolConfigParam[$key]['default'] = 'on'; +$pgpoolConfigParam[$key]['restart'] = TRUE; $key = 'log_connections'; $pgpoolConfigParam[$key]['type'] = 'B'; @@ -244,7 +278,8 @@ $pgpoolConfigParam[$key]['default'] = 'off'; $key = 'log_standby_delay'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'none'; -$pgpoolConfigParam[$key]['regexp'] = selectreg(array('always', 'if_over_threshold', 'none')); +$pgpoolConfigParam[$key]['select'] = array('always', 'if_over_threshold', 'none'); +$pgpoolConfigParam[$key]['regexp'] = selectreg($pgpoolConfigParam[$key]['select']); # - Syslog specific - @@ -252,11 +287,13 @@ $key = 'syslog_facility'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'LOCAL0'; $pgpoolConfigParam[$key]['regexp'] = $strreg; +$pgpoolConfigParam[$key]['parent'] = array('log_destination' => 'syslog'); $key = 'syslog_ident'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'pgpool'; $pgpoolConfigParam[$key]['regexp'] = $strreg; +$pgpoolConfigParam[$key]['parent'] = array('log_destination' => 'syslog'); # - Debug - @@ -269,19 +306,26 @@ $pgpoolConfigParam[$key]['max'] = NUM_MAX; $key = 'log_error_verbosity'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'DEFAULT'; -$pgpoolConfigParam[$key]['regexp'] = selectreg(array('TERSE', 'DEFAULT', 'VERBOSE')); +$pgpoolConfigParam[$key]['select'] = array('TERSE', 'DEFAULT', 'VERBOSE'); +$pgpoolConfigParam[$key]['regexp'] = selectreg($pgpoolConfigParam[$key]['select']); $key = 'client_min_messages'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'notice'; -$pgpoolConfigParam[$key]['regexp'] = selectreg(array('debug5', 'debug4', 'debug3', 'debug2', 'debug1', - 'log', 'notice', 'warning', 'error')); +$pgpoolConfigParam[$key]['select'] = array( + 'debug5', 'debug4', 'debug3', 'debug2', 'debug1', + 'log', 'notice', 'warning', 'error' +); +$pgpoolConfigParam[$key]['regexp'] = selectreg($pgpoolConfigParam[$key]['select']); $key = 'log_min_messages'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'warning'; -$pgpoolConfigParam[$key]['regexp'] = selectreg(array('debug5', 'debug4', 'debug3', 'debug2', 'debug1', - 'info', 'notice', 'warning', 'error', 'log', 'fatal', 'panic')); +$pgpoolConfigParam[$key]['select'] = array( + 'debug5', 'debug4', 'debug3', 'debug2', 'debug1', + 'info', 'notice', 'warning', 'error', 'log', 'fatal', 'panic' +); +$pgpoolConfigParam[$key]['regexp'] = selectreg($pgpoolConfigParam[$key]['select']); #------------------------------------------------------------------------------ # FILE LOCATIONS @@ -291,11 +335,13 @@ $key = 'pid_file_name'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = '/var/run/pgpool/pgpool.pid'; $pgpoolConfigParam[$key]['regexp'] = $dirreg; +$pgpoolConfigParam[$key]['restart'] = TRUE; $key = 'logdir'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = '/tmp'; $pgpoolConfigParam[$key]['regexp'] = $dirreg; +$pgpoolConfigParam[$key]['restart'] = TRUE; #------------------------------------------------------------------------------ # CONNECTION POOLING @@ -304,6 +350,7 @@ $pgpoolConfigParam[$key]['regexp'] = $dirreg; $key = 'connection_cache'; $pgpoolConfigParam[$key]['type'] = 'B'; $pgpoolConfigParam[$key]['default'] =true; +$pgpoolConfigParam[$key]['restart'] = TRUE; $key = 'reset_query_list'; $pgpoolConfigParam[$key]['type'] = 'C'; @@ -317,29 +364,35 @@ $pgpoolConfigParam[$key]['regexp'] = $queryreg; $key = 'replication_mode'; $pgpoolConfigParam[$key]['type'] = 'B'; $pgpoolConfigParam[$key]['default'] = 'off'; +$pgpoolConfigParam[$key]['restart'] = TRUE; $key = 'replicate_select'; $pgpoolConfigParam[$key]['type'] = 'B'; $pgpoolConfigParam[$key]['default'] = 'off'; +$pgpoolConfigParam[$key]['parent'] = array('replication_mode' => 'on'); $key = 'insert_lock'; $pgpoolConfigParam[$key]['type'] = 'B'; $pgpoolConfigParam[$key]['default'] = 'off'; +$pgpoolConfigParam[$key]['parent'] = array('replication_mode' => 'on'); $key = 'lobj_lock_table'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('replication_mode' => 'on'); # - Degenerate handling - $key = 'replication_stop_on_mismatch'; $pgpoolConfigParam[$key]['type'] = 'B'; $pgpoolConfigParam[$key]['default'] = 'off'; +$pgpoolConfigParam[$key]['parent'] = array('replication_mode' => 'on'); $key = 'failover_if_affected_tuples_mismatch'; $pgpoolConfigParam[$key]['type'] = 'B'; $pgpoolConfigParam[$key]['default'] = 'off'; +$pgpoolConfigParam[$key]['parent'] = array('replication_mode' => 'on'); #------------------------------------------------------------------------------ # LOAD BALANCING MODE @@ -348,34 +401,41 @@ $pgpoolConfigParam[$key]['default'] = 'off'; $key = 'load_balance_mode'; $pgpoolConfigParam[$key]['type'] = 'B'; $pgpoolConfigParam[$key]['default'] = 'off'; +$pgpoolConfigParam[$key]['restart'] = TRUE; $key = 'ignore_leading_white_space'; $pgpoolConfigParam[$key]['type'] = 'B'; $pgpoolConfigParam[$key]['default'] = true; +$pgpoolConfigParam[$key]['parent'] = array('load_balance_mode' => 'on'); $key = 'white_function_list'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('load_balance_mode' => 'on'); $key = 'black_function_list'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('load_balance_mode' => 'on'); $key = 'database_redirect_preference_list'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('load_balance_mode' => 'on'); $key = 'app_name_redirect_preference_list'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('load_balance_mode' => 'on'); $key = 'allow_sql_comments'; $pgpoolConfigParam[$key]['type'] = 'B'; $pgpoolConfigParam[$key]['default'] = 'off'; +$pgpoolConfigParam[$key]['parent'] = array('load_balance_mode' => 'on'); #------------------------------------------------------------------------------ # MASTER/SLAVE MODE @@ -384,11 +444,15 @@ $pgpoolConfigParam[$key]['default'] = 'off'; $key = 'master_slave_mode'; $pgpoolConfigParam[$key]['type'] = 'B'; $pgpoolConfigParam[$key]['default'] = 'off'; +$pgpoolConfigParam[$key]['restart'] = TRUE; $key = 'master_slave_sub_mode'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'slony'; -$pgpoolConfigParam[$key]['regexp'] = selectreg(array('slony', 'stream')); +$pgpoolConfigParam[$key]['select'] = array('slony', 'stream'); +$pgpoolConfigParam[$key]['regexp'] = selectreg($pgpoolConfigParam[$key]['select']); +$pgpoolConfigParam[$key]['restart'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('master_slave_mode' => 'on'); # - Streaming - @@ -397,28 +461,39 @@ $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 0; $pgpoolConfigParam[$key]['min'] = 0; $pgpoolConfigParam[$key]['max'] = NUM_MAX; +$pgpoolConfigParam[$key]['parent'] = array('master_slave_mode' => 'on', 'master_slave_sub_mode' => 'stream'); $key = 'sr_check_user'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $listreg; +$pgpoolConfigParam[$key]['parent'] = array('master_slave_mode' => 'on', 'master_slave_sub_mode' => 'stream'); $key = 'sr_check_password'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $listreg; +$pgpoolConfigParam[$key]['parent'] = array('master_slave_mode' => 'on', 'master_slave_sub_mode' => 'stream'); + +$key = 'sr_check_database'; +$pgpoolConfigParam[$key]['type'] = 'C'; +$pgpoolConfigParam[$key]['default'] = ''; +$pgpoolConfigParam[$key]['regexp'] = $listreg; +$pgpoolConfigParam[$key]['parent'] = array('master_slave_mode' => 'on', 'master_slave_sub_mode' => 'stream'); $key = 'delay_threshold'; $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 0; $pgpoolConfigParam[$key]['min'] = 0; $pgpoolConfigParam[$key]['max'] = NUM_MAX; +$pgpoolConfigParam[$key]['parent'] = array('master_slave_mode' => 'on', 'master_slave_sub_mode' => 'stream'); # - Special commands - $key = 'follow_master_command'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('master_slave_mode' => 'on'); #------------------------------------------------------------------------------ # PARALLEL MODE AND QUERY CACHE @@ -427,15 +502,20 @@ $pgpoolConfigParam[$key]['regexp'] = $anyelse; $key = 'parallel_mode'; $pgpoolConfigParam[$key]['type'] = 'B'; $pgpoolConfigParam[$key]['default'] = 'off'; +$pgpoolConfigParam[$key]['restart'] = TRUE; $key = 'enable_query_cache'; $pgpoolConfigParam[$key]['type'] = 'B'; $pgpoolConfigParam[$key]['default'] = 'off'; +$pgpoolConfigParam[$key]['restart'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('parallel_mode' => 'on'); $key = 'pgpool2_hostname'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'localhost'; $pgpoolConfigParam[$key]['regexp'] = $hostreg; +$pgpoolConfigParam[$key]['restart'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('parallel_mode' => 'on'); # - System DB info - @@ -443,32 +523,44 @@ $key = 'system_db_hostname'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'system_db_hostname'; $pgpoolConfigParam[$key]['regexp'] = $hostreg; +$pgpoolConfigParam[$key]['restart'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('parallel_mode' => 'on'); $key = 'system_db_port'; $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 5432; $pgpoolConfigParam[$key]['min'] = 1024; $pgpoolConfigParam[$key]['max'] = NUM_MAX; +$pgpoolConfigParam[$key]['restart'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('parallel_mode' => 'on'); $key = 'system_db_dbname'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'pgpool'; $pgpoolConfigParam[$key]['regexp'] = $strreg; +$pgpoolConfigParam[$key]['restart'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('parallel_mode' => 'on'); $key = 'system_db_schema'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'pgpool_catalog'; $pgpoolConfigParam[$key]['regexp'] = $strreg; +$pgpoolConfigParam[$key]['restart'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('parallel_mode' => 'on'); $key = 'system_db_user'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'pgpool'; $pgpoolConfigParam[$key]['regexp'] = $userreg; +$pgpoolConfigParam[$key]['restart'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('parallel_mode' => 'on'); $key = 'system_db_password'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['restart'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('parallel_mode' => 'on'); #------------------------------------------------------------------------------ # HEALTH CHECK @@ -496,6 +588,11 @@ $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$key = 'health_check_database'; +$pgpoolConfigParam[$key]['type'] = 'C'; +$pgpoolConfigParam[$key]['default'] = ''; +$pgpoolConfigParam[$key]['regexp'] = $anyelse; + $key = 'health_check_max_retries'; $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 0; @@ -532,6 +629,11 @@ $key = 'fail_over_on_backend_error'; $pgpoolConfigParam[$key]['type'] = 'B'; $pgpoolConfigParam[$key]['default'] = 'on'; +$key = 'search_primary_node_timeout'; +$pgpoolConfigParam[$key]['type'] = 'N'; +$pgpoolConfigParam[$key]['default'] = 10; +$pgpoolConfigParam[$key]['min'] = 0; + #------------------------------------------------------------------------------ # ONLINE RECOVERY #------------------------------------------------------------------------------ @@ -585,18 +687,35 @@ $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $hostreg; $pgpoolConfigParam[$key]['null_ok'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); $key = 'wd_port'; $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 9000; $pgpoolConfigParam[$key]['max'] = NUM_MAX; $pgpoolConfigParam[$key]['min'] = 1024; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); + +$key = 'wd_priority'; +$pgpoolConfigParam[$key]['type'] = 'N'; +$pgpoolConfigParam[$key]['default'] = 1; +$pgpoolConfigParam[$key]['min'] = 0; +$pgpoolConfigParam[$key]['max'] = NUM_MAX; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); $key = 'wd_authkey'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $anyelse; $pgpoolConfigParam[$key]['null_ok'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); + +$key = 'wd_ipc_socket_dir'; +$pgpoolConfigParam[$key]['type'] = 'C'; +$pgpoolConfigParam[$key]['default'] = '/tmp'; +$pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['null_ok'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); # Connection to up stream servers @@ -604,11 +723,13 @@ $key = 'trusted_servers'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); $key = 'ping_path'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); # Virtual IP control @@ -617,42 +738,62 @@ $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $hostreg; $pgpoolConfigParam[$key]['null_ok'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); $key = 'ifconfig_path'; $pgpoolConfigParam[$key]['type'] = 'C'; -$pgpoolConfigParam[$key]['default'] = ''; +$pgpoolConfigParam[$key]['default'] = '/sbin'; +$pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); + +$key = 'if_cmd_path'; +$pgpoolConfigParam[$key]['type'] = 'C'; +$pgpoolConfigParam[$key]['default'] = '/sbin'; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); $key = 'if_up_cmd'; $pgpoolConfigParam[$key]['type'] = 'C'; -$pgpoolConfigParam[$key]['default'] = ''; +$pgpoolConfigParam[$key]['default'] = 'ip addr add $_IP_$/24 dev eth0 label eth0:0'; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); $key = 'if_down_cmd'; $pgpoolConfigParam[$key]['type'] = 'C'; -$pgpoolConfigParam[$key]['default'] = ''; +$pgpoolConfigParam[$key]['default'] = 'ip addr del $_IP_$/24 dev eth0'; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); $key = 'arping_path'; $pgpoolConfigParam[$key]['type'] = 'C'; -$pgpoolConfigParam[$key]['default'] = ''; +$pgpoolConfigParam[$key]['default'] = '/usr/sbin'; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); $key = 'arping_cmd'; $pgpoolConfigParam[$key]['type'] = 'C'; -$pgpoolConfigParam[$key]['default'] = ''; +$pgpoolConfigParam[$key]['default'] = 'arping -U $_IP_$ -w 1'; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); # Behavior on escalation $key = 'clear_memqcache_on_escalation'; $pgpoolConfigParam[$key]['type'] = 'B'; $pgpoolConfigParam[$key]['default'] = 'on'; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); $key = 'wd_escalation_command'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); + +$key = 'wd_de_escalation_command'; +$pgpoolConfigParam[$key]['type'] = 'C'; +$pgpoolConfigParam[$key]['default'] = ''; +$pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); # Life checking pgpool-II @@ -661,13 +802,16 @@ $pgpoolConfigParam[$key]['regexp'] = $anyelse; $key = 'wd_lifecheck_method'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'heartbeat'; -$pgpoolConfigParam[$key]['regexp'] = selectreg(array('heartbeat', 'query')); +$pgpoolConfigParam[$key]['select'] = array('heartbeat', 'query'); +$pgpoolConfigParam[$key]['regexp'] = selectreg($pgpoolConfigParam[$key]['select']); +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); $key = 'wd_interval'; $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 10; $pgpoolConfigParam[$key]['max'] = NUM_MAX; $pgpoolConfigParam[$key]['min'] = 0; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); # (Configuration of heartbeat mode) @@ -676,34 +820,43 @@ $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 9694; $pgpoolConfigParam[$key]['max'] = NUM_MAX; $pgpoolConfigParam[$key]['min'] = 0; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on', 'wd_lifecheck_method' => 'heartbeat'); $key = 'wd_heartbeat_keepalive'; $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 2; $pgpoolConfigParam[$key]['max'] = NUM_MAX; $pgpoolConfigParam[$key]['min'] = 0; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on', 'wd_lifecheck_method' => 'heartbeat'); $key = 'wd_heartbeat_deadtime'; $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 30; $pgpoolConfigParam[$key]['max'] = NUM_MAX; $pgpoolConfigParam[$key]['min'] = 0; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on', 'wd_lifecheck_method' => 'heartbeat'); $key = 'heartbeat_destination'; $pgpoolConfigHbDestinationParam[$key]['type'] = 'C'; $pgpoolConfigHbDestinationParam[$key]['default'] = ''; $pgpoolConfigHbDestinationParam[$key]['regexp'] = $hostreg; +$pgpoolConfigHbDestinationParam[$key]['multiple'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on', 'wd_lifecheck_method' => 'heartbeat'); $key = 'heartbeat_destination_port'; $pgpoolConfigHbDestinationParam[$key]['type'] = 'N'; $pgpoolConfigHbDestinationParam[$key]['default'] = 9694; $pgpoolConfigHbDestinationParam[$key]['min'] = 1024; $pgpoolConfigHbDestinationParam[$key]['max'] = NUM_MAX; +$pgpoolConfigHbDestinationParam[$key]['multiple'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on', 'wd_lifecheck_method' => 'heartbeat'); $key = 'heartbeat_device'; $pgpoolConfigHbDestinationParam[$key]['type'] = 'C'; $pgpoolConfigHbDestinationParam[$key]['default'] = 'eth0'; $pgpoolConfigHbDestinationParam[$key]['regexp'] = $anyelse; +$pgpoolConfigHbDestinationParam[$key]['multiple'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on', 'wd_lifecheck_method' => 'heartbeat'); # (Configuration of query mode) @@ -712,26 +865,31 @@ $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 3; $pgpoolConfigParam[$key]['max'] = NUM_MAX; $pgpoolConfigParam[$key]['min'] = 0; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on', 'wd_lifecheck_method' => 'query'); $key = 'wd_lifecheck_query'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'SELECT 1'; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on', 'wd_lifecheck_method' => 'query'); $key = 'wd_lifecheck_dbname'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'template1'; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on', 'wd_lifecheck_method' => 'query'); $key = 'wd_lifecheck_user'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'nobody'; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on', 'wd_lifecheck_method' => 'query'); $key = 'wd_lifecheck_password'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on', 'wd_lifecheck_method' => 'query'); # Servers to monitor @@ -739,18 +897,24 @@ $key = 'other_pgpool_hostname'; $pgpoolConfigWdOtherParam[$key]['type'] = 'C'; $pgpoolConfigWdOtherParam[$key]['default'] = ''; $pgpoolConfigWdOtherParam[$key]['regexp'] = $hostreg; +$pgpoolConfigWdOtherParam[$key]['multiple'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); $key = 'other_pgpool_port'; $pgpoolConfigWdOtherParam[$key]['type'] = 'N'; $pgpoolConfigWdOtherParam[$key]['default'] = 9999; $pgpoolConfigWdOtherParam[$key]['min'] = 1024; $pgpoolConfigWdOtherParam[$key]['max'] = NUM_MAX; +$pgpoolConfigWdOtherParam[$key]['multiple'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); $key = 'other_wd_port'; $pgpoolConfigWdOtherParam[$key]['type'] = 'N'; $pgpoolConfigWdOtherParam[$key]['default'] = 9000; $pgpoolConfigWdOtherParam[$key]['min'] = 1024; $pgpoolConfigWdOtherParam[$key]['max'] = NUM_MAX; +$pgpoolConfigWdOtherParam[$key]['multiple'] = TRUE; +$pgpoolConfigParam[$key]['parent'] = array('use_watchdog' => 'on'); #------------------------------------------------------------------------------ # IN MEMORY QUERY CACHE @@ -763,67 +927,80 @@ $pgpoolConfigParam[$key]['default'] = 'off'; $key = 'memqcache_method'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'shmem'; -$pgpoolConfigParam[$key]['regexp'] = selectreg(array('shmem', 'memcached')); +$pgpoolConfigParam[$key]['select'] = array('shmem', 'memcached'); +$pgpoolConfigParam[$key]['regexp'] = selectreg($pgpoolConfigParam[$key]['select']); +$pgpoolConfigParam[$key]['parent'] = array('memory_cache_enabled' => 'on'); $key = 'memqcache_memcached_host'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = 'localhost'; $pgpoolConfigParam[$key]['regexp'] = $hostreg; +$pgpoolConfigParam[$key]['parent'] = array('memory_cache_enabled' => 'on'); $key = 'memqcache_memcached_port'; $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 11211; $pgpoolConfigParam[$key]['max'] = NUM_MAX; $pgpoolConfigParam[$key]['min'] = 1024; +$pgpoolConfigParam[$key]['parent'] = array('memory_cache_enabled' => 'on'); $key = 'memqcache_total_size'; $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 67108864; $pgpoolConfigParam[$key]['max'] = PHP_INT_MAX; $pgpoolConfigParam[$key]['min'] = 0; +$pgpoolConfigParam[$key]['parent'] = array('memory_cache_enabled' => 'on'); $key = 'memqcache_max_num_cache'; $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 1000000; $pgpoolConfigParam[$key]['max'] = PHP_INT_MAX; $pgpoolConfigParam[$key]['min'] = 0; +$pgpoolConfigParam[$key]['parent'] = array('memory_cache_enabled' => 'on'); $key = 'memqcache_expire'; $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 0; $pgpoolConfigParam[$key]['max'] = NUM_MAX; $pgpoolConfigParam[$key]['min'] = 0; +$pgpoolConfigParam[$key]['parent'] = array('memory_cache_enabled' => 'on'); $key = 'memqcache_auto_cache_invalidation'; $pgpoolConfigParam[$key]['type'] = 'B'; $pgpoolConfigParam[$key]['default'] = 'on'; +$pgpoolConfigParam[$key]['parent'] = array('memory_cache_enabled' => 'on'); $key = 'memqcache_maxcache'; $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 409600; $pgpoolConfigParam[$key]['max'] = PHP_INT_MAX; $pgpoolConfigParam[$key]['min'] = 0; +$pgpoolConfigParam[$key]['parent'] = array('memory_cache_enabled' => 'on'); $key = 'memqcache_cache_block_size'; $pgpoolConfigParam[$key]['type'] = 'N'; $pgpoolConfigParam[$key]['default'] = 1048576; $pgpoolConfigParam[$key]['max'] = PHP_INT_MAX; $pgpoolConfigParam[$key]['min'] = 512; +$pgpoolConfigParam[$key]['parent'] = array('memory_cache_enabled' => 'on'); $key = 'memqcache_oiddir'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = '/var/log/pgpool/oiddir'; $pgpoolConfigParam[$key]['regexp'] = $dirreg; +$pgpoolConfigParam[$key]['parent'] = array('memory_cache_enabled' => 'on'); $key = 'white_memqcache_table_list'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('memory_cache_enabled' => 'on'); $key = 'black_memqcache_table_list'; $pgpoolConfigParam[$key]['type'] = 'C'; $pgpoolConfigParam[$key]['default'] = ''; $pgpoolConfigParam[$key]['regexp'] = $anyelse; +$pgpoolConfigParam[$key]['parent'] = array('memory_cache_enabled' => 'on'); #------------------------------------------------------------------------------ # OTHERS diff --git a/innerSystemCatalog.php b/innerSystemCatalog.php index f1b3f72..75309ea 100644 --- a/innerSystemCatalog.php +++ b/innerSystemCatalog.php @@ -19,7 +19,7 @@ * is" without express or implied warranty. * * @author Ryuma Ando <[email protected]> - * @copyright 2003-2013 PgPool Global Development Group + * @copyright 2003-2015 PgPool Global Development Group * @version CVS: $Id$ */ @@ -42,25 +42,30 @@ if ($pgCatalog == '') { return; } -// Set Parameters -$params = readConfigParams(array('backend_hostname', 'backend_port')); - // Get Data From Database -$conn = @pg_connect(conStr($nodeNum)); -$sql = 'SHOW pool_status'; - -$rs = execQuery($conn, $sql); - -if (!pg_result_status($rs) == PGSQL_TUPLES_OK) { - $sql = "SELECT * FROM $pgCatalog"; - $rs = execQuery($conn, $sql); +$params = readConfigParams(array( + 'backend_hostname', 'backend_port', 'backend_weight', + 'health_check_user', 'health_check_password' +)); +$conn = openDBConnection(array( + 'host' => $params['backend_hostname'][$nodeNum], + 'port' => $params['backend_port'][$nodeNum], + 'dbname' => 'template1', + 'user' => $params['health_check_user'], + 'password' => $params['health_check_password'], +)); + +$rs = execQuery($conn, 'SHOW pool_status'); + +if (! pg_result_status($rs) == PGSQL_TUPLES_OK) { + $rs = execQuery($conn, "SELECT * FROM $pgCatalog"); $tpl->assign('catalog', $pgCatalog); } else { $tpl->assign('catalog', 'pool_status'); } -if (!pg_result_status($rs) == PGSQL_TUPLES_OK) { +if (! pg_result_status($rs) == PGSQL_TUPLES_OK) { $errorCode = 'e8001'; $tpl->assign('errorCode', $errorCode); $tpl->display('innerError.tpl'); diff --git a/lang/en.lang.php b/lang/en.lang.php index 12a140f..f78f4d5 100644 --- a/lang/en.lang.php +++ b/lang/en.lang.php @@ -19,7 +19,7 @@ * is" without express or implied warranty. * * @author Ryuma Ando <[email protected]> - * @copyright 2003-2013 PgPool Global Development Group + * @copyright 2003-2015 PgPool Global Development Group * @version CVS: $Id$ */ @@ -42,6 +42,7 @@ $message = array( 'descBlack_function_list' => 'Comma separated functions which write to database', 'descBlack_memqcache_table_list' => 'Comma separated list of table names not to be cached', 'descCheck_temp_table' => 'If on, enable temporary table check in SELECT statements', + 'descCheck_unlogged_table' => 'If on, enable unlogged table check in SELECT statements.', 'descChild_life_time' => 'Life of an idle child process in seconds', 'descChild_max_connections' => 'If child_max_connections connections were received, child exits', 'descClear_memqcache_on_escalation' => 'If on, watchdog clears all the query cache in the shared memory when pgpool-II escaltes to active', @@ -51,7 +52,7 @@ $message = array( 'descClient_min_messages' => 'Which minimum message levels are sent to the client', 'descConnection_cache' => 'If true, cache connections to PostgreSQL', 'descConnection_life_time' => 'Life time for each idle connection in seconds', - 'desCconnect_timeout' => 'Timeout value in milliseconds before giving up connecting to backend using connect() system call', + 'descConnect_timeout' => 'Timeout value in milliseconds before giving up connecting to backend using connect() system call', 'descDatabase_redirect_preference_list' => '"database name:node id" pairs to specify the node id when connecting to the database', 'descDelay_threshold' => 'If the standby server delays more than delay_threshold, '. 'any query goes to the primary only', @@ -67,6 +68,7 @@ $message = array( 'descHeartbeat_destination' => 'The destination of heartbeat signals. Specify by hostname or IP address.', 'descHeartbeat_destination_port' => 'The port number of the destination of heartbeat signals.', 'descHeartbeat_device' => 'The network device name for sending heartbeat signals', + 'descHealth_check_database' => 'The database name to perform health check', 'descHealth_check_period' => 'Specifies the interval for next health checking. 0 means no health checking, '. '-1 means no wait', 'descHealth_check_timeout' => 'Pgpool does "health check" periodically to detect PostgreSQL servers down, '. @@ -123,6 +125,7 @@ $message = array( 'descPcp_port' => 'The port number where pcp is running on', 'descPcp_socket_dir' => 'The socket directory pcp could connect', 'descPcp_timeout' => 'When there is no response in this time from client, it disconnects and stop', + 'descPcp_listen_addresses' => 'the hostname or IP address, on which pcp process will accept TCP/IP connections.', 'descPgpool2_hostname' => 'Pgpool2 server name where running on', 'descPool_passwd' => 'File name of pool_passwd for md5 authentication', 'descPort' => 'The port number where pgpool is running on', @@ -139,13 +142,18 @@ $message = array( 'descReplicate_select' => 'If true, replicate SELECT queries. If false, send only to master', 'descReplication_timeout' => 'In non strict replication mode, there will be a risk of deadlock. '. 'Timeout in second for monitoring the deadlock', + 'descSearch_primary_node_timeout' => 'the maximum amount of time in seconds to search'. + 'for a primary node when a failover scenario occurs.', + 'descSerialize_accept' => 'Whether to serialize accept() call for incoming client connections.', 'descReset_query_list' => 'Semicolon separated SQL commands to be issued at the end of session', + 'descSerialize_accept' => 'Whether to serialize accept() call for incoming client connections', 'descSsl' => 'The frontend connection', 'descSsl_ca_cert' => 'Path to the SSL private key file', 'descSsl_ca_cert_dir' => 'Path to the SSL public certificate file', 'descSsl_cert' => 'Path to the SSL private key file', 'descSsl_key' => 'Path to the SSL private key file', 'descSocket_dir' => 'The socket directory pgpool could connect', + 'descSr_check_database' => 'The database to perform streaming replication delay check', 'descSr_check_period' => 'Interval between the streaming replication delay checks in seconds.', 'descSr_check_user' => 'User name to perform streaming replication check', 'descSr_check_password' => 'Password of the user to perform streaming replication check', @@ -160,12 +168,19 @@ $message = array( 'descTrusted_servers' => 'The list of trusted servers to check the up stream connections', 'descUse_watchdog' => 'Enable watchdog', 'descWd_authkey' => 'The authentication key used in watchdog communication', - 'descWd_escalation_command' => 'The command which will be executed on the new active when pgpool-II escaltes to active', - 'descWd_heartbeat_deadtime' => 'If there are no heartbeat signal for the period specified by this option, watchdog regards it as failure of the remote pgpool-II.', + 'descWd_de_escalation_command' => 'Watchdog executes this command on the master pgpool-II watchdog node '. + 'when that node resigns from the master node responsibilities.', + 'descWd_escalation_command' => 'The command which will be executed on the new active '. + 'when pgpool-II escaltes to active', + 'descWd_heartbeat_deadtime' => 'If there are no heartbeat signal for the period '. + 'specified by this option, watchdog regards it '. + 'as failure of the remote pgpool-II.', 'descWd_heartbeat_keepalive' => 'The interval time of sending heartbeat signals in seconds', 'descWd_heartbeat_port' => 'The port number to receive heartbeat signals', 'descWd_hostname' => 'The hostname or IP address in which pgpool-II works', 'descWd_interval' => 'The interval between life checks of pgpool-II in second', + 'descWd_ipc_socket_dir' => 'The directory where the UNIX domain socket '. + 'accepting pgpool-II watchdog IPC connections will be created.', 'descWd_life_point' => 'The times to retry a failed life check of pgpool-II', 'descWd_lifecheck_dbname' => 'The database name connected for checking pgpool-II', 'descWd_lifecheck_method' => 'The method of life check', @@ -173,6 +188,8 @@ $message = array( 'descWd_lifecheck_password' => 'The user name to check pgpool-II', 'descWd_lifecheck_user' => 'The password of the user to check pgpool-II', 'descWd_port' => 'The port number on which pgpool-II works', + 'descWd_priority' => 'Elevate the local watchdog node priority in the elections '. + 'to select master watchdog node', 'descWhite_function_list' => 'Comma separated functions those do not write to Database', 'descWhite_memqcache_table_list' => 'Comma separated list of table names to be cached', diff --git a/lang/ja.lang.php b/lang/ja.lang.php index f7f7713..409aa83 100644 --- a/lang/ja.lang.php +++ b/lang/ja.lang.php @@ -41,6 +41,7 @@ $message = array( 'descBlack_function_list' => 'データベースに書き込みを行なうカンマ区切りの関数のリスト', 'descBlack_memqcache_table_list' => 'SELECT結果をキャッシュしたくないテーブル名のカンマ区切りのリスト', 'descCheck_temp_table' => '一時テーブルかどうかをチェック', + 'descCheck_unlogged_table' => 'unloggedテーブルかどうかをチェック', 'descChild_life_time' => 'pgpoolの子プロセスの寿命', 'descChild_max_connections' => '各pgpool子プロセスが終了するまでの接続回数', 'descClear_memqcache_on_escalation' => 'アクティブ昇格時に共有メモリ上のクエリキャッシュを削除するかどうか', @@ -49,7 +50,7 @@ $message = array( 'descClient_min_messages' => 'クライアントに送るログの詳細レベル', 'descConnection_cache' => 'コネクションキャッシュ機能の有無', 'descConnection_life_time' => 'コネクションプール中のコネクションの有効期間(秒)', - 'desCconnect_timeout' => 'connect()システムコールを使ってバックエンドに接続する際のタイムアウト値を指定(ミリ秒)', + 'descConnect_timeout' => 'connect()システムコールを使ってバックエンドに接続する際のタイムアウト値を指定(ミリ秒)', 'descDatabase_redirect_preference_list' => 'データベース名によって負荷分散をしたいノード番号を、"データベース名:ノード番号"で指定', 'descDebug_level' => 'デバッグメッセージの詳細レベル(0は無効)', 'descDelay_threshold' => '許容するスタンバイサーバの遅延(バイト)', @@ -64,13 +65,15 @@ $message = array( 'descHeartbeat_destination' => 'ハートビート信号の送信先ホスト名または IP アドレス', 'descHeartbeat_destination_port' => 'ハートビート信号の送信先ポート番号', 'descHeartbeat_device' => 'ハートビートの送受信に用いるネットワークデバイス名', - 'descHealth_check_period' => 'ヘルスチェックを行う間隔(秒)', + 'descHealth_check_database' => 'ヘルスチェックを行う対象のデータベース名', + 'descHealth_check_period' => 'ヘルスチェックを行なう間隔(秒)', 'descHealth_check_timeout' => 'ヘルスチェックが長時間待たされるのを防ぐためのタイムアウト値(秒)', 'descHealth_check_user' => 'ヘルスチェックを行うためのPostgreSQLユーザ名', 'descHealth_check_password' => 'ヘルスチェックを行うためのPostgreSQLパスワード', 'descHealth_check_max_retries' => 'ヘルスチェックに失敗した後にリトライする回数', 'descHealth_check_retry_delay' => 'ヘルスチェックのリトライの間の間隔(秒)', 'descIfconfig_path' => 'ifconfig コマンドのパス', + 'descIf_cmd_path' => 'if コマンドのパス', 'descIf_down_cmd' => '仮想 IP を停止するために実行するコマンド', 'descIf_up_cmd' => '仮想 IP を起動するために実行するコマンド', 'descIgnore_leading_white_space' => 'load balance時のSQL文行頭の空白を無視', @@ -110,13 +113,14 @@ $message = array( 'descOther_pgpool_port' => '監視する pgpool-II が稼働するポート番号', 'descOther_wd_port' => '監視する watchdog が稼働するポート番号', 'descParallel_mode' => 'パラレルモードでpgpoolを運転', - 'descPcp_port' => 'pgpool-IIが受け付けているポート番号', + 'descPcp_port' => 'pcpがTCP/IPコネクションを受け付けるポート番号', + 'descPcp_listen_addresses' => 'pcpがTCP/IPコネクションを受け付けるアドレス', 'descPcp_socket_dir' => 'pcpがコネクションを受け付けるUnix domain socketディレクトリ', 'descPcp_timeout' => 'この時間内にクライアントから応答がない場合はコネクションを切断して終了', 'descPgpool2_hostname' => 'pgpool2 が動作しているホスト名', 'descPool_passwd' => 'md5 認証で用いる認証ファイル', 'descPing_path' => 'ping コマンドのパス', - 'descPort' => 'pgpoolがコネクションを受け付けるポート番号', + 'descPort' => 'pgpoolがTCP/IPコネクションを受け付けるポート番号', 'descPrint_timestamp' => 'pgpoolのログにタイムスタンプを追加', 'descRecovery_user' => 'リカバリを行うためのPostgreSQLユーザ', 'descRecovery_password' => 'リカバリを行うためのPostgreSQLユーザパスワード', @@ -131,12 +135,15 @@ $message = array( 'descReplication_timeout' => 'デッドロックを監視するためのタイムアウト時間。'. '厳密でないレプリケーションモードでは、デッドロックが発生しやすくなります。', 'descReset_query_list' => 'セッションが終了するときにコネクションを初期化するためのSQLコマンド', + 'descSearch_primary_node_timeout' => 'フェイルオーバーが起きた時にプライマリノードを検索する際のタイムアウト時間(秒)', + 'descSerialize_accept' => 'クライアントからの接続受け付け時、accept() をシリアライズする', 'descSocket_dir' => 'pgpoolがコネクションを受け付けるUnix domain socketディレクトリ', 'descSsl' => 'pgpool-IIとバックエンドの間のSSL接続', 'descSsl_ca_cert' => 'opensslの-CAFileに指定するパス', 'descSsl_ca_cert_dir' => 'opensslの-CApathに指定するディレクトリパス', 'descSsl_cert' => 'フロントエンドとの接続に使用する公開x509証明書のフルパス', 'descSsl_key' => 'フロントエンドとの接続に使用するプライベートキーファイルのフルパス', + 'descSr_check_database' => 'ストリーミングレプリケーションの遅延チェックを行なう対象のデータベース名', 'descSr_check_period' => 'ストリーミングレプリケーションの遅延チェックの間隔(秒)', 'descSr_check_user' => 'ストリーミングレプリケーションの遅延チェックを行うユーザ', 'descSr_check_password' => 'ストリーミングレプリケーションの遅延チェックを行うユーザのパスワード', @@ -151,12 +158,14 @@ $message = array( 'descTrusted_servers' => '上位サーバのコンマ区切りのリスト', 'descUse_watchdog' => 'watchdog 機能の有無', 'descWd_authkey' => 'wachdog 間通信で用いられる認証キー', - 'descWd_escalation_command' => 'アクティブ昇格時に実行するコマンド', + 'descWd_de_escalation_command' => 'マスタ(コーディネータ)降格時に実行するコマンド', + 'descWd_escalation_command' => 'マスタ(コーディネータ)昇格時に実行するコマンド', 'descWd_heartbeat_deadtime' => '障害発生とみなすまでの猶予(秒)', 'descWd_heartbeat_keepalive' => 'ハートビート信号を送信する間隔(秒)', 'descWd_heartbeat_port' => 'ハートビート信号を受信するポート番号', 'descWd_hostname' => 'watchdog プロセスが相互監視を受信するためのホスト名', 'descWd_interval' => '死活監視の間隔(秒)', + 'descWd_ipc_socket_dir' => 'watchdog の IPC(プロセス間通信)で受け付ける UNIX ドメインソケットが作成されるディレクトリ', 'descWd_life_point' => '死活監視のリトライ回数', 'descWd_lifecheck_dbname' => '死活監視を行なうために接続するデータベース', 'descWd_lifecheck_method' => '死活監視の方法', @@ -164,6 +173,7 @@ $message = array( 'descWd_lifecheck_password' => '死活監視を行なうユーザのパスワード', 'descWd_lifecheck_user' => '死活監視を行なうユーザ', 'descWd_port' => 'watchdog プロセスが相互監視を受信するためのポート番号', + 'descWd_priority' => '自身の watchdog ノードがリーダに選ばれる優先度', 'descWhite_function_list' => 'データベースに書き込みを行なわないカンマ区切りの関数のリスト', 'descWhite_memqcache_table_list' => 'SELECT結果をキャッシュしたいテーブル名のカンマ区切りのリスト', diff --git a/libs/plugins/function.custom_input.php b/libs/plugins/function.custom_input.php new file mode 100644 index 0000000..e4afda8 --- /dev/null +++ b/libs/plugins/function.custom_input.php @@ -0,0 +1,29 @@ +<?php +function smarty_function_custom_input($args) +{ + extract($args); + global $params, $errors; + + if (! isset($param_in_form)) { + $param_in_form = $param; + } + + $val_arr = $select_options[$param]; + + $rtn = sprintf( + '<input type="text" name="%s" size="50" value="%s" />', + $param_in_form, $params[$param] + ); + + if ($errors[$param]) { + $rtn .= '<p class="check_error">'. + '<span class="error">Error</span> '. $errors[$param]. + '</p>'; + } + + if (isset($echo)) { + echo $rtn; + } else { + return $rtn; + } +} diff --git a/libs/plugins/function.custom_radio_bool.php b/libs/plugins/function.custom_radio_bool.php new file mode 100644 index 0000000..511e07a --- /dev/null +++ b/libs/plugins/function.custom_radio_bool.php @@ -0,0 +1,30 @@ +<?php +function smarty_function_custom_radio_bool($params) +{ + extract($params); + global $select_options, $params, $errors; + + if (! isset($param_in_form)) { + $param_in_form = $param; + } + + $checked_val = $params[$param]; + + $val_arr = array(1 => 'on', 0 => 'off'); + + echo '<div class="radio_bool">'; + foreach ($val_arr as $val => $label) { + $radio_id = "{$param}_{$val}"; + + printf('<input type="radio" name="%s" id="%s" value="%s" %s>'. + '<label for="%s">%s</label>', + $param_in_form, $radio_id, $val, ($val == $checked_val) ? 'checked' : NULL, + $radio_id, $label); + } + + if ($error) { + echo '<br>'. $error; + } + + echo '</div>'; +} diff --git a/libs/plugins/function.custom_select.php b/libs/plugins/function.custom_select.php new file mode 100644 index 0000000..e08f48a --- /dev/null +++ b/libs/plugins/function.custom_select.php @@ -0,0 +1,26 @@ +<?php +function smarty_function_custom_select($args) +{ + extract($args); + global $params, $errors, $select_options; + + $user_val = $params[$param]; + if (is_array($user_val) && $num !== NULL) { + $user_val = $user_val[$num]; + } + + $rtn = sprintf('<select name="%s">', $param); + foreach ($select_options[$param] as $key => $val) { + $rtn .= sprintf( + '<option value="%s" %s>%s</option>', + $key, ($val == $user_val) ? 'selected' : NULL, $val + ); + } + $rtn .= '</select>'; + + if ($errors[$param]) { + $rtn .='<br>'. $errors[$param]; + } + + echo $rtn; +} diff --git a/libs/plugins/function.custom_table_pgconfig.php b/libs/plugins/function.custom_table_pgconfig.php new file mode 100644 index 0000000..c1b2366 --- /dev/null +++ b/libs/plugins/function.custom_table_pgconfig.php @@ -0,0 +1,25 @@ +<?php +function smarty_function_custom_table_pgconfig($args) +{ + global $message; + extract($args); + +echo <<<EOT + <thead> + <tr> + <th>{$message['strParameter']}</th> + <th>{$message['strValue']}</th> + </tr> + </thead> +EOT; + + if (isset($tfoot) && $tfoot == FALSE) { return; } + +echo <<<EOT + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> +EOT; +} diff --git a/pgconfig.php b/pgconfig.php index 4d93971..e4c9bc0 100644 --- a/pgconfig.php +++ b/pgconfig.php @@ -19,12 +19,11 @@ * is" without express or implied warranty. * * @author Ryuma Ando <[email protected]> - * @copyright 2003-2014 PgPool Global Development Group + * @copyright 2003-2015 PgPool Global Development Group * @version CVS: $Id$ */ require_once('common.php'); -require('definePgpoolConfParam.php'); $tpl->assign('help', basename( __FILE__, '.php')); if (!isset($_SESSION[SESSION_LOGIN_USER])) { @@ -42,6 +41,27 @@ if (isset($_POST['action'])) { } /* --------------------------------------------------------------------- */ +/* Set parameters' info and current vales */ +/* --------------------------------------------------------------------- */ + +// Get parameters' info +$pgpoolConfigParamAll = $pgpoolConfigParam + $pgpoolConfigBackendParam + + $pgpoolConfigWdOtherParam + $pgpoolConfigHbDestinationParam; +$tpl->assign('pgpoolConfigParamAll', $pgpoolConfigParamAll); + +$configValue = readConfigParams(); +foreach ($pgpoolConfigParam as $key => $value) { + if (!isset($configValue[$key]) ) { + $configValue[$key] = (isset($value['default'])) ? + $value['default'] : NULL; + } +} + +// Get current values +$params = $configValue; +$tpl->assign('params', $params); + +/* --------------------------------------------------------------------- */ /* Add or Cancel */ /* --------------------------------------------------------------------- */ @@ -82,12 +102,6 @@ switch ($action) { /** * check $configFile */ -$configValue = readConfigParams(); -foreach ($pgpoolConfigParam as $key => $value) { - if (!isset($configValue[$key]) ) { - $configValue[$key] = $value['default']; - } -} switch ($action) { case 'update': @@ -96,8 +110,7 @@ switch ($action) { if (! $error) { if (is_writable(_PGPOOL2_CONFIG_FILE)) { - writeConfigFile($configValue, $pgpoolConfigParam); - $configValue = readConfigParams(); + writeConfigFile($configValue, $pgpoolConfigParamAll); $tpl->assign('status', 'success'); } else { @@ -128,7 +141,7 @@ switch ($action) { } if (is_writable(_PGPOOL2_CONFIG_FILE)) { - writeConfigFile($configValue, $pgpoolConfigParam); + writeConfigFile($configValue, $pgpoolConfigParamAll); $configValue = readConfigParams(); } else { @@ -165,7 +178,6 @@ if (!isset($configValue['other_pgpool_hostname'])) { $configValue['other_wd_port'][0] = NULL; } -$tpl->assign('params', $configValue); $tpl->assign('error', $error); $tpl->display('pgconfig.tpl'); @@ -182,42 +194,51 @@ $tpl->display('pgconfig.tpl'); * @param array $configParam * @param string $error */ -function check($key, $value, &$configParam ,&$error) +function check($key, $define, &$configParam ,&$error) { - //if (!isset($configParam[$key])) { continue; } - if (!isset($configParam[$key])) { return; } + if (! paramExists($key) || ! isset($configParam[$key])) { return; } - $type = $value['type']; - $result = FALSE; - switch ($type) { + if (isset($define['parent'])) { + $ignore_ok = FALSE; + foreach ($define['parent'] as $_param => $_expected_value) { + if (! isset($configParam[$_param]) || + $configParam[$_param] != $_expected_value) + { + $ignore_ok = TRUE; + } + if ($ignore_ok) { return; } + } + } + + $is_ok = FALSE; + switch ($define['type']) { case 'B': - $result = checkBoolean($configParam[$key]); + $is_ok = checkBoolean($configParam[$key]); // allow true/false and on/off as input format, // but write with only on/off format. - if ($result) { - if ($configParam[$key] == 'true') { - $configParam[$key] = 'on'; - } elseif ($configParam[$key] == 'false') { - $configParam[$key] = 'off'; - } + if ($configParam[$key] == 'true') { + $configParam[$key] = 'on'; + } elseif ($configParam[$key] == 'false') { + $configParam[$key] = 'off'; } break; case 'C': - $result = checkString($configParam[$key], $value); + $is_ok = checkString($configParam[$key], $define); break; case 'F': - $result = checkFloat($configParam[$key], $value['min'], $value['max']); + $is_ok = checkFloat($configParam[$key], $define['min'], $define['max']); break; case 'N': - $result = checkInteger($configParam[$key], $value['min'], $value['max']); + $is_ok = checkInteger($configParam[$key], $define['min'], $define['max']); break; } - if (!$result) { + + if ($is_ok === FALSE) { $error[$key] = TRUE; } } @@ -315,7 +336,7 @@ function checkLogical($configValue) } // syslog - if ($configValue['log_destination']) { + if ($configValue['log_destination'] && $configValue['log_destination'] == 'syslog') { if (empty($configValue['syslog_facility'])) { $errors['syslog_facility'] = TRUE; } if (empty($configValue['syslog_ident'])) { $errors['syslog_ident'] = TRUE; } } @@ -379,96 +400,56 @@ function checkLogical($configValue) * @param array $configValue * @param array $pgpoolConfigParam */ -function writeConfigFile($configValue, $pgpoolConfigParam) +function writeConfigFile($configValue, $pgpoolConfigParamAll) { - $configFile = @file(_PGPOOL2_CONFIG_FILE); - - $tmpConfigFile = array(); - for ($i = 0; $i < count($configFile); $i++) { - $line = $configFile[$i]; + $configFile = array(); + $originalConfigFile = @file(_PGPOOL2_CONFIG_FILE); + foreach ($originalConfigFile as $line) { + // Not-empty lines if (preg_match("/^\w/", $line)) { list($key, $value) = explode("=", $line); $key = trim($key); - if (!preg_match("/^backend_hostname/", $key) && - !preg_match("/^backend_port/", $key) && - !preg_match("/^backend_weight/", $key) && - !preg_match("/^backend_data_directory/", $key) && - !preg_match("/^backend_flag/", $key) && - !preg_match("/^other_pgpool_hostname/", $key) && - !preg_match("/^other_pgpool_port/", $key) && - !preg_match("/^other_wd_port/", $key) && - !preg_match("/^heartbeat_device/", $key) && - !preg_match("/^heartbeat_destination_port/", $key) && - !preg_match("/^heartbeat_destination/", $key) - ) - { - $tmpConfigFile[] = $line; - } + $num = preg_replace('/[^0-9]/', NULL, $key); + $key_wo_num = str_replace($num, NULL, $key); - } else { - $tmpConfigFile[] = $line; - } - } - $configFile = $tmpConfigFile; + // Modify the parameter' value if posted. + // (Ignore the params like "backend_hostname_0" which will be arranged in below) + if (! isset($pgpoolConfigParamAll[$key_wo_num]['multiple'])) { + if (isset($configValue[$key_wo_num])) { + $value = $configValue[$key]; + if (strcmp($pgpoolConfigParamAll[$key_wo_num]['type'], "C") == 0) { + $value = "'{$value}'"; + } + $configFile[] = "{$key_wo_num} = {$value}\n"; - foreach ($pgpoolConfigParam as $key => $value) { - $isWrite = FALSE; - for ($j = 0; $j < count($configFile); $j++) { - $line = $configFile[$j]; - $line = trim($line); - - if (preg_match("/^$key/", $line)) { - if (strcmp($pgpoolConfigParam[$key]['type'], "C") == 0) { - $configFile[$j] = $key . " = '" . $configValue[$key] . "'\n"; } else { - $configFile[$j] = $key . " = " . $configValue[$key]."\n"; + $configFile[] = $line; } - $isWrite = TRUE; - break; } - } - if (!$isWrite && paramExists($key)) { - if (strcmp($pgpoolConfigParam[$key]['type'], "C") == 0) { - $configFile[] = $key . " = '" . $configValue[$key] . "'\n"; - } else { - $configFile[] = $key . " = " . $configValue[$key]."\n"; - } + // comment or empty lines + } else { + $configFile[] = $line; } } - if (isset($configValue['backend_hostname'])) { - for ($i = 0; $i < count($configValue['backend_hostname']); $i++) { + $param_names = getMultiParams(); + foreach ($param_names as $group => $key_arr) { + for ($i = 0; $i < count($configValue[$key_arr[0]]); $i++) { + foreach ($key_arr as $key) { + $value = (isset($configValue[$key][$i])) ? $configValue[$key][$i] : NULL; - $configFile[] = "backend_hostname$i = '" . $configValue['backend_hostname'][$i] . "'\n"; - $configFile[] = "backend_port$i = " . $configValue['backend_port'][$i] . "\n"; - $configFile[] = "backend_weight$i = " . $configValue['backend_weight'][$i] . "\n"; - $configFile[] = "backend_data_directory$i = '" . $configValue['backend_data_directory'][$i] . "'\n"; + if (strcmp($pgpoolConfigParamAll[$key]['type'], "C") == 0) { + $value = "'{$value}'"; + } - if (paramExists('backend_flag')) { - $configFile[] = "backend_flag$i= '" . $configValue['backend_flag'][$i] . "'\n"; + $configFile[] = "{$key}{$i} = {$value}\n"; } } } - if (isset($configValue['other_pgpool_hostname'])) { - for ($i = 0; $i < count($configValue['other_pgpool_hostname']); $i++) { - $configFile[] = "other_pgpool_hostname$i = '" . $configValue['other_pgpool_hostname'][$i] . "'\n"; - $configFile[] = "other_pgpool_port$i = " . $configValue['other_pgpool_port'][$i] . "\n"; - $configFile[] = "other_wd_port$i = " . $configValue['other_wd_port'][$i] . "\n"; - } - } - - if (isset($configValue['heartbeat_destination'])) { - for ($i = 0; $i < count($configValue['heartbeat_destination']); $i++) { - $configFile[] = "heartbeat_destination$i = '" . $configValue['heartbeat_destination'][$i] . "'\n"; - $configFile[] = "heartbeat_destination_port$i = " . $configValue['heartbeat_destination_port'][$i] . "\n"; - $configFile[] = "heartbeat_device$i = '" . $configValue['heartbeat_device'][$i] . "'\n"; - } - } - $outfp = fopen(_PGPOOL2_CONFIG_FILE, 'w'); foreach ($configFile as $line) { fputs($outfp, $line); @@ -548,10 +529,7 @@ function arrangePostData() $configValue = array(); foreach ($pgpoolConfigParam as $key => $value) { - if ($pgpoolConfigParam[$key]['type'] == 'B') { - $configValue[$key] = (isset($_POST[$key])) ? 'on' : 'off'; - - } elseif (isset($_POST[$key])) { + if (isset($_POST[$key])) { $configValue[$key] = trim($_POST[$key]); } } @@ -588,7 +566,7 @@ function doAdd($configValue) if (isset($_POST['backend_data_directory'])) { $configValue['backend_data_directory'] = $_POST['backend_data_directory']; } else { - $configValue['backend_data_directory'][0] = NULL; + $configValue['backend_data_directory'][0] = NULL; } if (paramExists('backend_flag')) { @@ -747,7 +725,7 @@ function doCheck() // backend_hostname $result = checkString($configValue['backend_hostname'][$i], $pgpoolConfigBackendParam['backend_hostname']); - if (!$result) { + if (! $result) { $error['backend_hostname'][$i] = TRUE; } @@ -755,7 +733,7 @@ function doCheck() $result = checkInteger($configValue['backend_port'][$i], $pgpoolConfigBackendParam['backend_port']['min'], $pgpoolConfigBackendParam['backend_port']['max']); - if (!$result) { + if (! $result) { $error['backend_port'][$i] = TRUE; } @@ -763,14 +741,14 @@ function doCheck() $result = checkFloat($configValue['backend_weight'][$i], $pgpoolConfigBackendParam['backend_weight']['min'], $pgpoolConfigBackendParam['backend_weight']['max']); - if (!$result) { + if (! $result) { $error['backend_weight'][$i] = TRUE; } // backend_data_directory $result = checkString($configValue['backend_data_directory'][$i], $pgpoolConfigBackendParam['backend_data_directory']); - if (!$result) { + if (! $result) { $error['backend_data_directory'][$i] = TRUE; } @@ -778,7 +756,7 @@ function doCheck() if (paramExists('backend_flag')) { $result = checkString($configValue['backend_flag'][$i], $pgpoolConfigBackendParam['backend_flag']); - if (!$result) { + if (! $result) { $error['backend_flag'][$i] = TRUE; } } @@ -800,7 +778,7 @@ function doCheck() // heartbeat_destination $result = checkString($configValue['heartbeat_destination'][$i], $pgpoolConfigHbDestinationParam['heartbeat_destination']); - if (!$result) { + if (! $result) { $error['heartbeat_destination'][$i] = TRUE; } @@ -808,14 +786,14 @@ function doCheck() $result = checkInteger($configValue['heartbeat_destination_port'][$i], $pgpoolConfigHbDestinationParam['heartbeat_destination_port']['min'], $pgpoolConfigHbDestinationParam['heartbeat_destination_port']['max']); - if (!$result) { + if (! $result) { $error['heartbeat_destination_port'][$i] = TRUE; } // heartbeat_device $result = checkString($configValue['heartbeat_device'][$i], $pgpoolConfigHbDestinationParam['heartbeat_device']); - if (!$result) { + if (! $result) { $error['heartbeat_device'][$i] = TRUE; } } @@ -836,7 +814,7 @@ function doCheck() // other_pgpool_hostname $result = checkString($configValue['other_pgpool_hostname'][$i], $pgpoolConfigWdOtherParam['other_pgpool_hostname']); - if (!$result) { + if (! $result) { $error['other_pgpool_hostname'][$i] = TRUE; } @@ -844,7 +822,7 @@ function doCheck() $result = checkInteger($configValue['other_pgpool_port'][$i], $pgpoolConfigWdOtherParam['other_pgpool_port']['min'], $pgpoolConfigWdOtherParam['other_pgpool_port']['max']); - if (!$result) { + if (! $result) { $error['other_pgpool_port'][$i] = TRUE; } @@ -852,7 +830,7 @@ function doCheck() $result = checkInteger($configValue['other_wd_port'][$i], $pgpoolConfigWdOtherParam['other_wd_port']['min'], $pgpoolConfigWdOtherParam['other_wd_port']['max']); - if (!$result) { + if (! $result) { $error['other_wd_port'][$i] = TRUE; } } diff --git a/queryCache.php b/queryCache.php index c5cf584..6373ef7 100644 --- a/queryCache.php +++ b/queryCache.php @@ -70,12 +70,7 @@ $sysDbParam['password'] = $sysDbParam['system_db_password']; $sysDbSchema = $sysDbParam['system_db_schema']; $conn = openDBConnection($sysDbParam); -if ($conn == FALSE) { - $errorCode = 'e2001'; - $tpl->assign('errorCode', $errorCode); - $tpl->display('error.tpl'); - exit(); -} +if ($conn == FALSE) { errorPage('e2001'); } $deleteRow = NULL; if ($action == 'delete') { @@ -91,7 +86,7 @@ if ($action == 'delete') { $escaped = pg_escape_string($hashArray[$i]); $sql .= "hash = '$escaped' OR "; } - $sql .= "hash = '$hashArray[$i]'"; + $sql .= "hash = '{$hashArray[$i]}'"; $rs = execQuery($conn, $sql); $deleteRow = pg_affected_rows($rs); } @@ -163,12 +158,7 @@ if ($sort == "descending") { } $rs = execQuery($conn, $sql); -if ($rs == FALSE) { - $errorCode = 'e2002'; - $tpl->assign('errorCode', $errorCode); - $tpl->display('error.tpl'); - exit(); -} +if ($rs == FALSE) { errorPage('e2002'); } $result = pg_fetch_all($rs); @@ -19,7 +19,7 @@ * is" without express or implied warranty. * * @author Ryuma Ando <[email protected]> - * @copyright 2003-2014 PgPool Global Development Group + * @copyright 2003-2015 PgPool Global Development Group * @version SVN: $Id$ */ @@ -202,7 +202,7 @@ function setNodeInfoFromConf() global $tpl; global $is_pgpool_running; - if (!$is_pgpool_running) { + if (! $is_pgpool_running) { $nodeInfo = array(); $configValue = readConfigParams(array('backend_hostname', 'backend_port')); @@ -216,7 +216,7 @@ function setNodeInfoFromConf() $tpl->assign('nodeInfo', $nodeInfo); } - $configValue = readConfigParams('backend_hostname'); + $configValue = readConfigParams(array('backend_hostname')); $tpl->assign('next_node_num', (isset($configValue['backend_hostname'])) ? max(array_keys($configValue['backend_hostname'])) + 1 : 0); } @@ -413,7 +413,7 @@ function _addNewBackend() } // Get next nodeNumber - $configValue = readConfigParams('backend_hostname'); + $configValue = readConfigParams(array('backend_hostname')); $i = (isset($configValue['backend_hostname'])) ? max(array_keys($configValue['backend_hostname'])) + 1 : 0; @@ -428,7 +428,7 @@ function _addNewBackend() // Write pgpool.conf $outfp = fopen(_PGPOOL2_CONFIG_FILE, 'a'); - if (!$outfp) { return FALSE; } + if (! $outfp) { return FALSE; } foreach ($lines as $line) { if (fputs($outfp, $line) === FALSE) { return FALSE; @@ -457,8 +457,8 @@ function _removeBackend() // Read execept backend info of node $nodeNumber $lines_to_write = array(); $fd = fopen(_PGPOOL2_CONFIG_FILE, 'r'); - if (!$fd) { return FALSE; } - while (!feof($fd)) { + if (! $fd) { return FALSE; } + while (! feof($fd)) { $line = fgets($fd); if (strpos($line, "backend_hostname") !== FALSE || @@ -493,7 +493,7 @@ function _removeBackend() // Write editted lines $fd = fopen(_PGPOOL2_CONFIG_FILE, 'w'); - if (!$fd) { return FALSE; } + if (! $fd) { return FALSE; } foreach ($lines_to_write as $line) { if (fputs($fd, $line) === FALSE) { return FALSE; @@ -516,9 +516,19 @@ function _doPgCtl($nodeNumber, $pg_ctl_action) if (isSuperUser($_SESSION[SESSION_LOGIN_USER]) == FALSE) { return FALSE; } - $conn = @pg_connect(conStr($nodeNumber, 'login')); + $params = readConfigParams(array( + 'backend_hostname', 'backend_port', 'backend_weight', + )); + $conn = openDBConnection(array( + 'host' => $params['backend_hostname'][$nodeNum], + 'port' => $params['backend_port'][$nodeNum], + 'dbname' => 'template1', + 'user' => $_SESSION[SESSION_LOGIN_USER], + 'password' => $_SESSION[SESSION_LOGIN_USER_PASSWORD], + )); + if ($conn == FALSE) { - @pg_close($conn); + closeDBConnection($conn); return FALSE; } $query = sprintf("SELECT pgpool_pgctl('%s', '%s')", @@ -526,7 +536,7 @@ function _doPgCtl($nodeNumber, $pg_ctl_action) (isset($_POST['stop_mode'])) ? $_POST['stop_mode'] : NULL); $result = execQuery($conn, $query); - @pg_close($conn); + closeDBConnection($conn); return $result; } diff --git a/templates/config.tpl b/templates/config.tpl index 4606726..4896b57 100644 --- a/templates/config.tpl +++ b/templates/config.tpl @@ -38,177 +38,71 @@ </tfoot> <tbody> <tr> - <th><label>{$message.strLanguage|escape}</label> - (string)</th> - <td class="input"><select name="lang"> - <option value="auto">auto</option> - {foreach key=key item=str from=$messageList} - {if $params.lang == $key} - <option value="{$key|escape}" selected="selected">{$str|escape}</option> - {else} - <option value="{$key|escape}">{$str|escape}</option> - {/if} - {/foreach} - </select> + <th><label>{$message.strLanguage|escape}</label> (string)</th> + <td>{custom_select param='lang' echo=true} </td> </tr> - <th><label>{$message.strVersion|escape}</label> - (float)</th> - <td class="input"><select name="version"> - {foreach key=key item=str from=versions()} - {if $params.version == $str} - <option value="{$str|escape}" selected="selected">{$str|escape}</option> - {else} - <option value="{$str|escape}">{$str|escape}</option> - {/if} - {/foreach} - </select> - </td> + <tr> + <th><label>{$message.strVersion|escape}</label> (float)</th> + <td>{custom_select param='version' echo=true}</td> </tr> <tr> - {if isset($errors.pgpool_config_file)}<th class="error">{else}<th>{/if} - <label>{$message.strPgConfFile|escape}</label> - (string)</th> - <td><input type="text" name="pgpool_config_file" size="50" value="{$params.pgpool_config_file|escape}" /> - {if isset($errors.pgpool_config_file)} - <br />{$errors.pgpool_config_file|escape} - {/if} - </td></tr> + <th><label>{$message.strPgConfFile|escape}</label> (string)</th> + <td>{custom_input param='pgpool_config_file' echo=true}</td> + </tr> <tr> - {if isset($errors.password_file)}<th class="error">{else}<th>{/if} - <label>{$message.strPasswordFile|escape}</label> - (string)</th> - <td><input type="text" name="password_file" size="50" value="{$params.password_file|escape}" /> - {if isset($errors.password_file)} - <br />{$errors.password_file|escape} - {/if} - </td></tr> + <th><label>{$message.strPasswordFile|escape}</label> (string)</th> + <td>{custom_input param='password_file' echo=true}</td> + </tr> <tr> - {if isset($errors.pgpool_command)}<th class="error">{else}<th>{/if} - <label>{$message.strPgpoolCommand|escape}</label> - (string)</th> - <td><input type="text" name="pgpool_command" size="50" value="{$params.pgpool_command|escape}" /> - {if isset($errors.pgpool_command)} - <br />{$errors.pgpool_command|escape} - {/if} - </td></tr> + <th><label>{$message.strPgpoolCommand|escape}</label> (string)</th> + <td>{custom_input param='pgpool_command' echo=true}</td> + </tr> + + <tr><th colspan="2"><label>{$message.strPgpoolCommandOption|escape}</label></th></tr> {if hasMemqCache() == false} - <tr> - <th colspan="2"><label>{$message.strPgpoolCommandOption|escape}</label> - (string)</th></tr> - <tr><td>{$message.strCmdC|escape}(-c)</td> - <td> - {if $params.c == 1} - <input type="checkbox" name="c" checked="checked" /> - {else} - <input type="checkbox" name="c" /> - {/if} - {if isset($errors.c)} - <br />{$errors.c|escape} - {/if} - </td></tr> + <tr><td class="command_option">{$message.strCmdC|escape} (-c)</td> + <td>{custom_radio_bool param='c' echo=true}</td> + </tr> + {/if} + + <tr><td class="command_option">{$message.strCmdLargeD|escape} (-D)</td> + <td>{custom_radio_bool param='D' param_in_form='large_d' echo=true}</td> + </tr> + <tr><td class="command_option">{$message.strCmdN|escape} (-n)</td> + <td>{custom_radio_bool param='n' echo=true}</td> + </tr> + + {if hasMemqCache()} + <tr><td class="command_option">{$message.strCmdLargeC|escape} (-C)</td> + <td>{custom_radio_bool param='C' param_in_form='large_c'}</td> + </tr> {/if} - <tr><td>{$message.strCmdLargeD|escape}(-D)</td> - <td> - {if $params.D == 1} - <input type="checkbox" name="D" checked="checked" /> - {else} - <input type="checkbox" name="D" /> - {/if} - {if isset($errors.D)} - <br />{$errors.D|escape} - {/if} - </td></tr> - <tr><td>{$message.strCmdN|escape}(-n)</td> - <td> - {if $params.n == 1} - <input type="checkbox" name="n" checked="checked" /> - {else} - <input type="checkbox" name="n" /> - {/if} - {if isset($errors.n)} - <br />{$errors.n|escape} - {/if} - </td></tr> - <tr><td>{$message.strCmdLargeC|escape}(-C)</td> - <td> - {if $params.C == 1} - <input type="checkbox" name="C" checked="checked" /> - {else} - <input type="checkbox" name="C" /> - {/if} - {if isset($errors.C)} - <br />{$errors.n|escape} - {/if} - </td></tr> - <tr><td>{$message.strCmdD|escape}(-d)</td> - <td> - {if $params.d == 1} - <input type="checkbox" name="d" checked="checked" /> - {else} - <input type="checkbox" name="d" /> - {/if} - {if isset($errors.d)} - <br />{$errors.d|escape} - {/if} - </td></tr> - <tr><td>{$message.strCmdM|escape}(-m)</td><td><select name="m"> - {if $params.m == 's'} - <option value="s" selected="selected">smart</option> - <option value="f">fast</option> - <option value="i">immediate</option> - {elseif $params.m == 'f'} - <option value="s">smart</option> - <option value="f" selected="selected">fast</option> - <option value="i">immediate</option> - {elseif $params.m == 'i'} - <option value="s">smart</option> - <option value="f">fast</option> - <option value="i" selected="selected">immediate</option> - {else} - <option value="s">smart</option> - <option value="f">fast</option> - <option value="i">immediate</option> - {/if} - </td></tr> + <tr><td class="command_option">{$message.strCmdD|escape} (-d)</td> + <td>{custom_radio_bool param='d' echo=true}</td> + </tr> + <tr><td class="command_option">{$message.strCmdM|escape} (-m)</td> + <td>{custom_select param='m' echo=true}</td> + </td> + </tr> <tr> - {if isset($errors.pgpool_logfile)}<th class="error">{else}<th>{/if} - <label>{$message.strPgpoolLogFile|escape}</label> - (string)</th> - <td><input type="text" name="pgpool_logfile" size="50" value="{$params.pgpool_logfile|escape}" /> - {if isset($errors.pgpool_logfile)} - <br />{$errors.pgpool_logfile|escape} - {/if} - </td></tr> + <th><label>{$message.strPgpoolLogFile|escape}</label> (string)</th> + <td>{custom_input param='pgpool_logfile' echo=true}</td> + </tr> <tr> - {if isset($errors.pcp_client_dir)}<th class="error">{else}<th>{/if} - <label>{$message.strPcpDir|escape}</label> - (string)</th> - <td><input type="text" name="pcp_client_dir" size="50" value="{$params.pcp_client_dir|escape}" /> - {if isset($errors.pcp_client_dir)} - <br />{$errors.pcp_client_dir|escape} - {/if} - </td></tr> + <th><label>{$message.strPcpDir|escape}</label> (string)</th> + <td>{custom_input param='pcp_client_dir' echo=true}</td> + </tr> <tr> - {if isset($errors.pcp_hostname)}<th class="error">{else}<th>{/if} - <label>{$message.strPcpHostName|escape}</label> - (string)</th> - <td><input type="text" name="pcp_hostname" size="50" value="{$params.pcp_hostname|escape}" /> - {if isset($errors.pcp_hostname)} - <br />{$errors.pcp_hostname|escape} - {/if} - </td></tr> + <th><label>{$message.strPcpHostName|escape}</label> (string)</th> + <td>{custom_input param='pcp_hostname' echo=true}</td> + </tr> <tr> - {if isset($errors.pcp_refresh_time)}<th class="error">{else}<th>{/if} - <label>{$message.strPcpRefreshTime|escape}</label> - (integer) - </th><td><input type="text" name="pcp_refresh_time" size="50" value="{$params.pcp_refresh_time|escape}" /> - {if isset($errors.pcp_refresh_time)} - <br />{$errors.pcp_refresh_time|escape} - {/if} - </td></tr> + <th><label>{$message.strPcpRefreshTime|escape}</label> (string)</th> + <td>{custom_input param='pcp_refresh_time' echo=true}</td> + </tr> </tbody> </table> </form> diff --git a/templates/elements/pgconfig_submenu.tpl b/templates/elements/pgconfig_submenu.tpl new file mode 100644 index 0000000..dee8ca9 --- /dev/null +++ b/templates/elements/pgconfig_submenu.tpl @@ -0,0 +1,30 @@ +<div id="submenu"> + <h3>{$message.strPgConfSetting|escape}</h3> + <ul> + <li><a href="#connections">Connections</a></li> + <li><a href="#pools">Pools</a></li> + <li><a href="#backends">Backends</a></li> + <li><a href="#logs">Logs</a></li> + <li><a href="#file_locations">File Locations</a></li> + <li><a href="#connection_pooling">Connection Pooling</a></li> + <li><a href="#replication_mode">Replication Mode</a></li> + <li><a href="#load_balancing_mode">Load Balancing Mode</a></li> + <li><a href="#master_slave_mode">Mater/Slave Mode</a></li> + {if paramExists('parallel_mode')} + <li><a href="#parallel_mode">{if hasMemqcache()}Parallel Mode + {else}Parallel Mode and Query Cache{/if}</a></li> + {/if} + <li><a href="#health-check">Health Check</a></li> + <li><a href="#failover">Failover and Failback</a></li> + <li><a href="#recovery">Online Recovery</a></li> + {if hasWatchdog()} + <li><a href="#watchdog">Watchdog</a></li> + {/if} + {if hasMemqcache()} + <li><a href="#memqcache">In Memory Query Cache</a></li> + {/if} + {if paramExists('relcache_expire')} + <li><a href="#others">Others</a></li> + {/if} + </ul> +</div> diff --git a/templates/pgconfig.tpl b/templates/pgconfig.tpl index 8dafe27..d31303d 100644 --- a/templates/pgconfig.tpl +++ b/templates/pgconfig.tpl @@ -1,75 +1,11 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> +<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>{$message.strPgConfSetting|escape}</title> <link href="screen.css" rel="stylesheet" type="text/css" /> -<script type="text/javascript"> -<!-- -var msgDeleteConfirm = "{$message.msgDeleteConfirm|escape}"; -{literal} -function update(){ - document.pgconfig.action.value= "update"; - document.pgconfig.submit(); -} - -function resetData(){ - document.pgconfig.action.value= "reset"; - document.pgconfig.submit(); -} - - -function addNode() { - document.pgconfig.action.value= "add"; - document.pgconfig.submit(); -} -function addOtherWatchdog() { - document.pgconfig.action.value= "add_wd"; - document.pgconfig.submit(); -} -function addHeartbeatDestination() { - document.pgconfig.action.value= "add_heartbeat_destination"; - document.pgconfig.submit(); -} - -function cancelNode() { - document.pgconfig.action.value= "cancel"; - document.pgconfig.submit(); -} -function cancelOtherWatchdog() { - document.pgconfig.action.value= "cancel_wd"; - document.pgconfig.submit(); -} -function cancelHeartbeatDestination() { - document.pgconfig.action.value= "cancel_heartbeat_destination"; - document.pgconfig.submit(); -} - -function deleteNode(num){ - if(window.confirm(msgDeleteConfirm)){ - document.pgconfig.action.value= "delete"; - document.pgconfig.num.value = num; - document.pgconfig.submit(); - } -} -function delOtherWatchdog(num){ - if(window.confirm(msgDeleteConfirm)){ - document.pgconfig.action.value= "delete_wd"; - document.pgconfig.num.value = num; - document.pgconfig.submit(); - } -} -function delHeartbeatDestination(num){ - if(window.confirm(msgDeleteConfirm)){ - document.pgconfig.action.value= "delete_heartbeat_destination"; - document.pgconfig.num.value = num; - document.pgconfig.submit(); - } -} - -// --> -</script> -{/literal} +<script type="text/javascript" src="js/jquery.js"></script> +<script type="text/javascript" src="js/pgconfig.js"></script> </head> <body> @@ -79,10 +15,16 @@ function delHeartbeatDestination(num){ <div id="menu"> {include file="menu.tpl"} +{include file="elements/pgconfig_submenu.tpl"} </div> <div id="content"> -<div id="help"><a href="help.php?help={$help|escape}"><img src="images/question.gif" alt="help"/>{$message.strHelp|escape}</a></div> + +<div id="help"><a href="help.php?help={$help|escape}"> +<img src="images/question.gif" alt="help"/>{$message.strHelp|escape}</a> +</div> + +<h2>{$message.strPgConfSetting|escape}</h2> {* --------------------------------------------------------------------- * * Succeeed / Failed * @@ -106,1784 +48,696 @@ function delHeartbeatDestination(num){ {/if} {/if} - <h2>{$message.strPgConfSetting|escape}</h2> - <div id="submenu"> - <h3>Table of Contents</h3> - <ul> - <li><a href="#connections">Connections</a></li> - <li><a href="#pools">Pools</a></li> - <li><a href="#backends">Backends</a></li> - <li><a href="#logs">Logs</a></li> - <li><a href="#file_locations">File Locations</a></li> - <li><a href="#connection_pooling">Connection Pooling</a></li> - <li><a href="#replication_mode">Replication Mode</a></li> - <li><a href="#load_balancing_mode">Load Balancing Mode</a></li> - <li><a href="#master_slave_mode">Mater/Slave Mode</a></li> - {if paramExists('parallel_mode')} - <li><a href="#parallel_mode">{if hasMemqcache()}Parallel Mode - {else}Parallel Mode and Query Cache{/if}</a></li> - {/if} - <li><a href="#health-check">Health Check</a></li> - <li><a href="#failover">Failover and Failback</a></li> - <li><a href="#recovery">Online Recovery</a></li> - {if hasWatchdog()} - <li><a href="#watchdog">Watchdog</a></li> - {/if} - {if hasMemqcache()} - <li><a href="#memqcache">In Memory Query Cache</a></li> - {/if} - {if paramExists('relcache_expire')} - <li><a href="#others">Others</a></li> - {/if} - </ul> - </div> - - <form name="pgconfig" method="post" action="pgconfig.php"> - <input type="hidden" name="action" value="" /> - <input type="hidden" name="num" value="" /> + <form id="form_pgconfig" name="pgconfig" method="post" action="pgconfig.php" class="pgconfig"> + <input type="hidden" id="pgconfig_action" name="action" value="" /> + <input type="hidden" id="pgconfig_num" name="num" value="" /> - {* --------------------------------------------------------------------- * - * Connections * - * --------------------------------------------------------------------- *} - <h3><a name="connections" id="connections">Connections</a></h3> + {* ===================================================================== *} + <h3 id="connections">Connections</h3> + {* ===================================================================== *} <table> - <thead> - <tr> - <th>{$message.strParameter|escape}</th> - <th>{$message.strValue|escape}</th> - </tr> - </thead> - <tfoot> - <tr> - <td colspan="2"></td> - </tr> - </tfoot> - <tbody> - + {custom_table_pgconfig} + <tbody id="tb_connection"> {* --------------------------------------------------------------------- *} - <tr><th class="category" colspan="2">pgpool Connection Settings</th></tr> + {* --------------------------------------------------------------------- *} - <tr> - <th{if isset($error.listen_addresses)} class="error"{/if}> - <label>{$message.descListen_addresses|escape}</label> - <br />listen_addresses (string) *</th> - <td><input type="text" name="listen_addresses" value="{$params.listen_addresses|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.port)} class="error"{/if}> - <label>{$message.descPort|escape}</label> - <br />port (integer) *</th> - <td><input type="text" name="port" value="{$params.port|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.socket_dir)} class="error"{/if}> - <label>{$message.descSocket_dir|escape}</label> - <br />socket_dir (string) *</th> - <td><input type="text" name="socket_dir" value="{$params.socket_dir|escape}"/></td> - </tr> - + {custom_tr_pgconfig param='listen_addresses'} + {custom_tr_pgconfig param='port'} + {custom_tr_pgconfig param='socket_dir'} {if paramExists('listen_backlog_multiplier')} - <tr> - <th{if isset($error.listen_backlog_multiplier)} class="error"{/if}> - <label>{$message.descListen_backlog_multiplier|escape}</label> - <br />listen_backlog_multiplier (integer) *</th> - <td><input type="text" name="listen_backlog_multiplier" - value="{$params.listen_backlog_multiplier|escape}"/></td> - </tr> + {custom_tr_pgconfig param='listen_backlog_multiplier'} + {/if} + {if paramExists('serialize_accept')} + {custom_tr_pgconfig param='serialize_accept'} {/if} - - <tr> {if paramExists('backend_socket_dir')} - <tr> - <th{if isset($error.backend_socket_dir)} class="error"{/if}> - <label>{$message.descBackend_socket_dir|escape}</label> - <br />backend_socket_dir (string) *</th> - <td><input type="text" name="backend_socket_dir" - value="{$params.backend_socket_dir|escape}"/></td> - </tr> + {custom_tr_pgconfig param='backend_socket_dir'} {/if} + </tbody> + <tbody id="tb_connection_pcp"> {* --------------------------------------------------------------------- *} - <tr><th class="category" colspan="2">pgpool Communication Manager Connection Settings</th></tr> + {* --------------------------------------------------------------------- *} - <tr> - <th{if isset($error.pcp_port)} class="error"{/if}> - <label>{$message.descPcp_port|escape}</label> - <br />pcp_port (integer) *</th> - <td><input type="text" name="pcp_port" value="{$params.pcp_port|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.pcp_socket_dir)} class="error"{/if}> - <label>{$message.descPcp_socket_dir|escape}</label> - <br />pcp_socket_dir (string) *</th> - <td><input type="text" name="pcp_socket_dir" value="{$params.pcp_socket_dir|escape}"/></td> - </tr> + {custom_tr_pgconfig param='pcp_listen_addresses'} + {custom_tr_pgconfig param='pcp_port'} + {custom_tr_pgconfig param='pcp_socket_dir'} + </tbody> + <tbody id="tb_connection_auth"> {* --------------------------------------------------------------------- *} - <tr><th class="category" colspan="2">Authentication</th></tr> + {* --------------------------------------------------------------------- *} - <tr> - <th{if isset($error.enable_pool_hba)} class="error"{/if}> - <label>{$message.descEnable_pool_hba|escape}</label> - <br />enable_pool_hba (bool)</th> - <td><input type="checkbox" name="enable_pool_hba" id="enable_pool_hba" - {if $params.enable_pool_hba == 'on'}checked="checked"{/if} /></td> - </tr> - + {custom_tr_pgconfig param='enable_pool_hba'} {if paramExists('pool_passwd')} - <tr> - <th{if isset($error.pool_passwd)} class="error"{/if}> - <label>{$message.descPool_passwd|escape}</label> - <br />pool_passwd (string) *</th> - <td><input type="text" name="pool_passwd" value="{$params.pool_passwd|escape}"/></td> - </tr> + {custom_tr_pgconfig param='pool_passwd'} {/if} - - <tr> - <th{if isset($error.authentication_timeout)} class="error"{/if}> - <label>{$message.descAuthentication_timeout|escape}</label> - <br />authentication_timeout (integer)</th> - <td><input type="text" name="authentication_timeout" value="{$params.authentication_timeout|escape}"/></td> - </tr> - - {* --------------------------------------------------------------------- *} + {custom_tr_pgconfig param='authentication_timeout'} + </tbody> {if paramExists('ssl')} + <tbody id="tb_connection_ssl"> + {* --------------------------------------------------------------------- *} <tr><th class="category" colspan="2">SSL Connections</th></tr> + {* --------------------------------------------------------------------- *} - <tr> - <th{if isset($error.ssl)} class="error"{/if}> - <label>{$message.descSsl|escape}</label> - <br />ssl (bool) *</th> - <td><input type="checkbox" name="ssl" id="ssl" value="true" - {if $params.ssl == 'on'} checked="checked"{/if} /></td> - </tr> - - <tr> - <th{if isset($error.ssl_key)} class="error"{/if}> - <label>{$message.descSsl_key|escape}</label> - <br />ssl_key (string) *</th> - <td><input type="text" name="ssl_key" id="ssl_key" value="{$params.ssl_key|escape}" /></td> - </tr> - - <tr> - <th{if isset($error.ssl_cert)} class="error"{/if}> - <label>{$message.descSsl_cert|escape}</label> - <br />ssl_cert (string) *</th> - <td><input type="text" name="ssl_cert" id="ssl_cert" value="{$params.ssl_cert|escape}" /></td> - </tr> - - <tr> - <th{if isset($error.ssl_ca_cert)} class="error"{/if}> - <label>{$message.descSsl_ca_cert|escape}</label> - <br />ssl_ca_cert (string) *</th> - <td><input type="text" name="ssl_ca_cert" id="ssl_ca_cert" value="{$params.ssl_ca_cert|escape}" /></td> - </tr> - - <tr> - <th{if isset($error.ssl_ca_cert_dir)} class="error"{/if}> - <label>{$message.descSsl_ca_cert_dir|escape}</label> - <br />ssl_ca_cert_dir (string) *</th> - <td><input type="text" name="ssl_ca_cert_dir" id="ssl_ca_cert_dir" - value="{$params.ssl_ca_cert_dir|escape}" /></td> - </tr> + {custom_tr_pgconfig param='ssl'} + </tbody> + + <tbody id="tb_ssl_1"> + {custom_tr_pgconfig param='ssl_key'} + {custom_tr_pgconfig param='ssl_cert'} + {custom_tr_pgconfig param='ssl_ca_cert'} + {custom_tr_pgconfig param='ssl_ca_cert_dir'} + </tbody> {/if} </table> - - {* --------------------------------------------------------------------- * - * Pools * - * --------------------------------------------------------------------- *} - <h3><a name="pools" id="pools">Pools</a></h3> + {* ===================================================================== *} + <h3 id="pools">Pools</h3> + {* ===================================================================== *} <table> - <thead> - <tr> - <th>{$message.strParameter|escape}</th> - <th>{$message.strValue|escape}</th> - </tr> - </thead> - <tfoot> - <tr> - <td colspan="2"></td> - </tr> - </tfoot> - <tbody> + {custom_table_pgconfig} + <tbody id="tb_pools_size"> {* --------------------------------------------------------------------- *} - <tr><th class="category" colspan="2">Pool size</th></tr> + {* --------------------------------------------------------------------- *} - <tr> - <th{if isset($error.num_init_children)} class="error"{/if}> - <label>{$message.descNum_init_children|escape}</label> - <br />num_init_children (integer) *</th> - <td><input type="text" name="num_init_children" value="{$params.num_init_children|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.max_pool)} class="error"{/if}> - <label>{$message.descMax_pool|escape}</label> - <br />max_pool (integer) *</th> - <td><input type="text" name="max_pool" value="{$params.max_pool|escape}"/></td> - </tr> + {custom_tr_pgconfig param='num_init_children'} + {custom_tr_pgconfig param='max_pool'} + </tbody> + <tbody id="tb_pools_lifetime"> {* --------------------------------------------------------------------- *} - <tr><th class="category" colspan="2">Life time</th></tr> + {* --------------------------------------------------------------------- *} - <tr> - <th{if isset($error.child_life_time)} class="error"{/if}> - <label>{$message.descChild_life_time|escape}</label> - <br />child_life_time (integer)</th> - <td><input type="text" name="child_life_time" value="{$params.child_life_time|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.child_max_connections)} class="error"{/if}> - <label>{$message.descChild_max_connections|escape}</label> - <br />child_max_connections (integer)</th> - <td><input type="text" name="child_max_connections" value="{$params.child_max_connections|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.connection_life_time)} class="error"{/if}> - <label>{$message.descConnection_life_time|escape}</label> - <br />connection_life_time (integer)</th> - <td><input type="text" name="connection_life_time" value="{$params.connection_life_time|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.client_idle_limit)} class="error"{/if}> - <label>{$message.descClient_idle_limit|escape}</label> - <br />client_idle_limit (integer)</th> - <td><input type="text" name="client_idle_limit" value="{$params.client_idle_limit|escape}"/></td> - </tr> - + {custom_tr_pgconfig param='child_life_time'} + {custom_tr_pgconfig param='child_max_connections'} + {custom_tr_pgconfig param='connection_life_time'} + {custom_tr_pgconfig param='client_idle_limit'} </tbody> </table> - - {* --------------------------------------------------------------------- * - * Backends * - * --------------------------------------------------------------------- *} - <h3><a name="backends" id="backends">Backends</a></h3> + {* ===================================================================== *} + <h3 id="backends">Backends</h3> + {* ===================================================================== *} <table> - <thead> - <tr> - <th></th> - <th>{$message.strParameter|escape}</th> - <th>{$message.strValue|escape}</th> - <td></td> - </tr> - </thead> - - {if isset($isAdd) && $isAdd == true} - <tfoot> - <tr> - <td colspan="4"> - <input type="button" name="cancel" value="{$message.strCancel|escape}" onclick="cancelNode()" /></td> - </tr> - </tfoot> - {else} - <tfoot> - <tr> - <td colspan="4"> - <input type="button" name="add" value="{$message.strAdd|escape}" onclick="addNode()" /></td> - </tr> - </tfoot> - {/if} - <tbody> + {custom_table_pgconfig} + + <tbody id="tb_backends_node"> + {* --------------------------------------------------------------------- *} + <tr><th class="category" colspan="2">Backend node + <input type="button" name="add" value="{$message.strAdd|escape}" onclick="sendForm('add')" /> + </th></tr> + {* --------------------------------------------------------------------- *} {foreach from=$params.backend_hostname key=node_num item=v} - <tr> - <td rowspan="{if paramExists('backend_flag')}5{else}4{/if}"> - <span class="param_group">node {$node_num}</span></td> - <th{if isset($error.backend_hostname.$node_num)} class="error"{/if}> - <label>{$message.descBackend_hostname|escape}</label> - <br />backend_hostname{$node_num} (string)</th> - <td><input type="text" name="backend_hostname[]" value="{$params.backend_hostname.$node_num|escape}" /></td> - <td rowspan="{if paramExists('backend_flag')}5{else}4{/if}"> - <input type="button" name="delete" value="{$message.strDelete|escape}" - onclick="deleteNode({$node_num})" /></td> - </tr> - - <tr> - <th{if isset($error.backend_port.$node_num)} class="error"{/if}> - <label>{$message.descBackend_port|escape}</label> - <br />backend_port{$node_num|escape} (integer)</th> - <td><input type="text" name="backend_port[]" value="{$params.backend_port.$node_num|escape}" /></td> - </tr> - - <tr> - <th{if isset($error.backend_weight.$node_num)} class="error"{/if}> - <label>{$message.descBackend_weight|escape}</label> - <br />backend_weight{$node_num|escape} (float)</th> - <td><input type="text" name="backend_weight[]" value="{$params.backend_weight.$node_num|escape}" /></td> - </tr> - - <tr> - <th{if isset($error.backend_data_directory.$node_num)} class="error"{/if}> - <label>{$message.descBackend_data_directory|escape}</label> - <br />backend_data_directory{$node_num|escape} (string)</th> - <td><input type="text" name="backend_data_directory[]" - value="{$params.backend_data_directory.$node_num|escape}" /></td> - </tr> - - {if paramExists('backend_flag')} - <tr> - <th{if isset($error.backend_flag.$node_num)} class="error"{/if}> - <label>{$message.descBackend_flag|escape}</label> - <br />backend_flag{$node_num|escape} (string) *</th> - <td><select name="backend_flag[]" id="backend_flag[]"> - <option value="ALLOW_TO_FAILOVER" - {if $params.backend_flag.$node_num == 'ALLOW_TO_FAILOVER'}selected{/if}>ALLOW_TO_FAILOVER</option> - <option value="DISALLOW_TO_FAILOVER" - {if $params.backend_flag.$node_num == 'DISALLOW_TO_FAILOVER'}selected{/if}>DISALLOW_TO_FAILOVER</option> - </select></td> - </tr> - {/if} + <tr><th colspan="2"> + <span class="param_group">Backend node {$node_num}</span> + </th></tr> + {custom_tr_pgconfig param='backend_hostname' num=$node_num} + {custom_tr_pgconfig param='backend_port' num=$node_num} + {custom_tr_pgconfig param='backend_weight' num=$node_num} + {custom_tr_pgconfig param='backend_data_directory' num=$node_num} + {if paramExists('backend_flag')} + {custom_tr_pgconfig param='backend_flag' num=$node_num} + {/if} {/foreach} {if isset($isAdd) && $isAdd == true} - <tr> - <td rowspan="{if paramExists('backend_flag')}5{else}4{/if}"> - <span class="param_group">node {$node_num + 1}</span></td> - <th><label>{$message.descBackend_hostname|escape}</label> - <br />backend_hostname{$smarty.section.num.index} (string)</th> - <td><input type="text" name="backend_hostname[]" value="" /></td> - <td rowspan="{if paramExists('backend_flag')}5{else}4{/if}"> - </tr> - - </tr> - <tr> - <th><label>{$message.descBackend_port|escape}</label> - <br />backend_port{$smarty.section.num.index|escape} (integer)</th> - <td><input type="text" name="backend_port[]" value="" /></td> - </tr> - - <tr> - <th><label>{$message.descBackend_weight|escape}</label> - <br />backend_weight{$smarty.section.num.index|escape} (float)</th> - <td><input type="text" name="backend_weight[]" value="" /></td> - </tr> - - <tr> - <th><label>{$message.descBackend_data_directory|escape}</label> - <br />backend_data_directory{$smarty.section.num.index|escape} (string)</th> - <td><input type="text" name="backend_data_directory[]" value="" /></td> - </tr> - + <tr><th class="category" colspan="2"> + <span class="param_group">Backend node {$node_num + 1}</span> + <input type="button" name="delete" value="{$message.strDelete|escape}" + onclick="sendForm('delete', {$node_num})" /> + </th></tr> + {custom_tr_pgconfig param='backend_hostname' num=$node_num+1} + {custom_tr_pgconfig param='backend_port' num=$node_num+1} + {custom_tr_pgconfig param='backend_weight' num=$node_num+1} + {custom_tr_pgconfig param='backend_data_directory' num=$node_num+1} {if paramExists('backend_flag')} - <tr> - <th><label>{$message.descBackend_flag|escape}</label> - <br />backend_flag{$smarty.section.num.index|escape} *</th> - <td><select name="backend_flag[]" id="backend_flag[]"> - <option value="ALLOW_TO_FAILOVER" selected>ALLOW_TO_FAILOVER</option> - <option value="DISALLOW_TO_FAILOVER">DISALLOW_TO_FAILOVER</option> - </select></td> - </tr> + {custom_tr_pgconfig param='backend_flag' num=$node_num+1} {/if} {/if} - </tbody> </table> - - {* --------------------------------------------------------------------- * - * Logs * - * --------------------------------------------------------------------- *} - <h3><a name="logs" id="logs">Logs</a></h3> + {* ===================================================================== *} + <h3 id="logs">Logs</h3> + {* ===================================================================== *} <table> - <thead> - <tr> - <th>{$message.strParameter|escape}</th> - <th>{$message.strValue|escape}</th> - </tr> - </thead> - - <tfoot> - <tr> - <td colspan="2"></td> - </tr> - </tfoot> - - <tbody> - - {* --------------------------------------------------------------------- *} + {custom_table_pgconfig} {if paramExists('log_destination')} + <tbody id="tb_logs_where"> + {* --------------------------------------------------------------------- *} <tr><th class="category" colspan="2">Where to log</th></tr> + {* --------------------------------------------------------------------- *} - <tr> - {if isset($error.log_destination)}<th class="error">{else}<th>{/if} - <label>{$message.descLog_destination|escape}</label> - <br />log_destination *</th> - <td><select name="log_destination" id="log_destination"> - <option value="stderr" {if $params.log_destination == 'stderr'}selected{/if}>stderr</option> - <option value="syslog" {if $params.log_destination == 'syslog'}selected{/if}>syslog</option> - </select></td> - </tr> - {/if} - - {* --------------------------------------------------------------------- *} - - <tr><th class="category" colspan="2">What to log</th></tr> + {custom_tr_pgconfig param='log_destination'} + </tbody> - {if paramExists('log_line_prefix')} - <tr> - {if isset($error.log_line_prefix)}<th class="error">{else}<th>{/if} - <label>{$message.descLog_line_prefix|escape}</label> - <br />log_line_prefix (string)</th> - <td><input type="text" name="log_line_prefix" value="{$params.log_line_prefix|escape}"/></td> - </tr> - {/if} + <tbody id="tb_logs_what"> + {* --------------------------------------------------------------------- *} + <tr><th class="category" colspan="2">What to log</th></tr> + {* --------------------------------------------------------------------- *} - {if paramExists('print_timestamp')} - <tr> - <th{if isset($error.print_timestamp)} class="error"{/if}> - <label>{$message.descPrint_timestamp|escape}</label> - <br />print_timestamp (bool) *</th> - {if $params.print_timestamp == 'on'} - <td><input type="checkbox" name="print_timestamp" - id="print_timestamp" value="true" - {if $params.print_timestamp == 'on'}checked="checked"{/if} /></td> + {if paramExists('log_line_prefix')} + {custom_tr_pgconfig param='log_line_prefix'} {/if} - </tr> - {/if} + {if paramExists('print_timestamp')} + {custom_tr_pgconfig param='print_timestamp'} + {/if} + {custom_tr_pgconfig param='log_connections'} + {custom_tr_pgconfig param='log_hostname'} + {custom_tr_pgconfig param='log_statement'} + {if paramExists('log_per_node_statement')} + {custom_tr_pgconfig param='log_per_node_statement'} + {/if} + {if paramExists('log_standby_delay')} + {custom_tr_pgconfig param='log_standby_delay'} + {/if} + </tbody> - <tr> - <th{if isset($error.log_connections)} class="error"{/if}> - <label>{$message.descLog_connections|escape}</label> - <br />log_connections (bool)</th> - {if $params.log_connections == 'on'} - <td><input type="checkbox" name="log_connections" id="log_connections" value="true" - {if $params.log_connections == 'on'}checked="checked"{/if} /></td> - </tr> - - <tr> - <th{if isset($error.log_hostname)} class="error"{/if}> - <label>{$message.descLog_hostname|escape}</label> - <br />log_hostname (bool)</th> - {/if} - <td><input type="checkbox" name="log_hostname" id="log_hostname" value="true" - {if $params.log_hostname == 'on'}checked="checked"{/if} /></td> - </tr> - - <tr> - <th{if isset($error.log_statement)} class="error"{/if}> - <label>{$message.descLog_statement|escape}</label> - <br />log_statement (bool)</th> - <td><input type="checkbox" name="log_statement" id="log_statement" value="true" - {if $params.log_statement == 'on'}checked="checked"{/if} /></td> - </tr> - - {if paramExists('log_per_node_statement')} - <tr> - {if isset($error.log_per_node_statement)}<th class="error">{else}<th>{/if} - <label>{$message.descLog_per_node_statement|escape}</label> - <br />log_per_node_statement (bool)</th> - <td><input type="checkbox" name="log_per_node_statement" - id="log_per_node_statement" value="true" - {if $params.log_per_node_statement == 'on'}checked="checked"{/if} /></td> - </tr> - {/if} + <tbody id="tb_logs_debug"> + {* --------------------------------------------------------------------- *} + <tr><th class="category" colspan="2">Debug</th></tr> + {* --------------------------------------------------------------------- *} - {if paramExists('log_standby_delay')} - <tr> - <th{if isset($error.log_standby_delay)} class="error"{/if}> - <label>{$message.descLog_standby_delay|escape}</label> - <br />log_standby_delay (string)</th> - <td><select name="log_standby_delay" id="log_standby_delay"> - <option value="always" - {if $params.log_standby_delay == 'always'}selected{/if}>always</option> - <option value="if_over_threshold" - {if $params.log_standby_delay == 'if_over_threshold'}selected{/if}>if_over_threshold</option> - <option value="none" - {if $params.log_standby_delay == 'none'}selected{/if}>none</option> - </select></td> - </tr> + {if paramExists('debug_level')} + {custom_tr_pgconfig param='debug_level'} + {/if} + {if paramExists('log_error_verbosity')} + {custom_tr_pgconfig param='log_error_verbosity'} + {/if} + {if paramExists('client_min_messages')} + {custom_tr_pgconfig param='client_min_messages'} + {/if} + {if paramExists('log_min_messages')} + {custom_tr_pgconfig param='log_min_messages'} + {/if} + </tbody> {/if} - {* --------------------------------------------------------------------- *} - {if paramExists('syslog_facility')} + <tbody id="tb_logs_log_destination_syslog"> + {* --------------------------------------------------------------------- *} <tr><th class="category" colspan="2">Syslog specific</th></tr> + {* --------------------------------------------------------------------- *} - <tr> - {if isset($error.syslog_facility)}<th class="error">{else}<th>{/if} - <label>{$message.descSyslog_facility|escape}</label> - <br />syslog_facility (string) *</th> - <td><input type="text" name="syslog_facility" value="{$params.syslog_facility|escape}"/></td> - </tr> - - <tr> - {if isset($error.syslog_ident)}<th class="error">{else}<th>{/if} - <label>{$message.descSyslog_ident|escape}</label> - <br />syslog_ident (string) *</th> - <td><input type="text" name="syslog_ident" value="{$params.syslog_ident|escape}"/></td> - </tr> - {/if} - - {* --------------------------------------------------------------------- *} - - <tr><th class="category" colspan="2">Debug</th></tr> - - {if paramExists('debug_level')} - <tr> - <th{if isset($error.debug_level)} class="error"{/if}> - <label>{$message.descDebug_level|escape}</label> - <br />debug_level (integer)</th> - <td><input type="text" name="debug_level" value="{$params.debug_level|escape}"/></td> - </tr> - {/if} - - {if paramExists('log_error_verbosity')} - <tr> - <th{if isset($error.log_error_verbosity)} class="error"{/if}> - <label>{$message.descLog_error_verbosity|escape}</label> - <br />log_error_verbosity (string)</th> - <td><select name="log_error_verbosity" id="log_error_verbosity"> - <option value="TERSE" {if $params.log_error_verbosity == 'TERSE'}selected{/if}>TERSE</option> - <option value="DEFAULT" {if $params.log_error_verbosity == 'DEFAULT'}selected{/if}>DEFAULT</option> - <option value="VERBOSE" {if $params.log_error_verbosity == 'VERBOSE'}selected{/if}>VERBOSE</option> - </select></td> - </tr> - {/if} - - {if paramExists('client_min_messages')} - <tr> - <th{if isset($error.client_min_messages)} class="error"{/if}> - <label>{$message.descClient_min_messages|escape}</label> - <br />client_min_messages (string)</th> - <td><select name="client_min_messages" id="client_min_messages"> - <option value="debug5" {if $params.client_min_messages == 'debug5'}selected{/if}>debug5</option> - <option value="debug4" {if $params.client_min_messages == 'debug4'}selected{/if}>debug4</option> - <option value="debug3" {if $params.client_min_messages == 'debug3'}selected{/if}>debug3</option> - <option value="debug2" {if $params.client_min_messages == 'debug2'}selected{/if}>debug2</option> - <option value="debug1" {if $params.client_min_messages == 'debug1'}selected{/if}>debug1</option> - <option value="log" {if $params.client_min_messages == 'log'}selected{/if}>log</option> - <option value="notice" {if $params.client_min_messages == 'notice'}selected{/if}>notice</option> - <option value="warning" {if $params.client_min_messages == 'warning'}selected{/if}>warning</option> - <option value="error" {if $params.client_min_messages == 'error'}selected{/if}>error</option> - </select></td> - </tr> - {/if} - - {if paramExists('log_min_messages')} - <tr> - <th{if isset($error.log_min_messages)} class="error"{/if}> - <label>{$message.descLog_min_messages|escape}</label> - <br />log_min_messages (string)</th> - <td><select name="log_min_messages" id="log_min_messages"> - <option value="debug5" {if $params.log_min_messages == 'debug5'}selected{/if}>debug5</option> - <option value="debug4" {if $params.log_min_messages == 'debug4'}selected{/if}>debug4</option> - <option value="debug3" {if $params.log_min_messages == 'debug3'}selected{/if}>debug3</option> - <option value="debug2" {if $params.log_min_messages == 'debug2'}selected{/if}>debug2</option> - <option value="debug1" {if $params.log_min_messages == 'debug1'}selected{/if}>debug1</option> - <option value="info" {if $params.log_min_messages == 'info'}selected{/if}>info</option> - <option value="notice" {if $params.log_min_messages == 'notice'}selected{/if}>notice</option> - <option value="warning" {if $params.log_min_messages == 'warning'}selected{/if}>warning</option> - <option value="error" {if $params.log_min_messages == 'error'}selected{/if}>error</option> - <option value="log" {if $params.log_min_messages == 'log'}selected{/if}>log</option> - <option value="fatal" {if $params.log_min_messages == 'fatal'}selected{/if}>fatal</option> - <option value="panic" {if $params.log_min_messages == 'panic'}selected{/if}>panic</option> - </select></td> - </tr> + {custom_tr_pgconfig param='syslog_facility'} + {custom_tr_pgconfig param='syslog_ident'} + </tbody> {/if} - - </tbody> </table> - {* --------------------------------------------------------------------- * - * File Locations * - * --------------------------------------------------------------------- *} - <h3><a name="file_locations" id="file_locations">File Locations</a></h3> + {* ===================================================================== *} + <h3 id="file_locations">File Locations</h3> + {* ===================================================================== *} <table> - <thead> - <tr> - <th>{$message.strParameter|escape}</th> - <th>{$message.strValue|escape}</th> - </tr> - </thead> - <tfoot> - <tr> - <td colspan="2"></td> - </tr> - </tfoot> - <tbody> - - <tr> - <th{if isset($error.logdir)} class="error"{/if}> - <label>{$message.descLogdir|escape}</label> - <br />logdir (string) *</th> - <td><input type="text" name="logdir" value="{$params.logdir|escape}"/></td> - </tr> + {custom_table_pgconfig} + <tbody id="tb_file_locations"> + {custom_tr_pgconfig param='logdir'} {if paramExists('pid_file_name')} - <tr> - <th{if isset($error.pid_file_name)} class="error"{/if}> - <label>{$message.descPid_file_name|escape}</label> - <br />pid_file_name (string) *</th> - <td><input type="text" name="pid_file_name" value="{$params.pid_file_name|escape}"/></td> - </tr> + {custom_tr_pgconfig param='pid_file_name'} {/if} - </tbody> </table> - {* --------------------------------------------------------------------- * - * Connection Pooling * - * --------------------------------------------------------------------- *} - <h3><a name="connection_pooling" id="connection_pooling">Connection Pooling</a></h3> + {* ===================================================================== *} + <h3 id="connection_pooling">Connection Pooling</h3> + {* ===================================================================== *} <table> - <thead> - <tr> - <th>{$message.strParameter|escape}</th> - <th>{$message.strValue|escape}</th> - </tr> - </thead> - <tfoot> - <tr> - <td colspan="2"></td> - </tr> - </tfoot> - - <tbody> - - <tr> - <th{if isset($error.connection_cache)} class="error"{/if}> - <label>{$message.descConnection_cache|escape}</label> - <br />connection_cache (bool) *</th> - <td><input type="checkbox" name="connection_cache" - id="connection_cache" value="true" - {if $params.connection_cache == 'on'}checked="checked"{/if} /></td> - </tr> - - <tr> - <th{if isset($error.reset_query_list)} class="error"{/if}> - <label>{$message.descReset_query_list|escape}</label> - <br />reset_query_list (string)</th> - <td><input type="text" name="reset_query_list" value="{$params.reset_query_list|escape}"/></td> - </tr> + {custom_table_pgconfig} + <tbody id="tb_connection_pooling"> + {custom_tr_pgconfig param='connection_cache'} + {custom_tr_pgconfig param='reset_query_list'} </tbody> </table> - {* --------------------------------------------------------------------- * - * Replication Mode * - * --------------------------------------------------------------------- *} - <h3><a name="replication_mode" id="replication_mode">Replication Mode</a></h3> + {* ===================================================================== *} + <h3 id="replication_mode">Replication Mode</h3> + {* ===================================================================== *} <table> - <thead> - <tr> - <th>{$message.strParameter|escape}</th> - <th>{$message.strValue|escape}</th> - </tr> - </thead> - <tfoot> - <tr> - <td colspan="2"></td> - </tr> - </tfoot> - <tbody> - - <tr> - <th{if isset($error.replication_mode)} class="error"{/if}> - <label>{$message.descReplication_mode|escape}</label> - <br />replication_mode (bool) *</th> - <td><input type="checkbox" name="replication_mode" - id="replication_mode" value="true" - {if $params.replication_mode == 'on'} checked="checked"{/if} /></td> - </tr> - - <tr> - <th{if isset($error.replicate_select)} class="error"{/if}> - <label>{$message.descReplicate_select|escape}</label> - <br />replicate_select (bool)</th> - <td><input type="checkbox" name="replicate_select" - id="replicate_select" value="true" - {if $params.replicate_select == 'on'}checked="checked"{/if} /></td> - </tr> - - <tr> - <th{if isset($error.insert_lock)} class="error"{/if}> - <label>{$message.descInsert_lock|escape}</label> - <br />insert_lock (bool)</th> - <td><input type="checkbox" name="insert_lock" id="insert_lock" value="true" - {if $params.insert_lock == 'on'}checked="checked"{/if} /></td> - </tr> + {custom_table_pgconfig} + <tbody id="tb_replication_mode"> + {custom_tr_pgconfig param='replication_mode'} + </tbody> + + <tbody id="tb_replication_mode_on"> + {custom_tr_pgconfig param='replicate_select'} + {custom_tr_pgconfig param='insert_lock'} {if paramExists('lobj_lock_table')} - <tr> - <th{if isset($error.lobj_lock_table)} class="error"{/if}> - <label>{$message.descLobj_lock_table|escape}</label> - <br />lobj_lock_table (string)</th> - <td><input type="text" name="lobj_lock_table" - id="lobj_lock_table" value="{$params.lobj_lock_table|escape}" /></td> - </tr> + {custom_tr_pgconfig param='lobj_lock_table'} {/if} + </tbody> + <tbody id="tb_replication_mode_degnerate"> {* --------------------------------------------------------------------- *} - <tr><th class="category" colspan="2">Degenerate handling</th></tr> + {* --------------------------------------------------------------------- *} - <tr> - <th{if isset($error.replication_stop_on_mismatch)} class="error"{/if}> - <label>{$message.descReplication_stop_on_mismatch|escape}</label> - <br />replication_stop_on_mismatch (bool)</th> - <td><input type="checkbox" name="replication_stop_on_mismatch" - id="replication_stop_on_mismatch" value="true" - {if $params.replication_stop_on_mismatch == 'on'}checked="checked"{/if} /></td> - </tr> - + {custom_tr_pgconfig param='replication_stop_on_mismatch'} {if paramExists('failover_if_affected_tuples_mismatch')} - <tr> - <th{if isset($error.failover_if_affected_tuples_mismatch)} class="error"{/if}> - <label>{$message.descFailover_if_affected_tuples_mismatch|escape}</label> - <br />failover_if_affected_tuples_mismatch (bool)</th> - <td><input type="checkbox" name="failover_if_affected_tuples_mismatch" - id="failover_if_affected_tuples_mismatch" value="true" - {if $params.failover_if_affected_tuples_mismatch == 'on'}checked="checked"{/if} /></td> - </tr> + {custom_tr_pgconfig param='failover_if_affected_tuples_mismatch'} {/if} - {if paramExists('replication_timeout')} - <tr> - <th{if isset($error.replication_timeout)} class="error"{/if}> - <label>{$message.descReplication_timeout|escape}</label> - <br />replication_timeout (integer)</th> - <td><input type="text" name="replication_timeout" value="{$params.replication_timeout|escape}"/></td> - </tr> + {custom_tr_pgconfig param='replication_timeout'} {/if} - </tbody> </table> - {* --------------------------------------------------------------------- * - * Load Balancing Mode * - * --------------------------------------------------------------------- *} - <h3><a name="load_balancing_mode" id="load_balancing_mode">Load Balancing Mode</a></h3> + {* ===================================================================== *} + <h3 id="load_balancing_mode">Load Balancing Mode</h3> + {* ===================================================================== *} <table> - <thead> - <tr> - <th>{$message.strParameter|escape}</th> - <th>{$message.strValue|escape}</th> - </tr> - </thead> - <tfoot> - <tr> - <td colspan="2"></td> - </tr> - </tfoot> - - <tbody> - - <tr> - <th{if isset($error.load_balance_mode)} class="error"{/if}> - <label>{$message.descLoad_balance_mode|escape}</label> - <br />load_balance_mode (bool) *</th> - <td><input type="checkbox" name="load_balance_mode" - id="load_balance_mode" value="true" - {if $params.load_balance_mode == 'on'}checked="checked"{/if} /></td> - </tr> - - <tr> - <th{if isset($error.ignore_leading_white_space)} class="error"{/if}> - <label>{$message.descIgnore_leading_white_space|escape}</label> - <br />ignore_leading_white_space (bool)</th> - <td><input type="checkbox" name="ignore_leading_white_space" - id="ignore_leading_white_space" value="true" - {if $params.ignore_leading_white_space == 'on'}checked="checked"{/if} /></td> - </tr> + {custom_table_pgconfig} + + <tbody id="tb_load_balance_mode"> + {custom_tr_pgconfig param='load_balance_mode'} + </tbody> + <tbody id="tb_load_balance_mode_on"> + {custom_tr_pgconfig param='ignore_leading_white_space'} {if paramExists('white_function_list')} - <tr> - <th{if isset($error.white_function_list)} class="error"{/if}> - <label>{$message.descWhite_function_list|escape}</label> - <br />white_function_list (string)</th> - <td><input type="text" name="white_function_list" value="{$params.white_function_list|escape}"/></td> - </tr> + {custom_tr_pgconfig param='white_function_list'} {/if} - {if paramExists('black_function_list')} - <tr> - <th{if isset($error.black_function_list)} class="error"{/if}> - <label>{$message.descBlack_function_list|escape}</label> - <br />black_function_list (string)</th> - <td><input type="text" name="black_function_list" value="{$params.black_function_list|escape}"/></td> - </tr> + {custom_tr_pgconfig param='black_function_list'} {/if} - {if paramExists('database_redirect_preference_list')} - <tr> - <th{if isset($error.database_redirect_preference_list)} class="error"{/if}> - <label>{$message.descDatabase_redirect_preference_list|escape}</label> - <br />database_redirect_preference_list(string)</th> - <td><input type="text" name="database_redirect_preference_list" - value="{$params.database_redirect_preference_list|escape}"/></td> - </tr> + {custom_tr_pgconfig param='database_redirect_preference_list'} {/if} - {if paramExists('app_name_redirect_preference_list')} - <tr> - <th{if isset($error.app_name_redirect_preference_list)} class="error"{/if}> - <label>{$message.descApp_name_redirect_preference_list|escape}</label> - <br />app_name_redirect_preference_list (string)</th> - <td><input type="text" name="app_name_redirect_preference_list" - value="{$params.app_name_redirect_preference_list|escape}"/></td> - </tr> + {custom_tr_pgconfig param='app_name_redirect_preference_list'} {/if} - {if paramExists('allow_sql_comments')} - <tr> - <th{if isset($error.allow_sql_comments)} class="error"{/if}> - <label>{$message.descAllow_sql_comments|escape}</label> - <br />allow_sql_comments (bool) *</th> - <td><input type="checkbox" name="allow_sql_comments" - id="allow_sql_comments" value="true" - {if $params.allow_sql_comments == 'on'}checked="checked"{/if} /></td> - </tr> + {custom_tr_pgconfig param='allow_sql_comments'} {/if} </tbody> </table> - {* --------------------------------------------------------------------- * - * Master/Slave Mode * - * --------------------------------------------------------------------- *} - <h3><a name="master_slave_mode" id="master_slave_mode">Master/Slave Mode</a></h3> + {* ===================================================================== *} + <h3 id="master_slave_mode">Master/Slave Mode</h3> + {* ===================================================================== *} <table> - <thead> - <tr> - <th>{$message.strParameter|escape}</th> - <th>{$message.strValue|escape}</th> - </tr> - </thead> - <tfoot> - <tr> - <td colspan="2"></td> - </tr> - </tfoot> - - <tbody> - - <tr> - <th{if isset($error.master_slave_mode)} class="error"{/if}> - <label>{$message.descMaster_slave_mode|escape}</label> - <br />master_slave_mode (bool) *</th> - <td><input type="checkbox" name="master_slave_mode" - id="master_slave_mode" value="true" - {if $params.master_slave_mode == 'on'}checked="checked"{/if} /></td> - </tr> - - {if paramExists('master_slave_sub_mode')} - <tr> - <th{if isset($error.master_slave_sub_mode)} class="error"{/if}> - <label>{$message.descMaster_slave_sub_mode|escape}</label> - <br />master_slave_sub_mode (string) *</th> - <td><select name="master_slave_sub_mode" id="master_slave_sub_mode"> - <option value="slony" - {if $params.master_slave_sub_mode == 'slony'}selected{/if}>slony</option> - <option value="stream" - {if $params.master_slave_sub_mode == 'stream'}selected{/if}>stream</option> - </select></td> - </tr> - {/if} + {custom_table_pgconfig} - {* --------------------------------------------------------------------- *} + <tbody id="tb_master_slave_mode"> + {custom_tr_pgconfig param='master_slave_mode'} + </tbody> - {if paramExists('sr_check_period')} - <tr><th class="category" colspan="2">Streaming</th></tr> + {if paramExists('master_slave_sub_mode')} + <tbody id="tb_master_slave_mode_on_submode"> + {custom_tr_pgconfig param='master_slave_sub_mode'} + </tbody> - <tr> - <th{if isset($error.sr_check_period)} class="error"{/if}> - <label>{$message.descSr_check_period|escape}</label> - <br />sr_check_period (integer) *</th> - <td><input type="text" name="sr_check_period" value="{$params.sr_check_period|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.sr_check_user)} class="error"{/if}> - <label>{$message.descSr_check_user|escape}</label> - <br />sr_check_user (string) *</th> - <td><input type="text" name="sr_check_user" value="{$params.sr_check_user|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.sr_check_password)} class="error"{/if}> - <label>{$message.descSr_check_password|escape}</label> - <br />sr_check_password (string) *</th> - <td><input type="text" name="sr_check_password" value="{$params.sr_check_password|escape}"/></td> - </tr> - {/if} + {if paramExists('follow_master_command')} + <tbody id="tb_master_slave_mode_on_special_command"> + {* --------------------------------------------------------------------- *} + <tr><th class="category" colspan="2">Special commands</th></tr> + {* --------------------------------------------------------------------- *} - {if paramExists('delay_threshold')} - <tr> - <th{if isset($error.delay_threshold)} class="error"{/if}> - <label>{$message.descDelay_threshold|escape}</label> - <br />delay_threshold (integer)</th> - <td><input type="text" name="delay_threshold" - id="delay_threshold" value="{$params.delay_threshold|escape}" /></td> - </tr> + {custom_tr_pgconfig param='follow_master_command'} + </tbody> {/if} + {/if} - {* --------------------------------------------------------------------- *} - - {if paramExists('follow_master_command')} - <tr><th class="category" colspan="2">Special commands</th></tr> + <tbody id="tb_master_slave_sub_mode_stream"> + {if paramExists('sr_check_period')} + {* --------------------------------------------------------------------- *} + <tr><th class="category" colspan="2">Streaming</th></tr> + {* --------------------------------------------------------------------- *} - <tr> - <th{if isset($error.follow_master_command)} class="error"{/if}> - <label>{$message.descFollow_master_command|escape}</label> - <br />follow_master_command (string) *</th> - <td><input type="text" name="follow_master_command" - value="{$params.follow_master_command|escape}"/></td> - </tr> + {custom_tr_pgconfig param='sr_check_period'} + {custom_tr_pgconfig param='sr_check_user'} + {custom_tr_pgconfig param='sr_check_password'} + {if paramExists('sr_check_database')} + {custom_tr_pgconfig param='sr_check_database'} + {/if} {/if} + {if paramExists('delay_threshold')} + {custom_tr_pgconfig param='delay_threshold'} + {/if} </tbody> </table> - {* --------------------------------------------------------------------- * - * Parallel Mode * - * --------------------------------------------------------------------- *} {if paramExists('parallel_mode')} - <h3><a name="parallel_mode" id="parallel_mode">{if hasMemqcache()}Parallel Mode{else}Parallel Mode and Query Cache{/if}</a></h3> - - <table> - <thead> - <tr> - <th>{$message.strParameter|escape}</th> - <th>{$message.strValue|escape}</th> - </tr> - </thead> - <tfoot> - <tr> - <td colspan="2"></td> - </tr> - </tfoot> - - <tbody> - - <tr> - <th{if isset($error.parallel_mode)} class="error"{/if}> - <label>{$message.descParallel_mode|escape}</label> - <br />parallel_mode (bool) *</th> - <td><input type="checkbox" name="parallel_mode" - id="parallel_mode" value="true" - {if $params.parallel_mode == 'on'}checked="checked"{/if} /></td> - </tr> - - {if hasMemqcache() == false} - <tr> - <th{if isset($error.enable_query_cache)} class="error"{/if}> - <label>{$message.descEnable_query_cache|escape}</label> - <br />enable_query_cache (bool) *</th> - <td><input type="checkbox" name="enable_query_cache" id="enable_query_cache" - {if $params.enable_query_cache == 'on'}checked="checked"{/if} /></td> - </tr> - {/if} + {* ===================================================================== *} + <h3 id="parallel_mode"> + {if hasMemqcache()} + Parallel Mode + {else} + Parallel Mode and Query Cache + {/if}</a></h3> + {* ===================================================================== *} - <tr> - {if isset($error.pgpool2_hostname)} - <th><label>{$message.descPgpool2_hostname|escape}</label> - <br />pgpool2_hostname (string) *</th> - {else} - <th><label>{$message.descPgpool2_hostname|escape}</label> - <br />pgpool2_hostname (string) *</th> - {/if} - <td><input type="text" name="pgpool2_hostname" value="{$params.pgpool2_hostname|escape}"/></td> - </tr> + <table> + {custom_table_pgconfig} - {* --------------------------------------------------------------------- *} + <tbody id="tb_parallel_mode"> + {custom_tr_pgconfig param='parallel_mode'} + </tbody> - <tr><th class="category" colspan="2">System DB info</th></tr> - - <tr> - <th{if isset($error.system_db_hostname)} class="error"{/if}> - <label>{$message.descSystem_db_hostname|escape}</label> - <br />system_db_hostname (string) *</th> - <td><input type="text" name="system_db_hostname" value="{$params.system_db_hostname|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.system_db_port)} class="error"{/if}> - <label>{$message.descSystem_db_port|escape}</label> - <br />system_db_port (integer) *</th> - <td><input type="text" name="system_db_port" value="{$params.system_db_port|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.system_db_name)} class="error"{/if}> - <label>{$message.descSystem_db_dbname|escape}</label> - <br />system_db_dbname (string) *</th> - <td><input type="text" name="system_db_dbname" value="{$params.system_db_dbname|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.system_db_schema)} class="error"{/if}> - <label>{$message.descSystem_db_schema|escape}</label> - <br />system_db_schema (string) *</th> - <td><input type="text" name="system_db_schema" value="{$params.system_db_schema|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.system_db_schema)} class="error"{/if}> - <label>{$message.descSystem_db_user|escape}</label> - <br />system_db_user (string) *</th> - <td><input type="text" name="system_db_user" value="{$params.system_db_user|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.system_db_password)} class="error"{/if}> - <label>{$message.descSystem_db_password|escape}</label> - <br />system_db_password (string) *</th> - <td><input type="password" name="system_db_password" value="{$params.system_db_password|escape}"/></td> - </tr> + <tbody id="tb_parallel_mode_on_host"> + {custom_tr_pgconfig param='pgpool2_hostname'} + {if hasMemqcache() == false} + {custom_tr_pgconfig param='enable_query_cache'} + {/if} + </tbody> - </tbody> - </table> + <tbody id="tb_parallel_mode_on_system_db"> + {* --------------------------------------------------------------------- *} + <tr><th class="category" colspan="2">System DB info</th></tr> + {* --------------------------------------------------------------------- *} + + {custom_tr_pgconfig param='system_db_hostname'} + {custom_tr_pgconfig param='system_db_port'} + {custom_tr_pgconfig param='system_db_dbname'} + {custom_tr_pgconfig param='system_db_schema'} + {custom_tr_pgconfig param='system_db_user'} + {custom_tr_pgconfig param='system_db_password'} + </tbody> + </table> {/if} - {* --------------------------------------------------------------------- * - * Health Check * - * --------------------------------------------------------------------- *} - <h3><a name="health-check" id="health-check">Health Check</a></h3> + {* ===================================================================== *} + <h3 id="health-check">Health Check</h3> + {* ===================================================================== *} <table> - <thead> - <tr> - <th>{$message.strParameter|escape}</th> - <th>{$message.strValue|escape}</th> - </tr> - </thead> - <tfoot> - <tr> - <td colspan="2"></td> - </tr> - </tfoot> - - <tbody> - <tr> - <th{if isset($error.health_check_timeout)} class="error"{/if}> - <label>{$message.descHealth_check_timeout|escape}</label> - <br />health_check_timeout (integer)</th> - <td><input type="text" name="health_check_timeout" value="{$params.health_check_timeout|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.health_check_period)} class="error"{/if}> - <label>{$message.descHealth_check_period|escape}</label> - <br />health_check_period (integer)</th> - <td><input type="text" name="health_check_period" value="{$params.health_check_period|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.health_check_user)} class="error"{/if}> - <label>{$message.descHealth_check_user|escape}</label> - <br />health_check_user (string)</th> - <td><input type="text" name="health_check_user" value="{$params.health_check_user|escape}"/></td> - </tr> + {custom_table_pgconfig} + <tbody id="tb_healthcheck"> + {custom_tr_pgconfig param='health_check_period'} + {custom_tr_pgconfig param='health_check_timeout'} + {custom_tr_pgconfig param='health_check_user'} {if paramExists('health_check_password')} - <tr> - <th{if isset($error.health_check_password)} class="error"{/if}> - <label>{$message.descHealth_check_password|escape}</label> - <br />health_check_password (string)</th> - <td><input type="text" name="health_check_password" value="{$params.health_check_password|escape}"/></td> - </tr> + {custom_tr_pgconfig param='health_check_password'} + {/if} + {if paramExists('health_check_database')} + {custom_tr_pgconfig param='health_check_database'} {/if} - {if paramExists('health_check_max_retries')} - <tr> - <th{if isset($error.health_check_max_retries)} class="error"{/if}> - <label>{$message.descHealth_check_max_retries|escape}</label> - <br />health_check_max_retries (integer)</th> - <td><input type="text" name="health_check_max_retries" value="{$params.health_check_max_retries|escape}"/></td> - </tr> + {custom_tr_pgconfig param='health_check_max_retries'} {/if} - {if paramExists('health_check_retry_delay')} - <tr> - <th{if isset($error.health_check_retry_delay)} class="error"{/if}> - <label>{$message.descHealth_check_retry_delay|escape}</label> - <br />health_check_retry_delay (integer)</th> - <td><input type="text" name="health_check_retry_delay" value="{$params.health_check_retry_delay|escape}"/></td> - </tr> + {custom_tr_pgconfig param='health_check_retry_delay'} {/if} - {if paramExists('connect_timeout')} - <tr> - <th{if isset($error.connect_timeout)} class="error"{/if}> - <label>{$message.desCconnect_timeout|escape}</label> - <br />connect_timeout (integer)</th> - <td><input type="text" name="connect_timeout" value="{$params.connect_timeout|escape}"/></td> - </tr> + {custom_tr_pgconfig param='connect_timeout'} {/if} </tbody> - </tbody> </table> - {* --------------------------------------------------------------------- * - * Failover and Failback * - * --------------------------------------------------------------------- *} - <h3><a name="failover" id="failover">Failover and Failback</a></h3> + {* ===================================================================== *} + <h3 id="failover">Failover and Failback</h3> + {* ===================================================================== *} <table> - <thead> - <tr> - <th>{$message.strParameter|escape}</th> - <th>{$message.strValue|escape}</th> - </tr> - </thead> - <tfoot> - <tr> - <td colspan="2"></td> - </tr> - </tfoot> - - <tbody> - - <tr> - <th{if isset($error.failover_command)} class="error"{/if}> - <label>{$message.descFailover_command|escape}</label> - <br />failover_command (string)</th> - <td><input type="text" name="failover_command" value="{$params.failover_command|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.failback_command)} class="error"{/if}> - <label>{$message.descFailback_command|escape}</label> - <br />failback_command (string)</th> - <td><input type="text" name="failback_command" value="{$params.failback_command|escape}"/></td> - </tr> + {custom_table_pgconfig} + <tbody id="tb_failover"> + {custom_tr_pgconfig param='failover_command'} + {custom_tr_pgconfig param='failback_command'} {if paramExists('fail_over_on_backend_error')} - <tr> - <th{if isset($error.fail_over_on_backend_error)} class="error"{/if}> - <label>{$message.descFail_over_on_backend_error|escape}</label> - <br />fail_over_on_backend_error</th> - <td><input type="checkbox" name="fail_over_on_backend_error" - id="fail_over_on_backend_error" value="true" - {if $params.fail_over_on_backend_error == 'on'}checked="checked"{/if} /></td> - </tr> + {custom_tr_pgconfig param='fail_over_on_backend_error'} + {/if} + {if paramExists('search_primary_node_timeout')} + {custom_tr_pgconfig param='search_primary_node_timeout'} {/if} - </tbody> </table> - {* --------------------------------------------------------------------- * - * Online Recovery * - * --------------------------------------------------------------------- *} - <h3><a name="recovery" id="recovery">Online Recovery</a></h3> + {* ===================================================================== *} + <h3 id="recovery">Online Recovery</h3> + {* ===================================================================== *} <table> - <thead> - <tr> - <th>{$message.strParameter|escape}</th> - <th>{$message.strValue|escape}</th> - </tr> - </thead> - <tfoot> - <tr> - <td colspan="2"></td> - </tr> - </tfoot> - - <tbody> - <tr> - <th{if isset($error.recovery_user)} class="error"{/if}> - <label>{$message.descRecovery_user|escape}</label> - <br />recovery_user (string)</th> - <td><input type="text" name="recovery_user" value="{$params.recovery_user|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.recovery_password)} class="error"{/if}> - <label>{$message.descRecovery_password|escape}</label> - <br />recovery_password (string)</th> - <td><input type="password" name="recovery_password" value="{$params.recovery_password|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.recovery_1st_stage_command)} class="error"{/if}> - <label>{$message.descRecovery_1st_stage_command|escape}</label> - <br />recovery_1st_stage_command (string)</th> - <td><input type="text" name="recovery_1st_stage_command" - value="{$params.recovery_1st_stage_command|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.recovery_2nd_stage_command)} class="error"{/if}> - <label>{$message.descRecovery_2nd_stage_command|escape}</label> - <br />recovery_2nd_stage_command (string)</th> - <td><input type="text" name="recovery_2nd_stage_command" - value="{$params.recovery_2nd_stage_command|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.recovery_timeout)} class="error"{/if}> - <label>{$message.descRecovery_timeout|escape}</label> - <br />recovery_timeout (integer)</th> - <td><input type="text" name="recovery_timeout" value="{$params.recovery_timeout|escape}"/></td> - </tr> - + {custom_table_pgconfig} + + <tbody id="tb_recovery"> + {custom_tr_pgconfig param='recovery_user'} + {custom_tr_pgconfig param='recovery_password'} + {custom_tr_pgconfig param='recovery_1st_stage_command'} + {custom_tr_pgconfig param='recovery_2nd_stage_command'} + {custom_tr_pgconfig param='recovery_timeout'} {if paramExists('client_idle_limit_in_recovery')} - <tr> - <th{if isset($error.client_idle_limit_in_recovery)} class="error"{/if}> - <label>{$message.descClient_idle_limit_in_recovery|escape}</label> - <br />client_idle_limit_in_recovery (integer)</th> - <td><input type="text" name="client_idle_limit_in_recovery" - value="{$params.client_idle_limit_in_recovery|escape}"/></td> - </tr> + {custom_tr_pgconfig param='client_idle_limit_in_recovery'} {/if} </tbody> </table> {if hasWatchdog()} - {* --------------------------------------------------------------------- * - * Watchdog * - * --------------------------------------------------------------------- *} - <h3><a name="watchdog" id="watchdog">Watchdog</a></h3> + {* ===================================================================== *} + <h3 id="watchdog">Watchdog</h3> + {* ===================================================================== *} - <table> - <thead> - <tr> - <th>{$message.strParameter|escape}</th> - <th colspan="2">{$message.strValue|escape}</th> - </tr> - </thead> - <tbody> - {* --------------------------------------------------------------------- *} - <tr><th class="category" colspan="4">Enabling</th></tr> + <table> + {custom_table_pgconfig} - <tr> - <th{if isset($error.use_watchdog)} class="error"{/if} colspan="2"> - <label>{$message.descUse_watchdog|escape}</label> - <br />use_watchdog (bool) *</th> - <td colspan="2"><input type="checkbox" name="use_watchdog" id="use_watchdog" value="true" - {if $params.use_watchdog== 'on'}checked="checked"{/if} /></td> - </tr> + <tbody id="tb_watchdog"> + {custom_tr_pgconfig param='use_watchdog'} + </tbody> - {* --------------------------------------------------------------------- *} - <tr><th class="category" colspan="4">Connection to up stream servers</th></tr> - - <tr> - <th{if isset($error.trusted_servers)} class="error"{/if} colspan="2"> - <label>{$message.descTrusted_servers|escape}</label> - <br />trusted_servers (string) *</th> - <td colspan="2"><input type="text" name="trusted_servers" value="{$params.trusted_servers|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.ping_path)} class="error"{/if} colspan="2"> - <label>{$message.descPing_path|escape}</label> - <br />ping_path (string) *</th> - <td colspan="2"><input type="text" name="ping_path" value="{$params.ping_path|escape}"/></td> - </tr> + <tbody id="tb_watchdog_use_watchdog_on_connection"> + {* --------------------------------------------------------------------- *} + <tr><th class="category" colspan="4">Connection to up stream servers</th></tr> + {* --------------------------------------------------------------------- *} - {* --------------------------------------------------------------------- *} - <tr><th class="category" colspan="4">Watchdog communication Settings</th></tr> - - <tr> - <th{if isset($error.wd_hostname)} class="error"{/if} colspan="2"> - <label>{$message.descWd_hostname|escape}</label> - <br />wd_hostname (string) *</th> - <td colspan="2"><input type="text" name="wd_hostname" value="{$params.wd_hostname|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.wd_port)} class="error"{/if} colspan="2"> - <label>{$message.descWd_port|escape}</label> - <br />wd_port (integer) *</th> - <td colspan="2"><input type="text" name="wd_port" value="{$params.wd_port|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.wd_authkey)} class="error"{/if} colspan="2"> - <label>{$message.descWd_authkey|escape}</label> - <br />wd_authkey (string) *</th> - <td colspan="2"><input type="text" name="wd_authkey" value="{$params.wd_authkey|escape}"/></td> - </tr> + {custom_tr_pgconfig param='trusted_servers'} + {custom_tr_pgconfig param='ping_path'} + </tbody> - {* --------------------------------------------------------------------- *} - <tr><th class="category" colspan="4">Virtual IP control Setting</th></tr> - - <tr> - <th{if isset($error.delegate_IP)} class="error"{/if} colspan="2"> - <label>{$message.descDelegate_IP|escape}</label> - <br />delegate_IP (string) *</th> - <td colspan="2"><input type="text" name="delegate_IP" value="{$params.delegate_IP|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.ifconfig_path)} class="error"{/if} colspan="2"> - <label>{$message.descIfconfig_path|escape}</label> - <br />ifconfig_path (string) *</th> - <td colspan="2"><input type="text" name="ifconfig_path" value="{$params.ifconfig_path|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.if_up_cmd)} class="error"{/if} colspan="2"> - <label>{$message.descIf_up_cmd|escape}</label> - <br />if_up_cmd (string) *</th> - <td colspan="2"><input type="text" name="if_up_cmd" value="{$params.if_up_cmd|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.if_down_cmd)} class="error"{/if} colspan="2"> - <label>{$message.descIf_down_cmd|escape}</label> - <br />if_down_cmd (string) *</th> - <td colspan="2"><input type="text" name="if_down_cmd" value="{$params.if_down_cmd|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.arping_path)} class="error"{/if} colspan="2"> - <label>{$message.descArping_path|escape}</label> - <br />arping_path (string) *</th> - <td colspan="2"><input type="text" name="arping_path" value="{$params.arping_path|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.arping_cmd)} class="error"{/if} colspan="2"> - <label>{$message.descArping_cmd|escape}</label> - <br />arping_cmd (string) *</th> - <td colspan="2"><input type="text" name="arping_cmd" value="{$params.arping_cmd|escape}"/></td> - </tr> + <tbody id="tb_watchdog_use_watchdog_on_communication"> + {* --------------------------------------------------------------------- *} + <tr><th class="category" colspan="4">Watchdog communication Settings</th></tr> + {* --------------------------------------------------------------------- *} + + {custom_tr_pgconfig param='wd_hostname'} + {custom_tr_pgconfig param='wd_port'} + {if paramExists('wd_priority')} + {custom_tr_pgconfig param='wd_priority'} + {/if} + {custom_tr_pgconfig param='wd_authkey'} + {if paramExists('wd_ipc_socket_dir')} + {custom_tr_pgconfig param='wd_ipc_socket_dir'} + {/if} + </tbody> - {* --------------------------------------------------------------------- *} - <tr><th class="category" colspan="4">Behavior on escalation Setting</th></tr> - - <tr> - <th{if isset($error.clear_memqcache_on_escalation)} class="error"{/if} colspan="2"> - <label>{$message.descClear_memqcache_on_escalation|escape}</label> - <br />clear_memqcache_on_escalation (bool)</th> - <td><input type="checkbox" name="clear_memqcache_on_escalation" - id="clear_memqcache_on_escalation" value="true" - {if $params.clear_memqcache_on_escalation== 'on'}checked="checked"{/if} /></td> - </tr> - - <tr> - <th{if isset($error.wd_escalation_command)} class="error"{/if} colspan="2"> - <label>{$message.descWd_escalation_command|escape}</label> - <br />wd_escalation_command (string) *</th> - <td colspan="2"><input type="text" name="wd_escalation_command" value="{$params.wd_escalation_command|escape}"/></td> - </tr> + <tbody id="tb_watchdog_use_watchdog_on_vip"> + {* --------------------------------------------------------------------- *} + <tr><th class="category" colspan="4">Virtual IP control Setting</th></tr> + {* --------------------------------------------------------------------- *} + + {custom_tr_pgconfig param='delegate_IP'} + {if paramExists('ifconfig_path')} + {custom_tr_pgconfig param='ifconfig_path'} + {/if} + {if paramExists('if_cmd_path')} + {custom_tr_pgconfig param='if_cmd_path'} + {/if} + {custom_tr_pgconfig param='if_up_cmd'} + {custom_tr_pgconfig param='if_down_cmd'} + {custom_tr_pgconfig param='arping_path'} + {custom_tr_pgconfig param='arping_cmd'} + </tbody> - {* --------------------------------------------------------------------- *} - <tr><th class="category" colspan="4">Lifecheck Setting (common)</th></tr> - - {if paramExists('wd_lifecheck_method')} - <tr> - <th{if isset($error.wd_lifecheck_method)} class="error"{/if} colspan="2"> - <label>{$message.descWd_lifecheck_method|escape}</label> - <br />wd_lifecheck_method (string) *</th> - <td colspan="2"> - <input type="text" name="wd_lifecheck_method" value="{$params.wd_lifecheck_method|escape}"/></td> - </tr> - {/if} + <tbody id="tb_watchdog_use_watchdog_on_escalation"> - <tr> - <th{if isset($error.wd_interval)} class="error"{/if} colspan="2"> - <label>{$message.descWd_interval|escape}</label> - <br />wd_interval (integer) *</th> - <td colspan="2"><input type="text" name="wd_interval" value="{$params.wd_interval|escape}"/></td> - </tr> + {* --------------------------------------------------------------------- *} + <tr><th class="category" colspan="4">Behavior on escalation Setting</th></tr> + {* --------------------------------------------------------------------- *} - {* --------------------------------------------------------------------- *} - {if paramExists('heartbeat_destination')} - <tr><th class="category" colspan="4">Lifecheck Setting (heartbeat mode)</th></tr> - - <tr> - <th{if isset($error.wd_heartbeat_port)} class="error"{/if} colspan="2"> - <label>{$message.descWd_heartbeat_port|escape}</label> - <br />wd_heartbeat_port (integer) *</th> - <td colspan="2"> - <input type="text" name="wd_heartbeat_port" value="{$params.wd_heartbeat_port|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.wd_heartbeat_keepalive)} class="error"{/if} colspan="2"> - <label>{$message.descWd_heartbeat_keepalive|escape}</label> - <br />wd_heartbeat_keepalive (integer) *</th> - <td colspan="2"> - <input type="text" name="wd_heartbeat_keepalive" value="{$params.wd_heartbeat_keepalive|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.wd_heartbeat_deadtime)} class="error"{/if} colspan="2"> - <label>{$message.descWd_heartbeat_deadtime|escape}</label> - <br />wd_heartbeat_deadtime (integer) *</th> - <td colspan="2"> - <input type="text" name="wd_heartbeat_deadtime" value="{$params.wd_heartbeat_deadtime|escape}"/></td> - </tr> - - {if paramExists('heartbeat_destination')} - {foreach from=$params.heartbeat_destination key=dest_num item=v} - <tr> - <th rowspan="3"><span class="param_group">destination {$dest_num}</span></th> + {custom_tr_pgconfig param='clear_memqcache_on_escalation'} + {custom_tr_pgconfig param='wd_escalation_command'} + {if paramExists('wd_de_escalation_command')} + {custom_tr_pgconfig param='wd_de_escalation_command'} + {/if} + </tbody> - <th{if isset($error.heartbeat_destination[num])} class="error"{/if}> - <label>{$message.descHeartbeat_destination|escape}</label> - <br />heartbeat_destination{$dest_num|escape} (string)</th> - <td><input type="text" name="heartbeat_destination[]" - value="{$params.heartbeat_destination.$dest_num|escape}" /></td> + <tbody id="tb_watchdog_use_watchdog_on_lifecheck_common"> + {* --------------------------------------------------------------------- *} + <tr><th class="category" colspan="4">Lifecheck Setting (common)</th></tr> + {* --------------------------------------------------------------------- *} - <td rowspan="3"> - <input type="button" name="delete" value="{$message.strDelete|escape}" - onclick="delHeartbeatDestination({$dest_num})" /></td> - </tr> + {if paramExists('wd_lifecheck_method')} + {custom_tr_pgconfig param='wd_lifecheck_method'} + {/if} + {custom_tr_pgconfig param='wd_interval'} + </tbody> - <tr> - <th{if isset($error.heartbeat_destination_port[num])} class="error"{/if}> - <label>{$message.descHeartbeat_destination_port|escape}</label> - <br />heartbeat_destination_port{$dest_num} (integer)</th> - <td><input type="text" name="heartbeat_destination_port[]" - value="{$params.heartbeat_destination_port.$dest_num|escape}" /></td> - </tr> + {if paramExists('wd_heartbeat_port')} + <tbody id="tb_watchdog_wd_lifecheck_method_heartbeat"> + {* --------------------------------------------------------------------- *} + <tr><th class="category" colspan="4">Lifecheck Setting (heartbeat mode)</th></tr> + {* --------------------------------------------------------------------- *} + + {custom_tr_pgconfig param='wd_heartbeat_port'} + {custom_tr_pgconfig param='wd_heartbeat_keepalive'} + {custom_tr_pgconfig param='wd_heartbeat_deadtime'} + </tbody> + + <tbody id="tb_watchdog_wd_lifecheck_method_heartbeat_destinations"> + {* --------------------------------------------------------------------- *} + <tr><th class="category" colspan="4">Heartbeat destinations + <input type="button" name="add" value="{$message.strAdd|escape}" + onclick="sendForm('add_heartbeat_destination')" /> + </th></tr> + {* --------------------------------------------------------------------- *} + + {if paramExists('heartbeat_destination')} + {foreach from=$params.heartbeat_destination key=dest_num item=v} + <tr><th colspan="4"><span class="param_group"> + Heartbeat destination {$dest_num}</span> + </th></tr> + {custom_tr_pgconfig param='heartbeat_destination' num=$dest_num} + {custom_tr_pgconfig param='heartbeat_destination_port' num=$dest_num} + {custom_tr_pgconfig param='heartbeat_device' num=$dest_num} + {/foreach} + + {if isset($isAddHeartbeatDestination) && $isAddHeartbeatDestination == true} + <tr><th colspan="4"><span class="param_group"> + Heartbeat destination {$dest_num+1}</span> + <input type="button" name="delete" value="{$message.strDelete|escape}" + onclick="sendForm('delete_heartbeat_destination', {$dest_num+1})" /> + </th></tr> + {custom_tr_pgconfig param='heartbeat_destination' num=$dest_num+1} + {custom_tr_pgconfig param='heartbeat_destination_port' num=$dest_num+1} + {custom_tr_pgconfig param='heartbeat_device' num=$dest_num+1} + {/if} + {/if} + </tbody> + {/if} - <tr> - <th{if isset($error.heartbeat_device[num])} class="error"{/if}> - <label>{$message.descHeartbeat_device|escape}</label> - <br />heartbeat_device{$dest_num} (string)</th> - <td><input type="text" name="heartbeat_device[]" - value="{$params.heartbeat_device.$dest_num|escape}" /></td> - </tr> - {/foreach} + <tbody id="tb_watchdog_wd_lifecheck_method_query"> + {* --------------------------------------------------------------------- *} + <tr><th class="category" colspan="4">Lifecheck Setting (query mode)</th></tr> + {* --------------------------------------------------------------------- *} + + {custom_tr_pgconfig param='wd_life_point'} + {custom_tr_pgconfig param='wd_lifecheck_query'} + {if paramExists('wd_lifecheck_dbname')} + {custom_tr_pgconfig param='wd_lifecheck_dbname'} + {custom_tr_pgconfig param='wd_lifecheck_user'} + {custom_tr_pgconfig param='wd_lifecheck_password'} + {/if} + </tbody> - {if isset($isAddHeartbeatDestination) && $isAddHeartbeatDestination == true} - <tr> - <th rowspan="3"><span class="param_group">destination {$dest_num + 1}</span></th> - <th><label>{$message.descHeartbeat_destination|escape}</label> - <br />heartbeat_destination{$smarty.section.dest_num.index|escape} (string)</th> - <td><input type="text" name="heartbeat_destination[]" value="" /></td> - </tr> + <tbody id="tb_watchdog_use_watchdog_on_other"> + {* --------------------------------------------------------------------- *} + <tr><th class="category" colspan="4">Other pgpool Connection Settings + <input type="button" name="add" value="{$message.strAdd|escape}" + onclick="sendForm('add_wd')" /> + </th></tr> + {* --------------------------------------------------------------------- *} + {foreach from=$params.other_pgpool_hostname key=host_num item=v} <tr> - <th><label>{$message.descHeartbeat_destination_port|escape}</label> - <br />heartbeat_destination_port{$smarty.section.dest_num.index|escape} (integer)</th> - <td><input type="text" name="heartbeat_destination_port[]" value="" /></td> + <th colspan="2"><span class="param_group">other pgpool {$host_num}</span></th> </tr> + {custom_tr_pgconfig param='other_pgpool_hostname' num=$host_num} + {custom_tr_pgconfig param='other_pgpool_port' num=$host_num} + {custom_tr_pgconfig param='other_wd_port' num=$host_num} - <tr> - <th><label>{$message.descHeartbeat_device|escape}</label> - <br />heartbeat_device{$smarty.section.dest_num.index} (string)</th> - <td><input type="text" name="heartbeat_device[]" value="" /></td> - </tr> + {/foreach} - <tr class="tr_add_button"> - <td colspan="4"> - <input type="button" name="cancel" value="{$message.strCancel|escape}" - onclick="cancelHeartbeatDestination()" /></td> - </tr> - {else} - <tr class="tr_add_button"> - <td colspan="4"> - <input type="button" name="add" value="{$message.strAdd|escape}" - onclick="addHeartbeatDestination()" /></td> + {if isset($isAddWd) && $isAddWd == true} + <tr> + <th colspan="2"><span class="param_group">other pgpool {$host_num+1}</span></th> </tr> - {/if} - {/if} - {/if} - - {* --------------------------------------------------------------------- *} - <tr><th class="category" colspan="4">Lifecheck Setting (query mode)</th></tr> - - <tr> - <th{if isset($error.wd_life_point)} class="error"{/if} colspan="2"> - <label>{$message.descWd_life_point|escape}</label> - <br />wd_life_point(integer) *</th> - <td colspan="2"><input type="text" name="wd_life_point" value="{$params.wd_life_point|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.wd_lifecheck_query)} class="error"{/if} colspan="2"> - <label>{$message.descWd_lifecheck_query|escape}</label> - <br />wd_lifecheck_query (string) *</th> - <td colspan="2"> - <input type="text" name="wd_lifecheck_query" value="{$params.wd_lifecheck_query|escape}"/></td> - </tr> - - {if paramExists('wd_lifecheck_dbname')} - <tr> - <th{if isset($error.wd_lifecheck_dbname)} class="error"{/if} colspan="2"> - <label>{$message.descWd_lifecheck_dbname|escape}</label> - <br />wd_lifecheck_dbname (string) *</th> - <td colspan="2"><input type="text" name="wd_lifecheck_dbname" value="{$params.wd_lifecheck_dbname|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.wd_lifecheck_user)} class="error"{/if} colspan="2"> - <label>{$message.descWd_lifecheck_user|escape}</label> - <br />wd_lifecheck_user (string) *</th> - <td colspan="2"><input type="text" name="wd_lifecheck_user" value="{$params.wd_lifecheck_user|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.wd_lifecheck_password)} class="error"{/if} colspan="2"> - <label>{$message.descWd_lifecheck_password|escape}</label> - <br />wd_lifecheck_password (string) *</th> - <td colspan="2"><input type="text" name="wd_lifecheck_password" value="{$params.wd_lifecheck_password|escape}"/></td> - </tr> - {/if} - - {* --------------------------------------------------------------------- *} - <tr><th class="category" colspan="4">Other pgpool Connection Settings</th></tr> - - {foreach from=$params.other_pgpool_hostname key=host_num item=v} - <tr> - <th rowspan="3"><span class="param_group">other {$host_num}</span></th> - <th{if isset($error.other_pgpool_hostname[num])} class="error"{/if}> - <label>{$message.descOther_pgpool_hostname|escape}</label> - <br />other_pgpool_hostname{$host_num} (string)</th> - <td><input type="text" name="other_pgpool_hostname[]" - value="{$params.other_pgpool_hostname.$host_num|escape}" /></td> - <td rowspan="3"> - <input type="button" name="delete" value="{$message.strDelete|escape}" - onclick="delOtherWatchdog({$host_num})" /></td> - </tr> - - <tr> - <th{if isset($error.other_pgpool_port[num])} class="error"{/if}> - <label>{$message.descOther_pgpool_port|escape}</label> - <br />other_pgpool_port{$host_num|escape} (integer)</th> - <td><input type="text" name="other_pgpool_port[]" value="{$params.other_pgpool_port.$host_num|escape}" /></td> - </tr> - - <tr> - <th{if isset($error.other_wd_port[num])} class="error"{/if}> - <label>{$message.descOther_wd_port|escape}</label> - <br />other_wd_port{$host_num|escape} (integer)</th> - <td><input type="text" name="other_wd_port[]" value="{$params.other_wd_port.$host_num|escape}" /></td> - </tr> - {/foreach} - - {if isset($isAddWd) && $isAddWd == true} - <tr> - <th rowspan="3"><span class="param_group">other {$host_num + 1}</span></th> - <th><label>{$message.descOther_pgpool_hostname|escape}</label> - <br />other_pgpool_hostname{$smarty.section.num.index} (string)</th> - <td><input type="text" name="other_pgpool_hostname[]" value="" /></td> - </tr> - - <tr> - <th><label>{$message.descOther_pgpool_port|escape}</label> - <br />other_pgpool_port{$smarty.section.num.index|escape} (integer)</th> - <td><input type="text" name="other_pgpool_port[]" value="" /></td> - </tr> - - <tr> - <th><label>{$message.descOther_wd_port|escape}</label> - <br />other_wd_port{$smarty.section.num.index|escape} (integer)</th> - <td><input type="text" name="other_wd_port[]" value="" /></td> - </tr> - {/if} - - </tbody> - {if isset($isAddWd) && $isAddWd == true} - <tfoot> - <tr> - <td colspan="4"> - <input type="button" name="cancel" value="{$message.strCancel|escape}" onclick="cancelOtherWatchdog()" /></td> - </tr> - </tfoot> - {else} - <tfoot> - <tr> - <td colspan="4"> - <input type="button" name="add" value="{$message.strAdd|escape}" onclick="addOtherWatchdog()" /></td> - </tr> - </tfoot> - {/if} - </table> + {custom_tr_pgconfig param='other_pgpool_hostname' num=$host_num+1} + {custom_tr_pgconfig param='other_pgpool_port' num=$host_num+1} + {custom_tr_pgconfig param='other_wd_port' num=$host_num+1} + {/if} + </tbody> + </table> {/if} {if hasMemqcache()} - {* --------------------------------------------------------------------- * - * In Memory Query Cache * - * --------------------------------------------------------------------- *} - <h3><a name="memqcache" id="memqcache">In Memory Query Cache</a></h3> + {* ===================================================================== *} + <h3 id="memqcache">In Memory Query Cache</h3> + {* ===================================================================== *} <table> - <thead> - <tr> - <th>{$message.strParameter|escape}</th> - <th>{$message.strValue|escape}</th> - </tr> - </thead> - <tfoot> - <tr> - <td colspan="2"></td> - </tr> - </tfoot> - <tbody> - - <tr> - <th{if isset($error.memory_cache_enabled)} class="error"{/if}> - <label>{$message.descMemory_cache_enabled|escape}</label> - <br />memory_cache_enabled (bool)</th> - <td><input type="checkbox" name="memory_cache_enabled" id="memory_cache_enabled" value="true" - {if $params.memory_cache_enabled == 'on'}checked="checked"{/if} /></td> - </tr> - - <tr> - <th{if isset($error.memqcache_method)} class="error"{/if}> - <label>{$message.descMemqcache_method|escape}</label> - <br />memqcache_method (string) *</th> - <td><select name="memqcache_method" id="memqcache_method"> - <option value="shmem" {if $params.memqcache_method == 'shmem'}selected{/if}>shmem</option> - <option value="memcached" {if $params.memqcache_method == 'memcached'}selected{/if}>memcached</option> - </select></td> - </tr> + {custom_table_pgconfig} - <tr><th class="category" colspan="2">Memcached specific</th></tr> + <tbody id="tb_memqcache"> + {custom_tr_pgconfig param='memory_cache_enabled'} + </tbody> - <tr> - <th{if isset($error.memqcache_memcached_host)} class="error"{/if}> - <label>{$message.descMemqcache_memcached_host|escape}</label> - <br />memqcache_memcached_host (string) *</th> - <td><input type="text" name="memqcache_memcached_host" value="{$params.memqcache_memcached_host|escape}"/></td> - </tr> + <tbody id="tb_tb_memqcache_memory_cache_enabled_on"> + {custom_tr_pgconfig param='memqcache_method'} - <tr> - <th{if isset($error.memqcache_memcached_port)} class="error"{/if}> - <label>{$message.descMemqcache_memcached_port|escape}</label> - <br />memqcache_memcached_port (integer) *</th> - <td><input type="text" name="memqcache_memcached_port" value="{$params.memqcache_memcached_port|escape}"/></td> - </tr> + {* --------------------------------------------------------------------- *} + <tr><th class="category" colspan="2">Common</th></tr> + {* --------------------------------------------------------------------- *} - <tr><th class="category" colspan="2">Shared memory specific</th></tr> + {custom_tr_pgconfig param='memqcache_expire'} + {custom_tr_pgconfig param='memqcache_auto_cache_invalidation'} + {custom_tr_pgconfig param='memqcache_maxcache'} + {custom_tr_pgconfig param='memqcache_oiddir'} + {custom_tr_pgconfig param='white_memqcache_table_list'} + {custom_tr_pgconfig param='black_memqcache_table_list'} + </tbody> - <tr> - <th{if isset($error.memqcache_total_size)} class="error"{/if}> - <label>{$message.descMemqcache_total_size|escape}</label> - <br />memqcache_total_size (integer) *</th> - <td><input type="text" name="memqcache_total_size" value="{$params.memqcache_total_size|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.memqcache_max_num_cache)} class="error"{/if}> - <label>{$message.descMemqcache_max_num_cache|escape}</label> - <br />memqcache_max_num_cache (integer) *</th> - <td><input type="text" name="memqcache_max_num_cache" value="{$params.memqcache_max_num_cache|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.memqcache_cache_block_size)} class="error"{/if}> - <label>{$message.descMemqcache_cache_block_size|escape}</label> - <br />memqcache_cache_block_size (integer) *</th> - <td><input type="text" name="memqcache_cache_block_size" value="{$params.memqcache_cache_block_size|escape}"/></td> - </tr> + <tbody id="tb_memqcache_memqcache_method_memcached"> + {* --------------------------------------------------------------------- *} + <tr><th class="category" colspan="2">Memcached specific</th></tr> + {* --------------------------------------------------------------------- *} - <tr><th class="category" colspan="2">Common</th></tr> + {custom_tr_pgconfig param='memqcache_memcached_host'} + {custom_tr_pgconfig param='memqcache_memcached_port'} + </tbody> - <tr> - <th{if isset($error.memqcache_expire)} class="error"{/if}> - <label>{$message.descMemqcache_expire|escape}</label> - <br />memqcache_expire (integer) *</th> - <td><input type="text" name="memqcache_expire" value="{$params.memqcache_expire|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.memqcache_auto_cache_invalidation)} class="error"{/if}> - <label>{$message.descMemqcache_auto_cache_invalidation|escape}</label> - <br />memqcache_auto_cache_invalidation *</th> - <td><input type="checkbox" name="memqcache_auto_cache_invalidation" id="memqcache_auto_cache_invalidation" - value="true"{if $params.memqcache_auto_cache_invalidation == 'on'} checked="checked"{/if} /></td> - </tr> - - <tr> - <th{if isset($error.memqcache_maxcache)} class="error"{/if}> - <label>{$message.descMemqcache_maxcache|escape}</label> - <br />memqcache_maxcache (integer) *</th> - <td><input type="text" name="memqcache_maxcache" value="{$params.memqcache_maxcache|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.memqcache_oiddir)} class="error"{/if}> - <label>{$message.descMemqcache_oiddir|escape}</label> - <br />memqcache_oiddir (string) *</th> - <td><input type="text" name="memqcache_oiddir" value="{$params.memqcache_oiddir|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.white_memqcache_table_list)} class="error"{/if}> - <label>{$message.descWhite_memqcache_table_list|escape}</label> - <br />white_memqcache_table_list (string)</th> - <td><input type="text" name="white_memqcache_table_list" value="{$params.white_memqcache_table_list|escape}"/></td> - </tr> - - <tr> - <th{if isset($error.black_memqcache_table_list)} class="error"{/if}> - <label>{$message.descBlack_memqcache_table_list|escape}</label> - <br />black_memqcache_table_list (string)</th> - <td><input type="text" name="black_memqcache_table_list" value="{$params.black_memqcache_table_list|escape}"/></td> - </tr> + <tbody id="tb_memqcache_memqcache_method_shmem"> + {* --------------------------------------------------------------------- *} + <tr><th class="category" colspan="2">Shared memory specific</th></tr> + {* --------------------------------------------------------------------- *} - </tbody> + {custom_tr_pgconfig param='memqcache_total_size'} + {custom_tr_pgconfig param='memqcache_max_num_cache'} + {custom_tr_pgconfig param='memqcache_cache_block_size'} + </tbody> </table> {/if} {if paramExists('relcache_expire')} - {* --------------------------------------------------------------------- * - * Others * - * --------------------------------------------------------------------- *} - <h3><a name="others" id="others">Others</a></h3> + {* ===================================================================== *} + <h3 id="others">Others</h3> + {* ===================================================================== *} <table> - <thead> - <tr> - <th>{$message.strParameter|escape}</th> - <th>{$message.strValue|escape}</th> - </tr> - </thead> - <tfoot> - <tr> - <td colspan="2"></td> - </tr> - </tfoot> - <tbody> - - <tr> - <th{if isset($error.relcache_expire)} class="error"{/if}> - <label>{$message.descRelcache_expire|escape}</label> - <br />relcache_expire (integer)</th> - <td><input type="text" name="relcache_expire" value="{$params.relcache_expire|escape}"/></td> - </tr> + {custom_table_pgconfig} + <tbody id="tb_other"> + {custom_tr_pgconfig param='relcache_expire'} {if paramExists('relcache_size')} - <tr> - <th{if isset($error.relcache_size)} class="error"{/if}> - <label>{$message.descRelcache_size|escape}</label> - <br />relcache_size (integer)</th> - <td><input type="text" name="relcache_size" value="{$params.relcache_size|escape}"/></td> - </tr> + {custom_tr_pgconfig param='relcache_size'} {/if} - {if paramExists('check_temp_table')} - <tr> - <th{if isset($error.check_temp_table)} class="error"{/if}> - <label>{$message.descCheck_temp_table|escape}</label> - <br />check_temp_table (bool)</th> - <td><input type="checkbox" name="check_temp_table" id="check_temp_table" value="true" - {if $params.check_temp_table == 'on'}checked="checked"{/if} /></td> - </tr> + {custom_tr_pgconfig param='check_temp_table'} + {/if} + {if paramExists('check_unlogged_table')} + {custom_tr_pgconfig param='check_unlogged_table'} {/if} - </tbody> </table> {/if} @@ -1893,8 +747,8 @@ function delHeartbeatDestination(num){ * --------------------------------------------------------------------- *} <hr style="margin: 30px auto"> <p align="center"> - <input type="button" name="btnSubmit" value=" {$message.strUpdate|escape} " onclick="update()"/> - <input type="button" name="btnReset" value=" {$message.strReset|escape} " onclick="resetData()"/> + <input type="button" name="btnSubmit" value=" {$message.strUpdate|escape} " onclick="sendForm('update')"/> + <input type="button" name="btnReset" value=" {$message.strReset|escape} " onclick="test('reset')"/> </p> </form> diff --git a/version.php b/version.php index c88afb1..786e248 100644 --- a/version.php +++ b/version.php @@ -23,6 +23,6 @@ * @version SVN: $Id$
*/
-$version = '3.4.1';
+$version = '3.5.0';
?>
|