Removing locking on requests in MySQLAssetData.

These locks are not necessary since the connection is taken from the underlying mysql pool and not shared.
Such locking is already not done by some other parts of OpenSim.Data.MySQL.
Pointed out by arribasim-dev
0.8-extended
Justin Clark-Casey (justincc) 2014-08-22 19:46:46 +01:00 committed by Justin Clark-Casey
parent 30e04ee79c
commit 2e1e076629
1 changed files with 144 additions and 161 deletions

View File

@ -45,7 +45,6 @@ namespace OpenSim.Data.MySQL
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_connectionString;
private object m_dbLock = new object();
protected virtual Assembly Assembly
{
@ -107,8 +106,7 @@ namespace OpenSim.Data.MySQL
override public AssetBase GetAsset(UUID assetID)
{
AssetBase asset = null;
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
@ -147,7 +145,7 @@ namespace OpenSim.Data.MySQL
}
}
}
}
return asset;
}
@ -157,8 +155,6 @@ namespace OpenSim.Data.MySQL
/// <param name="asset">Asset UUID to create</param>
/// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
override public void StoreAsset(AssetBase asset)
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
@ -219,11 +215,8 @@ namespace OpenSim.Data.MySQL
}
}
}
}
private void UpdateAccessTime(AssetBase asset)
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
@ -254,7 +247,6 @@ namespace OpenSim.Data.MySQL
}
}
}
}
/// <summary>
/// Check if the assets exist in the database.
@ -271,8 +263,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();
@ -288,7 +278,6 @@ namespace OpenSim.Data.MySQL
}
}
}
}
bool[] results = new bool[uuids.Length];
for (int i = 0; i < uuids.Length; i++)
@ -309,8 +298,6 @@ namespace OpenSim.Data.MySQL
{
List<AssetMetadata> retList = new List<AssetMetadata>(count);
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
@ -355,14 +342,11 @@ namespace OpenSim.Data.MySQL
}
}
}
}
return retList;
}
public override bool Delete(string id)
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
@ -374,7 +358,6 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
}
}
return true;
}