Reverting the memory leak patch for MySQL. Problems have been reported with the grid server after running for several hours

This commit is contained in:
John Hurliman
2009-11-02 11:19:55 -08:00
parent f4e9809b7d
commit 6309fcc5b4
15 changed files with 932 additions and 893 deletions

View File

@@ -134,16 +134,18 @@ namespace OpenSim.Data.MySQL
/// </summary>
protected void GetWaitTimeout()
{
using (MySqlCommand cmd = new MySqlCommand(m_waitTimeoutSelect, dbcon))
MySqlCommand cmd = new MySqlCommand(m_waitTimeoutSelect, dbcon);
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
if (dbReader.Read())
{
if (dbReader.Read())
{
m_waitTimeout
= Convert.ToInt32(dbReader["@@wait_timeout"]) * TimeSpan.TicksPerSecond + m_waitTimeoutLeeway;
}
m_waitTimeout
= Convert.ToInt32(dbReader["@@wait_timeout"]) * TimeSpan.TicksPerSecond + m_waitTimeoutLeeway;
}
dbReader.Close();
cmd.Dispose();
}
m_lastConnectionUse = DateTime.Now.Ticks;
@@ -301,31 +303,31 @@ namespace OpenSim.Data.MySQL
{
CheckConnection();
using (MySqlCommand tablesCmd = new MySqlCommand(
"SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=?dbname",
dbcon))
{
tablesCmd.Parameters.AddWithValue("?dbname", dbcon.Database);
MySqlCommand tablesCmd =
new MySqlCommand(
"SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=?dbname",
dbcon);
tablesCmd.Parameters.AddWithValue("?dbname", dbcon.Database);
using (MySqlDataReader tables = tablesCmd.ExecuteReader())
using (MySqlDataReader tables = tablesCmd.ExecuteReader())
{
while (tables.Read())
{
while (tables.Read())
try
{
try
string tableName = (string) tables["TABLE_NAME"];
string comment = (string) tables["TABLE_COMMENT"];
if (tableList.ContainsKey(tableName))
{
string tableName = (string)tables["TABLE_NAME"];
string comment = (string)tables["TABLE_COMMENT"];
if (tableList.ContainsKey(tableName))
{
tableList[tableName] = comment;
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
tableList[tableName] = comment;
}
}
catch (Exception e)
{
m_log.Error(e.ToString());
}
}
tables.Close();
}
}
}
@@ -344,19 +346,19 @@ namespace OpenSim.Data.MySQL
{
CheckConnection(); // Not sure if this one is necessary
MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand();
MySqlCommand dbcommand = (MySqlCommand) dbcon.CreateCommand();
dbcommand.CommandText = sql;
foreach (KeyValuePair<string, object> param in parameters)
{
dbcommand.Parameters.AddWithValue(param.Key, param.Value);
}
return (IDbCommand)dbcommand;
return (IDbCommand) dbcommand;
}
catch (Exception e)
{
// Return null if it fails.
m_log.Error("Failed during Query generation: " + e.Message, e);
m_log.Error("Failed during Query generation: " + e.ToString());
return null;
}
}
@@ -692,6 +694,8 @@ namespace OpenSim.Data.MySQL
ret.Add(attachpoint, item);
}
r.Close();
return ret;
}