From 953b7f491798e97b7b36808e716975b22d80114b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 6 Sep 2010 23:00:24 +0100
Subject: Add test to check persistence of newly added pre-linked objects
Added a MockRegionDataPlugin to do in-memory persistence for tests since adding this to OpenSim.Data.Null.NullDataStore doesn't seem appropriate
NullDataStore can do nothing because OpenSim only ever retrieve region objects from the database on startup. Adding an in-memory store here would be unecessary overhead.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 49f29ad..93882ba 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1531,15 +1531,24 @@ namespace OpenSim.Region.Framework.Scenes
Backup();
}
+ public void Backup()
+ {
+ Backup(false);
+ }
+
///
/// Backup the scene. This acts as the main method of the backup thread.
///
+ ///
+ /// If true, then any changes that have not yet been persisted are persisted. If false,
+ /// then the persistence decision is left to the backup code (in some situations, such as object persistence,
+ /// it's much more efficient to backup multiple changes at once rather than every single one).
///
- public void Backup()
+ public void Backup(bool forced)
{
lock (m_returns)
{
- EventManager.TriggerOnBackup(m_storageManager.DataStore);
+ EventManager.TriggerOnBackup(m_storageManager.DataStore, forced);
m_backingup = false;
foreach (KeyValuePair ret in m_returns)
--
cgit v1.1
From ab875b32c1cbfe2871a33b7757ffea5466692263 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 6 Sep 2010 23:12:03 +0100
Subject: Make console backup command do a forced backup rather than non-forced
Remove no-arg backup method for simplicity as it only make sense to call non-forced backup internally
---
OpenSim/Region/Framework/Scenes/Scene.cs | 5 -----
1 file changed, 5 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 93882ba..183310d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1528,11 +1528,6 @@ namespace OpenSim.Region.Framework.Scenes
///
private void BackupWaitCallback(object o)
{
- Backup();
- }
-
- public void Backup()
- {
Backup(false);
}
--
cgit v1.1
From 3d033520fafa1431c52086d741d1f3c7409bc6eb Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 7 Sep 2010 00:34:06 +0100
Subject: 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 not 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.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
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
// rootPart.PhysActor = null;
// }
- if (UnlinkSceneObject(group.UUID, false))
+ if (UnlinkSceneObject(group, false))
{
EventManager.TriggerObjectBeingRemovedFromScene(group);
EventManager.TriggerParcelPrimCountTainted();
@@ -2107,18 +2107,25 @@ namespace OpenSim.Region.Framework.Scenes
/// Unlink the given object from the scene. Unlike delete, this just removes the record of the object - the
/// object itself is not destroyed.
///
- /// Id of object.
+ /// The scene object.
+ /// If true, only deletes from scene, but keeps the object in the database.
/// true if the object was in the scene, false if it was not
- /// If true, only deletes from scene, but keeps object in database.
- public bool UnlinkSceneObject(UUID uuid, bool softDelete)
+ public bool UnlinkSceneObject(SceneObjectGroup so, bool softDelete)
{
- if (m_sceneGraph.DeleteSceneObject(uuid, softDelete))
+ if (m_sceneGraph.DeleteSceneObject(so.UUID, softDelete))
{
if (!softDelete)
{
- m_storageManager.DataStore.RemoveObject(uuid,
- m_regInfo.RegionID);
+ // Force a database update so that the scene object group ID is accurate. It's possible that the
+ // group has recently been delinked from another group but that this change has not been persisted
+ // to the DB.
+ ForceSceneObjectBackup(so);
+ so.DetachFromBackup();
+ m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID);
}
+
+ // We need to keep track of this state in case this group is still queued for further backup.
+ so.IsDeleted = true;
return true;
}
@@ -2149,7 +2156,7 @@ namespace OpenSim.Region.Framework.Scenes
}
catch (Exception)
{
- m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border.");
+ m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border.");
}
return;
}
@@ -2166,7 +2173,7 @@ namespace OpenSim.Region.Framework.Scenes
}
catch (Exception)
{
- m_log.Warn("[DATABASE]: exception when trying to return the prim that crossed the border.");
+ m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border.");
}
return;
}
--
cgit v1.1