Skip to content

Commit

Permalink
Work around OS X webscalesql issue
Browse files Browse the repository at this point in the history
Summary: This is fairly ugly, and can hopefully get fixed in
webscalesql, but until then makes mysql and mysqli work on OS X.
Upstream bug discussion at
facebookarchive/webscalesql-5.6#23

Reviewed By: @paulbiss

Differential Revision: D2390712
  • Loading branch information
jwatzman committed Aug 28, 2015
1 parent ba5f30e commit 9752537
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion hphp/runtime/ext/mysql/mysql_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@ static MySQLStaticInitializer s_mysql_initializer;
int MySQLUtil::set_mysql_timeout(MYSQL *mysql,
MySQLUtil::TimeoutType type,
int ms) {
mysql_option opt = MYSQL_OPT_CONNECT_TIMEOUT;
#ifdef __APPLE__
// Work around a bug in webscalesql where setting a read or write timeout
// causes most mysql connections to fail (depending on the exact timing of
// packets). See https://github.com/webscalesql/webscalesql-5.6/issues/23
return 0;
#endif

mysql_option opt = MYSQL_OPT_CONNECT_TIMEOUT;
#ifdef MYSQL_MILLISECOND_TIMEOUT
switch (type) {
case MySQLUtil::ConnectTimeout: opt = MYSQL_OPT_CONNECT_TIMEOUT_MS; break;
Expand Down

0 comments on commit 9752537

Please sign in to comment.