From 1d95f0521d098f514e4331a2c43c5c212df879be Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Tue, 5 Feb 2008 12:18:50 +0000 Subject: Reverted MySQLDataStore.cs to not use static mutexes any more, patch didn't work anyway. Added js to OpenSim.ini.example. --- OpenSim/Framework/Data.MySQL/MySQLDataStore.cs | 61 +++++++++------------- .../ScriptEngine/DotNetEngine/ScriptManager.cs | 1 - 2 files changed, 24 insertions(+), 38 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs index b25924c..54f39bb 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs @@ -50,7 +50,6 @@ namespace OpenSim.Framework.Data.MySQL private const string m_landAccessListSelect = "select * from landaccesslist"; private DataSet m_dataSet; - private static object DBAccessLock = new object(); // Trying to use a static object because there might be other regions that keep modifying table private MySqlDataAdapter m_primDataAdapter; private MySqlDataAdapter m_shapeDataAdapter; private MySqlDataAdapter m_itemsDataAdapter; @@ -104,7 +103,7 @@ namespace OpenSim.Framework.Data.MySQL TestTables(m_connection); - lock (DBAccessLock) + lock (m_dataSet) { m_primTable = createPrimTable(); m_dataSet.Tables.Add(m_primTable); @@ -143,7 +142,7 @@ namespace OpenSim.Framework.Data.MySQL public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) { - lock (DBAccessLock) + lock (m_dataSet) { foreach (SceneObjectPart prim in obj.Children.Values) { @@ -170,7 +169,7 @@ namespace OpenSim.Framework.Data.MySQL DataTable shapes = m_shapeTable; string selectExp = "SceneGroupID = '" + Util.ToRawUuidString(obj) + "'"; - lock (DBAccessLock) + lock (m_dataSet) { DataRow[] primRows = prims.Select(selectExp); foreach (DataRow row in primRows) @@ -226,7 +225,7 @@ namespace OpenSim.Framework.Data.MySQL string byRegion = "RegionUUID = '" + Util.ToRawUuidString(regionUUID) + "'"; string orderByParent = "ParentID ASC"; - lock (DBAccessLock) + lock (m_dataSet) { DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); MainLog.Instance.Verbose("DATASTORE", @@ -336,7 +335,7 @@ namespace OpenSim.Framework.Data.MySQL MainLog.Instance.Verbose("DATASTORE", "Storing terrain revision r" + revision.ToString()); DataTable terrain = m_dataSet.Tables["terrain"]; - lock (DBAccessLock) + lock (m_dataSet) { MySqlCommand cmd = new MySqlCommand("insert into terrain(RegionUUID, Revision, Heightfield)" + " values(?RegionUUID, ?Revision, ?Heightfield)", m_connection); @@ -397,7 +396,7 @@ namespace OpenSim.Framework.Data.MySQL public void RemoveLandObject(LLUUID globalID) { - lock (DBAccessLock) + lock (m_dataSet) { using (MySqlCommand cmd = new MySqlCommand("delete from land where UUID=?UUID", m_connection)) { @@ -422,7 +421,7 @@ namespace OpenSim.Framework.Data.MySQL MainLog.Instance.Verbose("DATASTORE", "Tedds temp fix: Waiting 3 seconds for stuff to catch up. (Someone please fix! :))"); System.Threading.Thread.Sleep(2500 + rnd.Next(300, 900)); - lock (DBAccessLock) + lock (m_dataSet) { DataTable land = m_landTable; DataTable landaccesslist = m_landAccessListTable; @@ -454,14 +453,14 @@ namespace OpenSim.Framework.Data.MySQL landaccesslist.Rows.Add(newAccessRow); } - Commit_NoLock(); } + Commit(); } public List LoadLandObjects(LLUUID regionUUID) { List landDataForRegion = new List(); - lock (DBAccessLock) + lock (m_dataSet) { DataTable land = m_landTable; DataTable landaccesslist = m_landAccessListTable; @@ -523,39 +522,27 @@ namespace OpenSim.Framework.Data.MySQL m_connection.Open(); } - lock (DBAccessLock) + lock (m_dataSet) { - // Moved code to own sub that can be called directly by "StoreLandObject". - // Problem is that: - // - StoreLandObject locks - // - Some other function waits for lock - // - StoreLandObject releases lock - // - Other function obtains lock - // - StoreLandObject calls Commit that tries to take lock back - // - When StoreLandObject's Commit finally gets lock the table has been changed and we crash - Commit_NoLock(); - } - } + // DisplayDataSet(m_dataSet, "Region DataSet"); - private void Commit_NoLock() - { - // DisplayDataSet(m_dataSet, "Region DataSet"); + m_primDataAdapter.Update(m_primTable); + m_shapeDataAdapter.Update(m_shapeTable); - m_primDataAdapter.Update(m_primTable); - m_shapeDataAdapter.Update(m_shapeTable); - - if (persistPrimInventories) - { - m_itemsDataAdapter.Update(m_itemsTable); - } + if (persistPrimInventories) + { + m_itemsDataAdapter.Update(m_itemsTable); + } - m_terrainDataAdapter.Update(m_terrainTable); - m_landDataAdapter.Update(m_landTable); - m_landAccessListDataAdapter.Update(m_landAccessListTable); + m_terrainDataAdapter.Update(m_terrainTable); + m_landDataAdapter.Update(m_landTable); + m_landAccessListDataAdapter.Update(m_landAccessListTable); - m_dataSet.AcceptChanges(); + m_dataSet.AcceptChanges(); + } } + public void Shutdown() { Commit(); @@ -1231,7 +1218,7 @@ namespace OpenSim.Framework.Data.MySQL // For now, we're just going to crudely remove all the previous inventory items // no matter whether they have changed or not, and replace them with the current set. - lock (DBAccessLock) + lock (m_dataSet) { RemoveItems(primID); diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 4e20d95..61da6ef 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs @@ -41,7 +41,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine : base(scriptEngine) { base.m_scriptEngine = scriptEngine; - } private Compiler.LSL.Compiler LSLCompiler; -- cgit v1.1