aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-09-07 00:34:06 +0100
committerJustin Clark-Casey (justincc)2010-09-07 01:12:06 +0100
commit11f4a65f42dea66091cb08423479fa6ae46c98aa (patch)
treef16956aa3d2cac3ae325ffda621f2bd79b40310e
parentAdd test that checks correct persistence when an unlink is quickly followed b... (diff)
downloadopensim-SC_OLD-11f4a65f42dea66091cb08423479fa6ae46c98aa.zip
opensim-SC_OLD-11f4a65f42dea66091cb08423479fa6ae46c98aa.tar.gz
opensim-SC_OLD-11f4a65f42dea66091cb08423479fa6ae46c98aa.tar.bz2
opensim-SC_OLD-11f4a65f42dea66091cb08423479fa6ae46c98aa.tar.xz
Fix deletion persistence when freshly delinked prims are removed
Previously, Scene.Inventory.DeRezObjects() forced the persistence of prims before deletion. This is necessary so that freshly delinked prims can be deleted (otherwise they remain as parts of their old group and reappear on server restart). However, DeRezObjects() deleted to user inventory, which is required by llDie() or direct region module unlink and deletion. Therefore, forced persistence has been pushed down into Scene.UnlinkSceneObject() to be more general, this is still on the DeRezObjects() path. Uncommented TestDelinkPersistence() since this now passes. Tests required considerable elaboration of MockRegionDataPlugin to reflect underlying storing of parts.
-rw-r--r--OpenSim/Data/MySQL/MySQLLegacyRegionData.cs2
-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/Scene.Inventory.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs25
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs42
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs4
-rw-r--r--OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs80
-rw-r--r--OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs2
-rw-r--r--OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs2
10 files changed, 129 insertions, 57 deletions
diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
index 30253c3..a39e68d 100644
--- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
@@ -247,6 +247,8 @@ namespace OpenSim.Data.MySQL
247 247
248 public void RemoveObject(UUID obj, UUID regionUUID) 248 public void RemoveObject(UUID obj, UUID regionUUID)
249 { 249 {
250// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID);
251
250 List<UUID> uuids = new List<UUID>(); 252 List<UUID> uuids = new List<UUID>();
251 253
252 // Formerly, this used to check the region UUID. 254 // Formerly, this used to check the region UUID.
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/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 183310d..82e7d76 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2092,7 +2092,7 @@ namespace OpenSim.Region.Framework.Scenes
2092// rootPart.PhysActor = null; 2092// rootPart.PhysActor = null;
2093// } 2093// }
2094 2094
2095 if (UnlinkSceneObject(group.UUID, false)) 2095 if (UnlinkSceneObject(group, false))
2096 { 2096 {
2097 EventManager.TriggerObjectBeingRemovedFromScene(group); 2097 EventManager.TriggerObjectBeingRemovedFromScene(group);
2098 EventManager.TriggerParcelPrimCountTainted(); 2098 EventManager.TriggerParcelPrimCountTainted();
@@ -2107,18 +2107,25 @@ namespace OpenSim.Region.Framework.Scenes
2107 /// 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
2108 /// object itself is not destroyed. 2108 /// object itself is not destroyed.
2109 /// </summary> 2109 /// </summary>
2110 /// <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>
2111 /// <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>
2112 /// <param name="softDelete">If true, only deletes from scene, but keeps object in database.</param> 2113 public bool UnlinkSceneObject(SceneObjectGroup so, bool softDelete)
2113 public bool UnlinkSceneObject(UUID uuid, bool softDelete)
2114 { 2114 {
2115 if (m_sceneGraph.DeleteSceneObject(uuid, softDelete)) 2115 if (m_sceneGraph.DeleteSceneObject(so.UUID, softDelete))
2116 { 2116 {
2117 if (!softDelete) 2117 if (!softDelete)
2118 { 2118 {
2119 m_storageManager.DataStore.RemoveObject(uuid, 2119 // Force a database update so that the scene object group ID is accurate. It's possible that the
2120 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);
2121 } 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;
2122 2129
2123 return true; 2130 return true;
2124 } 2131 }
@@ -2149,7 +2156,7 @@ namespace OpenSim.Region.Framework.Scenes
2149 } 2156 }
2150 catch (Exception) 2157 catch (Exception)
2151 { 2158 {
2152 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.");
2153 } 2160 }
2154 return; 2161 return;
2155 } 2162 }
@@ -2166,7 +2173,7 @@ namespace OpenSim.Region.Framework.Scenes
2166 } 2173 }
2167 catch (Exception) 2174 catch (Exception)
2168 { 2175 {
2169 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.");
2170 } 2177 }
2171 return; 2178 return;
2172 } 2179 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index b8b3db5..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,10 +1381,18 @@ 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;
1388 }
1385 1389
1386 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);
1387 return; 1394 return;
1395 }
1388 1396
1389 // Since this is the top of the section of call stack for backing up a particular scene object, don't let 1397 // Since this is the top of the section of call stack for backing up a particular scene object, don't let
1390 // any exception propogate upwards. 1398 // any exception propogate upwards.
@@ -1420,7 +1428,7 @@ namespace OpenSim.Region.Framework.Scenes
1420 if (HasGroupChanged) 1428 if (HasGroupChanged)
1421 { 1429 {
1422 // 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.
1423 if ((isTimeToPersist()) || (forcedBackup)) 1431 if (isTimeToPersist() || forcedBackup)
1424 { 1432 {
1425 m_log.DebugFormat( 1433 m_log.DebugFormat(
1426 "[SCENE]: Storing {0}, {1} in {2}", 1434 "[SCENE]: Storing {0}, {1} in {2}",
@@ -1443,19 +1451,19 @@ namespace OpenSim.Region.Framework.Scenes
1443 1451
1444 backup_group = null; 1452 backup_group = null;
1445 } 1453 }
1446 // else 1454// else
1447 // { 1455// {
1448 // m_log.DebugFormat( 1456// m_log.DebugFormat(
1449 // "[SCENE]: Did not update persistence of object {0} {1}, selected = {2}", 1457// "[SCENE]: Did not update persistence of object {0} {1}, selected = {2}",
1450 // Name, UUID, IsSelected); 1458// Name, UUID, IsSelected);
1451 // } 1459// }
1452 } 1460 }
1453 } 1461 }
1454 catch (Exception e) 1462 catch (Exception e)
1455 { 1463 {
1456 m_log.ErrorFormat( 1464 m_log.ErrorFormat(
1457 "[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}",
1458 Name, UUID, m_scene.RegionInfo.RegionName, e, e.StackTrace); 1466 Name, UUID, m_scene.RegionInfo.RegionName, e.Message, e.StackTrace);
1459 } 1467 }
1460 } 1468 }
1461 1469
@@ -2245,7 +2253,7 @@ namespace OpenSim.Region.Framework.Scenes
2245 } 2253 }
2246 } 2254 }
2247 2255
2248 m_scene.UnlinkSceneObject(objectGroup.UUID, true); 2256 m_scene.UnlinkSceneObject(objectGroup, true);
2249 objectGroup.m_isDeleted = true; 2257 objectGroup.m_isDeleted = true;
2250 2258
2251 lock (objectGroup.m_parts) 2259 lock (objectGroup.m_parts)
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index 93409fa..62761fb 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -303,11 +303,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
303 /// <summary> 303 /// <summary>
304 /// Test that a delink of a previously linked object is correctly persisted to the database 304 /// Test that a delink of a previously linked object is correctly persisted to the database
305 /// </summary> 305 /// </summary>
306 //[Test] 306 [Test]
307 public void TestDelinkPersistence() 307 public void TestDelinkPersistence()
308 { 308 {
309 TestHelper.InMethod(); 309 TestHelper.InMethod();
310 //log4net.Config.XmlConfigurator.Configure(); 310 log4net.Config.XmlConfigurator.Configure();
311 311
312 TestScene scene = SceneSetupHelpers.SetupScene(); 312 TestScene scene = SceneSetupHelpers.SetupScene();
313 313
diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
index 1c139c5..2a055cc 100644
--- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Data.Null
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 protected Dictionary<UUID, RegionSettings> m_regionSettings = new Dictionary<UUID, RegionSettings>(); 46 protected Dictionary<UUID, RegionSettings> m_regionSettings = new Dictionary<UUID, RegionSettings>();
47 protected Dictionary<UUID, SceneObjectGroup> m_sceneObjects = new Dictionary<UUID, SceneObjectGroup>(); 47 protected Dictionary<UUID, SceneObjectPart> m_sceneObjectParts = new Dictionary<UUID, SceneObjectPart>();
48 protected Dictionary<UUID, ICollection<TaskInventoryItem>> m_primItems 48 protected Dictionary<UUID, ICollection<TaskInventoryItem>> m_primItems
49 = new Dictionary<UUID, ICollection<TaskInventoryItem>>(); 49 = new Dictionary<UUID, ICollection<TaskInventoryItem>>();
50 protected Dictionary<UUID, double[,]> m_terrains = new Dictionary<UUID, double[,]>(); 50 protected Dictionary<UUID, double[,]> m_terrains = new Dictionary<UUID, double[,]>();
@@ -85,18 +85,33 @@ namespace OpenSim.Data.Null
85 85
86 public void StoreObject(SceneObjectGroup obj, UUID regionUUID) 86 public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
87 { 87 {
88 m_log.DebugFormat( 88 // We can't simply store groups here because on delinking, OpenSim will not update the original group
89 "[MOCK REGION DATA PLUGIN]: Storing object {0} {1} in {2}", obj.Name, obj.UUID, regionUUID); 89 // directly. Rather, the newly delinked parts will be updated to be in their own scene object group
90 m_sceneObjects[obj.UUID] = obj; 90 // Therefore, we need to store parts rather than groups.
91 foreach (SceneObjectPart prim in obj.Children.Values)
92 {
93 m_log.DebugFormat(
94 "[MOCK REGION DATA PLUGIN]: Storing part {0} {1} in object {2} {3} in region {4}",
95 prim.Name, prim.UUID, obj.Name, obj.UUID, regionUUID);
96
97 m_sceneObjectParts[prim.UUID] = prim;
98 }
91 } 99 }
92 100
93 public void RemoveObject(UUID obj, UUID regionUUID) 101 public void RemoveObject(UUID obj, UUID regionUUID)
94 { 102 {
95 m_log.DebugFormat( 103 // All parts belonging to the object with the uuid are removed.
96 "[MOCK REGION DATA PLUGIN]: Removing object {0} from {1}", obj, regionUUID); 104 List<SceneObjectPart> parts = new List<SceneObjectPart>(m_sceneObjectParts.Values);
97 105 foreach (SceneObjectPart part in parts)
98 if (m_sceneObjects.ContainsKey(obj)) 106 {
99 m_sceneObjects.Remove(obj); 107 if (part.ParentGroup.UUID == obj)
108 {
109 m_log.DebugFormat(
110 "[MOCK REGION DATA PLUGIN]: Removing part {0} {1} as part of object {2} from {3}",
111 part.Name, part.UUID, obj, regionUUID);
112 m_sceneObjectParts.Remove(part.UUID);
113 }
114 }
100 } 115 }
101 116
102 // see IRegionDatastore 117 // see IRegionDatastore
@@ -107,10 +122,49 @@ namespace OpenSim.Data.Null
107 122
108 public List<SceneObjectGroup> LoadObjects(UUID regionUUID) 123 public List<SceneObjectGroup> LoadObjects(UUID regionUUID)
109 { 124 {
110 m_log.DebugFormat( 125 Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>();
111 "[MOCK REGION DATA PLUGIN]: Loading objects from {0}", regionUUID); 126
127 // Create all of the SOGs from the root prims first
128 foreach (SceneObjectPart prim in m_sceneObjectParts.Values)
129 {
130 if (prim.IsRoot)
131 {
132 m_log.DebugFormat(
133 "[MOCK REGION DATA PLUGIN]: Loading root part {0} {1} in {2}", prim.Name, prim.UUID, regionUUID);
134 objects[prim.UUID] = new SceneObjectGroup(prim);
135 }
136 }
137
138 // Add all of the children objects to the SOGs
139 foreach (SceneObjectPart prim in m_sceneObjectParts.Values)
140 {
141 SceneObjectGroup sog;
142 if (prim.UUID != prim.ParentUUID)
143 {
144 if (objects.TryGetValue(prim.ParentUUID, out sog))
145 {
146 int originalLinkNum = prim.LinkNum;
147
148 sog.AddPart(prim);
149
150 // SceneObjectGroup.AddPart() tries to be smart and automatically set the LinkNum.
151 // We override that here
152 if (originalLinkNum != 0)
153 prim.LinkNum = originalLinkNum;
154 }
155 else
156 {
157 m_log.WarnFormat(
158 "[MOCK REGION DATA PLUGIN]: Database contains an orphan child prim {0} {1} in region {2} pointing to missing parent {3}. This prim will not be loaded.",
159 prim.Name, prim.UUID, regionUUID, prim.ParentUUID);
160 }
161 }
162 }
163
164 // TODO: Load items. This is assymetric - we store items as a separate method but don't retrieve them that
165 // way!
112 166
113 return new List<SceneObjectGroup>(m_sceneObjects.Values); 167 return new List<SceneObjectGroup>(objects.Values);
114 } 168 }
115 169
116 public void StoreTerrain(double[,] ter, UUID regionID) 170 public void StoreTerrain(double[,] ter, UUID regionID)
diff --git a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
index b70b47d..b47ad5d 100644
--- a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Tests.Common.Mock
42 /// </summary> 42 /// </summary>
43 public class TestInventoryDataPlugin : IInventoryDataPlugin 43 public class TestInventoryDataPlugin : IInventoryDataPlugin
44 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 /// <value> 47 /// <value>
48 /// Inventory folders 48 /// Inventory folders
diff --git a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
index c57363a..915af7e 100644
--- a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
@@ -52,7 +52,7 @@ namespace OpenSim.Tests.Common
52 InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object); 52 InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object);
53 53
54 item.Folder = objsFolder.ID; 54 item.Folder = objsFolder.ID;
55 scene.AddInventoryItem(userId, item); 55 scene.AddInventoryItem(item);
56 56
57 return item; 57 return item;
58 } 58 }