Merge branch 'master' into bullet-2.82

bullet-2.82
Robert Adams 2014-08-26 06:47:50 -07:00
commit b3e423303f
7 changed files with 634 additions and 710 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;
}

View File

@ -45,21 +45,13 @@ namespace OpenSim.Data.MySQL
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
protected string m_connectionString;
protected object m_dbLock = new object();
protected MySqlFramework(string connectionString)
{
m_connectionString = connectionString;
}
//////////////////////////////////////////////////////////////
//
// All non queries are funneled through one connection
// to increase performance a little
//
protected int ExecuteNonQuery(MySqlCommand cmd)
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
@ -78,5 +70,4 @@ namespace OpenSim.Data.MySQL
}
}
}
}
}

View File

@ -51,6 +51,15 @@ namespace OpenSim.Data.MySQL
private static string LogHeader = "[REGION DB MYSQL]";
private string m_connectionString;
/// <summary>
/// This lock was being used to serialize database operations when the connection was shared, but this has
/// been unnecessary for a long time after we switched to using MySQL's underlying connection pooling instead.
/// FIXME: However, the locks remain in many places since they are effectively providing a level of
/// transactionality. This should be replaced by more efficient database transactions which would not require
/// unrelated operations to block each other or unrelated operations on the same tables from blocking each
/// other.
/// </summary>
private object m_dbLock = new object();
protected virtual Assembly Assembly
@ -738,8 +747,6 @@ namespace OpenSim.Data.MySQL
RegionLightShareData nWP = new RegionLightShareData();
nWP.OnSave += StoreRegionWindlightSettings;
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
@ -829,7 +836,6 @@ namespace OpenSim.Data.MySQL
}
}
}
}
return nWP;
}
@ -875,8 +881,6 @@ namespace OpenSim.Data.MySQL
}
public void StoreRegionWindlightSettings(RegionLightShareData wl)
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
@ -978,11 +982,8 @@ namespace OpenSim.Data.MySQL
}
}
}
}
public void RemoveRegionWindlightSettings(UUID regionID)
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
@ -996,12 +997,9 @@ namespace OpenSim.Data.MySQL
}
}
}
}
#region RegionEnvironmentSettings
public string LoadRegionEnvironmentSettings(UUID regionUUID)
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
@ -1027,11 +1025,8 @@ namespace OpenSim.Data.MySQL
}
}
}
}
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
@ -1048,11 +1043,8 @@ namespace OpenSim.Data.MySQL
}
}
}
}
public void RemoveRegionEnvironmentSettings(UUID regionUUID)
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
@ -1066,12 +1058,9 @@ namespace OpenSim.Data.MySQL
}
}
}
}
#endregion
public void StoreRegionSettings(RegionSettings rs)
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
@ -1121,7 +1110,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd);
}
}
}
SaveSpawnPoints(rs);
}
@ -2042,8 +2031,6 @@ namespace OpenSim.Data.MySQL
}
public void SaveExtra(UUID regionID, string name, string val)
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
@ -2060,11 +2047,8 @@ namespace OpenSim.Data.MySQL
}
}
}
}
public void RemoveExtra(UUID regionID, string name)
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
@ -2080,14 +2064,11 @@ namespace OpenSim.Data.MySQL
}
}
}
}
public Dictionary<string, string> GetExtra(UUID regionID)
{
Dictionary<string, string> ret = new Dictionary<string, string>();
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
@ -2105,7 +2086,6 @@ namespace OpenSim.Data.MySQL
}
}
}
}
return ret;
}

View File

@ -47,11 +47,6 @@ namespace OpenSim.Data.MySQL
get; set;
}
protected object Lock
{
get; set;
}
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
@ -1026,8 +1021,6 @@ namespace OpenSim.Data.MySQL
put.Parameters.AddWithValue("?DataKey", props.DataKey.ToString());
put.Parameters.AddWithValue("?DataVal", props.DataVal.ToString());
lock(Lock)
{
put.ExecuteNonQuery();
}
}
@ -1035,7 +1028,6 @@ namespace OpenSim.Data.MySQL
}
}
}
}
catch (Exception e)
{
m_log.DebugFormat("[PROFILES_DATA]" +
@ -1065,17 +1057,14 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
{
cmd.Parameters.AddWithValue("?UserId", props.UserId.ToString());
cmd.Parameters.AddWithValue("?TagId", props.TagId.ToString ());
cmd.Parameters.AddWithValue("?DataKey", props.DataKey.ToString ());
cmd.Parameters.AddWithValue("?DataVal", props.DataKey.ToString ());
cmd.Parameters.AddWithValue("?TagId", props.TagId.ToString());
cmd.Parameters.AddWithValue("?DataKey", props.DataKey.ToString());
cmd.Parameters.AddWithValue("?DataVal", props.DataKey.ToString());
lock(Lock)
{
cmd.ExecuteNonQuery();
}
}
}
}
catch (Exception e)
{
m_log.DebugFormat("[PROFILES_DATA]" +
@ -1087,4 +1076,3 @@ namespace OpenSim.Data.MySQL
#endregion Integration
}
}

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();
@ -168,12 +166,12 @@ namespace OpenSim.Data.MySQL
{
MemoryStream outputStream = new MemoryStream();
WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue);
// int compressedLength = asset.Data.Length;
// int compressedLength = asset.Data.Length;
asset.Data = outputStream.ToArray();
// m_log.DebugFormat(
// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
// asset.ID, asset.Name, asset.Data.Length, compressedLength);
// m_log.DebugFormat(
// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
// asset.ID, asset.Name, asset.Data.Length, compressedLength);
}
}
@ -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();
@ -233,7 +228,7 @@ namespace OpenSim.Data.MySQL
using (GZipStream compressionStream = new GZipStream(outputStream, CompressionMode.Compress, false))
{
// Console.WriteLine(WebUtil.CopyTo(new MemoryStream(asset.Data), compressionStream, int.MaxValue));
// Console.WriteLine(WebUtil.CopyTo(new MemoryStream(asset.Data), compressionStream, int.MaxValue));
// We have to close the compression stream in order to make sure it writes everything out to the underlying memory output stream.
compressionStream.Close();
byte[] compressedData = outputStream.ToArray();
@ -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;
}

View File

@ -367,10 +367,10 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset
AllowRemoteSetLoginLevel = "false"
; For V2 map
MapTileURL = "http://127.0.0.1:8002";
MapTileURL = "http://127.0.0.1:8002/";
; Url to search service
; SearchURL = "http://127.0.0.1:8002";
; SearchURL = "http://127.0.0.1:8002/";
; For V2/3 Web Profiles
; Work in progress: The ProfileServerURL/OpenIDServerURL are

View File

@ -326,10 +326,10 @@ MapGetServiceConnector = "8002/OpenSim.Server.Handlers.dll:MapGetServiceConnecto
AllowRemoteSetLoginLevel = "false"
; For V2 map
MapTileURL = "http://127.0.0.1:8002";
MapTileURL = "http://127.0.0.1:8002/";
; Url to search service
; SearchURL = "http://127.0.0.1:8002";
; SearchURL = "http://127.0.0.1:8002/";
; For V2/3 Web Profiles
; Work in progress: The ProfileServerURL/OpenIDServerURL are