Remove database connection locking in MySQLXAssetData. This is unnecessary as connections aren't shared and transactions are already in place where necessary.

0.8-extended
Justin Clark-Casey (justincc) 2014-08-22 20:34:33 +01:00 committed by Justin Clark-Casey
parent 3d49be21bc
commit a068c1dd9d
1 changed files with 170 additions and 188 deletions

View File

@ -57,7 +57,6 @@ namespace OpenSim.Data.MySQL
private bool m_enableCompression = false;
private string m_connectionString;
private object m_dbLock = new object();
/// <summary>
/// We can reuse this for all hashing since all methods are single-threaded through m_dbBLock
@ -131,8 +130,7 @@ namespace OpenSim.Data.MySQL
// m_log.DebugFormat("[MYSQL XASSET DATA]: Looking for asset {0}", assetID);
AssetBase asset = null;
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
@ -187,7 +185,6 @@ namespace OpenSim.Data.MySQL
}
}
}
}
return asset;
}
@ -201,8 +198,6 @@ namespace OpenSim.Data.MySQL
{
// m_log.DebugFormat("[XASSETS DB]: Storing asset {0} {1}", asset.Name, asset.ID);
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
@ -310,7 +305,6 @@ namespace OpenSim.Data.MySQL
}
}
}
}
/// <summary>
/// Updates the access time of the asset if it was accessed above a given threshhold amount of time.
@ -328,8 +322,6 @@ namespace OpenSim.Data.MySQL
if ((now - Utils.UnixTimeToDateTime(accessTime)).TotalDays < DaysBetweenAccessTimeUpdates)
return;
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
@ -354,7 +346,6 @@ namespace OpenSim.Data.MySQL
}
}
}
}
/// <summary>
/// We assume we already have the m_dbLock.
@ -411,8 +402,6 @@ namespace OpenSim.Data.MySQL
string ids = "'" + string.Join("','", uuids) + "'";
string sql = string.Format("SELECT ID FROM assets WHERE ID IN ({0})", ids);
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
@ -428,7 +417,6 @@ namespace OpenSim.Data.MySQL
}
}
}
}
bool[] results = new bool[uuids.Length];
for (int i = 0; i < uuids.Length; i++)
@ -449,8 +437,6 @@ namespace OpenSim.Data.MySQL
{
List<AssetMetadata> retList = new List<AssetMetadata>(count);
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
@ -487,7 +473,6 @@ namespace OpenSim.Data.MySQL
m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
}
}
}
return retList;
}
@ -496,8 +481,6 @@ namespace OpenSim.Data.MySQL
{
// m_log.DebugFormat("[XASSETS DB]: Deleting asset {0}", id);
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
@ -511,7 +494,6 @@ namespace OpenSim.Data.MySQL
// TODO: How do we deal with data from deleted assets? Probably not easily reapable unless we
// keep a reference count (?)
}
}
return true;
}