mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 21:10:56 +01:00
Remove unused *ParallelQueries() database connection methods
Summary: `executeParallelQueries()` is never called as `supportsParallelQueries()` returns `false` both in `AphrontDatabaseConnection` and `AphrontMySQLDatabaseConnection`. Thus remove this unused code which was intentionally meant for HHVM which does not support PHP>=7 anyway. P.S. Dear Facebook, if you are using this, let us know. We don't want to hurt your legacy Phabricator installation. Closes T15919 Test Plan: Grep for both functions. Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15919 Differential Revision: https://we.phorge.it/D25789
This commit is contained in:
parent
aa2b70708e
commit
30c47690ff
3 changed files with 0 additions and 89 deletions
|
@ -63,10 +63,6 @@ abstract class AphrontDatabaseConnection
|
|||
return false;
|
||||
}
|
||||
|
||||
public function supportsParallelQueries() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function setReadOnly($read_only) {
|
||||
$this->readOnly = $read_only;
|
||||
return $this;
|
||||
|
|
|
@ -145,79 +145,6 @@ final class AphrontMySQLDatabaseConnection
|
|||
mysql_free_result($result);
|
||||
}
|
||||
|
||||
public function supportsParallelQueries() {
|
||||
// fb_parallel_query() doesn't support results with different columns.
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @phutil-external-symbol function fb_parallel_query
|
||||
*/
|
||||
public function executeParallelQueries(
|
||||
array $queries,
|
||||
array $conns = array()) {
|
||||
assert_instances_of($conns, __CLASS__);
|
||||
|
||||
$map = array();
|
||||
$is_write = false;
|
||||
foreach ($queries as $id => $query) {
|
||||
$is_write = $is_write || $this->checkWrite($query);
|
||||
$conn = idx($conns, $id, $this);
|
||||
|
||||
$host = $conn->getConfiguration('host');
|
||||
$port = 0;
|
||||
$match = null;
|
||||
if (preg_match('/(.+):(.+)/', $host, $match)) {
|
||||
list(, $host, $port) = $match;
|
||||
}
|
||||
|
||||
$pass = $conn->getConfiguration('pass');
|
||||
if ($pass instanceof PhutilOpaqueEnvelope) {
|
||||
$pass = $pass->openEnvelope();
|
||||
}
|
||||
|
||||
$map[$id] = array(
|
||||
'sql' => $query,
|
||||
'ip' => $host,
|
||||
'port' => $port,
|
||||
'username' => $conn->getConfiguration('user'),
|
||||
'password' => $pass,
|
||||
'db' => $conn->getConfiguration('database'),
|
||||
);
|
||||
}
|
||||
|
||||
$profiler = PhutilServiceProfiler::getInstance();
|
||||
$call_id = $profiler->beginServiceCall(
|
||||
array(
|
||||
'type' => 'multi-query',
|
||||
'queries' => $queries,
|
||||
'write' => $is_write,
|
||||
));
|
||||
|
||||
$map = fb_parallel_query($map);
|
||||
|
||||
$profiler->endServiceCall($call_id, array());
|
||||
|
||||
$results = array();
|
||||
$pos = 0;
|
||||
$err_pos = 0;
|
||||
foreach ($queries as $id => $query) {
|
||||
$errno = idx(idx($map, 'errno', array()), $err_pos);
|
||||
$err_pos++;
|
||||
if ($errno) {
|
||||
try {
|
||||
$this->throwQueryCodeException($errno, $map['error'][$id]);
|
||||
} catch (Exception $ex) {
|
||||
$results[$id] = $ex;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$results[$id] = $map['result'][$pos];
|
||||
$pos++;
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
protected function fetchAssoc($result) {
|
||||
return mysql_fetch_assoc($result);
|
||||
}
|
||||
|
|
|
@ -56,18 +56,6 @@ final class QueryFuture extends Future {
|
|||
}
|
||||
|
||||
if (!$this->conn->supportsAsyncQueries()) {
|
||||
if ($this->conn->supportsParallelQueries()) {
|
||||
$queries = array();
|
||||
$conns = array();
|
||||
foreach (self::$futures as $id => $future) {
|
||||
$queries[$id] = $future->query;
|
||||
$conns[$id] = $future->conn;
|
||||
}
|
||||
$results = $this->conn->executeParallelQueries($queries, $conns);
|
||||
$this->processResults($results);
|
||||
return true;
|
||||
}
|
||||
|
||||
$conns = array();
|
||||
$conn_queries = array();
|
||||
foreach (self::$futures as $id => $future) {
|
||||
|
|
Loading…
Reference in a new issue