aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-12-03 00:08:58 +0000
committerJustin Clark-Casey (justincc)2010-12-03 00:12:59 +0000
commit7e72afcb3e9d5467ad4dd2e6ba5d1e0632d77877 (patch)
tree531cca8628579ea509231a8aa88375f93306c30a /OpenSim/Region/Framework/Scenes
parentStop LLUDPServer sending updates after object deletes by always queueing deletes (diff)
downloadopensim-SC_OLD-7e72afcb3e9d5467ad4dd2e6ba5d1e0632d77877.zip
opensim-SC_OLD-7e72afcb3e9d5467ad4dd2e6ba5d1e0632d77877.tar.gz
opensim-SC_OLD-7e72afcb3e9d5467ad4dd2e6ba5d1e0632d77877.tar.bz2
opensim-SC_OLD-7e72afcb3e9d5467ad4dd2e6ba5d1e0632d77877.tar.xz
Only force prim persistence before delete if the prim is the result of an unpersisted delink
This considerably improves delete performance for objects with large linksets
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs8
3 files changed, 26 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 90223b1..66c6924 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1997,7 +1997,7 @@ namespace OpenSim.Region.Framework.Scenes
1997 /// <param name="group">Object Id</param> 1997 /// <param name="group">Object Id</param>
1998 /// <param name="silent">Suppress broadcasting changes to other clients.</param> 1998 /// <param name="silent">Suppress broadcasting changes to other clients.</param>
1999 public void DeleteSceneObject(SceneObjectGroup group, bool silent) 1999 public void DeleteSceneObject(SceneObjectGroup group, bool silent)
2000 { 2000 {
2001// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); 2001// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID);
2002 2002
2003 //SceneObjectPart rootPart = group.GetChildPart(group.UUID); 2003 //SceneObjectPart rootPart = group.GetChildPart(group.UUID);
@@ -2038,7 +2038,7 @@ namespace OpenSim.Region.Framework.Scenes
2038 2038
2039 group.DeleteGroupFromScene(silent); 2039 group.DeleteGroupFromScene(silent);
2040 2040
2041// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); 2041// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
2042 } 2042 }
2043 2043
2044 /// <summary> 2044 /// <summary>
@@ -2057,9 +2057,12 @@ namespace OpenSim.Region.Framework.Scenes
2057 // Force a database update so that the scene object group ID is accurate. It's possible that the 2057 // Force a database update so that the scene object group ID is accurate. It's possible that the
2058 // group has recently been delinked from another group but that this change has not been persisted 2058 // group has recently been delinked from another group but that this change has not been persisted
2059 // to the DB. 2059 // to the DB.
2060 ForceSceneObjectBackup(so); 2060 // This is an expensive thing to do so only do it if absolutely necessary.
2061 if (so.HasGroupChangedDueToDelink)
2062 ForceSceneObjectBackup(so);
2063
2061 so.DetachFromBackup(); 2064 so.DetachFromBackup();
2062 SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID); 2065 SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID);
2063 } 2066 }
2064 2067
2065 // We need to keep track of this state in case this group is still queued for further backup. 2068 // We need to keep track of this state in case this group is still queued for further backup.
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 4ec530e..f17fb28 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -119,10 +119,19 @@ namespace OpenSim.Region.Framework.Scenes
119 timeFirstChanged = DateTime.Now.Ticks; 119 timeFirstChanged = DateTime.Now.Ticks;
120 } 120 }
121 m_hasGroupChanged = value; 121 m_hasGroupChanged = value;
122
123// m_log.DebugFormat(
124// "[SCENE OBJECT GROUP]: HasGroupChanged set to {0} for {1} {2}", m_hasGroupChanged, Name, LocalId);
122 } 125 }
123 126
124 get { return m_hasGroupChanged; } 127 get { return m_hasGroupChanged; }
125 } 128 }
129
130 /// <summary>
131 /// Has the group changed due to an unlink operation? We record this in order to optimize deletion, since
132 /// an unlinked group currently has to be persisted to the database before we can perform an unlink operation.
133 /// </summary>
134 public bool HasGroupChangedDueToDelink { get; private set; }
126 135
127 private bool isTimeToPersist() 136 private bool isTimeToPersist()
128 { 137 {
@@ -1330,6 +1339,7 @@ namespace OpenSim.Region.Framework.Scenes
1330 backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity; 1339 backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity;
1331 backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem; 1340 backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem;
1332 HasGroupChanged = false; 1341 HasGroupChanged = false;
1342 HasGroupChangedDueToDelink = false;
1333 1343
1334 m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this); 1344 m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this);
1335 datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); 1345 datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID);
@@ -2208,8 +2218,9 @@ namespace OpenSim.Region.Framework.Scenes
2208 2218
2209 linkPart.Rezzed = RootPart.Rezzed; 2219 linkPart.Rezzed = RootPart.Rezzed;
2210 2220
2211 //HasGroupChanged = true; 2221 // When we delete a group, we currently have to force persist to the database if the object id has changed
2212 //ScheduleGroupForFullUpdate(); 2222 // (since delete works by deleting all rows which have a given object id)
2223 objectGroup.HasGroupChangedDueToDelink = true;
2213 2224
2214 return objectGroup; 2225 return objectGroup;
2215 } 2226 }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index f57cf98..b84298f 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -121,13 +121,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests
121 "Not exactly sure what this is asserting..."); 121 "Not exactly sure what this is asserting...");
122 122
123 // Delink part 2 123 // Delink part 2
124 grp1.DelinkFromGroup(part2.LocalId); 124 SceneObjectGroup grp3 = grp1.DelinkFromGroup(part2.LocalId);
125 125
126 if (debugtest) 126 if (debugtest)
127 m_log.Debug("Group2: Prim2: OffsetPosition:" + part2.AbsolutePosition + ", OffsetRotation:" + part2.RotationOffset); 127 m_log.Debug("Group2: Prim2: OffsetPosition:" + part2.AbsolutePosition + ", OffsetRotation:" + part2.RotationOffset);
128 128
129 Assert.That(grp1.Parts.Length, Is.EqualTo(1), "Group 1 still contained part2 after delink."); 129 Assert.That(grp1.Parts.Length, Is.EqualTo(1), "Group 1 still contained part2 after delink.");
130 Assert.That(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero"); 130 Assert.That(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero");
131 Assert.That(grp3.HasGroupChangedDueToDelink, Is.True);
131 } 132 }
132 133
133 [Test] 134 [Test]
@@ -325,7 +326,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
325 326
326 SceneObjectGroup sog = new SceneObjectGroup(rootPart); 327 SceneObjectGroup sog = new SceneObjectGroup(rootPart);
327 sog.AddPart(linkPart); 328 sog.AddPart(linkPart);
328 scene.AddNewSceneObject(sog, true); 329 scene.AddNewSceneObject(sog, true);
329 330
330 // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked 331 // 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 thread.
@@ -333,7 +334,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
333 334
334 // These changes should occur immediately without waiting for a backup pass 335 // These changes should occur immediately without waiting for a backup pass
335 SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); 336 SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false);
337
338 Assert.That(groupToDelete.HasGroupChangedDueToDelink, Is.True);
336 scene.DeleteSceneObject(groupToDelete, false); 339 scene.DeleteSceneObject(groupToDelete, false);
340 Assert.That(groupToDelete.HasGroupChangedDueToDelink, Is.False);
337 341
338 List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); 342 List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);
339 343