From 8d6bd1b650481173c881262b0fcd79f5e1bd5d00 Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 4 Feb 2009 16:00:39 +0000 Subject: Added a ForceSceneObjectBackup method to Scene, which as it says forces a database backup/update on the SceneObjectGroup. This is now called at the beginning of DeRezObject, so we know the database is upto date before we attempt to delete a object. Fix Mantis #1004 Which happened because Database backups don't happen if a object is still selected, so when you select a part in a link-set and then unlink it and then delete it, all without unselecting the prim at all. The unlink changes never get updated to the database. So then when the call to delete the prim from the database happens, which is called with the SceneObjectId. That SceneObjectId is never found, as the database still has that prim as part of another link set. It is possible that these changes might have to be reverted and for us to find a different method of fixing the problem. If the performance overhead is too high or it causes any other problems. --- OpenSim/Region/Environment/Scenes/EventManager.cs | 4 ++-- OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 4 ++++ OpenSim/Region/Environment/Scenes/Scene.cs | 10 +++++++++- OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 4 ++-- 4 files changed, 17 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Environment/Scenes/EventManager.cs b/OpenSim/Region/Environment/Scenes/EventManager.cs index 618e6b5..bba7eed 100644 --- a/OpenSim/Region/Environment/Scenes/EventManager.cs +++ b/OpenSim/Region/Environment/Scenes/EventManager.cs @@ -52,7 +52,7 @@ namespace OpenSim.Region.Environment.Scenes public event OnTerrainTickDelegate OnTerrainTick; - public delegate void OnBackupDelegate(IRegionDataStore datastore); + public delegate void OnBackupDelegate(IRegionDataStore datastore, bool forceBackup); public event OnBackupDelegate OnBackup; @@ -504,7 +504,7 @@ namespace OpenSim.Region.Environment.Scenes handlerBackup = OnBackup; if (handlerBackup != null) { - handlerBackup(dstore); + handlerBackup(dstore, false); } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index cb9aee2..bc80d56 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -1686,6 +1686,10 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup grp = part.ParentGroup; + //force a database backup/update on this SceneObjectGroup + //So that we know the database is upto date, for when deleting the object from it + ForceSceneObjectBackup(grp); + bool permissionToTake = false; bool permissionToDelete = false; diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 32bd9aa..194d782 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -728,7 +728,7 @@ namespace OpenSim.Region.Environment.Scenes { if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged) { - ((SceneObjectGroup)entity).ProcessBackup(m_storageManager.DataStore); + ((SceneObjectGroup)entity).ProcessBackup(m_storageManager.DataStore, false); } } @@ -1052,6 +1052,14 @@ namespace OpenSim.Region.Environment.Scenes } } + public void ForceSceneObjectBackup(SceneObjectGroup group) + { + if (group != null) + { + group.ProcessBackup(m_storageManager.DataStore, true); + } + } + public void AddReturn(UUID agentID, string objectName, Vector3 location, string reason) { lock (m_returns) diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 9c29338..5ae95ee 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -1222,7 +1222,7 @@ namespace OpenSim.Region.Environment.Scenes /// Processes backup. /// /// - public void ProcessBackup(IRegionDataStore datastore) + public void ProcessBackup(IRegionDataStore datastore, bool forcedBackup) { if (!m_isBackedUp) return; @@ -1265,7 +1265,7 @@ namespace OpenSim.Region.Environment.Scenes if (HasGroupChanged) { // don't backup while it's selected or you're asking for changes mid stream. - if (isTimeToPersist()) + if ((isTimeToPersist()) || (forcedBackup)) { m_log.DebugFormat( "[SCENE]: Storing {0}, {1} in {2}", -- cgit v1.1