BUG UPGRADE MORE THAN 160 WS.

When you try to upgrade more than 160 ws in a single PM instalation a TO MANY CONNECTIONS ERROR happens, and this stop the ws upgrade.

When you make the upgrade of many ws, each ws opens a new connection to the DB, and this is closed only at the end of all ws upgrade, so this cause the TO MANY CONNECTIONS error.

To solve the problem I kill the connection to the DB at the end of each ws upgrade.
This commit is contained in:
jennylee
2014-07-31 17:00:31 -04:00
parent 22d1dbff19
commit ac5f0925d0

View File

@@ -525,18 +525,29 @@ class workspaceTools
$oCriteria->add(ConfigurationPeer::OBJ_UID, array("todo", "draft", "sent", "unassigned", "paused", "cancelled"), Criteria::NOT_IN);
ConfigurationPeer::doDelete($oCriteria);
// end of reset
//close connection
$connection = Propel::getConnection( 'workflow' );
$sql = "SELECT * FROM information_schema.processlist WHERE user = SUBSTRING_INDEX(USER(),'@',1) and db = DATABASE() ORDER BY id;";
$stmt = $connection->createStatement();
$rs = $stmt->executeQuery( $sql, ResultSet::FETCHMODE_ASSOC );
while ($rs->next()) {
$row = $rs->getRow();
$oStatement = $connection->prepareStatement( "kill ". $row['ID'] );
$oStatement->executeQuery();
//close connection
$connection = Propel::getConnection( 'workflow' );
$sql_sleep = "SELECT * FROM information_schema.processlist WHERE command = 'Sleep' and user = SUBSTRING_INDEX(USER(),'@',1) and db = DATABASE() ORDER BY id;";
$stmt_sleep = $connection->createStatement();
$rs_sleep = $stmt_sleep->executeQuery( $sql_sleep, ResultSet::FETCHMODE_ASSOC );
while ($rs_sleep->next()) {
$row_sleep = $rs_sleep->getRow();
$oStatement_sleep = $connection->prepareStatement( "kill ". $row_sleep['ID'] );
$oStatement_sleep->executeQuery();
}
$sql_query = "SELECT * FROM information_schema.processlist WHERE user = SUBSTRING_INDEX(USER(),'@',1) and db = DATABASE() ORDER BY id;";
$stmt_query = $connection->createStatement();
$rs_query = $stmt_query->executeQuery( $sql_query, ResultSet::FETCHMODE_ASSOC );
while ($rs_query->next()) {
$row_query = $rs_query->getRow();
$oStatement_query = $connection->prepareStatement( "kill ". $row_query['ID'] );
$oStatement_query->executeQuery();
}
}
/**