Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/check/PhabricatorMySQLSetupCheck.php
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | if (!in_array('STRICT_ALL_TABLES', $modes)) { | ||||
'Without this mode enabled, MySQL will silently ignore some error '. | 'Without this mode enabled, MySQL will silently ignore some error '. | ||||
'conditions, including inserts which attempt to store more data in '. | 'conditions, including inserts which attempt to store more data in '. | ||||
'a column than actually fits. This behavior is usually undesirable '. | 'a column than actually fits. This behavior is usually undesirable '. | ||||
'and can lead to data corruption (by truncating multibyte characters '. | 'and can lead to data corruption (by truncating multibyte characters '. | ||||
'in the middle), data loss (by discarding the data which does not '. | 'in the middle), data loss (by discarding the data which does not '. | ||||
'fit into the column), or security concerns (for example, by '. | 'fit into the column), or security concerns (for example, by '. | ||||
'truncating keys or credentials).'. | 'truncating keys or credentials).'. | ||||
"\n\n". | "\n\n". | ||||
'Phabricator is developed and tested in "STRICT_ALL_TABLES" mode so '. | '%s is developed and tested in "STRICT_ALL_TABLES" mode so '. | ||||
'you should normally never encounter these situations, but may run '. | 'you should normally never encounter these situations, but may run '. | ||||
'into them if you interact with the database directly, run '. | 'into them if you interact with the database directly, run '. | ||||
'third-party code, develop extensions, or just encounter a bug in '. | 'third-party code, develop extensions, or just encounter a bug in '. | ||||
'the software.'. | 'the software.'. | ||||
"\n\n". | "\n\n". | ||||
'Enabling "STRICT_ALL_TABLES" makes MySQL raise an explicit error '. | 'Enabling "STRICT_ALL_TABLES" makes MySQL raise an explicit error '. | ||||
'if one of these unusual situations does occur. This is a safer '. | 'if one of these unusual situations does occur. This is a safer '. | ||||
'behavior and prevents these situations from causing secret, subtle, '. | 'behavior and prevents these situations from causing secret, subtle, '. | ||||
'and potentially serious issues later on.'. | 'and potentially serious issues later on.'. | ||||
"\n\n". | "\n\n". | ||||
'You can find more information about this mode (and how to configure '. | 'You can find more information about this mode (and how to configure '. | ||||
'it) in the MySQL manual. Usually, it is sufficient to add this to '. | 'it) in the MySQL manual. Usually, it is sufficient to add this to '. | ||||
'your "my.cnf" file (in the "[mysqld]" section) and then '. | 'your "my.cnf" file (in the "[mysqld]" section) and then '. | ||||
'restart "mysqld":'. | 'restart "mysqld":'. | ||||
"\n\n". | "\n\n". | ||||
'%s'. | '%s'. | ||||
"\n". | "\n". | ||||
'Note that if you run other applications against the same database, '. | 'Note that if you run other applications against the same database, '. | ||||
'they may not work in strict mode.'. | 'they may not work in strict mode.'. | ||||
"\n\n". | "\n\n". | ||||
'If you can not or do not want to enable "STRICT_ALL_TABLES", you '. | 'If you can not or do not want to enable "STRICT_ALL_TABLES", you '. | ||||
'can safely ignore this warning. Phabricator will work correctly '. | 'can safely ignore this warning. %s will work correctly '. | ||||
'with this mode enabled or disabled.', | 'with this mode enabled or disabled.', | ||||
$host_name, | $host_name, | ||||
phutil_tag('pre', array(), 'sql_mode=STRICT_ALL_TABLES')); | PhabricatorPlatformSite::getName(), | ||||
phutil_tag('pre', array(), 'sql_mode=STRICT_ALL_TABLES'), | |||||
PhabricatorPlatformSite::getName()); | |||||
$this->newIssue('sql_mode.strict') | $this->newIssue('sql_mode.strict') | ||||
->setName(pht('MySQL %s Mode Not Set', 'STRICT_ALL_TABLES')) | ->setName(pht('MySQL %s Mode Not Set', 'STRICT_ALL_TABLES')) | ||||
->setSummary($summary) | ->setSummary($summary) | ||||
->setMessage($message) | ->setMessage($message) | ||||
->setDatabaseRef($ref) | ->setDatabaseRef($ref) | ||||
->addMySQLConfig('sql_mode'); | ->addMySQLConfig('sql_mode'); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | if ($is_myisam_fulltext) { | ||||
$summary = pht( | $summary = pht( | ||||
'MySQL (on host "%s") is using a default stopword file, which '. | 'MySQL (on host "%s") is using a default stopword file, which '. | ||||
'will prevent searching for many common words.', | 'will prevent searching for many common words.', | ||||
$host_name); | $host_name); | ||||
$message = pht( | $message = pht( | ||||
"Database host \"%s\" is using the builtin stopword file for ". | "Database host \"%s\" is using the builtin stopword file for ". | ||||
"building search indexes. This can make Phabricator's search ". | "building search indexes. This can make %s's search ". | ||||
"feature less useful.\n\n". | "feature less useful.\n\n". | ||||
"Stopwords are common words which are not indexed and thus can not ". | "Stopwords are common words which are not indexed and thus can not ". | ||||
"be searched for. The default stopword file has about 500 words, ". | "be searched for. The default stopword file has about 500 words, ". | ||||
"including various words which you are likely to wish to search ". | "including various words which you are likely to wish to search ". | ||||
"for, such as 'various', 'likely', 'wish', and 'zero'.\n\n". | "for, such as 'various', 'likely', 'wish', and 'zero'.\n\n". | ||||
"To make search more useful, you can use an alternate stopword ". | "To make search more useful, you can use an alternate stopword ". | ||||
"file with fewer words. Alternatively, if you aren't concerned ". | "file with fewer words. Alternatively, if you aren't concerned ". | ||||
"about searching for common words, you can ignore this warning. ". | "about searching for common words, you can ignore this warning. ". | ||||
"If you later plan to configure Elasticsearch, you can also ignore ". | "If you later plan to configure Elasticsearch, you can also ignore ". | ||||
"this warning: this stopword file only affects MySQL fulltext ". | "this warning: this stopword file only affects MySQL fulltext ". | ||||
"indexes.\n\n". | "indexes.\n\n". | ||||
"To choose a different stopword file, add this to your %s file ". | "To choose a different stopword file, add this to your %s file ". | ||||
"(in the %s section) and then restart %s:\n\n". | "(in the %s section) and then restart %s:\n\n". | ||||
"%s\n". | "%s\n". | ||||
"(You can also use a different file if you prefer. The file ". | "(You can also use a different file if you prefer. The file ". | ||||
"suggested above has about 50 of the most common English words.)\n\n". | "suggested above has about 50 of the most common English words.)\n\n". | ||||
"Finally, run this command to rebuild indexes using the new ". | "Finally, run this command to rebuild indexes using the new ". | ||||
"rules:\n\n". | "rules:\n\n". | ||||
"%s", | "%s", | ||||
$host_name, | $host_name, | ||||
PhabricatorPlatformSite::getName(), | |||||
phutil_tag('tt', array(), 'my.cnf'), | phutil_tag('tt', array(), 'my.cnf'), | ||||
phutil_tag('tt', array(), '[mysqld]'), | phutil_tag('tt', array(), '[mysqld]'), | ||||
phutil_tag('tt', array(), 'mysqld'), | phutil_tag('tt', array(), 'mysqld'), | ||||
phutil_tag('pre', array(), 'ft_stopword_file='.$stopword_path), | phutil_tag('pre', array(), 'ft_stopword_file='.$stopword_path), | ||||
phutil_tag( | phutil_tag( | ||||
'pre', | 'pre', | ||||
array(), | array(), | ||||
"mysql> REPAIR TABLE {$namespace}_search.search_documentfield;")); | "mysql> REPAIR TABLE {$namespace}_search.search_documentfield;")); | ||||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | if ($innodb_bytes < $minimum_bytes) { | ||||
$host_name); | $host_name); | ||||
$message = pht( | $message = pht( | ||||
"Database host \"%s\" is configured with a very small %s (%s). ". | "Database host \"%s\" is configured with a very small %s (%s). ". | ||||
"This may cause poor database performance and lock exhaustion.\n\n". | "This may cause poor database performance and lock exhaustion.\n\n". | ||||
"There are no hard-and-fast rules to setting an appropriate value, ". | "There are no hard-and-fast rules to setting an appropriate value, ". | ||||
"but a reasonable starting point for a standard install is something ". | "but a reasonable starting point for a standard install is something ". | ||||
"like 40%% of the total memory on the machine. For example, if you ". | "like 40%% of the total memory on the machine. For example, if you ". | ||||
"have 4GB of RAM on the machine you have installed Phabricator on, ". | "have 4GB of RAM on the machine you have installed %s on, ". | ||||
"you might set this value to %s.\n\n". | "you might set this value to %s.\n\n". | ||||
"You can read more about this option in the MySQL documentation to ". | "You can read more about this option in the MySQL documentation to ". | ||||
"help you make a decision about how to configure it for your use ". | "help you make a decision about how to configure it for your use ". | ||||
"case. There are no concerns specific to Phabricator which make it ". | "case. There are no concerns specific to %s which make it ". | ||||
"different from normal workloads with respect to this setting.\n\n". | "different from normal workloads with respect to this setting.\n\n". | ||||
"To adjust the setting, add something like this to your %s file (in ". | "To adjust the setting, add something like this to your %s file (in ". | ||||
"the %s section), replacing %s with an appropriate value for your ". | "the %s section), replacing %s with an appropriate value for your ". | ||||
"host and use case. Then restart %s:\n\n". | "host and use case. Then restart %s:\n\n". | ||||
"%s\n". | "%s\n". | ||||
"If you're satisfied with the current setting, you can safely ". | "If you're satisfied with the current setting, you can safely ". | ||||
"ignore this setup warning.", | "ignore this setup warning.", | ||||
$host_name, | $host_name, | ||||
phutil_tag('tt', array(), 'innodb_buffer_pool_size'), | phutil_tag('tt', array(), 'innodb_buffer_pool_size'), | ||||
phutil_tag('tt', array(), $innodb_readable), | phutil_tag('tt', array(), $innodb_readable), | ||||
PhabricatorPlatformSite::getName(), | |||||
phutil_tag('tt', array(), '1600M'), | phutil_tag('tt', array(), '1600M'), | ||||
PhabricatorPlatformSite::getName(), | |||||
phutil_tag('tt', array(), 'my.cnf'), | phutil_tag('tt', array(), 'my.cnf'), | ||||
phutil_tag('tt', array(), '[mysqld]'), | phutil_tag('tt', array(), '[mysqld]'), | ||||
phutil_tag('tt', array(), '1600M'), | phutil_tag('tt', array(), '1600M'), | ||||
phutil_tag('tt', array(), 'mysqld'), | phutil_tag('tt', array(), 'mysqld'), | ||||
phutil_tag('pre', array(), 'innodb_buffer_pool_size=1600M')); | phutil_tag('pre', array(), 'innodb_buffer_pool_size=1600M')); | ||||
$this->newIssue('mysql.innodb_buffer_pool_size') | $this->newIssue('mysql.innodb_buffer_pool_size') | ||||
->setName(pht('MySQL May Run Slowly')) | ->setName(pht('MySQL May Run Slowly')) | ||||
▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0