aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/EntityBase.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs37
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs47
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs85
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs5
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs2
13 files changed, 166 insertions, 66 deletions
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
index 241cac0..916148b 100644
--- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
+++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
@@ -111,11 +111,11 @@ namespace OpenSim.Region.Framework.Scenes
111 111
112 private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e) 112 private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e)
113 { 113 {
114 m_log.Debug("[SCENE]: Starting send to inventory loop"); 114 m_log.Debug("[ASYNC DELETER]: Starting send to inventory loop");
115 115
116 while (InventoryDeQueueAndDelete()) 116 while (InventoryDeQueueAndDelete())
117 { 117 {
118 //m_log.Debug("[SCENE]: Sent item successfully to inventory, continuing..."); 118 //m_log.Debug("[ASYNC DELETER]: Sent item successfully to inventory, continuing...");
119 } 119 }
120 } 120 }
121 121
@@ -137,7 +137,7 @@ namespace OpenSim.Region.Framework.Scenes
137 x = m_inventoryDeletes.Dequeue(); 137 x = m_inventoryDeletes.Dequeue();
138 138
139 m_log.DebugFormat( 139 m_log.DebugFormat(
140 "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left); 140 "[ASYNC DELETER]: Sending object to user's inventory, {0} item(s) remaining.", left);
141 141
142 try 142 try
143 { 143 {
@@ -152,7 +152,8 @@ namespace OpenSim.Region.Framework.Scenes
152 } 152 }
153 catch (Exception e) 153 catch (Exception e)
154 { 154 {
155 m_log.DebugFormat("Exception background sending object: " + e); 155 m_log.ErrorFormat(
156 "[ASYNC DELETER]: Exception background sending object: {0}{1}", e.Message, e.StackTrace);
156 } 157 }
157 158
158 return true; 159 return true;
@@ -164,12 +165,16 @@ namespace OpenSim.Region.Framework.Scenes
164 // We can't put the object group details in here since the root part may have disappeared (which is where these sit). 165 // We can't put the object group details in here since the root part may have disappeared (which is where these sit).
165 // FIXME: This needs to be fixed. 166 // FIXME: This needs to be fixed.
166 m_log.ErrorFormat( 167 m_log.ErrorFormat(
167 "[SCENE]: Queued sending of scene object to agent {0} {1} failed: {2}", 168 "[ASYNC DELETER]: Queued sending of scene object to agent {0} {1} failed: {2} {3}",
168 (x != null ? x.remoteClient.Name : "unavailable"), (x != null ? x.remoteClient.AgentId.ToString() : "unavailable"), e.ToString()); 169 (x != null ? x.remoteClient.Name : "unavailable"),
170 (x != null ? x.remoteClient.AgentId.ToString() : "unavailable"),
171 e.Message,
172 e.StackTrace);
169 } 173 }
170 174
171 m_log.Debug("[SCENE]: No objects left in inventory send queue."); 175 m_log.Debug("[ASYNC DELETER]: No objects left in inventory send queue.");
176
172 return false; 177 return false;
173 } 178 }
174 } 179 }
175} 180} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/EntityBase.cs b/OpenSim/Region/Framework/Scenes/EntityBase.cs
index e183f9d..6fd38e5 100644
--- a/OpenSim/Region/Framework/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Framework/Scenes/EntityBase.cs
@@ -69,6 +69,7 @@ namespace OpenSim.Region.Framework.Scenes
69 public bool IsDeleted 69 public bool IsDeleted
70 { 70 {
71 get { return m_isDeleted; } 71 get { return m_isDeleted; }
72 set { m_isDeleted = value; }
72 } 73 }
73 protected bool m_isDeleted; 74 protected bool m_isDeleted;
74 75
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 7bcc4db..c434e4f 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -684,7 +684,7 @@ namespace OpenSim.Region.Framework.Scenes
684 } 684 }
685 } 685 }
686 686
687 public void TriggerOnBackup(IRegionDataStore dstore) 687 public void TriggerOnBackup(IRegionDataStore dstore, bool forced)
688 { 688 {
689 OnBackupDelegate handlerOnAttach = OnBackup; 689 OnBackupDelegate handlerOnAttach = OnBackup;
690 if (handlerOnAttach != null) 690 if (handlerOnAttach != null)
@@ -693,7 +693,7 @@ namespace OpenSim.Region.Framework.Scenes
693 { 693 {
694 try 694 try
695 { 695 {
696 d(dstore, false); 696 d(dstore, forced);
697 } 697 }
698 catch (Exception e) 698 catch (Exception e)
699 { 699 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 4e871d9..c49386a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1720,7 +1720,7 @@ namespace OpenSim.Region.Framework.Scenes
1720 public virtual void DeRezObject(IClientAPI remoteClient, uint localID, 1720 public virtual void DeRezObject(IClientAPI remoteClient, uint localID,
1721 UUID groupID, DeRezAction action, UUID destinationID) 1721 UUID groupID, DeRezAction action, UUID destinationID)
1722 { 1722 {
1723 DeRezObjects(remoteClient, new List<uint>() { localID} , groupID, action, destinationID); 1723 DeRezObjects(remoteClient, new List<uint>() { localID }, groupID, action, destinationID);
1724 } 1724 }
1725 1725
1726 public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs, 1726 public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs,
@@ -1757,11 +1757,6 @@ namespace OpenSim.Region.Framework.Scenes
1757 deleteIDs.Add(localID); 1757 deleteIDs.Add(localID);
1758 deleteGroups.Add(grp); 1758 deleteGroups.Add(grp);
1759 1759
1760 // Force a database backup/update on this SceneObjectGroup
1761 // So that we know the database is upto date,
1762 // for when deleting the object from it
1763 ForceSceneObjectBackup(grp);
1764
1765 if (remoteClient == null) 1760 if (remoteClient == null)
1766 { 1761 {
1767 // Autoreturn has a null client. Nothing else does. So 1762 // Autoreturn has a null client. Nothing else does. So
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 49f29ad..82e7d76 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1528,18 +1528,22 @@ namespace OpenSim.Region.Framework.Scenes
1528 /// </summary> 1528 /// </summary>
1529 private void BackupWaitCallback(object o) 1529 private void BackupWaitCallback(object o)
1530 { 1530 {
1531 Backup(); 1531 Backup(false);
1532 } 1532 }
1533 1533
1534 /// <summary> 1534 /// <summary>
1535 /// Backup the scene. This acts as the main method of the backup thread. 1535 /// Backup the scene. This acts as the main method of the backup thread.
1536 /// </summary> 1536 /// </summary>
1537 /// <param name="forced">
1538 /// If true, then any changes that have not yet been persisted are persisted. If false,
1539 /// then the persistence decision is left to the backup code (in some situations, such as object persistence,
1540 /// it's much more efficient to backup multiple changes at once rather than every single one).
1537 /// <returns></returns> 1541 /// <returns></returns>
1538 public void Backup() 1542 public void Backup(bool forced)
1539 { 1543 {
1540 lock (m_returns) 1544 lock (m_returns)
1541 { 1545 {
1542 EventManager.TriggerOnBackup(m_storageManager.DataStore); 1546 EventManager.TriggerOnBackup(m_storageManager.DataStore, forced);
1543 m_backingup = false; 1547 m_backingup = false;
1544 1548
1545 foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns) 1549 foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns)
@@ -2088,7 +2092,7 @@ namespace OpenSim.Region.Framework.Scenes
2088// rootPart.PhysActor = null; 2092// rootPart.PhysActor = null;
2089// } 2093// }
2090 2094
2091 if (UnlinkSceneObject(group.UUID, false)) 2095 if (UnlinkSceneObject(group, false))
2092 { 2096 {
2093 EventManager.TriggerObjectBeingRemovedFromScene(group); 2097 EventManager.TriggerObjectBeingRemovedFromScene(group);
2094 EventManager.TriggerParcelPrimCountTainted(); 2098 EventManager.TriggerParcelPrimCountTainted();
@@ -2103,18 +2107,25 @@ namespace OpenSim.Region.Framework.Scenes
2103 /// Unlink the given object from the scene. Unlike delete, this just removes the record of the object - the 2107 /// Unlink the given object from the scene. Unlike delete, this just removes the record of the object - the
2104 /// object itself is not destroyed. 2108 /// object itself is not destroyed.
2105 /// </summary> 2109 /// </summary>
2106 /// <param name="uuid">Id of object.</param> 2110 /// <param name="so">The scene object.</param>
2111 /// <param name="softDelete">If true, only deletes from scene, but keeps the object in the database.</param>
2107 /// <returns>true if the object was in the scene, false if it was not</returns> 2112 /// <returns>true if the object was in the scene, false if it was not</returns>
2108 /// <param name="softDelete">If true, only deletes from scene, but keeps object in database.</param> 2113 public bool UnlinkSceneObject(SceneObjectGroup so, bool softDelete)
2109 public bool UnlinkSceneObject(UUID uuid, bool softDelete)
2110 { 2114 {
2111 if (m_sceneGraph.DeleteSceneObject(uuid, softDelete)) 2115 if (m_sceneGraph.DeleteSceneObject(so.UUID, softDelete))
2112 { 2116 {
2113 if (!softDelete) 2117 if (!softDelete)
2114 { 2118 {
2115 m_storageManager.DataStore.RemoveObject(uuid, 2119 // Force a database update so that the scene object group ID is accurate. It's possible that the
2116 m_regInfo.RegionID); 2120 // group has recently been delinked from another group but that this change has not been persisted
2121 // to the DB.
2122 ForceSceneObjectBackup(so);
2123 so.DetachFromBackup();
2124 m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID);
2117 } 2125 }
2126
2127 // We need to keep track of this state in case this group is still queued for further backup.
2128 so.IsDeleted = true;
2118 2129
2119 return true; 2130 return true;
2120 } 2131 }
@@ -2145,7 +2156,7 @@ namespace OpenSim.Region.Framework.Scenes
2145 } 2156 }
2146 catch (Exception) 2157 catch (Exception)
2147 { 2158 {
2148 m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border."); 2159 m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border.");
2149 } 2160 }
2150 return; 2161 return;
2151 } 2162 }
@@ -2162,7 +2173,7 @@ namespace OpenSim.Region.Framework.Scenes
2162 } 2173 }
2163 catch (Exception) 2174 catch (Exception)
2164 { 2175 {
2165 m_log.Warn("[DATABASE]: exception when trying to return the prim that crossed the border."); 2176 m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border.");
2166 } 2177 }
2167 return; 2178 return;
2168 } 2179 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index 3b84734..86ba2aa 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -300,7 +300,7 @@ namespace OpenSim.Region.Framework.Scenes
300 300
301 public void BackupCurrentScene() 301 public void BackupCurrentScene()
302 { 302 {
303 ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); }); 303 ForEachCurrentScene(delegate(Scene scene) { scene.Backup(true); });
304 } 304 }
305 305
306 public bool TrySetCurrentScene(string regionName) 306 public bool TrySetCurrentScene(string regionName)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 64a6dd5..09e3e0e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1226,16 +1226,16 @@ namespace OpenSim.Region.Framework.Scenes
1226 } 1226 }
1227 1227
1228 /// <summary> 1228 /// <summary>
1229 /// Delete this group from its scene and tell all the scene presences about that deletion. 1229 /// Delete this group from its scene.
1230 /// </summary> 1230 /// </summary>
1231 /// <param name="silent">Broadcast deletions to all clients.</param> 1231 ///
1232 /// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood
1233 /// up and all avatars receive notification of its removal. Removal of the scene object from database backup
1234 /// must be handled by the caller.
1235 ///
1236 /// <param name="silent">If true then deletion is not broadcast to clients</param>
1232 public void DeleteGroup(bool silent) 1237 public void DeleteGroup(bool silent)
1233 { 1238 {
1234 // We need to keep track of this state in case this group is still queued for backup.
1235 m_isDeleted = true;
1236
1237 DetachFromBackup();
1238
1239 lock (m_parts) 1239 lock (m_parts)
1240 { 1240 {
1241 foreach (SceneObjectPart part in m_parts.Values) 1241 foreach (SceneObjectPart part in m_parts.Values)
@@ -1381,14 +1381,21 @@ namespace OpenSim.Region.Framework.Scenes
1381 public virtual void ProcessBackup(IRegionDataStore datastore, bool forcedBackup) 1381 public virtual void ProcessBackup(IRegionDataStore datastore, bool forcedBackup)
1382 { 1382 {
1383 if (!m_isBackedUp) 1383 if (!m_isBackedUp)
1384 {
1385// m_log.DebugFormat(
1386// "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID);
1384 return; 1387 return;
1385 1388 }
1386 // Since this is the top of the section of call stack for backing up a particular scene object, don't let
1387 // any exception propogate upwards.
1388 1389
1389 if (IsDeleted || UUID == UUID.Zero) 1390 if (IsDeleted || UUID == UUID.Zero)
1391 {
1392// m_log.DebugFormat(
1393// "[WATER WARS]: Ignoring backup of {0} {1} since object is marked as already deleted", Name, UUID);
1390 return; 1394 return;
1395 }
1391 1396
1397 // Since this is the top of the section of call stack for backing up a particular scene object, don't let
1398 // any exception propogate upwards.
1392 try 1399 try
1393 { 1400 {
1394 if (!m_scene.ShuttingDown) // if shutting down then there will be nothing to handle the return so leave till next restart 1401 if (!m_scene.ShuttingDown) // if shutting down then there will be nothing to handle the return so leave till next restart
@@ -1421,7 +1428,7 @@ namespace OpenSim.Region.Framework.Scenes
1421 if (HasGroupChanged) 1428 if (HasGroupChanged)
1422 { 1429 {
1423 // don't backup while it's selected or you're asking for changes mid stream. 1430 // don't backup while it's selected or you're asking for changes mid stream.
1424 if ((isTimeToPersist()) || (forcedBackup)) 1431 if (isTimeToPersist() || forcedBackup)
1425 { 1432 {
1426 m_log.DebugFormat( 1433 m_log.DebugFormat(
1427 "[SCENE]: Storing {0}, {1} in {2}", 1434 "[SCENE]: Storing {0}, {1} in {2}",
@@ -1444,19 +1451,19 @@ namespace OpenSim.Region.Framework.Scenes
1444 1451
1445 backup_group = null; 1452 backup_group = null;
1446 } 1453 }
1447 // else 1454// else
1448 // { 1455// {
1449 // m_log.DebugFormat( 1456// m_log.DebugFormat(
1450 // "[SCENE]: Did not update persistence of object {0} {1}, selected = {2}", 1457// "[SCENE]: Did not update persistence of object {0} {1}, selected = {2}",
1451 // Name, UUID, IsSelected); 1458// Name, UUID, IsSelected);
1452 // } 1459// }
1453 } 1460 }
1454 } 1461 }
1455 catch (Exception e) 1462 catch (Exception e)
1456 { 1463 {
1457 m_log.ErrorFormat( 1464 m_log.ErrorFormat(
1458 "[SCENE]: Storing of {0}, {1} in {2} failed with exception {3}\n\t{4}", 1465 "[SCENE]: Storing of {0}, {1} in {2} failed with exception {3}{4}",
1459 Name, UUID, m_scene.RegionInfo.RegionName, e, e.StackTrace); 1466 Name, UUID, m_scene.RegionInfo.RegionName, e.Message, e.StackTrace);
1460 } 1467 }
1461 } 1468 }
1462 1469
@@ -2246,7 +2253,7 @@ namespace OpenSim.Region.Framework.Scenes
2246 } 2253 }
2247 } 2254 }
2248 2255
2249 m_scene.UnlinkSceneObject(objectGroup.UUID, true); 2256 m_scene.UnlinkSceneObject(objectGroup, true);
2250 objectGroup.m_isDeleted = true; 2257 objectGroup.m_isDeleted = true;
2251 2258
2252 lock (objectGroup.m_parts) 2259 lock (objectGroup.m_parts)
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
index e140cd5..3a0dd00 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
@@ -28,20 +28,21 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using NUnit.Framework;
31using OpenMetaverse; 32using OpenMetaverse;
32using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
33 34using OpenSim.Tests.Common;
34using NUnit.Framework;
35 35
36namespace OpenSim.Region.Framework.Scenes.Tests 36namespace OpenSim.Region.Framework.Scenes.Tests
37{ 37{
38 [TestFixture] 38 [TestFixture]
39 public class BorderTests 39 public class BorderTests
40 { 40 {
41
42 [Test] 41 [Test]
43 public void TestCross() 42 public void TestCross()
44 { 43 {
44 TestHelper.InMethod();
45
45 List<Border> testborders = new List<Border>(); 46 List<Border> testborders = new List<Border>();
46 47
47 Border NorthBorder = new Border(); 48 Border NorthBorder = new Border();
@@ -75,8 +76,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
75 position = new Vector3(200,280,21); 76 position = new Vector3(200,280,21);
76 Assert.That(NorthBorder.TestCross(position)); 77 Assert.That(NorthBorder.TestCross(position));
77 78
78
79
80 // Test automatic border crossing 79 // Test automatic border crossing
81 // by setting the border crossing aabb to be the whole region 80 // by setting the border crossing aabb to be the whole region
82 position = new Vector3(25,25,21); // safely within one 256m region 81 position = new Vector3(25,25,21); // safely within one 256m region
@@ -95,12 +94,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
95 94
96 WestBorder.BorderLine = new Vector3(0, 256, 255); // automatic border cross in the region 95 WestBorder.BorderLine = new Vector3(0, 256, 255); // automatic border cross in the region
97 Assert.That(WestBorder.TestCross(position)); 96 Assert.That(WestBorder.TestCross(position));
98
99 } 97 }
100 98
101 [Test] 99 [Test]
102 public void TestCrossSquare512() 100 public void TestCrossSquare512()
103 { 101 {
102 TestHelper.InMethod();
103
104 List<Border> testborders = new List<Border>(); 104 List<Border> testborders = new List<Border>();
105 105
106 Border NorthBorder = new Border(); 106 Border NorthBorder = new Border();
@@ -174,12 +174,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
174 Assert.That(!b.TestCross(position)); 174 Assert.That(!b.TestCross(position));
175 175
176 } 176 }
177
178 } 177 }
179 178
180 [Test] 179 [Test]
181 public void TestCrossRectangle512x256() 180 public void TestCrossRectangle512x256()
182 { 181 {
182 TestHelper.InMethod();
183
183 List<Border> testborders = new List<Border>(); 184 List<Border> testborders = new List<Border>();
184 185
185 Border NorthBorder = new Border(); 186 Border NorthBorder = new Border();
@@ -258,6 +259,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
258 [Test] 259 [Test]
259 public void TestCrossOdd512x512w256hole() 260 public void TestCrossOdd512x512w256hole()
260 { 261 {
262 TestHelper.InMethod();
263
261 List<Border> testborders = new List<Border>(); 264 List<Border> testborders = new List<Border>();
262 // 512____ 265 // 512____
263 // | | 266 // | |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
index 3e2a2af..b3c3e22 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
@@ -53,7 +53,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
53 public void T010_AddObjects() 53 public void T010_AddObjects()
54 { 54 {
55 TestHelper.InMethod(); 55 TestHelper.InMethod();
56 // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod());
57 56
58 random = new Random(); 57 random = new Random();
59 SceneObjectGroup found; 58 SceneObjectGroup found;
@@ -89,7 +88,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
89 public void T011_ThreadAddRemoveTest() 88 public void T011_ThreadAddRemoveTest()
90 { 89 {
91 TestHelper.InMethod(); 90 TestHelper.InMethod();
92 // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod());
93 91
94 // This test adds and removes with mutiple threads, attempting to break the 92 // This test adds and removes with mutiple threads, attempting to break the
95 // uuid and localid dictionary coherence. 93 // uuid and localid dictionary coherence.
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index 0b7608d..62761fb 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -26,13 +26,13 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.Reflection; 30using System.Reflection;
30using NUnit.Framework; 31using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers; 32using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse; 33using OpenMetaverse;
33using OpenSim.Framework; 34using OpenSim.Framework;
34using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
35
36using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Tests.Common; 37using OpenSim.Tests.Common;
38using OpenSim.Tests.Common.Mock; 38using OpenSim.Tests.Common.Mock;
@@ -260,5 +260,86 @@ namespace OpenSim.Region.Framework.Scenes.Tests
260 && (part4.RotationOffset.W - compareQuaternion.W < 0.00003), 260 && (part4.RotationOffset.W - compareQuaternion.W < 0.00003),
261 "Badness 3"); 261 "Badness 3");
262 } 262 }
263
264 /// <summary>
265 /// Test that a new scene object which is already linked is correctly persisted to the persistence layer.
266 /// </summary>
267 [Test]
268 public void TestNewSceneObjectLinkPersistence()
269 {
270 TestHelper.InMethod();
271 //log4net.Config.XmlConfigurator.Configure();
272
273 TestScene scene = SceneSetupHelpers.SetupScene();
274
275 string rootPartName = "rootpart";
276 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
277 string linkPartName = "linkpart";
278 UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000");
279
280 SceneObjectPart rootPart
281 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
282 { Name = rootPartName, UUID = rootPartUuid };
283 SceneObjectPart linkPart
284 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
285 { Name = linkPartName, UUID = linkPartUuid };
286
287 SceneObjectGroup sog = new SceneObjectGroup(rootPart);
288 sog.AddPart(linkPart);
289 scene.AddNewSceneObject(sog, true);
290
291 // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked
292 // scene backup thread.
293 scene.Backup(true);
294
295 List<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID);
296
297 Assert.That(storedObjects.Count, Is.EqualTo(1));
298 Assert.That(storedObjects[0].Children.Count, Is.EqualTo(2));
299 Assert.That(storedObjects[0].Children.ContainsKey(rootPartUuid));
300 Assert.That(storedObjects[0].Children.ContainsKey(linkPartUuid));
301 }
302
303 /// <summary>
304 /// Test that a delink of a previously linked object is correctly persisted to the database
305 /// </summary>
306 [Test]
307 public void TestDelinkPersistence()
308 {
309 TestHelper.InMethod();
310 log4net.Config.XmlConfigurator.Configure();
311
312 TestScene scene = SceneSetupHelpers.SetupScene();
313
314 string rootPartName = "rootpart";
315 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
316 string linkPartName = "linkpart";
317 UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000");
318
319 SceneObjectPart rootPart
320 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
321 { Name = rootPartName, UUID = rootPartUuid };
322 SceneObjectPart linkPart
323 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
324 { Name = linkPartName, UUID = linkPartUuid };
325
326 SceneObjectGroup sog = new SceneObjectGroup(rootPart);
327 sog.AddPart(linkPart);
328 scene.AddNewSceneObject(sog, true);
329
330 // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked
331 // scene backup thread.
332 scene.Backup(true);
333
334 // These changes should occur immediately without waiting for a backup pass
335 SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false);
336 scene.DeleteSceneObject(groupToDelete, false);
337
338 List<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID);
339
340 Assert.That(storedObjects.Count, Is.EqualTo(1));
341 Assert.That(storedObjects[0].Children.Count, Is.EqualTo(1));
342 Assert.That(storedObjects[0].Children.ContainsKey(rootPartUuid));
343 }
263 } 344 }
264} 345} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index e39a362..ab5968c 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
@@ -173,6 +173,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
173 173
174 Assert.That(neighbours.Count, Is.EqualTo(2)); 174 Assert.That(neighbours.Count, Is.EqualTo(2));
175 } 175 }
176
176 public void fixNullPresence() 177 public void fixNullPresence()
177 { 178 {
178 string firstName = "testfirstname"; 179 string firstName = "testfirstname";
@@ -389,8 +390,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
389 390
390 public static string GetRandomCapsObjectPath() 391 public static string GetRandomCapsObjectPath()
391 { 392 {
392 TestHelper.InMethod();
393
394 UUID caps = UUID.Random(); 393 UUID caps = UUID.Random();
395 string capsPath = caps.ToString(); 394 string capsPath = caps.ToString();
396 capsPath = capsPath.Remove(capsPath.Length - 4, 4); 395 capsPath = capsPath.Remove(capsPath.Length - 4, 4);
@@ -429,4 +428,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests
429 return name.ToString(); 428 return name.ToString();
430 } 429 }
431 } 430 }
432} 431} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
index e5fcb54..fd59138 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
@@ -300,7 +300,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
300 } 300 }
301 } 301 }
302 m_log.Info("[CMMODEL]: Scheduling a backup of new scene object groups to backup."); 302 m_log.Info("[CMMODEL]: Scheduling a backup of new scene object groups to backup.");
303 scene.Backup(); 303 scene.Backup(true);
304 } 304 }
305 305
306 /// <summary> 306 /// <summary>
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index 672109b..122ad40 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -133,7 +133,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
133 m_firstEmptyCompileQueue = false; 133 m_firstEmptyCompileQueue = false;
134 m_oarFileLoading = false; 134 m_oarFileLoading = false;
135 135
136 m_scene.Backup(); 136 m_scene.Backup(false);
137 137
138 c.From = "RegionReady"; 138 c.From = "RegionReady";
139 if (m_lastOarLoadedOk) 139 if (m_lastOarLoadedOk)